InspectionDefenceMapper.xml
5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.mindworkplate.mapper.InspectionDefenceMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.InspectionDefence">
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="batch_id" property="batchId" jdbcType="INTEGER"/>
<result column="defence_count" property="defenceCount" jdbcType="INTEGER"/>
<result column="avg_defence" property="avgDefence" jdbcType="VARCHAR"/>
<result column="customer_type" property="customerType" jdbcType="VARCHAR"/>
<result column="failure_reason" property="failureReason" jdbcType="VARCHAR"/>
<result column="summary" property="summary" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR"/>
</resultMap>
<resultMap id="ResponseMap" type="cn.com.glsx.dj.mindworkplate.dto.DefenceDetailPageDTO">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="batch_id" property="batchId" jdbcType="INTEGER"/>
<result column="defence_count" property="defenceCount" jdbcType="INTEGER"/>
<result column="avg_defence" property="avgDefence" jdbcType="VARCHAR"/>
<result column="customer_type" property="customerType" jdbcType="VARCHAR"/>
<result column="failure_reason" property="failureReason" jdbcType="VARCHAR"/>
<result column="summary" property="summary" jdbcType="VARCHAR"/>
<collection property="detailList" javaType="java.util.List"
resultMap="cn.com.glsx.dj.mindworkplate.mapper.DefenceDetailMapper.BaseResultMap"
columnPrefix="t1_"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, batch_id, defence_count, avg_defence, customer_type, failure_reason, summary,
standard_question,standard_answer,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="getDefenceDetail" resultMap="ResponseMap">
select t.id,
t.batch_id,
t.defence_count,
t.avg_defence,
t.customer_type,
t.failure_reason,
t.summary,
t1.id as t1_id,
t1.defence_id as t1_defence_id,
t1.def_score as t1_def_score,
t1.con_start_time as t1_con_start_time,
t1.question as t1_question,
t1.answer as t1_answer,
t1.suggestions_for_improvement as t1_suggestions_for_improvement,
t1.refine_the_expression as t1_refine_the_expression,
t1.highlight as t1_highlight,
t1.standard_question as t1_standard_question,
t1.standard_answer as t1_standard_answer
from inspection_defence t
left join inspection_defence_detail t1 on t.id = t1.defence_id and t1.deleted_flag = 'N'
where t.batch_id = #{batchId}
and t.deleted_flag = 'N'
ORDER BY t1.con_start_time desc
</select>
<update id="deleteByIdList">
update inspection_defence set deleted_flag = 'D' , updated_date = now() where id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<select id="getByBatchId" resultType="java.lang.Integer">
select id
from inspection_defence
where batch_id = #{batchId}
and deleted_flag = 'N'
</select>
<select id="getDefenceDetailByBatchIds" resultMap="ResponseMap">
select
t.batch_id,
t.defence_count,
t.avg_defence,
t.customer_type,
t.failure_reason,
t.summary,
t1.id as t1_id,
t1.defence_id as t1_defence_id,
t1.def_score as t1_def_score,
t1.con_start_time as t1_con_start_time,
t1.question as t1_question,
t1.answer as t1_answer,
t1.suggestions_for_improvement as t1_suggestions_for_improvement,
t1.refine_the_expression as t1_refine_the_expression,
t1.highlight as t1_highlight,
t1.standard_question as t1_standard_question,
t1.standard_answer as t1_standard_answer
from inspection_defence t
left join inspection_defence_detail t1 on t.id = t1.defence_id and t1.deleted_flag = 'N'
where
<if test="batchIds != null and batchIds.size>0">
t.batch_id in
<foreach close=")" collection="batchIds" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
and t.deleted_flag = 'N'
ORDER BY t1.con_start_time desc
</select>
</mapper>