修复bug #789
This commit is contained in:
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.pictc.constant.FieldNameConstants;
|
||||
import com.pictc.datalog.DataOperationContent;
|
||||
import com.pictc.datalog.DataOperationListener;
|
||||
import com.pictc.enums.BusinessCode;
|
||||
@ -129,6 +130,7 @@ public class CountryRegionController {
|
||||
}else {
|
||||
dto.setFullPath(dto.getFullName());
|
||||
}
|
||||
checkParams(dto);
|
||||
return content.getObj();
|
||||
}
|
||||
|
||||
@ -164,6 +166,7 @@ public class CountryRegionController {
|
||||
}else {
|
||||
dto.setFullPath(dto.getFullName());
|
||||
}
|
||||
checkParams(dto);
|
||||
return content.getObj();
|
||||
}
|
||||
|
||||
@ -243,4 +246,20 @@ public class CountryRegionController {
|
||||
}
|
||||
|
||||
|
||||
private void checkParams(UpdateLngBRegionDto dto) {
|
||||
Long codeCount = countryRegionService.count(new LambdaQueryWrapper<LngBRegion>()
|
||||
.eq(LngBRegion::getCode, dto.getCode()).ne(dto.getId() != null, LngBRegion::getId, dto.getId()));
|
||||
if (codeCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.CODE));
|
||||
}
|
||||
Long nameCount = countryRegionService.count(new LambdaQueryWrapper<LngBRegion>()
|
||||
.eq(LngBRegion::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBRegion::getId, dto.getId()));
|
||||
if (nameCount > 0) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
|
||||
FieldNameConstants.FULL_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user