|
@@ -188,4 +188,83 @@
|
|
|
GROUP BY m.parent_id
|
|
GROUP BY m.parent_id
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="selectOneCheckedInfo">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ 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 t.checked_person = #{user_id}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ GROUP BY mth
|
|
|
|
|
+ ) checked_score_t
|
|
|
|
|
+ LEFT JOIN (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ COUNT(t.checked_person) AS checked_num,
|
|
|
|
|
+ t.checked_person,
|
|
|
|
|
+ monthfunc (t.start_time) AS mth,
|
|
|
|
|
+ t.id
|
|
|
|
|
+ FROM
|
|
|
|
|
+ check_task t
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ t.checked_person IS NOT NULL
|
|
|
|
|
+ AND 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="user_id !=null ">
|
|
|
|
|
+ AND t.checked_person = #{user_id}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ GROUP BY mth
|
|
|
|
|
+ ) check_num_t ON checked_score_t.checked_person = check_num_t.checked_person
|
|
|
|
|
+ AND check_num_t.mth = checked_score_t.mth
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectOneCheckedInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
|
|
|
|
|
+ SELECT * FROM ( <include refid="selectOneCheckedInfo"/> ) t
|
|
|
|
|
+ </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 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
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ AND checked_person = #{user_id}
|
|
|
|
|
+ ) t
|
|
|
|
|
+ LEFT JOIN check_item ci ON t.parent_id = ci.id
|
|
|
|
|
+ ) m ON t.id = m.task_id
|
|
|
|
|
+ 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>
|
|
|
|
|
+ GROUP BY m.parent_id
|
|
|
|
|
+
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
</mapper>
|
|
</mapper>
|