Переглянути джерело

新增驾驶舱首页查询接口

chenhongyan1989 1 рік тому
батько
коміт
327dd60d5d
18 змінених файлів з 370 додано та 46 видалено
  1. 0 9
      energy-manage-service/src/main/java/com/energy/manage/service/controller/analysis/AnalysisController.java
  2. 4 5
      energy-manage-service/src/main/java/com/energy/manage/service/controller/analysiscomment/AnalysisCommentController.java
  3. 31 0
      energy-manage-service/src/main/java/com/energy/manage/service/controller/homepage/HomePageController.java
  4. 5 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/analysis/AnalysisTypeVo.java
  5. 72 0
      energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/homepage/HomePageVo.java
  6. 7 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/analysis/AnalysisResultMapper.java
  7. 9 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/windexceptioncount/WindExceptionCountMapper.java
  8. 9 0
      energy-manage-service/src/main/java/com/energy/manage/service/mappers/windrelation/WindRelationMapper.java
  9. 9 9
      energy-manage-service/src/main/java/com/energy/manage/service/service/analysis/impl/AnalysisServiceImpl.java
  10. 2 2
      energy-manage-service/src/main/java/com/energy/manage/service/service/analysiscomment/AnalysisCommentService.java
  11. 8 3
      energy-manage-service/src/main/java/com/energy/manage/service/service/analysiscomment/impl/AnalysisCommentServiceImpl.java
  12. 16 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/homepage/HomePageService.java
  13. 130 0
      energy-manage-service/src/main/java/com/energy/manage/service/service/homepage/impl/HomePageServiceImpl.java
  14. 1 1
      energy-manage-service/src/main/java/com/energy/manage/service/task/AutoAnalysisTask.java
  15. 14 0
      energy-manage-service/src/main/resources/mybatis/analysis/AnalysisResultMapper.xml
  16. 2 1
      energy-manage-service/src/main/resources/mybatis/analysis/AnalysisTypeMapper.xml
  17. 35 16
      energy-manage-service/src/main/resources/mybatis/windexceptioncount/WindExceptionCountMapper.xml
  18. 16 0
      energy-manage-service/src/main/resources/mybatis/windrelation/WindRelationMapper.xml

+ 0 - 9
energy-manage-service/src/main/java/com/energy/manage/service/controller/analysis/AnalysisController.java

@@ -69,13 +69,4 @@ public class AnalysisController extends BaseServiceController {
         return success(analysisService.analysisDetail(batchCode,analysisTypeCode,fieldEngineCode));
     }
 
-    @ApiOperation(value = "测试")
-    @GetMapping("/test")
-    public ResultResp test()
-    {
-        System.out.println("analysisUrl: " + AlgorithmProperties.analysisUrl);
-        System.out.println("analysisJson: " + AlgorithmProperties.analysisJson);
-        return success();
-    }
-
 }

+ 4 - 5
energy-manage-service/src/main/java/com/energy/manage/service/controller/analysiscomment/AnalysisCommentController.java

@@ -12,6 +12,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * @author chy
  * @date 2024/5/24 17:09
@@ -55,12 +57,9 @@ public class AnalysisCommentController extends BaseServiceController {
     @UserLoginToken
     @ApiOperation(value = "富文本编辑")
     @PostMapping("/analysisCommentEdit")
-    public ResultResp analysisCommentEdit(@RequestBody AnalysisCommentDescriptionDto commentDescriptionDto)
+    public ResultResp analysisCommentEdit(@RequestBody List<AnalysisCommentDescriptionDto> commentDescriptionDtos)
     {
-        Integer userId = getUserId();
-        commentDescriptionDto.setCreateBy(userId);
-        commentDescriptionDto.setUpdateBy(userId);
-        return success(analysisCommentService.analysisCommentEdit(commentDescriptionDto));
+        return success(analysisCommentService.analysisCommentEdit(commentDescriptionDtos,getUserId()));
     }
 
 }

+ 31 - 0
energy-manage-service/src/main/java/com/energy/manage/service/controller/homepage/HomePageController.java

