c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
<?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="com.objecteye.mapper.SyVehicleModelMapper">
<resultMap id="BaseResultMap" type="com.objecteye.entity.SyVehicleModel">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="initials" jdbcType="VARCHAR" property="initials"/>
<result column="brand" jdbcType="VARCHAR" property="brand"/>
<result column="subbrand" jdbcType="VARCHAR" property="subbrand"/>
<result column="birthday" jdbcType="VARCHAR" property="birthday"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, initials, brand, subbrand, birthday
</sql>
<!--1 查询所有的汽车型号首字母-->
<!--List<String> selectDisplayForInitials();-->
<select id="selectDisplayForInitials" resultType="java.lang.String">
select distinct initials
from sy_vehicle_model
order by initials;
</select>
<!--2 List<String> selectDisplayForBrand();-->
<!--//查询某个首字母下的汽车型号品牌-->
<select id="selectDisplayForBrand" parameterType="java.lang.String" resultType="java.lang.String">
select distinct brand
from sy_vehicle_model
where initials = #{initals}
</select>
<!--3 List<String> selectDisplayForSubbrand();-->
<!--//查询某个首字母下的汽车型号品牌-->
<select id="selectDisplayForSubbrand" parameterType="java.lang.String" resultType="java.lang.String">
select distinct subbrand
from sy_vehicle_model
where brand = #{brand}
</select>
<!--4 List<String> selectDisplayForBirthday();-->
<!--//查询某品牌下的汽车生产日期-->
<select id="selectDisplayForBirthday" parameterType="java.lang.String" resultType="java.lang.String">
select birthday
from sy_vehicle_model
where subbrand = #{subbrand}
</select>
<!-- 5 返回所有车辆类型列表
List<String> displayVehicleTypeList();-->
<select id="displayVehicleTypeList" resultType="java.lang.String">
select distinct name
from sy_vehicle_type;
</select>
<!--6 返回所有车辆车身颜色列表
List<String> displayVehicleColorList();-->
<select id="displayVehicleColorList" resultType="com.objecteye.pojo.NameValue">
select distinct name,
value
from sy_vehicle_color;
</select>
<!-- 7 返回所有车辆号牌类型列表
List<String> displayVehiclePlateTypeList();-->
<select id="displayVehiclePlateTypeList" resultType="com.objecteye.pojo.NameValue">
select distinct name,
value
from sy_vehicle_plate_type;
</select>
<!--8 返回所有车辆年检标个数列表
List<String> displayVehicleNjbNumberList();-->
<select id="displayVehicleNjbNumberList" resultType="java.lang.String">
select distinct njb_number
from sy_vehicle_njb_number;
</select>
<select id="selectByExample" parameterType="com.objecteye.entity.SyVehicleModelExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from sy_vehicle_model
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sy_vehicle_model
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from sy_vehicle_model
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.objecteye.entity.SyVehicleModelExample">
delete from sy_vehicle_model
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.objecteye.entity.SyVehicleModel">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sy_vehicle_model (initials, brand, subbrand,
birthday)
values (#{initials,jdbcType=VARCHAR}, #{brand,jdbcType=VARCHAR}, #{subbrand,jdbcType=VARCHAR},
#{birthday,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.objecteye.entity.SyVehicleModel">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sy_vehicle_model
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="initials != null">
initials,
</if>
<if test="brand != null">
brand,
</if>
<if test="subbrand != null">
subbrand,
</if>
<if test="birthday != null">
birthday,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="initials != null">
#{initials,jdbcType=VARCHAR},
</if>
<if test="brand != null">
#{brand,jdbcType=VARCHAR},
</if>
<if test="subbrand != null">
#{subbrand,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
#{birthday,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.objecteye.entity.SyVehicleModelExample"
resultType="java.lang.Integer">
select count(*) from sy_vehicle_model
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sy_vehicle_model
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.initials != null">
initials = #{record.initials,jdbcType=VARCHAR},
</if>
<if test="record.brand != null">
brand = #{record.brand,jdbcType=VARCHAR},
</if>
<if test="record.subbrand != null">
subbrand = #{record.subbrand,jdbcType=VARCHAR},
</if>
<if test="record.birthday != null">
birthday = #{record.birthday,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update sy_vehicle_model
set id = #{record.id,jdbcType=INTEGER},
initials = #{record.initials,jdbcType=VARCHAR},
brand = #{record.brand,jdbcType=VARCHAR},
subbrand = #{record.subbrand,jdbcType=VARCHAR},
birthday = #{record.birthday,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.objecteye.entity.SyVehicleModel">
update sy_vehicle_model
<set>
<if test="initials != null">
initials = #{initials,jdbcType=VARCHAR},
</if>
<if test="brand != null">
brand = #{brand,jdbcType=VARCHAR},
</if>
<if test="subbrand != null">
subbrand = #{subbrand,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
birthday = #{birthday,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.objecteye.entity.SyVehicleModel">
update sy_vehicle_model
set initials = #{initials,jdbcType=VARCHAR},
brand = #{brand,jdbcType=VARCHAR},
subbrand = #{subbrand,jdbcType=VARCHAR},
birthday = #{birthday,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
|