|
|
@@ -62,5 +62,71 @@
|
|
|
</if> )
|
|
|
u LEFT JOIN check_item s ON u.parent_id = s.id GROUP BY dept_id,item_id
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
+ <sql id="selectAllCheckedInfo">
|
|
|
+ SELECT
|
|
|
+ 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 != 23
|
|
|
+ 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>
|
|
|
+ GROUP BY
|
|
|
+ mth,
|
|
|
+ t.checked_person
|
|
|
+ ) 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 != 23
|
|
|
+ <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
|
|
|
+ t.checked_person,
|
|
|
+ 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="selectYearScoreInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
|
|
|
+ SELECT sum(tab.checkd_all_score) AS all_check_score , sum(tab.checked_num) AS checked_num , tab.mth FROM ( <include refid="selectAllCheckedInfo" /> ) tab
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="dept_list!=null and queryType == 2 ">
|
|
|
+ AND tab.checked_dept IN
|
|
|
+ <foreach item="obj" collection="dept_list" open="("
|
|
|
+ separator="," close=")">
|
|
|
+ #{obj.id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="dept_id!=null and queryType ==3">
|
|
|
+ AND tab.checked_dept=#{dept_id}
|
|
|
+ </if>
|
|
|
+ GROUP BY tab.mth
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|