From 6234ef30e315d6518401926c2eae0267c4742dfd Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 23 Aug 2021 10:55:35 +0800
Subject: [PATCH] 1.首页接口调整

---
 src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml |  159 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 138 insertions(+), 21 deletions(-)

diff --git a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
index e6b5959..562c54e 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -26,6 +26,8 @@
         <result column="representativecell" property="representativecell"/>
         <result column="contacts" property="contacts"/>
         <result column="contactscell" property="contactscell"/>
+        <result column="businessLicense" property="businessLicense"/>
+        <result column="licence" property="licence"/>
     </resultMap>
 
 
@@ -101,7 +103,7 @@
         LEFT JOIN blade_dept d ON d.id= u.dept_id
         LEFT JOIN sys_jurisdiction j ON j.id= u.jurisdiction
         WHERE
-        hold = 1
+        hold = 2
         <if test="jurisdiction!=null and jurisdiction!=''">
             and u.jurisdiction =#{jurisdiction}
         </if>
@@ -539,7 +541,7 @@
         jurisdiction
         FROM blade_user
         WHERE role_id = '1412226235153731586'
-        AND hold = 0
+        AND hold = 1
         AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )
         GROUP BY dept_id,
         jurisdiction
@@ -551,7 +553,7 @@
         jurisdiction
         FROM blade_user
         WHERE role_id = '1412226235153731586'
-        AND hold = 0
+        AND hold = 1
         AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( create_time, '%Y%m' ) ) = 1
         GROUP BY dept_id,
         jurisdiction
@@ -780,7 +782,7 @@
         GROUP BY
         i.departmentid
         )
-        AND role_id='1412226235153731586' AND hold=0
+        AND role_id='1412226235153731586' AND hold=1
         <if test="deptid!=null and deptid!=''">
             and dept_id =#{deptid}
         </if>
@@ -856,24 +858,25 @@
         SELECT COUNT
         (*) as num,
         d.dept_name,
+        u.real_name,
         j.dept_name AS jurname
         FROM blade_user u
         LEFT JOIN blade_dept d ON d.id = u.dept_id
         LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction
-        WHERE u.examination_type = 1
+        WHERE u.examination_type = 1 and u.is_deleted=0
         <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">
             and u.jurisdiction =#{jurisdiction}
         </if>
         <if test="deptid!=null and deptid!=''">
             and u.dept_id =#{deptid}
         </if>
-        <if test="type!=null and type=='1'">
-            and to_days(u.update_time) = to_days(now());
+        <if test="type!=null and type=='1'.toString()">
+            and to_days(u.update_time) = to_days(now())
         </if>
