refactor: 动态数据源单元测试优化

This commit is contained in:
haoxr
2023-04-29 17:49:07 +08:00
parent cbd1621935
commit 1b1888c36d
4 changed files with 5 additions and 11 deletions

View File

@@ -24,7 +24,7 @@ public class DynamicDataSourceSample {
@Transactional
public boolean updateDictTypeCode(Long dictTypeId,String newTypeCode) {
public boolean updateMaster(Long dictTypeId,String newTypeCode) {
SysDictType dictType = dictTypeService.getById(dictTypeId);
String originalTypeCode = dictType.getCode();
@@ -32,7 +32,7 @@ public class DynamicDataSourceSample {
boolean result = dictTypeService.updateById(dictType);
if (result) {
result = dictService.updateDictTypeCode(originalTypeCode, newTypeCode);
result = dictService.updateSlave(originalTypeCode, newTypeCode);
}
return result;
}

View File

@@ -73,5 +73,5 @@ public interface SysDictService extends IService<SysDict> {
* @param newTypeCode
* @return
*/
boolean updateDictTypeCode(String originalTypeCode, String newTypeCode);
boolean updateSlave(String originalTypeCode, String newTypeCode);
}

View File

@@ -170,7 +170,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
*/
@DS("slave")
@Override
public boolean updateDictTypeCode(String originalTypeCode, String newTypeCode) {
public boolean updateSlave(String originalTypeCode, String newTypeCode) {
boolean result = this.update(new LambdaUpdateWrapper<SysDict>()
.eq(SysDict::getTypeCode, originalTypeCode)
.set(SysDict::getTypeCode, newTypeCode)