AiSparringTaskStaffRefMapper.xml
7.47 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
<?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.AiSparringTaskStaffRefMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.AiSparringTaskStaffRef" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="task_id" property="taskId" jdbcType="VARCHAR" />
<result column="yq_merchant_id" property="yqMerchantId" jdbcType="INTEGER" />
<result column="yq_merchant_name" property="yqMerchantName" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_uuid" property="staffUuid" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="try_count" property="tryCount" jdbcType="INTEGER" />
<result column="sparring_status" property="sparringStatus" jdbcType="INTEGER" />
<result column="estimated_result" property="estimatedResult" jdbcType="VARCHAR" />
<result column="score" property="score" jdbcType="DECIMAL" />
<result column="completion_time" property="completionTime" 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.AiSparringTaskStaffRefDTO" >
</resultMap>
<resultMap id="TaskStaffRecordExportMap" type="cn.com.glsx.dj.mindworkplate.dto.AiSparringTaskStaffRecordExportDTO">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="role_type" property="roleType" jdbcType="INTEGER" />
<result column="sparring_duration" property="sparringDuration" jdbcType="INTEGER" />
<result column="completion_time" property="completionTime" jdbcType="TIMESTAMP" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="score" property="score" />
<result column="sparring_type" property="sparringType" />
<result column="sparring_type" property="sparringType" />
<result column="level" property="level" jdbcType="VARCHAR" />
</resultMap>
<sql id="Prefix_Column">
${prefix}.id as ${prefix}_id,
${prefix}.task_id as ${prefix}_task_id,
${prefix}.yq_merchant_id as ${prefix}_yq_merchant_id,
${prefix}.yq_merchant_name as ${prefix}_yq_merchant_name,
${prefix}.staff_name as ${prefix}_staff_name,
${prefix}.staff_uuid as ${prefix}_staff_uuid,
${prefix}.staff_phone as ${prefix}_staff_phone,
${prefix}.try_count as ${prefix}_try_count,
${prefix}.sparring_status as ${prefix}_sparring_status,
${prefix}.estimated_result as ${prefix}_estimated_result,
${prefix}.score as ${prefix}_score,
${prefix}.completion_time as ${prefix}_completion_time,
${prefix}.created_by as ${prefix}_created_by,
${prefix}.created_date as ${prefix}_created_date,
${prefix}.updated_by as ${prefix}_updated_by,
${prefix}.updated_date as ${prefix}_updated_date,
${prefix}.deleted_flag as ${prefix}_deleted_flag
</sql>
<select id="page"
parameterType="cn.com.glsx.dj.mindworkplate.dto.AiSparringTaskStaffRequestDTO"
resultMap="DTOResultMap">
select * from ai_sparring_task_staff_ref astsr
<where>
astsr.deleted_flag = 'N'
<if test="id != null">
and astsr.id = #{id}
</if>
<if test="taskId != null">
and astsr.task_id = #{taskId}
</if>
<if test="yqMerchantId != null">
and astsr.yq_merchant_id = #{yqMerchantId}
</if>
<if test="yqMerchantName != null and yqMerchantName != ''">
and astsr.yq_merchant_name like concat('%', #{yqMerchantName}, '%')
</if>
<if test="staffPhone != null and staffPhone != ''">
and astsr.staff_phone like concat('%', #{staffPhone}, '%')
</if>
<if test="staffName != null and staffName != ''">
and astsr.staff_name like concat('%', #{staffName}, '%')
</if>
<if test="sparringStatus != null">
and astsr.sparring_status = #{sparringStatus}
</if>
<if test="startTime != null">
and astsr.completion_time >= #{startTime}
</if>
<if test="endTime != null">
and astsr.completion_time <= #{endTime}
</if>
</where>
order by astsr.created_date desc
</select>
<select id="findByIds" resultMap="BaseResultMap">
select * from ai_sparring_task_staff_ref
<where>
deleted_flag = 'N' and id in
<foreach collection="ids" item="id" close=")" open="(" separator=",">
#{id}
</foreach>
</where>
</select>
<select id="findById" resultMap="DTOResultMap">
select * from ai_sparring_task_staff_ref
where deleted_flag = 'N' and id = #{id}
</select>
<select id="findByStaffUuid" resultMap="DTOResultMap">
select * from ai_sparring_task_staff_ref
where deleted_flag = 'N' and staff_uuid = #{staffUuid}
order by try_count, created_date desc
limit 1
</select>
<update id="incrTryCount">
update ai_sparring_task_staff_ref set try_count = try_count + 1, updated_date = current_timestamp()
where deleted_flag = 'N' and id = #{id} and try_count < 3
</update>
<select id="listTaskStaffRecord" parameterType="cn.com.glsx.dj.mindworkplate.dto.AiSparringTaskStaffRequestDTO"
resultMap="TaskStaffRecordExportMap">
select ssr.id, ssr.sparring_duration, ssr.completion_time, ssr.role_type, ssr.score,assi.staff_name, assi.staff_phone,
ssr.sparring_type, ssr.`level`
from ai_sparring_staff_record ssr
left join ai_sparring_staff_info assi on ssr.task_staff_id = assi.id and assi.deleted_flag = 'N'
<where>
ssr.deleted_flag = 'N'
<if test="sparringStatus != null">
and ssr.sparring_status = #{sparringStatus}
</if>
<if test="taskId != null">
and ssr.sparring_task_id = #{taskId}
</if>
<if test="staffPhone != null and staffPhone != ''">
and assi.staff_phone like concat('%', #{staffPhone}, '%')
</if>
<if test="staffName != null and staffName != ''">
and assi.staff_name like concat('%', #{staffName}, '%')
</if>
<if test="startTime != null">
and ssr.completion_time >= #{startTime}
</if>
<if test="endTime != null">
and ssr.completion_time <= #{endTime}
</if>
</where>
order by ssr.completion_time desc
</select>
</mapper>