-        <if test="type!=null and type=='2'">
+        <if test="type!=null and type=='2'.toString()">
             and DATE_FORMAT(u.update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
         </if>
-        GROUP BY d.dept_name,
+        GROUP BY d.dept_name,u.real_name,
         j.dept_name
     </select>
     <!--表现差的数量-->
@@ -891,10 +894,10 @@
         <if test="deptid!=null and deptid!=''">
             and u.departmentid =#{deptid}
         </if>
-        <if test="type!=null and type=='1'">
-            and to_days(u.time) = to_days(now());
+        <if test="type!=null and type=='1'.toString()">
+            and to_days(u.time) = to_days(now())
         </if>
-        <if test="type!=null and type=='2'">
+        <if test="type!=null and type=='2'.toString()">
             and DATE_FORMAT(u.time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
         </if>
         GROUP BY d.dept_name,
@@ -985,7 +988,7 @@
         blade_user
         WHERE
         role_id = '1412226235153731586'
-        AND hold=0
+        AND hold=1
         GROUP BY
         dept_id,
         jurisdiction
@@ -1134,7 +1137,7 @@
         jurisdiction
         FROM blade_user
         WHERE role_id = '1412226235153731586'
-        AND hold = 0
+        AND hold = 1
         GROUP BY dept_id,
         jurisdiction
         ) D ON A.departmentid = D.dept_id
@@ -1229,6 +1232,7 @@
         SELECT
         i.enterpriseName,
         i.departmentid,
+        i.jurisdiction,
         j.dept_name
         FROM
         sys_information i
@@ -1280,21 +1284,134 @@
         SELECT d.dept_name AS gsname,
         di.dispatcherTime,
         di.end_time,
-        de.dept_name as fwname,
+        u.name AS fwname,
         di.num,
         j.dept_name as jurname
         FROM sys_dispatcher di
         LEFT JOIN blade_dept d ON d.id = di.dept_id
-        LEFT JOIN blade_dept de ON de.id = di.dispatcher_unit_id
+        LEFT JOIN sys_dispatcher_unit u ON u.id = di.dispatcher_unit_id
         LEFT JOIN sys_jurisdiction j ON j.id = di.jurisdiction where 1=1
-        <if test="name!=null and name!=''">
-            and di.dept_name like concat('%', #{name},'%')
-        </if>
+        and di.dept_id=#{deptid}
         <if test="jurisdiction!=null and jurisdiction!=''and jurisdiction!='1123598813738675201'">
             and di.jurisdiction =#{jurisdiction}
         </if>
-        <if test="fwname!=null and name!=''">
-            and de.dept_name like concat('%', #{fwname},'%')
+        <if test="fid!=null and fid!=''">
+            and di.dispatcher_unit_id=#{fid}
         </if>
     </select>
+    <!--服务单位下拉-->
+    <select id="selectFw" resultType="java.util.HashMap">
+        SELECT id, name
+        FROM `sys_dispatcher_unit`
+    </select>
+
+    <!--单位处罚数量-->
+    <select id="selectCf" resultType="java.util.HashMap">
+        SELECT COUNT(*) AS num,
+        i.enterpriseName,
+        j.dept_name as jurname,
+        i.departmentid
+        FROM `sys_punish` p
+        LEFT JOIN sys_information i ON i.departmentid = p.deptid
+        LEFT JOIN sys_jurisdiction j ON j.id = p.jurisdiction where 1=1
+        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">
+            and p.jurisdiction =#{jurisdiction}
+        </if>
+        GROUP BY i.enterpriseName, i.departmentid, j.dept_name
+    </select>
+
+    <!--单位材料不全数量-->
+    <select id="selectCl" resultType="java.util.HashMap">
+        SELECT
+        COUNT( * ) AS num,
+        i.enterpriseName,
+        j.dept_name as jurname
+        FROM
+        sys_information i
+        LEFT JOIN sys_jurisdiction j ON j.id=i.jurisdiction WHERE i.creditCode is NULL
+        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'">
+            and i.jurisdiction =#{jurisdiction}
+        </if>
+        GROUP BY
+        i.enterpriseName,j.dept_name
+    </select>
+
+    <!--违规经营-->
+    <select id="selectWg" resultType="java.util.HashMap">
+        SELECT A.enterpriseName,
+               A.representative,
+               A.establishTime,
+               A.registeredCapital,
+               A.capital,
+               A.representativecell,
+               A.contacts,
+               A.contactscell,
+               A.deptname,
+               A.jurname,
+               IFNULL(B.cznum, 0) AS cznum,
+               IFNULL(C.sbnum, 0) AS sbnum,
+               IFNULL(D.znum, 0)  AS znum
+        FROM (
+                 SELECT u.enterpriseName,
+                        u.representative,
+                        u.establishTime,
+                        u.registeredCapital,
+                        u.capital,
+                        u.representativecell,
+                        u.contacts,
+                        u.contactscell,
+                        u.departmentid,
+                        u.jurisdiction,
+                        d.dept_name AS deptname,
+                        j.dept_name AS jurname
+                 FROM sys_information u
+                          LEFT JOIN blade_dept d ON d.id = u.departmentid
+                          LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction
+                 GROUP BY u.enterpriseName,
+                          u.representative,
+                          u.establishTime,
+                          u.registeredCapital,
+                          u.capital,
+                          u.representativecell,
+                          u.contacts,
+                          u.contactscell,
+                          u.departmentid,
+                          u.jurisdiction,
+                          d.dept_name,
+                          j.dept_name
+             ) A
+                 LEFT JOIN (
+            SELECT COUNT(*) AS cznum,
+                   dept_id
+            FROM blade_user
+            WHERE hold = 1
+              AND role_id = '1412226235153731586'
+              AND is_deleted = 0
+            GROUP BY dept_id
+        ) B ON B.dept_id = A.departmentid
+                 LEFT JOIN (
+            SELECT COUNT(*) AS sbnum,
+                   dept_id
+            FROM blade_user
+            WHERE soil = 0
+              AND role_id = '1412226235153731586'
+              AND is_deleted = 0
+            GROUP BY dept_id
+        ) C ON C.dept_id = A.departmentid
+                 LEFT JOIN (SELECT COUNT(*) AS znum, dept_id
+                            FROM blade_user
+                            WHERE role_id = '1412226235153731586'
+                              AND is_deleted = 0
+                            GROUP BY dept_id) D ON D.dept_id = A.departmentid
+    </select>
+
+
+    <!--经营不善-->
+    <select id="selectJy" resultType="java.util.HashMap">
+        SELECT i.*,
+               IFNULL(d.num, 0) as num
+        FROM sys_information i
+                 LEFT JOIN (SELECT COUNT(*) num, dept_id FROM sys_dispatcher_unit GROUP BY dept_id) d
+                           ON i.departmentid = d.dept_id
+    </select>
 </mapper>

--
Gitblit v1.9.3