|
@@ -48,19 +48,19 @@
|
|
|
|
|
|
<select id="getAllSum" resultType="Map">
|
|
<select id="getAllSum" resultType="Map">
|
|
SELECT count(id) allqy,COUNT(DISTINCT des13) allper FROM ly_enterprise_info
|
|
SELECT count(id) allqy,COUNT(DISTINCT des13) allper FROM ly_enterprise_info
|
|
- WHERE del_flag = 0 AND (des13 IS NOT NULL OR des13 != '') ;
|
|
|
|
|
|
+ WHERE del_flag = 0 AND (des13 IS NOT NULL AND des13 != '') ;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getAllSum2" resultType="Map">
|
|
<select id="getAllSum2" resultType="Map">
|
|
SELECT count(id) allqy,COUNT(DISTINCT des13) allper FROM ly_enterprise_info
|
|
SELECT count(id) allqy,COUNT(DISTINCT des13) allper FROM ly_enterprise_info
|
|
- WHERE del_flag = 0 AND des13 = #{loginName} AND (des13 IS NOT NULL OR des13 != '') ;
|
|
|
|
|
|
+ WHERE del_flag = 0 AND des13 = #{loginName} AND (des13 IS NOT NULL AND des13 != '') ;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getFinishSum" resultType="Map">
|
|
<select id="getFinishSum" resultType="Map">
|
|
- SELECT count(a.id) finishqy,COUNT(DISTINCT des13) finishper
|
|
|
|
|
|
+ SELECT COUNT(DISTINCT a.id) finishqy,COUNT(DISTINCT des13) finishper
|
|
FROM ly_enterprise_info a
|
|
FROM ly_enterprise_info a
|
|
LEFT JOIN ly_service b ON a.id = b.qy_id
|
|
LEFT JOIN ly_service b ON a.id = b.qy_id
|
|
- WHERE a.del_flag = 0 AND qy_id IS NOT NULL AND (des13 IS NOT NULL OR des13 != '')
|
|
|
|
|
|
+ WHERE a.del_flag = 0 AND qy_id IS NOT NULL AND (des13 IS NOT NULL AND des13 != '')
|
|
AND DATE_FORMAT(b.create_date, '%Y-%m-%d') >= #{start} AND DATE_FORMAT(b.create_date, '%Y-%m-%d') <= #{end};
|
|
AND DATE_FORMAT(b.create_date, '%Y-%m-%d') >= #{start} AND DATE_FORMAT(b.create_date, '%Y-%m-%d') <= #{end};
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -68,7 +68,7 @@
|
|
SELECT count(a.id) finishqy,COUNT(DISTINCT des13) finishper
|
|
SELECT count(a.id) finishqy,COUNT(DISTINCT des13) finishper
|
|
FROM ly_enterprise_info a
|
|
FROM ly_enterprise_info a
|
|
LEFT JOIN ly_service b ON a.id = b.qy_id
|
|
LEFT JOIN ly_service b ON a.id = b.qy_id
|
|
- WHERE a.del_flag = 0 AND qy_id IS NOT NULL AND (des13 IS NOT NULL OR des13 != '')
|
|
|
|
|
|
+ WHERE a.del_flag = 0 AND qy_id IS NOT NULL AND (des13 IS NOT NULL AND des13 != '')
|
|
AND des13 = #{loginName}
|
|
AND des13 = #{loginName}
|
|
AND DATE_FORMAT(b.create_date, '%Y-%m-%d') >= #{start} AND DATE_FORMAT(b.create_date, '%Y-%m-%d') <= #{end};
|
|
AND DATE_FORMAT(b.create_date, '%Y-%m-%d') >= #{start} AND DATE_FORMAT(b.create_date, '%Y-%m-%d') <= #{end};
|
|
</select>
|
|
</select>
|
|
@@ -91,11 +91,11 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getPerson" resultType="Map">
|
|
<select id="getPerson" resultType="Map">
|
|
- SELECT des1, COUNT(DISTINCT des13) AS perNum FROM ly_enterprise_info WHERE del_flag = 0 AND (des13 IS NOT NULL OR des13 != '') GROUP BY des1;
|
|
|
|
|
|
+ SELECT des1, COUNT(DISTINCT des13) AS perNum FROM ly_enterprise_info WHERE del_flag = 0 AND (des13 IS NOT NULL AND des13 != '') GROUP BY des1;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getAreaInfo" resultType="Map">
|
|
<select id="getAreaInfo" resultType="Map">
|
|
- SELECT des1 FROM ly_enterprise_info WHERE del_flag = 0 AND (des13 IS NOT NULL OR des13 != '') GROUP BY des1;
|
|
|
|
|
|
+ SELECT des1 FROM ly_enterprise_info WHERE del_flag = 0 AND (des13 IS NOT NULL AND des13 != '') GROUP BY des1;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getPersonInfo" resultType="Map">
|
|
<select id="getPersonInfo" resultType="Map">
|
|
@@ -106,43 +106,46 @@
|
|
AND DATE_FORMAT(create_date, '%Y-%m-%d') >= #{beginTime} AND DATE_FORMAT(create_date, '%Y-%m-%d') <= #{endTime}
|
|
AND DATE_FORMAT(create_date, '%Y-%m-%d') >= #{beginTime} AND DATE_FORMAT(create_date, '%Y-%m-%d') <= #{endTime}
|
|
</if>
|
|
</if>
|
|
) b ON a.id = b.qy_id
|
|
) b ON a.id = b.qy_id
|
|
- WHERE a.del_flag = 0 AND (des13 IS NOT NULL OR des13 != '')
|
|
|
|
|
|
+ WHERE a.del_flag = 0 AND (des13 IS NOT NULL AND des13 != '')
|
|
<if test="des1 != ''">
|
|
<if test="des1 != ''">
|
|
AND des1 = #{des1}
|
|
AND des1 = #{des1}
|
|
</if>
|
|
</if>
|
|
<if test="name != ''">
|
|
<if test="name != ''">
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
|
</if>
|
|
</if>
|
|
|
|
+ GROUP BY des13
|
|
<if test="state == 1">
|
|
<if test="state == 1">
|
|
- AND b.id IS NULL
|
|
|
|
|
|
+ HAVING sum = 0
|
|
</if>
|
|
</if>
|
|
<if test="state == 2">
|
|
<if test="state == 2">
|
|
- AND b.id IS NOT NULL
|
|
|
|
|
|
+ HAVING sum > 0
|
|
</if>
|
|
</if>
|
|
- GROUP BY des13
|
|
|
|
ORDER BY sum DESC;
|
|
ORDER BY sum DESC;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getCompanyInfo" resultType="Map">
|
|
<select id="getCompanyInfo" resultType="Map">
|
|
- SELECT b.id AS sum,des13,des14,des1,name FROM ly_enterprise_info a
|
|
|
|
|
|
+ SELECT COUNT(DISTINCT b.id) AS sum,des13,des14,des1,name FROM
|
|
|
|
+ (SELECT id, des13,des14,des1,name,del_flag FROM ly_enterprise_info a
|
|
|
|
+ WHERE a.del_flag = 0 AND des13 IS NOT NULL AND des13 != '') a
|
|
LEFT JOIN
|
|
LEFT JOIN
|
|
(SELECT * FROM ly_service WHERE del_flag = 0
|
|
(SELECT * FROM ly_service WHERE del_flag = 0
|
|
<if test="beginTime != ''">
|
|
<if test="beginTime != ''">
|
|
AND DATE_FORMAT(create_date, '%Y-%m-%d') >= #{beginTime} AND DATE_FORMAT(create_date, '%Y-%m-%d') <= #{endTime}
|
|
AND DATE_FORMAT(create_date, '%Y-%m-%d') >= #{beginTime} AND DATE_FORMAT(create_date, '%Y-%m-%d') <= #{endTime}
|
|
</if>
|
|
</if>
|
|
) b ON a.id = b.qy_id
|
|
) b ON a.id = b.qy_id
|
|
- WHERE a.del_flag = 0 AND (des13 IS NOT NULL OR des13 != '')
|
|
|
|
|
|
+ WHERE a.del_flag = 0 AND (des13 IS NOT NULL AND des13 != '')
|
|
<if test="des1 != ''">
|
|
<if test="des1 != ''">
|
|
AND des1 = #{des1}
|
|
AND des1 = #{des1}
|
|
</if>
|
|
</if>
|
|
<if test="name != ''">
|
|
<if test="name != ''">
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
|
</if>
|
|
</if>
|
|
|
|
+ GROUP BY a.id
|
|
<if test="state == 1">
|
|
<if test="state == 1">
|
|
- AND b.id IS NULL
|
|
|
|
|
|
+ HAVING sum = 0
|
|
</if>
|
|
</if>
|
|
<if test="state == 2">
|
|
<if test="state == 2">
|
|
- AND b.id IS NOT NULL
|
|
|
|
|
|
+ HAVING sum > 0
|
|
</if>
|
|
</if>
|
|
ORDER BY sum DESC;
|
|
ORDER BY sum DESC;
|
|
</select>
|
|
</select>
|