From 9ca86187d65db0180f6d23b8efd13136b6db394c Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 20 九月 2024 11:45:40 +0800
Subject: [PATCH] 考核成绩导出优化

---
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml                 |   16 ++++----
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java          |    4 ++
 ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexVideoVO.java          |    2 
 ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java                      |    6 ++
 ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java    |    1 
 ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java |   38 ++++++++++++++-----
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java        |    8 +++-
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml                |   17 ++++----
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml               |   17 ++++----
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java         |    4 ++
 10 files changed, 74 insertions(+), 39 deletions(-)

diff --git a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
index 0b52092..b5394be 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
@@ -43,11 +43,15 @@
     @Excel(name = "寰楀垎")
     @TableField(exist = false)
     private BigDecimal score;
+    /** 璁惧鏁伴噺 */
+    @Excel(name = "璁惧鏁伴噺")
+    @TableField(exist = false)
+    private Integer num;
 
     @TableField(exist = false)
     public List<Integer> deptIds;
     @TableField(exist = false)
-    public List<Integer> examineTags;
+    public Integer examineTagQuery;
     @TableField(exist = false)
     public List<Integer> examineCategories;
     /** 璇锋眰鍙傛暟 */
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
index 3148832..1d31b48 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
@@ -93,6 +93,7 @@
     //杞崲鎴愬瓧绗︿覆鐢ㄤ簬excel瀵煎嚭
     public static CheckIndexCarVO getExcelVo(@NonNull CheckIndexCar checkIndexCar) {
         CheckIndexCarVO checkIndexCarVo = new CheckIndexCarVO();
+        checkIndexCarVo.setNum(checkIndexCar.getNum());
         checkIndexCarVo.setScore(checkIndexCar.getScore().setScale(2,RoundingMode.HALF_UP));
         checkIndexCarVo.setDeptName(checkIndexCar.getDeptName());
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
@@ -120,6 +121,7 @@
      * 瀵煎嚭鏃剁敤浜庤绠楀钩鍧囧��
      */
     public static CheckIndexCar calculateAverage(List<CheckIndexCar> checkIndexCars) {
+        Integer numSum = 0;
         BigDecimal scoreSum = BigDecimal.ZERO;
         BigDecimal viewConnectStabilitySum = BigDecimal.ZERO;
         BigDecimal siteOnlineSum = BigDecimal.ZERO;
@@ -132,6 +134,7 @@
         BigDecimal vehicleUrlAvailabilitySum = BigDecimal.ZERO;
         BigDecimal vehiclePictureAvailabilitySum = BigDecimal.ZERO;
         for (CheckIndexCar car : checkIndexCars) {
+            numSum = numSum + (car.getNum() == null? 0:car.getNum());
             scoreSum = scoreSum.add(car.getScore() == null ? BigDecimal.ZERO : car.getScore());
             viewConnectStabilitySum = viewConnectStabilitySum.add(car.getViewConnectStability());
             siteOnlineSum = siteOnlineSum.add(car.getSiteOnline());
@@ -149,6 +152,7 @@
         checkIndexCar.setDeptName(checkIndexCars.get(0).getDeptName());
         checkIndexCar.setExamineTag(checkIndexCars.get(0).getExamineTag());
         checkIndexCar.setScore(scoreSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP));
+        checkIndexCar.setNum(numSum/checkIndexCars.size());
         checkIndexCar.setViewConnectStability(viewConnectStabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP));
         checkIndexCar.setSiteOnline(siteOnlineSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP));
         checkIndexCar.setDeviceDirectoryConsistent(deviceDirectoryConsistentSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP));
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
index 244f4f0..13e87b4 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
@@ -83,6 +83,7 @@
     //杞崲鎴愬瓧绗︿覆鐢ㄤ簬excel瀵煎嚭
     public static CheckIndexFaceVO getExcelVo(@NonNull CheckIndexFace checkIndexFace) {
         CheckIndexFaceVO checkIndexFaceVo = new CheckIndexFaceVO();
+        checkIndexFaceVo.setNum(checkIndexFace.getNum());
         checkIndexFaceVo.setScore(checkIndexFace.getScore().setScale(2,RoundingMode.HALF_UP));
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         //閬垮厤鍚堣琛屾姤閿�(鍚堣鏁版嵁 缂哄皯createTimeStr瀛楁 鐩存帴灏哻reateTimeStr璁剧疆涓�"鍚堣")
@@ -106,6 +107,7 @@
     }
     /** 鐢ㄤ簬瀵煎嚭璁$畻骞冲潎鍊� */
     public static CheckIndexFace calculateAverage(List<CheckIndexFace> checkIndexFaces) {
+        Integer numSum = 0;
         BigDecimal scoreSum = BigDecimal.ZERO;
         BigDecimal totalViewConnectStability = BigDecimal.ZERO;
         BigDecimal totalSiteOnline = BigDecimal.ZERO;
@@ -119,6 +121,7 @@
         int count = checkIndexFaces.size();
 
         for (CheckIndexFace indexFace : checkIndexFaces) {
+            numSum = numSum + (indexFace.getNum() == null? 0:indexFace.getNum());
             scoreSum = scoreSum.add(indexFace.getScore() == null ? BigDecimal.ZERO : indexFace.getScore());
             totalViewConnectStability = totalViewConnectStability.add(indexFace.getViewConnectStability());
             totalSiteOnline = totalSiteOnline.add(indexFace.getSiteOnline());
@@ -133,6 +136,7 @@
         result.setCreateTimeStr("鍚堣");
         result.setDeptName(checkIndexFaces.get(0).getDeptName());
         result.setExamineTag(checkIndexFaces.get(0).getExamineTag());
+        result.setNum(numSum/count);
         result.setScore(scoreSum.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
         result.setViewConnectStability(totalViewConnectStability.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
         result.setSiteOnline(totalSiteOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
index 9fe3488..bed934e 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
@@ -121,13 +121,14 @@
     //杞崲鎴愬瓧绗︿覆鐢ㄤ簬excel瀵煎嚭
     public static CheckIndexVideoVO getExcelVo(@NonNull CheckIndexVideo checkIndexVideo) {
         CheckIndexVideoVO checkIndexVideoVO = new CheckIndexVideoVO();
-        checkIndexVideoVO.setScore(checkIndexVideo.getScore().setScale(2,RoundingMode.HALF_UP));
+        checkIndexVideoVO.setNum(checkIndexVideo.getNum());
+        checkIndexVideoVO.setScore(checkIndexVideo.getScore().setScale(2, RoundingMode.HALF_UP));
         checkIndexVideoVO.setDeptName(checkIndexVideo.getDeptName());
         //閬垮厤鍚堣琛屾姤閿�(鍚堣鏁版嵁 缂哄皯createTimeStr瀛楁 鐩存帴灏哻reateTimeStr璁剧疆涓�"鍚堣")
         if (StringUtils.isEmpty(checkIndexVideo.getCreateTimeStr())) {
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
             checkIndexVideoVO.setCreateTimeStr(format.format(checkIndexVideo.getCreateTime()));
-        }else {
+        } else {
             checkIndexVideoVO.setCreateTimeStr(checkIndexVideo.getCreateTimeStr());
         }
         checkIndexVideoVO.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexVideo.getExamineTag()) ? "鐪佸巺鑰冩牳" : "鍖哄幙鑰冩牳");
@@ -153,6 +154,7 @@
      * 鐢ㄤ簬瀵煎嚭璁$畻骞冲潎鍊�
      */
     public static CheckIndexVideo calculateAverage(List<CheckIndexVideo> videos) {
+        Integer numSum = 0;
         BigDecimal scoreSum = BigDecimal.ZERO;
         BigDecimal totalPlatformOnline = BigDecimal.ZERO;
         BigDecimal totalMonitorQualification = BigDecimal.ZERO;
@@ -171,6 +173,7 @@
 
         int count = videos.size();
         for (CheckIndexVideo video : videos) {
+            numSum = numSum + (video.getNum() == null? 0:video.getNum());
             scoreSum = scoreSum.add(video.getScore() == null ? BigDecimal.ZERO : video.getScore());
             totalPlatformOnline = totalPlatformOnline.add(video.getPlatformOnline());
             totalMonitorQualification = totalMonitorQualification.add(video.getMonitorQualification());
@@ -193,6 +196,7 @@
         averageVideo.setCreateTimeStr("鍚堣");
         averageVideo.setDeptName(videos.get(0).getDeptName());
         averageVideo.setExamineTag(videos.get(0).getExamineTag());
+        averageVideo.setNum(numSum/count);
         averageVideo.setScore(scoreSum.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
         averageVideo.setPlatformOnline(totalPlatformOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
         averageVideo.setMonitorQualification(totalMonitorQualification.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexVideoVO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexVideoVO.java
index 2e1c1c9..922346e 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexVideoVO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexVideoVO.java
@@ -42,7 +42,7 @@
     /**
      * 褰曡薄鍙敤鐜�
      */
-    @Excel(name = "褰曡薄鍙敤鐜�")
+    @Excel(name = "褰曞儚鍙敤鐜�")
     private String videoAvailableText;
 
     /**
diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
index 00d8fda..f73d7a5 100644
--- a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
+++ b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
@@ -95,7 +95,6 @@
     @Log(title = "璇︽儏椤靛鍑鸿�冩牳绉垎", businessType = BusinessType.EXPORT)
     @PostMapping("/detailExport")
     @PreAuthorize("@ss.hasPermi('check:result:detail:export')")
-    //鍏辩敤鐨勪竴涓柟娉曠敤checkScore鎺ュ弬,new瀵硅薄鐨勬柟寮忛槻鎶ゃ��
     public void detailExport(HttpServletResponse response, CheckScore checkScore) throws IOException {
         CheckResultExportDTO exportDTO = new CheckResultExportDTO();
         exportDTO.setDate(checkScore.getDate());
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
index e8012fe..e05e86c 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -319,10 +319,16 @@
         checkIndexCar.setQuarter(exportDTO.getQuarter());
         checkIndexCar.setDeptId(exportDTO.getDeptId());
         checkIndexCar.setDeptIds(exportDTO.getDeptIds());
-        checkIndexCar.setExamineTags(exportDTO.getExamineTags());
         //鏉冮檺鎺у埗 鍙兘鏌ョ湅宸插彂甯�
         roleControl(checkIndexCar);
-        List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar);
+        List<CheckIndexCar> checkIndexCars = new ArrayList<>();
+        for (Integer examineTag : exportDTO.getExamineTags()) {
+            checkIndexCar.setExamineTag(Short.valueOf(examineTag+""));
+            if(examineTag ==0){
+                checkIndexCar.setExamineTagQuery(1);
+            }
+            checkIndexCars.addAll(indexCarService.selectCheckIndexCarList(checkIndexCar));
+        }
         //璁$畻骞冲潎鍊兼斁鍦╡xcel鏈�鍚�
         if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexCars)) {
             //鍏堝尯鍒嗚�冩牳鏍囩锛屽啀鍖哄垎鍖哄幙
@@ -361,10 +367,16 @@
         checkIndexFace.setQuarter(exportDTO.getQuarter());
         checkIndexFace.setDeptId(exportDTO.getDeptId());
         checkIndexFace.setDeptIds(exportDTO.getDeptIds());
-        checkIndexFace.setExamineTags(exportDTO.getExamineTags());
         //鏉冮檺鎺у埗 鍙兘鏌ョ湅宸插彂甯�
         roleControl(checkIndexFace);
-        List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace);
+        List<CheckIndexFace> checkIndexFaces = new ArrayList<>();
+        for (Integer examineTag : exportDTO.getExamineTags()) {
+            checkIndexFace.setExamineTag(Short.valueOf(examineTag+""));
+            if(examineTag ==0){
+                checkIndexFace.setExamineTagQuery(1);
+            }
+            checkIndexFaces.addAll(indexFaceService.selectCheckIndexFaceList(checkIndexFace));
+        }
         //璁$畻骞冲潎鍊兼斁鍦╡xcel鏈�鍚�
         if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexFaces)) {
             //鍏堝尯鍒嗚�冩牳鏍囩锛屽啀鍖哄垎鍖哄幙
@@ -403,10 +415,16 @@
         checkIndexVideo.setQuarter(exportDTO.getQuarter());
         checkIndexVideo.setDeptId(exportDTO.getDeptId());
         checkIndexVideo.setDeptIds(exportDTO.getDeptIds());
-        checkIndexVideo.setExamineTags(exportDTO.getExamineTags());
         //鏉冮檺鎺у埗 鍙兘鏌ョ湅宸插彂甯�
         roleControl(checkIndexVideo);
-        List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo);
+        List<CheckIndexVideo> checkIndexVideos = new ArrayList<>();
+        for (Integer examineTag : exportDTO.getExamineTags()) {
+            checkIndexVideo.setExamineTag(Short.valueOf(examineTag+""));
+            if(examineTag ==0){
+                checkIndexVideo.setExamineTagQuery(1);
+            }
+            checkIndexVideos.addAll(indexVideoService.selectCheckIndexVideoList(checkIndexVideo));
+        }
         //璁$畻骞冲潎鍊兼斁鍦╡xcel鏈�鍚�
         if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexVideos)) {
             //鍏堝尯鍒嗚�冩牳鏍囩锛屽啀鍖哄垎鍖哄幙
@@ -517,14 +535,14 @@
         for (CheckScore checkScore : dashboard) {
             List<Map<String, Object>> list = new ArrayList<>();
             Map<String, Object> map = new HashMap<>();
-            map.put("value",checkScore.getScore());
-            if(dashboardQuery.getDataScope() ==1) {
+            map.put("value", checkScore.getScore());
+            if (dashboardQuery.getDataScope() == 1) {
                 map.put("name", "鐪佸巺寰楀垎");
-            }else {
+            } else {
                 map.put("name", "鍖哄幙寰楀垎");
             }
             list.add(map);
-            resultMap.put(checkScore.getDeptName(),list );
+            resultMap.put(checkScore.getDeptName(), list);
         }
         return resultMap;
     }
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
index ae68374..8472ac5 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
@@ -10,6 +10,7 @@
         <result property="examineTag"    column="examine_tag"    />
         <result property="createTime"    column="create_time"    />
         <result property="score"    column="score"    />
+        <result property="num"    column="num"    />
         <result property="viewConnectStability"    column="view_connect_stability"    />
         <result property="siteOnline"    column="site_online"    />
         <result property="deviceDirectoryConsistent"    column="device_directory_consistent"    />
@@ -27,13 +28,16 @@
     </sql>
 
     <select id="selectCheckIndexCarList"  resultMap="CheckIndexCarResult">
-        select tcic.*,sd.dept_name,tcs.score
+        select tcic.*,sd.dept_name,tcs.score,count(m.serial_number) as num
         from t_check_index_car tcic left join sys_dept sd on tcic.dept_id = sd.dept_id
         left join t_check_score tcs on tcic.id = tcs.index_id
+        left join t_yw_point p on p.dept_id = tcic.dept_id
+        left join t_monitor m on p.serial_number = m.serial_number
         <where>
-            tcs.examine_category = 2
+            tcs.examine_category = 2 and m.camera_fun_type like concat('%',2,'%')
             <if test="deptId != null "> and tcic.dept_id = #{deptId}</if>
             <if test="examineTag != null "> and tcic.examine_tag = #{examineTag}</if>
+            <if test="examineTagQuery != null "> and p.province_tag = #{examineTagQuery}</if>
             <if test="date != null "> and  date_format(tcic.create_time,'%Y-%m') = #{date}</if>
             <if test="day != null "> and  date(tcic.create_time) = #{day}</if>
             <if test="params.publish != null  and params.publish != ''">and tcic.publish = #{params.publish}</if>
@@ -42,13 +46,9 @@
                     #{deptId}
                 </foreach>
             </if>
-            <if test="examineTags != null and examineTags.size()>0">and tcic.examine_tag in
-                <foreach collection="examineTags" separator="," open="(" close=")" item="examineTag">
-                    #{examineTag}
-                </foreach>
-            </if>
         </where>
-        order by tcic.examine_tag desc,tcic.create_time,tcs.score desc
+        group by tcic.id
+        order by tcic.examine_tag desc,sd.area_code,tcic.create_time
     </select>
 
     <select id="getCheckIndexCarList"  resultMap="CheckIndexCarResult">
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
index fa8afc6..bad4ffe 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
@@ -8,6 +8,8 @@
         <result property="id"    column="id"    />
         <result property="deptId"    column="dept_id"    />
         <result property="examineTag"    column="examine_tag"    />
+        <result property="num"    column="num"    />
+        <result property="score"    column="score"    />
         <result property="createTime"    column="create_time"    />
         <result property="viewConnectStability"    column="view_connect_stability"    />
         <result property="siteOnline"    column="site_online"    />
@@ -24,13 +26,16 @@
     </sql>
 
     <select id="selectCheckIndexFaceList"  resultMap="CheckIndexFaceResult">
-        select tcif.*,sd.dept_name,tcs.score
+        select tcif.*,sd.dept_name,tcs.score,count(m.serial_number) as num
         from t_check_index_face tcif left join sys_dept sd on tcif.dept_id = sd.dept_id
         left join t_check_score tcs on tcif.id = tcs.index_id
+        left join t_yw_point p on p.dept_id = tcif.dept_id
+        left join t_monitor m on p.serial_number = m.serial_number
         <where>
-            tcs.examine_category = 3
+            tcs.examine_category = 3 and m.camera_fun_type like concat('%',3,'%')
             <if test="deptId != null "> and tcif.dept_id = #{deptId}</if>
             <if test="examineTag != null "> and tcif.examine_tag = #{examineTag}</if>
+            <if test="examineTagQuery != null "> and p.province_tag = #{examineTagQuery}</if>
             <if test="date != null "> and  date_format(tcif.create_time,'%Y-%m') = #{date}</if>
             <if test="day != null "> and  date(tcif.create_time) = #{day}</if>
             <if test="params.publish != null  and params.publish != ''">and tcif.publish = #{params.publish}</if>
@@ -39,13 +44,9 @@
                     #{deptId}
                 </foreach>
             </if>
-            <if test="examineTags != null and examineTags.size()>0">and tcif.examine_tag in
-                <foreach collection="examineTags" separator="," open="(" close=")" item="examineTag">
-                    #{examineTag}
-                </foreach>
-            </if>
         </where>
-        order by tcif.examine_tag desc,tcif.create_time,tcs.score desc
+        group by tcif.id
+        order by tcif.examine_tag desc,sd.area_code,tcif.create_time
     </select>
 
     <select id="getCheckIndexFaceList"  resultMap="CheckIndexFaceResult">
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
index 4790df7..c6d6db9 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
@@ -8,6 +8,8 @@
         <result property="id"    column="id"    />
         <result property="deptId"    column="dept_id"    />
         <result property="createTime"    column="create_time"    />
+        <result property="num"    column="num"    />
+        <result property="score"    column="score"    />
         <result property="examineTag"    column="examine_tag"    />
         <result property="platformOnline"    column="platform_online"    />
         <result property="monitorQualification"    column="monitor_qualification"    />
@@ -30,13 +32,16 @@
     </sql>
 
     <select id="selectCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult">
-        select tciv.*,sd.dept_name,tcs.score
+        select tciv.*,sd.dept_name,tcs.score,count(m.serial_number) as num
         from t_check_index_video tciv left join sys_dept sd on tciv.dept_id = sd.dept_id
         left join t_check_score tcs on tciv.id = tcs.index_id
+        left join t_yw_point p on p.dept_id = tciv.dept_id
+        left join t_monitor m on p.serial_number = m.serial_number
         <where>
-            tcs.examine_category = 1
+            tcs.examine_category = 1 and m.camera_fun_type like concat('%',1,'%')
             <if test="deptId != null "> and tciv.dept_id = #{deptId}</if>
             <if test="examineTag != null "> and tciv.examine_tag = #{examineTag}</if>
+            <if test="examineTagQuery != null "> and p.province_tag = #{examineTagQuery}</if>
             <if test="date != null "> and  date_format(tciv.create_time,'%Y-%m') = #{date}</if>
             <if test="day != null "> and  date(tciv.create_time) = #{day}</if>
             <if test="createTime != null "> and  date(tciv.create_time) = #{createTime}</if>
@@ -46,13 +51,9 @@
                 #{deptId}
             </foreach>
             </if>
-            <if test="examineTags != null and examineTags.size()>0">and tciv.examine_tag in
-                <foreach collection="examineTags" separator="," open="(" close=")" item="examineTag">
-                    #{examineTag}
-                </foreach>
-            </if>
         </where>
-        order by tciv.examine_tag desc,tciv.create_time,tcs.score desc
+        group by tciv.id
+        order by tciv.examine_tag desc,sd.area_code,tciv.create_time
     </select>
     <select id="getCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult">
         select tciv.*,sd.dept_name

--
Gitblit v1.8.0