TBCarShotMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.com.lzt.car.carshot.dao.TBCarShootDao">
  4. <resultMap type="cn.com.lzt.car.carshot.entity.TBCarShoot" id="TBCarShotResultMap">
  5. <result property="id" column="id" jdbcType=""/>
  6. <result property="plate" column="plate" jdbcType=""/>
  7. <result property="type" column="type" jdbcType=""/>
  8. <result property="camera" column="camera" jdbcType=""/>
  9. <result property="position" column="position" jdbcType=""/>
  10. <result property="uploadTime" column="upload_time" jdbcType=""/>
  11. <result property="shot" column="shot" jdbcType=""/>
  12. <result property="shotType" column="shot_type" jdbcType=""/>
  13. <result property="createTime" column="create_time" jdbcType=""/>
  14. <result property="updateTime" column="update_time" jdbcType=""/>
  15. <result property="status" column="status" jdbcType=""/>
  16. </resultMap>
  17. <sql id="table_field">
  18. #allSqlColumn()
  19. </sql>
  20. <!--通过Id查询单个-->
  21. <select id="getById" resultMap="TBCarShotResultMap" parameterType="java.lang.Integer">
  22. select
  23. <include refid="table_field" />
  24. from t_b_car_shot
  25. where id = #{id,jdbcType=}
  26. </select>
  27. <!--通过实体不为空的属性作为筛选条件查询列表-->
  28. <select id="listByEntity" resultMap="TBCarShotResultMap" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
  29. select
  30. <include refid="table_field" />
  31. from t_b_car_shot
  32. <where>
  33. <if test="id != null">
  34. and id = #{id,jdbcType=}
  35. </if>
  36. <if test="plate != null">
  37. and plate = #{plate,jdbcType=}
  38. </if>
  39. <if test="type != null">
  40. and type = #{type,jdbcType=}
  41. </if>
  42. <if test="camera != null">
  43. and camera = #{camera,jdbcType=}
  44. </if>
  45. <if test="position != null">
  46. and position = #{position,jdbcType=}
  47. </if>
  48. <if test="uploadTime != null">
  49. and upload_time = #{uploadTime,jdbcType=}
  50. </if>
  51. <if test="shot != null">
  52. and shot = #{shot,jdbcType=}
  53. </if>
  54. <if test="shotType != null">
  55. and shot_type = #{shotType,jdbcType=}
  56. </if>
  57. <if test="createTime != null">
  58. and create_time = #{createTime,jdbcType=}
  59. </if>
  60. <if test="updateTime != null">
  61. and update_time = #{updateTime,jdbcType=}
  62. </if>
  63. <if test="status != null">
  64. and status = #{status,jdbcType=}
  65. </if>
  66. </where>
  67. </select>
  68. <!--通过实体不为空的属性作为筛选条件查询单个-->
  69. <select id="getByEntity" resultMap="TBCarShotResultMap" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
  70. select
  71. <include refid="table_field" />
  72. from t_b_car_shot
  73. <where>
  74. <if test="id != null">
  75. and id = #{id,jdbcType=}
  76. </if>
  77. <if test="plate != null">
  78. and plate = #{plate,jdbcType=}
  79. </if>
  80. <if test="type != null">
  81. and type = #{type,jdbcType=}
  82. </if>
  83. <if test="camera != null">
  84. and camera = #{camera,jdbcType=}
  85. </if>
  86. <if test="position != null">
  87. and position = #{position,jdbcType=}
  88. </if>
  89. <if test="uploadTime != null">
  90. and upload_time = #{uploadTime,jdbcType=}
  91. </if>
  92. <if test="shot != null">
  93. and shot = #{shot,jdbcType=}
  94. </if>
  95. <if test="shotType != null">
  96. and shot_type = #{shotType,jdbcType=}
  97. </if>
  98. <if test="createTime != null">
  99. and create_time = #{createTime,jdbcType=}
  100. </if>
  101. <if test="updateTime != null">
  102. and update_time = #{updateTime,jdbcType=}
  103. </if>
  104. <if test="status != null">
  105. and status = #{status,jdbcType=}
  106. </if>
  107. </where>
  108. </select>
  109. <!--通过Id列表作为筛选条件查询列表,列表长度不为0-->
  110. <select id="listByIds" resultMap="TBCarShotResultMap" parameterType="list">
  111. select
  112. <include refid="table_field" />
  113. from t_b_car_shot
  114. where id in
  115. <foreach item="item" collection="list" separator="," open="(" close=")" index="index">
  116. #{item}
  117. </foreach>
  118. </select>
  119. <!--新增实体属性不为null的列-->
  120. <insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
  121. insert into t_b_car_shot
  122. <trim prefix="(" suffix=")" suffixOverrides=",">
  123. <if test="id != null">
  124. id,
  125. </if>
  126. <if test="plate != null">
  127. plate,
  128. </if>
  129. <if test="type != null">
  130. type,
  131. </if>
  132. <if test="camera != null">
  133. camera,
  134. </if>
  135. <if test="position != null">
  136. position,
  137. </if>
  138. <if test="uploadTime != null">
  139. upload_time,
  140. </if>
  141. <if test="shot != null">
  142. shot,
  143. </if>
  144. <if test="shotType != null">
  145. shot_type,
  146. </if>
  147. <if test="createTime != null">
  148. create_time,
  149. </if>
  150. <if test="updateTime != null">
  151. update_time,
  152. </if>
  153. <if test="status != null">
  154. status,
  155. </if>
  156. </trim>
  157. <trim prefix="values (" suffix=")" suffixOverrides=",">
  158. <if test="id != null">
  159. #{id,jdbcType=},
  160. </if>
  161. <if test="plate != null">
  162. #{plate,jdbcType=},
  163. </if>
  164. <if test="type != null">
  165. #{type,jdbcType=},
  166. </if>
  167. <if test="camera != null">
  168. #{camera,jdbcType=},
  169. </if>
  170. <if test="position != null">
  171. #{position,jdbcType=},
  172. </if>
  173. <if test="uploadTime != null">
  174. #{uploadTime,jdbcType=},
  175. </if>
  176. <if test="shot != null">
  177. #{shot,jdbcType=},
  178. </if>
  179. <if test="shotType != null">
  180. #{shotType,jdbcType=},
  181. </if>
  182. <if test="createTime != null">
  183. #{createTime,jdbcType=},
  184. </if>
  185. <if test="updateTime != null">
  186. #{updateTime,jdbcType=},
  187. </if>
  188. <if test="status != null">
  189. #{status,jdbcType=},
  190. </if>
  191. </trim>
  192. </insert>
  193. <!--批量新增所有列,列表长度不能为0,且列表id统一为null或者统一不为null-->
  194. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true" parameterType="list">
  195. insert into t_b_car_shot
  196. (id, plate, type, camera, position, upload_time, shot, shot_type, create_time, update_time, status)
  197. values
  198. <foreach item="item" collection="list" separator="," open="" close="" index="index">
  199. (#{item.id}, #{item.plate}, #{item.type}, #{item.camera}, #{item.position}, #{item.uploadTime}, #{item.shot}, #{item.shotType}, #{item.createTime}, #{item.updateTime}, #{item.status})
  200. </foreach>
  201. </insert>
  202. <!--通过主键修改实体属性不为null的列-->
  203. <update id="update" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
  204. update t_b_car_shot
  205. <set>
  206. <if test="plate != null and plate != ''">
  207. plate = #{plate,jdbcType=},
  208. </if>
  209. <if test="type != null">
  210. type = #{type,jdbcType=},
  211. </if>
  212. <if test="camera != null">
  213. camera = #{camera,jdbcType=},
  214. </if>
  215. <if test="position != null and position != ''">
  216. position = #{position,jdbcType=},
  217. </if>
  218. <if test="uploadTime != null">
  219. upload_time = #{uploadTime,jdbcType=},
  220. </if>
  221. <if test="shot != null and shot != ''">
  222. shot = #{shot,jdbcType=},
  223. </if>
  224. <if test="shotType != null">
  225. shot_type = #{shotType,jdbcType=},
  226. </if>
  227. <if test="createTime != null">
  228. create_time = #{createTime,jdbcType=},
  229. </if>
  230. <if test="updateTime != null">
  231. update_time = #{updateTime,jdbcType=},
  232. </if>
  233. <if test="status != null">
  234. status = #{status,jdbcType=},
  235. </if>
  236. </set>
  237. where id = #{id,jdbcType=}
  238. </update>
  239. <!--通过表字段修改实体属性不为null的列-->
  240. <update id="updateByField">
  241. update t_b_car_shot
  242. <set>
  243. <if test="where.plate == null and set.plate != null and set.plate != ''">
  244. plate = #{set.plate,jdbcType=},
  245. </if>
  246. <if test="where.type == null and set.type != null">
  247. type = #{set.type,jdbcType=},
  248. </if>
  249. <if test="where.camera == null and set.camera != null">
  250. camera = #{set.camera,jdbcType=},
  251. </if>
  252. <if test="where.position == null and set.position != null and set.position != ''">
  253. position = #{set.position,jdbcType=},
  254. </if>
  255. <if test="where.uploadTime == null and set.uploadTime != null">
  256. upload_time = #{set.uploadTime,jdbcType=},
  257. </if>
  258. <if test="where.shot == null and set.shot != null and set.shot != ''">
  259. shot = #{set.shot,jdbcType=},
  260. </if>
  261. <if test="where.shotType == null and set.shotType != null">
  262. shot_type = #{set.shotType,jdbcType=},
  263. </if>
  264. <if test="where.createTime == null and set.createTime != null">
  265. create_time = #{set.createTime,jdbcType=},
  266. </if>
  267. <if test="where.updateTime == null and set.updateTime != null">
  268. update_time = #{set.updateTime,jdbcType=},
  269. </if>
  270. <if test="where.status == null and set.status != null">
  271. status = #{set.status,jdbcType=},
  272. </if>
  273. </set>
  274. <where>
  275. <if test="where.id != null">
  276. and id = #{where.id,jdbcType=}
  277. </if>
  278. <if test="where.plate != null">
  279. and plate = #{where.plate,jdbcType=}
  280. </if>
  281. <if test="where.type != null">
  282. and type = #{where.type,jdbcType=}
  283. </if>
  284. <if test="where.camera != null">
  285. and camera = #{where.camera,jdbcType=}
  286. </if>
  287. <if test="where.position != null">
  288. and position = #{where.position,jdbcType=}
  289. </if>
  290. <if test="where.uploadTime != null">
  291. and upload_time = #{where.uploadTime,jdbcType=}
  292. </if>
  293. <if test="where.shot != null">
  294. and shot = #{where.shot,jdbcType=}
  295. </if>
  296. <if test="where.shotType != null">
  297. and shot_type = #{where.shotType,jdbcType=}
  298. </if>
  299. <if test="where.createTime != null">
  300. and create_time = #{where.createTime,jdbcType=}
  301. </if>
  302. <if test="where.updateTime != null">
  303. and update_time = #{where.updateTime,jdbcType=}
  304. </if>
  305. <if test="where.status != null">
  306. and status = #{where.status,jdbcType=}
  307. </if>
  308. </where>
  309. </update>
  310. <!--通过主键修改实体列表,列表长度不能为0,注意:当实体属性为null时,对应的列也会别更新为null-->
  311. <update id="updateBatch" parameterType="list">
  312. update t_b_car_shot
  313. <trim prefix="set" suffixOverrides=",">
  314. <trim prefix="plate = case" suffix="end,">
  315. <foreach collection="list" item="item" index="index">
  316. when id = #{item.id} then #{item.plate}
  317. </foreach>
  318. </trim>
  319. <trim prefix="type = case" suffix="end,">
  320. <foreach collection="list" item="item" index="index">
  321. when id = #{item.id} then #{item.type}
  322. </foreach>
  323. </trim>
  324. <trim prefix="camera = case" suffix="end,">
  325. <foreach collection="list" item="item" index="index">
  326. when id = #{item.id} then #{item.camera}
  327. </foreach>
  328. </trim>
  329. <trim prefix="position = case" suffix="end,">
  330. <foreach collection="list" item="item" index="index">
  331. when id = #{item.id} then #{item.position}
  332. </foreach>
  333. </trim>
  334. <trim prefix="upload_time = case" suffix="end,">
  335. <foreach collection="list" item="item" index="index">
  336. when id = #{item.id} then #{item.uploadTime}
  337. </foreach>
  338. </trim>
  339. <trim prefix="shot = case" suffix="end,">
  340. <foreach collection="list" item="item" index="index">
  341. when id = #{item.id} then #{item.shot}
  342. </foreach>
  343. </trim>
  344. <trim prefix="shot_type = case" suffix="end,">
  345. <foreach collection="list" item="item" index="index">
  346. when id = #{item.id} then #{item.shotType}
  347. </foreach>
  348. </trim>
  349. <trim prefix="create_time = case" suffix="end,">
  350. <foreach collection="list" item="item" index="index">
  351. when id = #{item.id} then #{item.createTime}
  352. </foreach>
  353. </trim>
  354. <trim prefix="update_time = case" suffix="end,">
  355. <foreach collection="list" item="item" index="index">
  356. when id = #{item.id} then #{item.updateTime}
  357. </foreach>
  358. </trim>
  359. <trim prefix="status = case" suffix="end,">
  360. <foreach collection="list" item="item" index="index">
  361. when id = #{item.id} then #{item.status}
  362. </foreach>
  363. </trim>
  364. </trim>
  365. where id in
  366. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  367. #{item.id,jdbcType=}
  368. </foreach>
  369. </update>
  370. <!--通过主键删除-->
  371. <delete id="deleteById" parameterType="java.lang.Integer">
  372. delete from t_b_car_shot where id = #{id,jdbcType=}
  373. </delete>
  374. <!--通过实体非空属性删除-->
  375. <delete id="deleteByEntity" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
  376. delete from t_b_car_shot
  377. <where>
  378. <if test="plate != null">
  379. and plate = #{plate,jdbcType=}
  380. </if>
  381. <if test="type != null">
  382. and type = #{type,jdbcType=}
  383. </if>
  384. <if test="camera != null">
  385. and camera = #{camera,jdbcType=}
  386. </if>
  387. <if test="position != null">
  388. and position = #{position,jdbcType=}
  389. </if>
  390. <if test="uploadTime != null">
  391. and upload_time = #{uploadTime,jdbcType=}
  392. </if>
  393. <if test="shot != null">
  394. and shot = #{shot,jdbcType=}
  395. </if>
  396. <if test="shotType != null">
  397. and shot_type = #{shotType,jdbcType=}
  398. </if>
  399. <if test="createTime != null">
  400. and create_time = #{createTime,jdbcType=}
  401. </if>
  402. <if test="updateTime != null">
  403. and update_time = #{updateTime,jdbcType=}
  404. </if>
  405. <if test="status != null">
  406. and status = #{status,jdbcType=}
  407. </if>
  408. </where>
  409. </delete>
  410. <!--通过主键列表删除,列表长度不能为0-->
  411. <delete id="deleteByIds" parameterType="list">
  412. delete from t_b_car_shot where id in
  413. <foreach item="item" collection="list" separator="," open="(" close=")" index="index">
  414. #{item}
  415. </foreach>
  416. </delete>
  417. <select id="countAll" resultType="int">
  418. select count(*) from t_b_car_shot
  419. </select>
  420. <select id="countByEntity" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot" resultType="int">
  421. select count(*) from t_b_car_shot
  422. <where>
  423. <if test="id != null">
  424. and id = #{id,jdbcType=}
  425. </if>
  426. <if test="plate != null">
  427. and plate = #{plate,jdbcType=}
  428. </if>
  429. <if test="type != null">
  430. and type = #{type,jdbcType=}
  431. </if>
  432. <if test="camera != null">
  433. and camera = #{camera,jdbcType=}
  434. </if>
  435. <if test="position != null">
  436. and position = #{position,jdbcType=}
  437. </if>
  438. <if test="uploadTime != null">
  439. and upload_time = #{uploadTime,jdbcType=}
  440. </if>
  441. <if test="shot != null">
  442. and shot = #{shot,jdbcType=}
  443. </if>
  444. <if test="shotType != null">
  445. and shot_type = #{shotType,jdbcType=}
  446. </if>
  447. <if test="createTime != null">
  448. and create_time = #{createTime,jdbcType=}
  449. </if>
  450. <if test="updateTime != null">
  451. and update_time = #{updateTime,jdbcType=}
  452. </if>
  453. <if test="status != null">
  454. and status = #{status,jdbcType=}
  455. </if>
  456. </where>
  457. </select>
  458. </mapper>