ソースを参照

区域接口调整

jichaobo 2 年 前
コミット
e1f5853856

+ 12 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAreaController.java

@@ -35,6 +35,18 @@ public class PatrolInspectionAreaController {
         return ApiResult.success();
     }
 
+
+    /**
+     * 巡查自检-巡检区域-子区域新增
+     * @param patrolInspectionArea
+     * @return
+     */
+    @PostMapping("addPatrolInspectionAreaSon")
+    public ApiResult<Void> addPatrolInspectionAreaSon(@RequestBody PatrolInspectionArea patrolInspectionArea) {
+        patrolInspectionAreaService.addPatrolInspectionAreaSon(patrolInspectionArea);
+        return ApiResult.success();
+    }
+
     /**
      * 巡查自检-巡检区域-编辑
      *

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAreaService.java

@@ -19,6 +19,8 @@ public interface PatrolInspectionAreaService extends CrudService<PatrolInspectio
 
     void addPatrolInspectionArea(PatrolInspectionAreaVo patrolInspectionAreaVo);
 
+    void addPatrolInspectionAreaSon(PatrolInspectionArea patrolInspectionArea);
+
     void updatePatrolInspectionArea(PatrolInspectionArea patrolInspectionArea);
 
     void delPatrolInspectionArea(Integer id);

+ 18 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAreaServiceImpl.java

@@ -2,6 +2,7 @@ package com.usky.fire.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.common.core.exception.BusinessException;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.fire.domain.PatrolInspectionArea;
@@ -57,6 +58,23 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         }
     }
 
+
+    public void addPatrolInspectionAreaSon(PatrolInspectionArea patrolInspectionArea) {
+        LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionArea::getEnable, 1)
+                .eq(PatrolInspectionArea::getId, patrolInspectionArea.getAreaFid());
+        List<PatrolInspectionArea> list = this.list(queryWrapper);
+        if (list.size()<=0){
+            throw new BusinessException("父级ID不存在");
+        }
+        patrolInspectionArea.setCompanyId(list.get(0).getCompanyId());
+        patrolInspectionArea.setCreator(SecurityUtils.getUsername());
+        patrolInspectionArea.setCreateTime(LocalDateTime.now());
+        patrolInspectionArea.setEnable(1);
+        patrolInspectionArea.setTenantId(SecurityUtils.getTenantId());
+        this.save(patrolInspectionArea);
+    }
+
     /**
      * 巡查自检-巡检区域-编辑
      *