|
@@ -5,36 +5,36 @@
|
5
|
5
|
|
6
|
6
|
<update id="updateScore">
|
7
|
7
|
UPDATE ta_check t
|
8
|
|
- INNER JOIN (
|
9
|
|
- SELECT
|
10
|
|
- a.check_id,
|
11
|
|
- sum( a.score ) AS score,
|
12
|
|
- count( 1 ) AS num
|
13
|
|
- FROM
|
14
|
|
- ta_check_item a
|
15
|
|
- WHERE
|
16
|
|
- a.check_id = #{checkId}
|
17
|
|
- AND a.item_type = 'loc'
|
18
|
|
- AND a.`status` = 1
|
19
|
|
- ) m ON m.check_id = t.check_id
|
20
|
|
- INNER JOIN (
|
21
|
|
- SELECT
|
22
|
|
- a.check_id,
|
23
|
|
- sum( a.score ) AS score,
|
24
|
|
- count( 1 ) AS num
|
25
|
|
- FROM
|
26
|
|
- ta_check_item a
|
27
|
|
- INNER JOIN ta_check_answer s ON s.item_id = a.item_id
|
28
|
|
- WHERE
|
29
|
|
- a.check_id = #{checkId}
|
30
|
|
- AND a.item_type = 'survey'
|
31
|
|
- AND a.`status` = 1
|
32
|
|
- ) n ON n.check_id = t.check_id
|
33
|
|
- SET t.loc_score = m.score,
|
34
|
|
- t.loc_num = m.num,
|
35
|
|
- t.survey_score = n.score,
|
36
|
|
- t.survey_num = n.num
|
|
8
|
+ INNER JOIN (
|
|
9
|
+ SELECT
|
|
10
|
+ a.check_id,
|
|
11
|
+ sum( a.score ) AS score,
|
|
12
|
+ count( 1 ) AS num
|
|
13
|
+ FROM
|
|
14
|
+ ta_check_item a
|
37
|
15
|
WHERE
|
38
|
|
- t.check_id = #{checkId}
|
|
16
|
+ a.check_id = #{checkId}
|
|
17
|
+ AND a.item_type = 'loc'
|
|
18
|
+ AND a.`status` = 1
|
|
19
|
+ ) m ON m.check_id = t.check_id
|
|
20
|
+ INNER JOIN (
|
|
21
|
+ SELECT
|
|
22
|
+ a.check_id,
|
|
23
|
+ a.score AS score,
|
|
24
|
+ s.num
|
|
25
|
+ FROM
|
|
26
|
+ ta_check_item a
|
|
27
|
+ INNER JOIN ( SELECT t.item_id,count(1) as num FROM ta_check_answer t WHERE t.check_id =#{checkId} AND t.`status`=1 GROUP BY t.item_id )s ON s.item_id = a.item_id
|
|
28
|
+ WHERE
|
|
29
|
+ a.check_id = #{checkId}
|
|
30
|
+ AND a.item_type = 'survey'
|
|
31
|
+ AND a.`status` = 1
|
|
32
|
+ ) n ON n.check_id = t.check_id
|
|
33
|
+ SET t.loc_score = m.score,
|
|
34
|
+ t.loc_num = m.num,
|
|
35
|
+ t.survey_score = n.score,
|
|
36
|
+ t.survey_num = n.num
|
|
37
|
+ WHERE
|
|
38
|
+ t.check_id = #{checkId}
|
39
|
39
|
</update>
|
40
|
40
|
</mapper>
|