微调
This commit is contained in:
@@ -79,7 +79,7 @@ public class DictDataController extends BaseController {
|
||||
* 修改字典数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改字典数据")
|
||||
@ApiImplicitParam(name = "updateParam", value = "字典数据", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated DictDataParam.UpdateParam updateParam) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DictPqController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新电能质量指标字典")
|
||||
@ApiImplicitParam(name = "updateParam", value = "更新参数", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated DictPqParam.UpdateParam updateParam) {
|
||||
@@ -70,7 +70,7 @@ public class DictPqController extends BaseController {
|
||||
LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = dictPqService.updateDictPq(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DictTreeController extends BaseController {
|
||||
* @param dicParam 修改参数
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改")
|
||||
@ApiImplicitParam(name = "dicParam", value = "数据", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated DictTreeParam.UpdateParam dicParam) {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DictTypeController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改字典类型")
|
||||
@ApiImplicitParam(name = "updateParam", value = "字典类型数据", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated DictTypeParam.UpdateParam updateParam) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
|
||||
@Override
|
||||
public DictData getDicDataById(String dicIndex) {
|
||||
return this.baseMapper.selectById(dicIndex);
|
||||
return this.lambdaQuery().eq(DictData::getId, dicIndex).eq(DictData::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,11 +109,13 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
@Override
|
||||
public List<SimpleTreeDTO> dictDataCache() {
|
||||
MPJLambdaWrapper<DictData> dictTypeWrapper = new MPJLambdaWrapper<DictData>()
|
||||
.eq(DictData::getState, DataStateEnum.ENABLE.getCode())
|
||||
.selectAll(DictData.class)
|
||||
.selectAs(DictType::getId, DictDataCache::getTypeId)
|
||||
.selectAs(DictType::getName, DictDataCache::getTypeName)
|
||||
.selectAs(DictType::getCode, DictDataCache::getTypeCode)
|
||||
.leftJoin(DictType.class, DictType::getId, DictData::getTypeId);
|
||||
.leftJoin(DictType.class, DictType::getId, DictData::getTypeId)
|
||||
.eq(DictType::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<DictDataCache> allDictData = this.getBaseMapper().selectJoinList(DictDataCache.class, dictTypeWrapper);
|
||||
|
||||
Map<Object, List<DictDataCache>> dictDataCacheMap = allDictData.stream()
|
||||
@@ -166,10 +168,9 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
*/
|
||||
private void checkDicDataName(DictDataParam dictDataParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<DictData> dictDataLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictDataLambdaQueryWrapper
|
||||
.eq(DictData::getName, dictDataParam.getName())
|
||||
.eq(DictData::getTypeId, dictDataParam.getTypeId())
|
||||
.eq(DictData::getState, DataStateEnum.ENABLE.getCode());
|
||||
dictDataLambdaQueryWrapper.eq(DictData::getTypeId, dictDataParam.getTypeId())
|
||||
.eq(DictData::getState, DataStateEnum.ENABLE.getCode())
|
||||
.and(w -> w.eq(DictData::getName, dictDataParam.getName()).or().eq(DictData::getCode, dictDataParam.getCode()));
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (dictDataParam instanceof DictDataParam.UpdateParam) {
|
||||
@@ -179,7 +180,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
int countByAccount = this.count(dictDataLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(SystemResponseEnum.DICT_DATA_NAME_REPEAT);
|
||||
throw new BusinessException(SystemResponseEnum.DICT_DATA_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,9 +103,8 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
*/
|
||||
private void checkDicTypeName(DictTypeParam dictTypeParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<DictType> dictTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictTypeLambdaQueryWrapper
|
||||
.eq(DictType::getName, dictTypeParam.getName())
|
||||
.eq(DictType::getState, DataStateEnum.ENABLE.getCode());
|
||||
dictTypeLambdaQueryWrapper.eq(DictType::getState, DataStateEnum.ENABLE.getCode())
|
||||
.and(w -> w.eq(DictType::getCode, dictTypeParam.getCode()).or().eq(DictType::getName, dictTypeParam.getName()));
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (dictTypeParam instanceof DictTypeParam.UpdateParam) {
|
||||
@@ -115,7 +114,7 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
int countByAccount = this.count(dictTypeLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(SystemResponseEnum.DICT_TYPE_NAME_REPEAT);
|
||||
throw new BusinessException(SystemResponseEnum.DICT_TYPE_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ public enum SystemResponseEnum {
|
||||
* A00350 ~ A00449
|
||||
*/
|
||||
SYSTEM_COMMON_ERROR("A00350","系统模块异常"),
|
||||
DICT_TYPE_NAME_REPEAT("A00351", "字典类型名称重复"),
|
||||
DICT_DATA_NAME_REPEAT("A00352", "字典数据名称重复"),
|
||||
DICT_TYPE_REPEAT("A00351", "字典类型名称或编码重复"),
|
||||
DICT_DATA_REPEAT("A00352", "字典数据名称或编码重复"),
|
||||
AREA_CODE_REPEAT("A00353","行政区域编码重复"),
|
||||
LOAD_TYPE_EMPTY("A00354","用能负荷数据为空"),
|
||||
LINE_MARK_EMPTY("A00355","字典监测点评分等级数据为空"),
|
||||
|
||||
Reference in New Issue
Block a user