|
@@ -40,25 +40,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectBFStatistics" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
|
|
<select id="selectBFStatistics" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
|
|
|
- SELECT y.user_id,y.dept_id,IFNULL(x.checked_num,0)+IFNULL(o1.check_a_num,0) checked_num,IFNULL(x.score,0)+IFNULL(o1.check_a_score,0) score,o2.check_t_num,o2.check_t_score,o3.check_x_num,o3.check_x_score,o4.check_s_num,o4.check_s_score
|
|
|
|
|
|
|
+ SELECT x.user_id,x.dept_id,IFNULL(x.checked_num,0)+IFNULL(o1.check_a_num,0) checked_num,IFNULL(x.score,0)+IFNULL(o1.check_a_score,0) score,o2.check_t_num,o2.check_t_score,o3.check_x_num,o3.check_x_score,o4.check_s_num,o4.check_s_score
|
|
|
,IFNULL(x.checked_num,0)+IFNULL(o1.check_a_num,0)+IFNULL(o2.check_t_num,0)+IFNULL(o3.check_x_num,0)+IFNULL(o4.check_s_num,0) check_all_num
|
|
,IFNULL(x.checked_num,0)+IFNULL(o1.check_a_num,0)+IFNULL(o2.check_t_num,0)+IFNULL(o3.check_x_num,0)+IFNULL(o4.check_s_num,0) check_all_num
|
|
|
,IFNULL(x.score,0)+IFNULL(o1.check_a_score,0)+IFNULL(o2.check_t_score,0)+IFNULL(o3.check_x_score,0)+IFNULL(o4.check_s_score,0) check_all_score
|
|
,IFNULL(x.score,0)+IFNULL(o1.check_a_score,0)+IFNULL(o2.check_t_score,0)+IFNULL(o3.check_x_score,0)+IFNULL(o4.check_s_score,0) check_all_score
|
|
|
- FROM
|
|
|
|
|
-
|
|
|
|
|
- ( select ORGANID AS dept_id , id AS user_id from t_sys_users t where 1=1
|
|
|
|
|
- <if test="position_ids != null and position_ids.size() > 0">
|
|
|
|
|
- AND t.positionid in
|
|
|
|
|
- <foreach collection="position_ids" item="position_id" index="index"
|
|
|
|
|
- open="(" close=")" separator=",">
|
|
|
|
|
- #{position_id}
|
|
|
|
|
- </foreach>
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="dept_id!=null">
|
|
|
|
|
- AND t.ORGANID =#{dept_id}
|
|
|
|
|
- </if>
|
|
|
|
|
- ) y LEFT JOIN
|
|
|
|
|
-
|
|
|
|
|
- (SELECT u.checked_person AS user_id , u.checked_dept AS dept_id,count(1) AS checked_num,sum(u.score) AS score FROM (
|
|
|
|
|
|
|
+ FROM(SELECT u.checked_person AS user_id , u.checked_dept AS dept_id,count(1) AS checked_num,sum(u.score) AS score FROM (
|
|
|
SELECT t.checked_person , t.checked_dept,ci.parent_id, t.check_item_score AS score FROM check_score t
|
|
SELECT t.checked_person , t.checked_dept,ci.parent_id, t.check_item_score AS score FROM check_score t
|
|
|
LEFT JOIN check_item ci ON t.check_item_id = ci.id
|
|
LEFT JOIN check_item ci ON t.check_item_id = ci.id
|
|
|
LEFT JOIN check_task ct ON ct.id = t.task_id
|
|
LEFT JOIN check_task ct ON ct.id = t.task_id
|
|
@@ -70,12 +55,11 @@
|
|
|
AND t.checked_dept =#{dept_id}
|
|
AND t.checked_dept =#{dept_id}
|
|
|
</if>
|
|
</if>
|
|
|
)
|
|
)
|
|
|
- u LEFT JOIN check_item s ON u.parent_id = s.id GROUP BY checked_person) x
|
|
|
|
|
- ON y.user_id = x.user_id AND y.dept_id = x.dept_id
|
|
|
|
|
- LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_a_num,SUM(check_score) check_a_score FROM other_check WHERE check_type = 1 GROUP BY user_id,dept_id) o1 ON o1.user_id = y.user_id AND y.dept_id = o1.dept_id
|
|
|
|
|
- LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_t_num,SUM(check_score) check_t_score FROM other_check WHERE check_type = 2 GROUP BY user_id,dept_id) o2 ON o2.user_id = y.user_id AND y.dept_id = o2.dept_id
|
|
|
|
|
- LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_x_num,SUM(check_score) check_x_score FROM other_check WHERE check_type = 3 GROUP BY user_id,dept_id) o3 ON o3.user_id = y.user_id AND y.dept_id = o3.dept_id
|
|
|
|
|
- LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_s_num,SUM(check_score) check_s_score FROM other_check WHERE check_type = 4 GROUP BY user_id,dept_id) o4 ON o4.user_id = y.user_id AND y.dept_id = o4.dept_id
|
|
|
|
|
|
|
+ u LEFT JOIN check_item s ON u.parent_id = s.id GROUP BY checked_person)x
|
|
|
|
|
+ LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_a_num,SUM(check_score) check_a_score FROM other_check WHERE check_type = 1 GROUP BY user_id,dept_id) o1 ON o1.user_id = x.user_id AND x.dept_id = o1.dept_id
|
|
|
|
|
+ LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_t_num,SUM(check_score) check_t_score FROM other_check WHERE check_type = 2 GROUP BY user_id,dept_id) o2 ON o2.user_id = x.user_id AND x.dept_id = o2.dept_id
|
|
|
|
|
+ LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_x_num,SUM(check_score) check_x_score FROM other_check WHERE check_type = 3 GROUP BY user_id,dept_id) o3 ON o3.user_id = x.user_id AND x.dept_id = o3.dept_id
|
|
|
|
|
+ LEFT JOIN (SELECT user_id,dept_id,COUNT(1) check_s_num,SUM(check_score) check_s_score FROM other_check WHERE check_type = 4 GROUP BY user_id,dept_id) o4 ON o4.user_id = x.user_id AND x.dept_id = o4.dept_id
|
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|