|
|
@@ -20,11 +20,10 @@
|
|
|
|
|
|
<select id="selectMList" parameterType="com.xintong.visualinspection.pojo.TaskAndScore" resultType="com.xintong.visualinspection.pojo.TaskAndScore">
|
|
|
|
|
|
- SELECT * from check_task a LEFT JOIN check_score b on a.id=b.task_id where
|
|
|
- a.monitor_user_id != -1 and a.monitor_user_id != 0 and
|
|
|
- a.start_time >= #{start_time} and a.end_time < #{end_time} and a.check_status !=22
|
|
|
-
|
|
|
-
|
|
|
+ SELECT * from check_task a LEFT JOIN check_score b on a.id=b.task_id where
|
|
|
+ a.monitor_user_id != -1 and a.monitor_user_id != 0 and
|
|
|
+ a.start_time >= #{start_time} and a.end_time < #{end_time} and a.check_status !=22
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@@ -97,29 +96,27 @@
|
|
|
check_num_t.checked_num , checked_score_t.mth, checked_score_t.checkd_all_score , checked_score_t.checked_person,checked_score_t.checked_dept
|
|
|
FROM
|
|
|
(
|
|
|
- SELECT
|
|
|
- monthfunc (t.start_time) AS mth,
|
|
|
- sum(m.check_item_score) AS checkd_all_score,
|
|
|
- t.*
|
|
|
- FROM
|
|
|
- check_task t,
|
|
|
- check_score m
|
|
|
- WHERE
|
|
|
- t.id = m.task_id
|
|
|
- AND t.check_status != 22
|
|
|
- AND t.checked_person IS NOT NULL
|
|
|
- <if test="start_date !=null">
|
|
|
- AND t.start_time >= #{start_date}
|
|
|
- </if>
|
|
|
- <if test="end_date !=null">
|
|
|
- AND t.end_time < #{end_date}
|
|
|
- </if>
|
|
|
- <if test="mth!=null and mth!=''">
|
|
|
- AND monthfunc (t.start_time) =#{mth}
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- mth,
|
|
|
- t.checked_person
|
|
|
+ SELECT
|
|
|
+ monthfunc (t.start_time) AS mth,
|
|
|
+ sum(m.check_item_score) AS checkd_all_score,t.*
|
|
|
+ FROM
|
|
|
+ check_score m INNER JOIN
|
|
|
+ ( select * From check_task t
|
|
|
+ where t.check_status != 22
|
|
|
+ <if test="start_date !=null">
|
|
|
+ AND t.start_time >= #{start_date}
|
|
|
+ </if>
|
|
|
+ <if test="end_date !=null">
|
|
|
+ AND t.end_time < #{end_date}
|
|
|
+ </if>
|
|
|
+ <if test="mth!=null and mth!=''">
|
|
|
+ AND monthfunc (t.start_time) =#{mth}
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ ON m.task_id = t.id
|
|
|
+ WHERE 1=1
|
|
|
+ GROUP BY mth , t.checked_person
|
|
|
+
|
|
|
) checked_score_t
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
@@ -194,7 +191,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCheckedItemScoreInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
|
|
|
- SELECT count(m.check_item_score) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
|
|
|
+ SELECT count(DISTINCT m.task_id) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
|
|
|
(
|
|
|
select ci.name AS check_item_name , t.* FROM
|
|
|
( SELECT ci.parent_id, t.* from check_score t LEFT JOIN check_item ci ON t.check_item_id = ci.id
|
|
|
@@ -223,36 +220,34 @@
|
|
|
check_num_t.checked_num , checked_score_t.mth, checked_score_t.checkd_all_score AS all_check_score , checked_score_t.checked_person,checked_score_t.checked_dept
|
|
|
FROM
|
|
|
(
|
|
|
- SELECT
|
|
|
- monthfunc (t.start_time) AS mth,
|
|
|
- sum(m.check_item_score) AS checkd_all_score,
|
|
|
- t.*
|
|
|
- FROM
|
|
|
- check_task t,
|
|
|
- check_score m
|
|
|
- WHERE
|
|
|
- t.id = m.task_id
|
|
|
- AND t.check_status != 22
|
|
|
- AND t.checked_person IS NOT NULL
|
|
|
- <if test="start_date !=null">
|
|
|
- AND t.start_time >= #{start_date}
|
|
|
- </if>
|
|
|
- <if test="end_date !=null">
|
|
|
- AND t.end_time < #{end_date}
|
|
|
- </if>
|
|
|
- <if test="user_id !=null ">
|
|
|
- AND m.checked_person = #{user_id}
|
|
|
- </if>
|
|
|
- GROUP BY mth
|
|
|
+ SELECT
|
|
|
+ monthfunc (t.start_time) AS mth,
|
|
|
+ sum(m.check_item_score) AS checkd_all_score,t.*
|
|
|
+ FROM
|
|
|
+ check_score m INNER JOIN
|
|
|
+ ( select * From check_task t
|
|
|
+ where t.check_status != 22
|
|
|
+ <if test="start_date !=null">
|
|
|
+ AND t.start_time >= #{start_date}
|
|
|
+ </if>
|
|
|
+ <if test="end_date !=null">
|
|
|
+ AND t.end_time < #{end_date}
|
|
|
+ </if> ) t
|
|
|
+ ON m.task_id = t.id
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="user_id !=null ">
|
|
|
+ AND m.checked_person = #{user_id}
|
|
|
+ </if>
|
|
|
+ GROUP BY mth
|
|
|
+
|
|
|
) checked_score_t
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
- COUNT(t.checked_person) AS checked_num,
|
|
|
+ COUNT( t.id) AS checked_num,
|
|
|
t.checked_person,
|
|
|
- monthfunc (t.start_time) AS mth,
|
|
|
- t.id
|
|
|
+ monthfunc (t.start_time) AS mth
|
|
|
FROM
|
|
|
- check_task t
|
|
|
+ check_task t
|
|
|
WHERE
|
|
|
t.checked_person IS NOT NULL
|
|
|
AND t.check_status != 22
|
|
|
@@ -275,7 +270,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectOneCheckedItemInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
|
|
|
- SELECT count(m.check_item_score) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
|
|
|
+ SELECT count(DISTINCT m.task_id) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
|
|
|
(
|
|
|
select ci.name AS check_item_name , t.* FROM
|
|
|
( SELECT ci.parent_id, t.* from check_score t LEFT JOIN check_item ci ON t.check_item_id = ci.id
|
|
|
@@ -302,10 +297,10 @@
|
|
|
LEFT JOIN (SELECT ci.* ,cp.name AS parent_name FROM check_item ci LEFT JOIN check_item cp ON ci.parent_id = cp.id) ci ON ci.id = cs.check_item_id
|
|
|
where t.check_status !=22
|
|
|
<if test="queryType!=null and queryType==0">
|
|
|
- AND t.checked_person = #{user_id}
|
|
|
+ AND cs.checked_person = #{user_id}
|
|
|
</if>
|
|
|
<if test="queryType!=null and queryType==1 and user_id!=null and user_id!=''">
|
|
|
- AND t.checkman = #{user_id}
|
|
|
+ AND cs.checkman = #{user_id}
|
|
|
</if>
|
|
|
<if test="start_date !=null and end_date !=null and queryType ==1">
|
|
|
AND t.check_time >= #{start_date} AND t.check_time < #{end_date}
|