Merge pull request 'm' (#37) from yanyang into master

Reviewed-on: #37
This commit is contained in:
闫阳 2023-12-28 15:44:48 +08:00
commit 8c3d387257
3 changed files with 6 additions and 6 deletions

View File

@ -108,13 +108,13 @@ public class ProductLevelController {
ProductLevelDTO entity = productLevelService.get(dto.getId()); ProductLevelDTO entity = productLevelService.get(dto.getId());
QueryWrapper<ProductLevel> wrapper1 = new QueryWrapper<>(); QueryWrapper<ProductLevel> wrapper1 = new QueryWrapper<>();
wrapper1.eq(ProductLevel.CODE, dto.getCode()); wrapper1.eq(ProductLevel.CODE, dto.getCode());
if(entity.getCode()!=dto.getCode() && productLevelMapper.selectCount(wrapper1)!= 0){ if(!entity.getCode().equals(dto.getCode()) && productLevelMapper.selectCount(wrapper1)!= 0){
return new Result().error(1,"编码重复"); return new Result().error(1,"编码重复");
} }
//验证名称是否重名 //验证名称是否重名
QueryWrapper<ProductLevel> wrapper2 = new QueryWrapper<>(); QueryWrapper<ProductLevel> wrapper2 = new QueryWrapper<>();
wrapper2.eq(ProductLevel.PRODUCT_LEVEL, dto.getProductLevel()); wrapper2.eq(ProductLevel.PRODUCT_LEVEL, dto.getProductLevel());
if(entity.getProductLevel()!=dto.getProductLevel() && productLevelMapper.selectCount(wrapper2)!= 0){ if(!entity.getProductLevel().equals(dto.getProductLevel()) && productLevelMapper.selectCount(wrapper2)!= 0){
return new Result().error(1,"名称重复"); return new Result().error(1,"名称重复");
} }
else { else {

View File

@ -109,14 +109,14 @@ public class ScenesController {
ScenesDTO entity = scenesService.get(dto.getId()); ScenesDTO entity = scenesService.get(dto.getId());
QueryWrapper<Scenes> wrapper1 = new QueryWrapper<>(); QueryWrapper<Scenes> wrapper1 = new QueryWrapper<>();
wrapper1.eq(Scenes.CODE, dto.getCode()); wrapper1.eq(Scenes.CODE, dto.getCode());
if(entity.getCode()!=dto.getCode() && scenesMapper.selectCount(wrapper1)!= 0){ if(!entity.getCode().equals(dto.getCode()) && scenesMapper.selectCount(wrapper1)!= 0){
return new Result().error(1,"编码重复"); return new Result().error(1,"编码重复");
} }
//验证名称是否重名 //验证名称是否重名
QueryWrapper<Scenes> wrapper2 = new QueryWrapper<>(); QueryWrapper<Scenes> wrapper2 = new QueryWrapper<>();
wrapper2.eq(Scenes.SCENES_NAME, dto.getScenesName()); wrapper2.eq(Scenes.SCENES_NAME, dto.getScenesName());
System.out.println(scenesMapper.selectCount(wrapper2)); System.out.println(scenesMapper.selectCount(wrapper2));
if(entity.getScenesName()!=dto.getScenesName() && scenesMapper.selectCount(wrapper2)!= 0){ if(!entity.getScenesName().equals(dto.getScenesName()) && scenesMapper.selectCount(wrapper2)!= 0){
return new Result().error(1,"名称重复"); return new Result().error(1,"名称重复");
} }
else { else {

View File

@ -106,13 +106,13 @@ public class WorkingTimeController {
WorkingTimeDTO entity = workingTimeService.get(dto.getId()); WorkingTimeDTO entity = workingTimeService.get(dto.getId());
QueryWrapper<WorkingTime> wrapper1 = new QueryWrapper<>(); QueryWrapper<WorkingTime> wrapper1 = new QueryWrapper<>();
wrapper1.eq(WorkingTime.CODE, dto.getCode()); wrapper1.eq(WorkingTime.CODE, dto.getCode());
if(entity.getCode()!=dto.getCode() && workingTimeMapper.selectCount(wrapper1)!= 0){ if(!entity.getCode().equals(dto.getCode()) && workingTimeMapper.selectCount(wrapper1)!= 0){
return new Result().error(1,"编码重复"); return new Result().error(1,"编码重复");
} }
//验证名称是否重名 //验证名称是否重名
QueryWrapper<WorkingTime> wrapper2 = new QueryWrapper<>(); QueryWrapper<WorkingTime> wrapper2 = new QueryWrapper<>();
wrapper2.eq( WorkingTime.ORDER_NAME, dto.getOrderName()); wrapper2.eq( WorkingTime.ORDER_NAME, dto.getOrderName());
if(entity.getOrderName()!=dto.getOrderName() && workingTimeMapper.selectCount(wrapper2)!= 0){ if(!entity.getOrderName().equals(dto.getOrderName()) && workingTimeMapper.selectCount(wrapper2)!= 0){
return new Result().error(1,"名称重复"); return new Result().error(1,"名称重复");
} }
else { else {