Browse Source

增加树查询

shiyue 1 year ago
parent
commit
b3966f51e2

+ 11 - 5
energy-manage-service/src/main/java/com/energy/manage/service/controller/company/WindCompanyController.java

@@ -5,7 +5,9 @@ import com.energy.manage.common.reponse.ResultResp;
 import com.energy.manage.service.config.annotations.UserLoginToken;
 import com.energy.manage.service.domain.dto.company.*;
 import com.energy.manage.service.domain.vo.company.WindCompanyPageVo;
+import com.energy.manage.service.domain.vo.windfield.WindFieldVo;
 import com.energy.manage.service.service.company.WindCompanyService;
+import com.energy.manage.service.service.windfield.WindFieldService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -23,7 +25,10 @@ import java.util.Map;
 public class WindCompanyController {
 
     @Autowired
-    WindCompanyService windCompanyService;
+    private WindCompanyService windCompanyService;
+
+    @Autowired
+    private WindFieldService windFieldService;
 
 
     @UserLoginToken
@@ -40,9 +45,10 @@ public class WindCompanyController {
     @ApiOperation(value = "删除企业")
     public ResultResp delCompany(@RequestBody WindCompanyDelDto dto) {
 
-
-
-
+        List<WindFieldVo> list = windFieldService.getWindFieldVos(dto.getCompanyCode());
+        if (list.size() > 0) {
+            return ResultResp.FAIL("项目公司有绑定风场不可删除!");
+        }
         boolean flg = windCompanyService.delCompany(dto);
         return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
     }
@@ -70,7 +76,7 @@ public class WindCompanyController {
     @ApiOperation(value = "查询企业树")
     public ResultResp<List<Map<String, Object>>> getAllWindCompany(@RequestBody WindCompanyPageDto windCompanyPageDto) {
 
-        List<Map<String, Object>> list = windCompanyService.getAllWindCompany(windCompanyPageDto.getState(),windCompanyPageDto.getCompanyName());
+        List<Map<String, Object>> list = windCompanyService.getAllWindCompany(windCompanyPageDto.getState(), windCompanyPageDto.getCompanyName());
         return ResultResp.SUCCESS(list);
     }