ソースを参照

凌云集团更改公司

peiguo 5 年 前
コミット
4d471ec288
1 ファイル変更39 行追加41 行削除
  1. 39 41
      whepi-web/src/main/resources/mapper/SweepCodeMapper.xml

+ 39 - 41
whepi-web/src/main/resources/mapper/SweepCodeMapper.xml

@@ -376,7 +376,7 @@
                 and (g.linkman like concat('%',#{phone},'%')
                 or g.phone = #{phone} )
             </if>
-            <if test="unitId != null and unitId != ''">
+            <if test="unitId != null and unitId != '' and unitId!=0">
                 and d.unit_id = #{unitId}
             </if>
             <if test="departmentId != null and departmentId != ''">
@@ -422,7 +422,7 @@
                 and (g.linkman like concat('%',#{phone},'%')
                 or g.phone = #{phone} )
             </if>
-            <if test="unitId != null and unitId != ''">
+            <if test="unitId != null and unitId != '' and unitId!=0">
                 and d.unit_id = #{unitId}
             </if>
             <if test="departmentId != null and departmentId != ''">
@@ -433,46 +433,44 @@
     </select>
 
     <select id="exClockCount" resultType="com.bofeng.entity.Clock">
-        select * from (
-            SELECT
-            CONCAT( d.ridgepole, d.unit ) AS unit,
-            de.department_name AS departmentName,
-            count(de.department_name) as clockCount
-            FROM out_scan c
-            inner join (select user_id,min(date) as dateStr
-            from out_scan
-            where uptown_id = 1238790987234 and go_status = 1 and in_type = 1
-            <if test="dateSta != null and dateSta !=''">
-                and date >= #{dateSta}
+        SELECT
+        CONCAT( d.ridgepole, d.unit ) AS unit,
+        de.department_name AS departmentName,
+        count(de.department_name) as clockCount
+        FROM out_scan c
+        inner join (select user_id,min(date) as dateStr
+        from out_scan
+        where uptown_id = 1238790987234 and go_status = 1 and in_type = 1
+        <if test="dateSta != null and dateSta !=''">
+            and date >= #{dateSta}
+        </if>
+        <if test="dateEnd != null and dateEnd !=''">
+            and date &lt; #{dateEnd}
+        </if>
+        group by user_id)aa on aa.user_id = c.user_id and aa.dateStr = c.date and c.go_status = 1 and c.in_type = 1
+        INNER JOIN sys_user_role t ON c.user_id = t.user_id AND role_id = 1
+        INNER JOIN sys_uptown_house e ON e.house_id = t.property_id
+        INNER JOIN sys_uptown_unit d ON d.unit_id = e.unit_id
+        INNER JOIN sys_uptown_home g ON g.house_id = t.property_id
+        LEFT JOIN sys_department de ON de.department_id = e.department_id
+        inner join sys_uptown_door b on c.door_id = b.door_id
+        <where>
+            <if test="queryProperties != null and queryProperties != ''">
+                and b.door_name like concat('%',#{queryProperties},'%')
             </if>
-            <if test="dateEnd != null and dateEnd !=''">
-                and date &lt; #{dateEnd}
-            </if>
-            group by user_id)aa on aa.user_id = c.user_id and aa.dateStr = c.date and c.go_status = 1 and c.in_type = 1
-            INNER JOIN sys_user_role t ON c.user_id = t.user_id AND role_id = 1
-            INNER JOIN sys_uptown_house e ON e.house_id = t.property_id
-            INNER JOIN sys_uptown_unit d ON d.unit_id = e.unit_id
-            INNER JOIN sys_uptown_home g ON g.house_id = t.property_id
-            LEFT JOIN sys_department de ON de.department_id = e.department_id
-            inner join sys_uptown_door b on c.door_id = b.door_id
-            <where>
-                <if test="queryProperties != null and queryProperties != ''">
-                    and b.door_name like concat('%',#{queryProperties},'%')
-                </if>
-                <if test="phone != null and phone != ''">
-                    and (g.linkman like concat('%',#{phone},'%')
-                    or g.phone = #{phone} )
-                </if>
-                <if test="unitId != null and unitId != ''">
-                    and d.unit_id = #{unitId}
-                </if>
-                <if test="departmentId != null and departmentId != ''">
-                    and de.department_id = #{departmentId}
-                </if>
-            </where>
-            group by de.department_name, d.ridgepole, d.unit,de.department_name
-            order by unit,de.department_name
-        ) bb where bb.departmentName is not null
+            <if test="phone != null and phone != ''">
+                and (g.linkman like concat('%',#{phone},'%')
+                or g.phone = #{phone} )
+            </if>
+            <if test="unitId != null and unitId != '' and unitId!=0">
+                and d.unit_id = #{unitId}
+            </if>
+            <if test="departmentId != null and departmentId != ''">
+                and de.department_id = #{departmentId}
+            </if>
+        </where>
+        group by de.department_name, d.ridgepole, d.unit,de.department_name
+        order by unit,de.department_name
     </select>
 
 </mapper>