lengfaqiang 2 лет назад
Родитель
Сommit
8772cf568c

+ 2 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsProjectMapper.java

@@ -32,4 +32,6 @@ public interface KwsProjectMapper extends BaseMapper<KwsProject> {
     List<ProjectDeviceVO> selectDeviceNotBindList(@Param("deviceQuery") DeviceQuery deviceQuery);
 
     List<ProjectDeviceVO> selectNotBindDeviceList(@Param("deviceQuery") DeviceQuery deviceQuery);
+
+    List<KwsProject> selectListData(@Param("ids") List<String> ids, @Param("delFlag") Integer delFlag);
 }

+ 3 - 4
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/ReportService.java

@@ -60,16 +60,15 @@ public class ReportService {
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(info, list);
         }
-        List<String> collect = list.stream().map(ReportStatementVO::getProjectId).collect(Collectors.toList());
-        List<KwsProject> kwsProjects = projectMapper.selectList(new LambdaQueryWrapper<KwsProject>()
-                .in(KwsProject::getId, collect)
-                .eq(KwsProject::getDelFlag, 0));
+        List<String> collect = list.stream().map(ReportStatementVO::getProjectId).distinct().collect(Collectors.toList());
+        List<KwsProject> kwsProjects = projectMapper.selectListData(collect,null);
         Map<Long, String> map = new HashMap<>();
         if (!CollectionUtils.isEmpty(kwsProjects)) {
             map = kwsProjects.stream().collect(Collectors.toMap(KwsProject::getId, KwsProject::getName));
         }
         for (ReportStatementVO reportStatementVO : list) {
             reportStatementVO.setReportType(ReportTypeEnum.getDescription(reportStatementVO.getReportType()));
+            reportStatementVO.setProjectName(map.get(Long.parseLong(reportStatementVO.getProjectId())));
         }
         return PageRes.build(info, list);
     }

+ 16 - 0
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsProjectMapper.xml

@@ -214,4 +214,20 @@
               , '%')
         </if>
     </select>
+
+    <select id="selectListData" resultMap="BaseResultMap">
+        select *
+        from kws_project
+        <where>
+            <if test="ids != null and ids.size() > 0">
+                and id in
+                <foreach collection="ids" close=")" open="(" item="item" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="delFlag != null">
+                and del_flag = #{delFlag}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 3 - 0
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsReportDataMapper.xml

@@ -316,5 +316,8 @@
       <if test="query.endTime != null and query.endTime != ''">
           and a.create_time &lt;= #{query.endTime}
       </if>
+      <if test="mountainId != null and mountainId != ''">
+          and a.mountain_id = #{mountainId}
+      </if>
   </select>
 </mapper>