@@ -0,0 +1,31 @@
+package com.energy.manage.service.controller.homepage;
+
+import com.energy.manage.common.reponse.ResultResp;
+import com.energy.manage.service.controller.base.BaseServiceController;
+import com.energy.manage.service.service.homepage.HomePageService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author chy
+ * @date 2024/6/13 13:52
+ * @desc
+ */
+@RestController
+@RequestMapping("/homePage")
+public class HomePageController extends BaseServiceController {
+
+    @Autowired
+    private HomePageService homePageService;
+
+    @ApiOperation("驾驶舱首页查询")
+    @GetMapping("/query")
+    public ResultResp query(@RequestParam("codeNumber") String codeNumber,
+                            @RequestParam("codeType") String codeType){
+        return success(homePageService.query(codeNumber,codeType));
+    }
+}

+ 5 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/analysis/AnalysisTypeVo.java

@@ -30,6 +30,11 @@ public class AnalysisTypeVo {
     private String typeCode ;
 
     /**
+     * 分析类型标识
+     */
+    private String typeFlag ;
+
+    /**
      * 分析类型名称
      */
     private String typeName ;

+ 72 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/homepage/HomePageVo.java

@@ -0,0 +1,72 @@
+package com.energy.manage.service.domain.vo.homepage;
+
+import com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @author chy
+ * @date 2024/6/13 15:10
+ * @desc
+ */
+@Data
+@Accessors(chain = true)
+public class HomePageVo {
+
+    /**
+     * 已分析
+     */
+    private Integer analysisedCount = 0;
+
+    /**
+     * 分析中
+     */
+    private Integer analysisingCount = 0;
+
+    /**
+     * 未分析
+     */
+    private Integer noAnalysisCount = 0;
+
+    /**
+     * 异常总数
+     */
+    private Integer errCounrt = 0;
+
+    /**
+     * 本月异常数
+     */
+    private Integer errCountInCurrentMonth = 0;
+
+    /**
+     * 未处理异常数
+     */
+    private Integer errCountNotDeal = 0;
+
+    /**
+     * 异常设备数
+     */
+    private Integer errDeviceCount = 0;
+
+    /**
+     * 异常信息
+     */
+    private List<WindExceptionCountVo> errList;
+
+
+    /**
+     * 分析完成+1
+     */
+    public void analysisedCountAdd(){
+         analysisedCount++;
+    }
+
+    /**
+     * 分析中+1
+     */
+    public void analysisingCountAdd(){
+          analysisingCount++;
+    }
+}

+ 7 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/analysis/AnalysisResultMapper.java

@@ -31,4 +31,11 @@ public interface AnalysisResultMapper extends MyMapper<AnalysisResultPo> {
      */
     int selectAlasisingCount();
 
+    /**
+     * 查询风场最新批次的分析结果
+     * @param fieldCodes
+     * @return
+     */
+    List<AnalysisResultVo> selectLastBatchResultByFieldCode(@Param("fieldCodes") List<String> fieldCodes);
+
 }

+ 9 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/windexceptioncount/WindExceptionCountMapper.java

@@ -4,6 +4,7 @@ import com.energy.manage.common.mapper.MyMapper;
 import com.energy.manage.common.po.windexceptioncount.WindExceptionCountPo;
 import com.energy.manage.service.domain.dto.windexceptioncount.WindExceptionCountDto;
 import com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -39,4 +40,12 @@ public interface WindExceptionCountMapper extends MyMapper<WindExceptionCountPo>
      */
     int updatePoSelecttive(WindExceptionCountDto analysisResultDto);
 
+
+    /**
+     * 根据风场查询异常描述
+     * @param fieldCodes
+     * @return
+     */
+    List<WindExceptionCountVo> selectByfieldCodes(@Param("fieldCodes") List<String> fieldCodes);
+
 }

+ 9 - 0
energy-manage-service/src/main/java/com/energy/manage/service/mappers/windrelation/WindRelationMapper.java

@@ -4,6 +4,7 @@ import com.energy.manage.common.mapper.MyMapper;
 import com.energy.manage.common.po.windfield.WindFieldPO;
 import com.energy.manage.common.po.windrelation.WindRelationPO;
 import com.energy.manage.service.domain.vo.company.WindCompanyPageVo;
