TicketCustomerFieldValue.xml
5.92 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
<?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="mapper.TicketCustomerFieldValueMapper">
<resultMap id="BaseResultMap" type="com.uccc.base.springboot.domain.TicketCustomerFieldValue">
<result column="ticket_id" property="ticketId" jdbcType="INTEGER"/>
<result column="custom_field_id" property="customFieldId" jdbcType="INTEGER"/>
<result column="string_values" property="stringValues" jdbcType="VARCHAR"/>
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
<result column="update_at" property="updateAt" jdbcType="TIMESTAMP"/>
<result column="is_delete" property="isDelete" jdbcType="BIT"/>
<result column="int_values" property="intValues" jdbcType="INTEGER"/>
<result column="date_values" property="dateValues" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="BaseColumn">
ticket_id,custom_field_id,string_values,created_at,update_at,is_delete,int_values,date_values
</sql>
<insert id="insert" parameterType="com.uccc.base.springboot.domain.TicketCustomerFieldValue" keyProperty="id" useGeneratedKeys="true">
INSERT INTO ticket_customer_field_values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ticketId != null">
tenant_id,
</if>
<if test="customFieldId != null">
custom_field_id,
</if>
<if test="stringValues != null">
string_values,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updateAt != null">
update_at,
</if>
<if test="isDelete != null">
is_delete,
</if>
<if test="intValues != null">
int_values,
</if>
<if test="dateValues != null">
date_values,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketId != null">
#{ticketId},
</if>
<if test="customFieldId != null">
#{customFieldId},
</if>
<if test="stringValues != null">
#{stringValues},
</if>
<if test="createdAt != null">
#{createdAt},
</if>
<if test="updateAt != null">
#{updateAt},
</if>
<if test="isDelete != null">
#{isDelete},
</if>
<if test="intValues != null">
#{intValues},
</if>
<if test="dateValues != null">
#{dateValues},
</if>
false
</trim>
</insert>
<select id="query" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="BaseColumn"/>
FROM ticket_customer_field_values
WHERE 1 =1
<if test="ticketId != null">
and ticket_id = #{ticketId}
</if>
<if test="customFieldId != null">
and custom_field_id = #{customFieldId}
</if>
<if test="stringValues != null and stringValues != ''">
and string_values = #{stringValues}
</if>
<if test="createdAt != null">
and created_at = #{createdAt}
</if>
<if test="updateAt != null">
and update_at = #{updateAt}
</if>
<if test="isDelete != null">
and is_delete = #{isDelete}
</if>
<if test="intValues != null">
and int_values = #{intValues}
</if>
<if test="dateValues != null">
and date_values = #{dateValues}
</if>
<if test="startDateValues != null and endDateValues != null">
and date_values BETWEEN #{startDateValues} AND #{endDateValues}
</if>
<if test="offset != null and limit != null">
limit #{limit} offset #{offset}
</if>
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT
count(id)
FROM ticket_customer_field_values
WHERE 1 =1
<if test="ticketId != null">
and ticket_id = #{ticketId}
</if>
<if test="customFieldId != null">
and custom_field_id = #{customFieldId}
</if>
<if test="stringValues != null and stringValues != ''">
and string_values = #{stringValues}
</if>
<if test="createdAt != null">
and created_at = #{createdAt}
</if>
<if test="updateAt != null">
and update_at = #{updateAt}
</if>
<if test="isDelete != null">
and is_delete = #{isDelete}
</if>
<if test="intValues != null">
and int_values = #{intValues}
</if>
<if test="dateValues != null">
and date_values = #{dateValues}
</if>
<if test="startDateValues != null and endDateValues != null">
and date_values BETWEEN #{startDateValues} AND #{endDateValues}
</if>
</select>
<update id="update" parameterType="com.uccc.base.springboot.domain.TicketCustomerFieldValue">
UPDATE
ticket_customer_field_values
<set>
<if test="stringValues != null and stringValues != ''">
string_values = #{stringValues},
</if>
<if test="updateAt != null">
update_at = now(),
</if>
<if test="intValues != null">
int_values = #{intValues},
</if>
<if test="dateValues != null">
date_values = #{dateValues},
</if>
</set>
WHERE
custom_field_id = #{customFieldId} AND ticket_id = #{ticketId}
</update>
</mapper>