AiSparringTaskMapper.xml
7.61 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?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.AiSparringTaskMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.AiSparringTask">
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="task_name" property="taskName" jdbcType="VARCHAR"/>
<result column="task_state" property="taskState" jdbcType="INTEGER"/>
<result column="business_scenario" property="businessScenario" jdbcType="INTEGER"/>
<result column="task_type" property="taskType" jdbcType="INTEGER"/>
<result column="ai_type" property="aiType" jdbcType="INTEGER"/>
<result column="prompt_on_off" property="promptOnOff" jdbcType="INTEGER"/>
<result column="start_time" property="startTime" jdbcType="TIMESTAMP"/>
<result column="end_time" property="endTime" jdbcType="TIMESTAMP"/>
<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="DTOResultMap" extends="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.dto.AiSparringTaskDTO">
</resultMap>
<resultMap id="staffTaskDTOResultMap" type="cn.com.glsx.dj.mindworkplate.dto.AiSparringStaffTaskDTO">
<association property="task" resultMap="DTOResultMap" columnPrefix="task_"/>
<association property="staff"
resultMap="cn.com.glsx.dj.mindworkplate.mapper.AiSparringTaskStaffRefMapper.DTOResultMap"
columnPrefix="staff_"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, task_name, task_state, business_scenario, task_type, ai_type, prompt_on_off, start_time, end_time,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="page"
parameterType="cn.com.glsx.dj.mindworkplate.dto.AiSparringTaskRequestDTO"
resultMap="DTOResultMap">
select * from ai_sparring_task ast
<where>
ast.deleted_flag = 'N'
<if test="id != null">
and ast.id = #{id}
</if>
<if test="taskName != null and taskName != ''">
and ast.task_name like concat('%', #{taskName}, '%')
</if>
<if test="taskState != null">
and ast.task_state = #{taskState}
</if>
<if test="businessScenario != null">
and ast.business_scenario = #{businessScenario}
</if>
<if test="startTime != null">
and ast.start_time >= #{startTime}
</if>
<if test="endTime != null">
and ast.end_time <= #{endTime}
</if>
<if test="createTimeStart != null">
and ast.created_date >= #{createTimeStart}
</if>
<if test="createTimeEnd != null">
and ast.created_date <= #{createTimeEnd}
</if>
</where>
order by
<if test="orderBy != null and orderBy != ''">
ast.#{orderBy}
<if test="sortord != null and sortord != ''">
#{sortord}
</if>
,
</if>
ast.created_date desc
</select>
<select id="findByIds" resultMap="BaseResultMap">
select * from ai_sparring_task
<where>
deleted_flag = 'N'
and id in
<foreach collection="ids" item="id" close=")" open="(" separator=",">
#{id}
</foreach>
</where>
</select>
<select id="pageStaffTask"
parameterType="cn.com.glsx.dj.mindworkplate.dto.AiSparringTaskStaffRequestDTO"
resultMap="staffTaskDTOResultMap">
select
ast.id as task_id,
ast.task_name as task_task_name,
ast.business_scenario as task_business_scenario,
ast.task_type as task_task_type,
ast.ai_type as task_ai_type,
ast.prompt_on_off as task_prompt_on_off,
ast.start_time as task_start_time,
ast.end_time as task_end_time,
ast.created_by as task_created_by,
ast.created_date as task_created_date,
ast.updated_by as task_updated_by,
ast.updated_date as task_updated_date,
ast.deleted_flag as task_deleted_flag,
astsr.id as staff_id,
astsr.task_id as staff_task_id,
astsr.yq_merchant_id as staff_yq_merchant_id,
astsr.yq_merchant_name as staff_yq_merchant_name,
astsr.staff_uuid as staff_staff_uuid,
astsr.staff_name as staff_staff_name,
astsr.staff_phone as staff_staff_phone,
astsr.try_count as staff_try_count,
astsr.sparring_status as staff_sparring_status,
astsr.estimated_result as staff_estimated_result,
astsr.score as staff_score,
astsr.completion_time as staff_completion_time,
astsr.created_by as staff_created_by,
astsr.created_date as staff_created_date,
astsr.updated_by as staff_updated_by,
astsr.updated_date as staff_updated_date,
astsr.deleted_flag as staff_deleted_flag
from ai_sparring_task ast
inner join ai_sparring_task_staff_ref astsr on astsr.task_id = ast.id
<where>
ast.deleted_flag = 'N'
and astsr.deleted_flag = 'N'
<if test="id != null">
and astsr.id = #{id}
</if>
<if test="taskName != null and taskName != ''">
and ast.task_name like concat('%', #{taskName}, '%')
</if>
<if test="taskState != null">
and ast.task_state <= #{taskState}
</if>
<if test="staffUuid != null and staffUuid != ''">
and astsr.staff_uuid = #{staffUuid}
</if>
<if test="yqMerchantId != null">
and astsr.yq_merchant_id = #{yqMerchantId}
</if>
<if test="sparringStatus != null">
and astsr.sparring_status = #{sparringStatus}
</if>
<if test="tryCount != null">
and astsr.try_count <= #{tryCount}
</if>
</where>
order by ast.task_state asc, ast.created_date desc
</select>
<update id="updateDeadlineStatus">
update ai_sparring_task set task_state = 2
where deleted_flag = 'N' and task_state != 2 and end_time <= current_timestamp()
</update>
<select id="findTaskIdByStaff"
resultType="java.lang.Integer">
select ast.id from ai_sparring_staff_info info
left join ai_sparring_task_staff_ref astsr on info.staff_uuid = astsr.staff_uuid and astsr.deleted_flag = 'N'
left join ai_sparring_task ast on astsr.task_id = ast.id and ast.deleted_flag = 'N'
<where>
ast.task_state = 1 and NOW() BETWEEN ast.start_time AND ast.end_time
<if test="staffUuid != null and staffUuid != ''">
and info.staff_uuid = #{staffUuid}
</if>
<if test="yqMerchantId != null">
and astsr.yq_merchant_id = #{yqMerchantId}
</if>
order by ast.created_date desc limit 1
</where>
</select>
</mapper>