|
@@ -36,6 +36,13 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void addPatrolInspectionArea(PatrolInspectionAreaVo patrolInspectionAreaVo) {
|
|
|
+ LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionArea::getEnable, 1)
|
|
|
+ .eq(PatrolInspectionArea::getAreaName, patrolInspectionAreaVo.getAreaName());
|
|
|
+ List<PatrolInspectionArea> list = this.list(queryWrapper);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ throw new BusinessException("区域不可以重复");
|
|
|
+ }
|
|
|
PatrolInspectionArea patrolInspectionArea = new PatrolInspectionArea();
|
|
|
patrolInspectionArea.setAreaName(patrolInspectionAreaVo.getAreaName());
|
|
|
patrolInspectionArea.setAreaFid(0);
|
|
@@ -68,6 +75,14 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
|
|
|
if (list.size() <= 0) {
|
|
|
throw new BusinessException("父级ID不存在");
|
|
|
}
|
|
|
+ LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperOne.eq(PatrolInspectionArea::getEnable, 1)
|
|
|
+ .eq(PatrolInspectionArea::getAreaFid, patrolInspectionArea.getAreaFid())
|
|
|
+ .eq(PatrolInspectionArea::getAreaName, patrolInspectionArea.getAreaName());
|
|
|
+ List<PatrolInspectionArea> list2 = this.list(queryWrapperOne);
|
|
|
+ if (list2.size() > 0) {
|
|
|
+ throw new BusinessException("区域名称不可重复");
|
|
|
+ }
|
|
|
patrolInspectionArea.setCompanyId(list.get(0).getCompanyId());
|
|
|
patrolInspectionArea.setCreator(SecurityUtils.getUsername());
|
|
|
patrolInspectionArea.setCreateTime(LocalDateTime.now());
|