+import com.energy.manage.service.domain.vo.windrelation.WindRelationVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -23,4 +24,12 @@ public interface WindRelationMapper extends MyMapper<WindRelationPO> {
     List<WindCompanyPageVo> selectWindRelationCompanyByType(@Param("type") String type,@Param("state")Integer state,@Param("companyName")String companyName);
 
 
+    /**
+     * 根据code查询信息
+     * @param codeNumbers
+     * @return
+     */
+    List<WindRelationPO> selectByCodeNumber(@Param("codeNumbers") List<String> codeNumbers);
+
+
 }

+ 9 - 9
energy-manage-service/src/main/java/com/energy/manage/service/service/analysis/impl/AnalysisServiceImpl.java

@@ -89,16 +89,19 @@ public class AnalysisServiceImpl implements AnalysisService {
             if(checkAnalysising()){
                 return ResultResp.FAIL(ConstVar.ANALYSISING);
             }
-            //分析类型code转换为flag(便于json分析类型赋值)
-            transferAnalysisFlagByCode(analysisDto);
+            //手动分析要进行分析类型code转换为flag(便于json分析类型赋值)
+            // (是因为算法分析类型code与平台分析类型code没有做统一,开发之后才做统一,所以需要转换)
+            if(analysisDto.getAutoOrManual().equalsIgnoreCase(AnalysisConstants.MANUAL_ANALYSIS)){
+                transferAnalysisFlagByCode(analysisDto);
+            }
             //将配置文件中的算法json转换为对象
             JsonNode rootNode = mapper.readTree(AlgorithmProperties.analysisJson);
             //将入参analysisDto转换为算法标准json
             dataProccess(analysisDto,rootNode);
             log.info("调用分析算法之前,将入参analysisDto转换为算法标准json = {}" + rootNode.toString());
             //调用算法
-            JSONObject jsonObject = HttpUtils.doPost(AlgorithmProperties.analysisUrl,mapper.convertValue(rootNode, Map.class));
-            log.info("调用算法分析返回结果:{}",jsonObject);
+//            JSONObject jsonObject = HttpUtils.doPost(AlgorithmProperties.analysisUrl,mapper.convertValue(rootNode, Map.class));
+//            log.info("调用算法分析返回结果:{}",jsonObject);
             return ResultResp.SUCCESS();
         } catch (JsonProcessingException e) {
             log.error("批次号 = {} 手动分析异常",analysisDto.getDataBatchNum(),e);
@@ -135,18 +138,15 @@ public class AnalysisServiceImpl implements AnalysisService {
             return analysisDetailVos;
         }
         //最新总文件
-        List<AnalysisGeneralFileVo> newGeneralFileVos = new ArrayList<>();
-        //获取最新总文件列表
-        newGeneralFileVos = getNewGeneralFiles(batchCode,analysisTypeCode);
+        List<AnalysisGeneralFileVo> newGeneralFileVos = getNewGeneralFiles(batchCode,analysisTypeCode);
         //获取最新分文件
         List<AnalysisDiagramRelationVo> newDiagramRelationVos = getNewDiagramRelations(batchCode, analysisTypeCode, fieldEngineCode);
         //查询评论
         List<AnalysisCommentDescriptionVo> commentDescriptionVos = commentDescriptionMapper.selecByBatchCodeAndAnalysisTypeCode(batchCode,analysisTypeCode);
         //根据分析类型设置分析结果
-        List<AnalysisGeneralFileVo> finalNewGeneralFileVos = newGeneralFileVos;
         analysisTypeVos.forEach(analysisTypeVo -> {
             //设置相应参数
-            AnalysisDetailVo analysisDetailVo = getAnalysisDetailVo(analysisTypeVo, finalNewGeneralFileVos,newDiagramRelationVos,commentDescriptionVos);
+            AnalysisDetailVo analysisDetailVo = getAnalysisDetailVo(analysisTypeVo, newGeneralFileVos,newDiagramRelationVos,commentDescriptionVos);
             if(analysisDetailVo != null){
                 analysisDetailVos.add(analysisDetailVo);
             }

+ 2 - 2
energy-manage-service/src/main/java/com/energy/manage/service/service/analysiscomment/AnalysisCommentService.java

@@ -41,8 +41,8 @@ public interface AnalysisCommentService {
 
     /**
      * 富文本编辑
-     * @param commentDescriptionDto
+     * @param commentDescriptionDtos
      * @return
      */
-    int analysisCommentEdit(AnalysisCommentDescriptionDto commentDescriptionDto);
+    int analysisCommentEdit(List<AnalysisCommentDescriptionDto> commentDescriptionDtos,Integer userId);
 }

+ 8 - 3
energy-manage-service/src/main/java/com/energy/manage/service/service/analysiscomment/impl/AnalysisCommentServiceImpl.java

@@ -86,13 +86,18 @@ public class AnalysisCommentServiceImpl implements AnalysisCommentService {
 
     /**
      * 富文本编辑
-     * @param dto
+     * @param dtos
+     * @Param userId
      * @return
      */
     @Override
-    public int analysisCommentEdit(AnalysisCommentDescriptionDto dto) {
+    public int analysisCommentEdit(List<AnalysisCommentDescriptionDto> dtos, Integer userId) {
         AtomicInteger count = new AtomicInteger(0);
-        dto.getCommentList().parallelStream().forEach(item -> count.addAndGet(saveCommentDescription(dto, item)));
+        for(AnalysisCommentDescriptionDto dto : dtos){
+            dto.setCreateBy(userId);
+            dto.setUpdateBy(userId);
+            dto.getCommentList().parallelStream().forEach(item -> count.addAndGet(saveCommentDescription(dto, item)));
+        }
         return count.get();
     }
 

+ 16 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/homepage/HomePageService.java

@@ -0,0 +1,16 @@
+package com.energy.manage.service.service.homepage;
+
+/**
+ * @author chy
+ * @date 2024/6/13 14:02
+ * @desc
+ */
+public interface HomePageService {
+
+    /**
+     * 驾驶舱首页查询
+     * @param codeNumber
+     * @param codeType
+     */
+    Object query(String codeNumber,String codeType);
+}

+ 130 - 0
energy-manage-service/src/main/java/com/energy/manage/service/service/homepage/impl/HomePageServiceImpl.java

@@ -0,0 +1,130 @@
+package com.energy.manage.service.service.homepage.impl;
+
+import com.energy.manage.common.enums.TypeRelationEnum;
+import com.energy.manage.common.po.windrelation.WindRelationPO;
+import com.energy.manage.service.domain.vo.analysis.AnalysisResultVo;
+import com.energy.manage.service.domain.vo.homepage.HomePageVo;
+import com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo;
+import com.energy.manage.service.domain.vo.windrelation.WindRelationVo;
+import com.energy.manage.service.mappers.analysis.AnalysisResultMapper;
+import com.energy.manage.service.mappers.windexceptioncount.WindExceptionCountMapper;
+import com.energy.manage.service.mappers.windrelation.WindRelationMapper;
+import com.energy.manage.service.service.homepage.HomePageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author chy
+ * @date 2024/6/13 14:03
+ * @desc
+ */
+@Service
+public class HomePageServiceImpl implements HomePageService {
+
+
+    @Autowired
+    private WindRelationMapper relationMapper;
+
+    @Autowired
+    private AnalysisResultMapper analysisResultMapper;
+
+    @Autowired
+    private WindExceptionCountMapper exceptionCountMapper;
+
+
+    /**
+     * 驾驶舱首页查询
+     * @param codeNumber
+     * @param codeType
+     */
+    @Override
+    public HomePageVo query(String codeNumber, String codeType) {
+        //返回实体对象
+        HomePageVo homePageVo = new HomePageVo();
+        //风场
+        List<String> fieldCodes = new ArrayList<>();
+        //根据类型判断获取风场code
+        if(codeType.equals(TypeRelationEnum.COMPANY_NUMBER.getCode())){
+            getFieldCodeList(Arrays.asList(codeNumber), fieldCodes);
+        }else{
+            fieldCodes.add(codeNumber);
+        }
+        //如果风场code为空,则不设置
+        if(CollectionUtils.isEmpty(fieldCodes)){
+            return homePageVo;
+        }
+        //设置未分析、分析中、已分析数目
+        setAnalysisCount(homePageVo,fieldCodes);
+        //设置异常数
+        setErrCount(homePageVo,fieldCodes);
+        //设置异常信息
+//        setErrInfo(homePageVo,fieldCodes);
+        return homePageVo;
+    }
+
+
+    /**
+     * 递归获取风场code
+     * @param companyCodes
+     * @param fieldCodes
+     */
+    private void getFieldCodeList(List<String> companyCodes, List<String> fieldCodes){
+        if(CollectionUtils.isEmpty(companyCodes)){
+            return;
+        }
+        List<WindRelationPO> relationPos = relationMapper.selectByCodeNumber(companyCodes);
+        List<String> companyCodeList = new ArrayList<>();
+        relationPos.parallelStream().forEach(item -> {
+            if(TypeRelationEnum.WIND_FIELD_NUMBER.getCode().equals(item.getType())){
+                fieldCodes.add(item.getCodeNumber());
+            }
+            if(TypeRelationEnum.COMPANY_NUMBER.getCode().equals(item.getType())){
+                companyCodeList.add(item.getCodeNumber());
+            }
+        });
+        getFieldCodeList(companyCodeList,fieldCodes);
+    }
+
+    /**
+     * 分析数设置
+     * @param homePageVo
+     * @param fieldCodes
+     */
+    private void setAnalysisCount(HomePageVo homePageVo,List<String> fieldCodes){
+        List<AnalysisResultVo> resultVos = analysisResultMapper.selectLastBatchResultByFieldCode(fieldCodes);
+        Integer total = fieldCodes.size();
+        if(CollectionUtils.isEmpty(resultVos)){
+            //分析结果为空的时候证明没有风场没有进行分析
+            homePageVo.setNoAnalysisCount(total);
+            return ;
+        }
+        resultVos.stream().forEach(item -> {
+            Integer analysisState = item.getAnalysisState();
+            //分析中
+            if(item.getAnalysisState().equals(0)){
+                homePageVo.analysisingCountAdd();
+            }
+            //分析完成
+            if(item.getAnalysisState().equals(1)){
+                homePageVo.analysisedCountAdd();
+            }
+        });
+        //设置未分析
+        homePageVo.setNoAnalysisCount(total - homePageVo.getAnalysisedCount() - homePageVo.getAnalysisingCount());
+    }
+
+    /**
+     * 设置异常数
+     * @param homePageVo
+     * @param fieldCodes
+     */
+    public void setErrCount(HomePageVo homePageVo, List<String> fieldCodes){
+        List<WindExceptionCountVo> exceptionCounts = exceptionCountMapper.selectByfieldCodes(fieldCodes);
+
+    }
+}

+ 1 - 1
energy-manage-service/src/main/java/com/energy/manage/service/task/AutoAnalysisTask.java

@@ -69,7 +69,7 @@ public class AutoAnalysisTask {
         analysisDto.setAutoOrManual(AnalysisConstants.AUTO_ANALYSIS);
         analysisDto.setDataBatchNum(dataTransferVo.getBatchCode());
         analysisDto.setPowerFarmID(dataTransferVo.getFieldCode());
-        List<String> typeCodeList = typeMapper.selectAllVo().parallelStream().map(AnalysisTypeVo::getTypeCode).collect(Collectors.toList());
+        List<String> typeCodeList = typeMapper.selectAllVo().parallelStream().map(AnalysisTypeVo::getTypeFlag).collect(Collectors.toList());
         analysisDto.setConfigAnalysis(typeCodeList);
         return analysisDto;
     }

+ 14 - 0
energy-manage-service/src/main/resources/mybatis/analysis/AnalysisResultMapper.xml

@@ -39,4 +39,18 @@
         from analysis_result
         where analysis_state = 0
     </select>
+    <select id="selectLastBatchResultByFieldCode" parameterType="java.lang.String" resultType="com.energy.manage.service.domain.vo.analysis.AnalysisResultVo">
+        select result.*
+        from analysis_result result
+        inner join (
+            select field_code,max(batch_code) as batch_code
+            from wind_field_batch
+            GROUP BY field_code
+            having field_code in
+            <foreach collection="fieldCodes" item="fieldCode" separator="," open="(" close=")">
+                #{fieldCode,jdbcType=VARCHAR}
+            </foreach>
+                   ) as batch
+        on result.batch_code = batch.batch_code;
+    </select>
 </mapper>

+ 2 - 1
energy-manage-service/src/main/resources/mybatis/analysis/AnalysisTypeMapper.xml

@@ -15,6 +15,7 @@
         select id,
                parent_id,
                type_code,
+               type_flag,
                type_name
         from analysis_type
     </select>
@@ -36,7 +37,7 @@
         where 1 = 1
         <if test="typeCodes != null and typeCodes.size() > 0">
             and type_code in
-                <foreach collection="typeCodes" open="(" close="" separator="," item="typeCode">
+                <foreach collection="typeCodes" open="(" close=")" separator="," item="typeCode">
                     #{typeCode,jdbcType=VARCHAR}
                 </foreach>
         </if>

+ 35 - 16
energy-manage-service/src/main/resources/mybatis/windexceptioncount/WindExceptionCountMapper.xml

@@ -16,33 +16,52 @@
     </resultMap>
 
     <select id="selectByCondition" parameterType="com.energy.manage.service.domain.dto.windexceptioncount.WindExceptionCountDto" resultType="com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo">
-        SELECT
-        count.id,
-        count.batch_code,
-        count.engine_code,
-        type.type_name as analysis_type_name,
-        count.analysis_type_code,
-        count.err_count,
-        count.handle_err_count,
-        count.create_by,
-        count.create_time,
-        count.update_by,
-        count.update_time
-        FROM
+        select
+            count.id,
+            count.batch_code,
+            count.engine_code,
+            type.type_name as analysis_type_name,
+            count.analysis_type_code,
+            count.err_count,
+            count.handle_err_count,
+            count.create_by,
+            count.create_time,
+            count.update_by,
+            count.update_time
+        from
             wind_exception_count count
         left join analysis_type type
         on count.analysis_type_code = type.type_code
-        WHERE
+        where
             count.is_delete = 0
         and count.batch_code = #{batchCode}
         <if test="engineCode != null and engineCode != ''">
-            AND count.engine_code = #{engineCode}
+            and count.engine_code = #{engineCode}
         </if>
         <if test="analysisTypeCode != null and analysisTypeCode != ''">
-            AND count.analysis_type_code = #{analysisTypeCode}
+            and count.analysis_type_code = #{analysisTypeCode}
         </if>
     </select>
 
+    <select id="selectByfieldCodes" parameterType="java.lang.String" resultType="com.energy.manage.service.domain.vo.windexceptioncount.WindExceptionCountVo">
+        select
+            *
+        from
+            wind_exception_count
+        where
+            batch_code in (
+                select distinct
+                    batch_code
+                from
+                    wind_field_batch
+                where
+                    field_code in
+                    <foreach collection="fieldCodes" open="(" separator="," close=")" item="fieldCode">
+                        #{fieldCode,jdbcType=VARCHAR}
+                    </foreach>
+                );
+    </select>
+
     <insert id="insertPoSelective" parameterType="com.energy.manage.service.domain.dto.windexceptioncount.WindExceptionCountDto">
         insert into wind_exception_count
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 16 - 0
energy-manage-service/src/main/resources/mybatis/windrelation/WindRelationMapper.xml

@@ -56,5 +56,21 @@
         </if>
     </select>
 
+    <select id="selectByCodeNumber" parameterType="java.lang.String" resultType="com.energy.manage.common.po.windrelation.WindRelationPO">
+        select code_number,
+               type,
+               parent_code
+        from wind_relation
+        where code_number in
+        <foreach collection="codeNumbers" item="codeNumber" open="(" separator="," close=")">
+            #{codeNumber,jdbcType=VARCHAR}
+        </foreach>
+        or parent_code in
+        <foreach collection="codeNumbers" item="codeNumber" open="(" separator="," close=")">
+            #{codeNumber,jdbcType=VARCHAR}
+        </foreach>
+
+    </select>
+
 
 </mapper>