韩福成 hace 1 año
padre
commit
11fc913022

+ 11 - 0
src/main/java/com/sooka/sponest/data/digitalforest/controller/CenterdataTForestGridLevelController.java

@@ -6,9 +6,11 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.sooka.sponest.data.digitalforest.domain.CenterdataTForestAfforestation;
 import com.sooka.sponest.data.digitalforest.domain.CenterdataTForestGridLevel;
 import com.sooka.sponest.data.digitalforest.domain.CenterdataTForestLinleader;
 import com.sooka.sponest.data.digitalforest.domain.vo.CenterdataTForestGridLevelVo;
+import com.sooka.sponest.data.digitalforest.service.ICenterdataTForestAfforestationService;
 import com.sooka.sponest.data.digitalforest.service.ICenterdataTForestGridLevelService;
 import com.sooka.sponest.data.digitalforest.service.ICenterdataTForestLinleaderService;
 import com.sooka.sponest.data.utils.DataConstants;
@@ -39,6 +41,9 @@ public class CenterdataTForestGridLevelController extends BaseController {
     @Autowired
     private ICenterdataTForestLinleaderService iCenterdataTForestLinleaderService;
 
+    @Autowired
+    private ICenterdataTForestAfforestationService centerdataTForestAfforestationService;
+
     /**
      * 查询林业网格层级信息列表
      */
@@ -154,6 +159,12 @@ public class CenterdataTForestGridLevelController extends BaseController {
         if (!list.isEmpty()) {
             return AjaxResult.error("已有下级资源");
         }
+        CenterdataTForestAfforestation centerdataTForestAfforestation = new CenterdataTForestAfforestation();
+        centerdataTForestAfforestation.setForestFarmId(String.valueOf(id));
+        List<CenterdataTForestAfforestation> afforestationList = centerdataTForestAfforestationService.selectCenterdataTForestAfforestationList(centerdataTForestAfforestation);
+        if (!afforestationList.isEmpty()) {
+            return AjaxResult.error("已有下级资源");
+        }
         int result = centerdataTForestGridLevelService.deleteCenterdataTForestGridLevelById(id);
         return toAjax(result);
     }