From 3c8f3a7b74f62a9053cd9d860d8f1d37454712eb Mon Sep 17 00:00:00 2001
From: 郑永安 <zyazyz250@sina.com>
Date: 星期一, 04 九月 2023 17:53:59 +0800
Subject: [PATCH] back

---
 src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml |   61 +++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml b/src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml
index fc4038c..9587e36 100644
--- a/src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml
+++ b/src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml
@@ -86,8 +86,7 @@
     <where>1=1
       and
       isdel = 0
-      and province is null
-      or province = ''
+      and province in(null,'')
     </where>) c
     <where>
         1=1
@@ -151,4 +150,62 @@
       </if>
     </where>
   </select>
+  <select id="getCountByArea" resultType="java.lang.Integer">
+    SELECT count(*) FROM company
+    where isdel = 0
+    <if test="params.province != null and params.province !=''">
+      and province = #{params.province}
+    </if>
+    <if test="params.city != null and params.city !=''">
+      and city = #{params.city}
+    </if>
+    <if test="params.area != null and params.area !=''">
+      and area = #{params.area}
+    </if>
+  </select>
+
+  <select id="getUncheckCompanyByArea"  resultType="com.gk.hotwork.Domain.CompanyInfo">
+    SELECT
+      c1.*
+    FROM
+      company c1
+    WHERE
+      c1.isdel = 0
+      <if test="query.province != null and query.province !=''">
+        and c1.province = #{query.province}
+      </if>
+      <if test="query.city != null and query.city !=''">
+        and c1.city = #{query.city}
+      </if>
+      <if test="query.area != null and query.area !=''">
+        and c1.area = #{query.area}
+      </if>
+      AND c1.id NOT IN (
+      SELECT
+        s.checked_company_id
+      FROM
+        safety_self_inspection s
+          INNER JOIN company c ON c.id = s.checked_company_id
+      WHERE
+        s.valid_flag = 1
+        AND s.flag = 2
+        <if test="query.province != null and query.province !=''">
+          and c.province = #{query.province}
+        </if>
+        <if test="query.city != null and query.city !=''">
+          and c.city = #{query.city}
+        </if>
+        <if test="query.area != null and query.area !=''">
+          and c.area = #{query.area}
+        </if>
+        <if test="query.startTime != null" >
+          and s.inspection_time <![CDATA[ >= ]]> #{query.startTime}
+        </if>
+        <if test="query.endTime != null" >
+          and s.inspection_time <![CDATA[ <= ]]> #{query.endTime}
+        </if>
+      GROUP BY
+        s.checked_company_id
+    )
+  </select>
 </mapper>

--
Gitblit v1.9.2