DeviceCheckDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  2. <mapper namespace="cn.ourwill.module.house.dao.dm.DeviceCheckDao">
  3. <resultMap type="cn.ourwill.module.house.entity.dm.DeviceCheck" id="baseMap">
  4. <result column="id" property="id"/>
  5. <result column="uuid" property="uuid"/>
  6. <result column="c_id" property="cId"/>
  7. <result column="c_time" property="cTime"/>
  8. <result column="u_id" property="uId"/>
  9. <result column="u_time" property="uTime"/>
  10. <result column="grain_id" property="grainId"/>
  11. <result column="check_date" property="checkDate"/>
  12. <result column="device_checker" property="deviceChecker"/>
  13. <result column="check_number" property="checkNumber"/>
  14. <result column="check_kind" property="deviceKind"/>
  15. <result column="checker_pic" property="checkerPic"/>
  16. </resultMap>
  17. <sql id="columns">
  18. a.id,
  19. a.uuid,
  20. a.grain_id,
  21. a.check_date,
  22. a.device_checker,
  23. a.check_number,
  24. a.device_kind,
  25. a.c_time,
  26. a.c_id,
  27. a.u_time,
  28. a.u_id,
  29. a.checker_pic
  30. </sql>
  31. <sql id="joinCols">
  32. </sql>
  33. <select id="get" resultMap="baseMap">
  34. SELECT
  35. <include refid="columns"/>
  36. FROM device_check a
  37. <include refid="joinCols"/>
  38. WHERE a.id = #{id}
  39. </select>
  40. <select id="findwzList" resultMap="baseMap">
  41. SELECT
  42. <include refid="columns"/>
  43. FROM device_check a
  44. <include refid="joinCols"/>
  45. <where>
  46. <if test="id !=null">
  47. and id = #{id}
  48. </if>
  49. <if test="uuid !=null">
  50. and uuid = #{uuid}
  51. </if>
  52. <if test="grainId !=null">
  53. and grain_id = #{grainId}
  54. </if>
  55. <if test="checkDate != null">
  56. and check_date=#{checkDate}
  57. </if>
  58. <if test="searchStartDate !=null">
  59. and check_date <![CDATA[ >= ]]> #{searchStartDate}
  60. </if>
  61. <if test="searchEndDate !=null">
  62. and check_date &lt;= #{searchEndDate}
  63. </if>
  64. <if test="deviceChecker != null">
  65. and device_checker=#{deviceChecker}
  66. </if>
  67. <if test="checkNumber !=null">
  68. and check_number like CONCAT('%',#{checkNumber},'%')
  69. </if>
  70. and device_kind!=1
  71. <if test="checkerPic != null">
  72. and checker_pic=#{checkerPic}
  73. </if>
  74. <if test="cTime !=null">
  75. and c_time = #{cTime}
  76. </if>
  77. <if test="cId !=null">
  78. and c_id = #{cId}
  79. </if>
  80. <if test="uTime !=null">
  81. and u_time = #{uTime}
  82. </if>
  83. <if test="uId !=null">
  84. and u_id = #{uId}
  85. </if>
  86. </where>
  87. <choose>
  88. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  89. ORDER BY ${page.orderBy}
  90. </when>
  91. <otherwise>
  92. </otherwise>
  93. </choose>
  94. </select>
  95. <select id="findsbList" resultMap="baseMap">
  96. SELECT
  97. <include refid="columns"/>
  98. FROM device_check a
  99. <include refid="joinCols"/>
  100. <where>
  101. <if test="id !=null">
  102. and id = #{id}
  103. </if>
  104. <if test="uuid !=null">
  105. and uuid = #{uuid}
  106. </if>
  107. <if test="grainId !=null">
  108. and grain_id = #{grainId}
  109. </if>
  110. <if test="checkDate != null">
  111. and check_date=#{checkDate}
  112. </if>
  113. <if test="searchStartDate !=null">
  114. and check_date <![CDATA[ >= ]]> #{searchStartDate}
  115. </if>
  116. <if test="searchEndDate !=null">
  117. and check_date &lt;= #{searchEndDate}
  118. </if>
  119. <if test="deviceChecker != null">
  120. and device_checker=#{deviceChecker}
  121. </if>
  122. <if test="checkNumber !=null">
  123. and check_number like CONCAT('%',#{checkNumber},'%')
  124. </if>
  125. and device_kind=1
  126. <if test="checkerPic != null">
  127. and checker_pic=#{checkerPic}
  128. </if>
  129. <if test="cTime !=null">
  130. and c_time = #{cTime}
  131. </if>
  132. <if test="cId !=null">
  133. and c_id = #{cId}
  134. </if>
  135. <if test="uTime !=null">
  136. and u_time = #{uTime}
  137. </if>
  138. <if test="uId !=null">
  139. and u_id = #{uId}
  140. </if>
  141. </where>
  142. <choose>
  143. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  144. ORDER BY ${page.orderBy}
  145. </when>
  146. <otherwise>
  147. </otherwise>
  148. </choose>
  149. </select>
  150. <select id="findAllList" resultMap="baseMap">
  151. SELECT
  152. <include refid="columns"/>
  153. FROM device_check a
  154. <include refid="joinCols"/>
  155. <where>
  156. <if test="id !=null">
  157. and id = #{id}
  158. </if>
  159. <if test="uuid !=null">
  160. and uuid = #{uuid}
  161. </if>
  162. <if test="grainId !=null">
  163. and grain_id = #{grainId}
  164. </if>
  165. <if test="checkDate != null">
  166. and check_date LIKE CONCAT('%',DATE_FORMAT(#{checkDate}, '%Y'),'%')
  167. </if>
  168. <if test="searchStartDate !=null">
  169. and check_date <![CDATA[ >= ]]> #{searchStartDate}
  170. </if>
  171. <if test="searchEndDate !=null">
  172. and check_date &lt;= #{searchEndDate}
  173. </if>
  174. <if test="deviceChecker != null">
  175. and device_checker=#{deviceChecker}
  176. </if>
  177. <if test="checkNumber !=null">
  178. and check_number like CONCAT('%',#{checkNumber},'%')
  179. </if>
  180. <if test="deviceKind != null">
  181. and device_kind = #{deviceKind}
  182. </if>
  183. <if test="checkerPic != null">
  184. and checker_pic=#{checkerPic}
  185. </if>
  186. <if test="cTime !=null">
  187. and c_time = #{cTime}
  188. </if>
  189. <if test="cId !=null">
  190. and c_id = #{cId}
  191. </if>
  192. <if test="uTime !=null">
  193. and u_time = #{uTime}
  194. </if>
  195. <if test="uId !=null">
  196. and u_id = #{uId}
  197. </if>
  198. </where>
  199. <choose>
  200. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  201. ORDER BY ${page.orderBy}
  202. </when>
  203. <otherwise>
  204. </otherwise>
  205. </choose>
  206. </select>
  207. <select id="getByUuid" resultMap="baseMap">
  208. SELECT
  209. <include refid="columns"/>
  210. FROM device_check a
  211. <include refid="joinCols"/>
  212. WHERE a.uuid = #{uuid}
  213. </select>
  214. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  215. parameterType="cn.ourwill.module.house.entity.dm.DeviceCheck">
  216. INSERT INTO device_check
  217. <trim prefix="(" suffix=")" suffixOverrides=",">
  218. <if test="uuid !=null">
  219. uuid,
  220. </if>
  221. <if test="grainId !=null">
  222. grain_id,
  223. </if>
  224. <if test="checkDate != null">
  225. check_date,
  226. </if>
  227. <if test="deviceChecker != null">
  228. device_checker,
  229. </if>
  230. <if test="checkNumber != null">
  231. check_number,
  232. </if>
  233. <if test="deviceKind != null">
  234. device_kind,
  235. </if>
  236. <if test="checkerPic != null">
  237. checker_pic,
  238. </if>
  239. <if test=" cTime != null">
  240. c_time,
  241. </if>
  242. <if test=" cId != null">
  243. c_id,
  244. </if>
  245. <if test=" uTime != null">
  246. u_time,
  247. </if>
  248. <if test=" uId != null">
  249. u_id,
  250. </if>
  251. </trim>
  252. <trim prefix="values (" suffix=")" suffixOverrides=",">
  253. <if test="uuid !=null">
  254. #{uuid},
  255. </if>
  256. <if test="grainId !=null">
  257. #{grainId},
  258. </if>
  259. <if test="checkDate != null">
  260. #{checkDate},
  261. </if>
  262. <if test="deviceChecker != null">
  263. #{deviceChecker},
  264. </if>
  265. <if test="checkNumber != null">
  266. #{checkNumber},
  267. </if>
  268. <if test="deviceKind != null">
  269. #{deviceKind},
  270. </if>
  271. <if test="checkerPic != null">
  272. #{checkerPic},
  273. </if>
  274. <if test=" cTime != null">
  275. #{cTime},
  276. </if>
  277. <if test=" cId != null">
  278. #{cId},
  279. </if>
  280. <if test=" uTime != null">
  281. #{uTime},
  282. </if>
  283. <if test=" uId != null">
  284. #{uId},
  285. </if>
  286. </trim>
  287. </insert>
  288. <update id="update" parameterType="cn.ourwill.module.house.entity.dm.DeviceCheck">
  289. UPDATE device_check
  290. <set>
  291. <if test="grainId != null">
  292. grain_id= #{grainId} ,
  293. </if>
  294. <if test="checkDate != null">
  295. check_date = #{checkDate},
  296. </if>
  297. <if test="deviceChecker != null">
  298. device_checker = #{deviceChecker},
  299. </if>
  300. <if test="checkNumber != null">
  301. check_number = #{checkNumber},
  302. </if>
  303. <if test="deviceKind != null">
  304. device_kind = #{deviceKind},
  305. </if>
  306. <if test="checkerPic != null">
  307. checker_pic = #{checkerPic},
  308. </if>
  309. <if test="cTime != null">
  310. c_time= #{cTime} ,
  311. </if>
  312. <if test="cId != null">
  313. c_id= #{cId} ,
  314. </if>
  315. <if test="uTime != null">
  316. u_time= #{uTime} ,
  317. </if>
  318. <if test="uId != null">
  319. u_id= #{uId} ,
  320. </if>
  321. <if test="version != null">
  322. version= #{version}
  323. </if>
  324. </set>
  325. WHERE id = #{id}
  326. </update>
  327. <update id="updateByUuid" parameterType="cn.ourwill.module.house.entity.dm.DeviceCheck">
  328. UPDATE device_check
  329. <set>
  330. <if test="grainId != null">
  331. grain_id= #{grainId} ,
  332. </if>
  333. <if test="checkDate != null">
  334. check_date = #{checkDate},
  335. </if>
  336. <if test="deviceChecker != null">
  337. device_checker = #{deviceChecker},
  338. </if>
  339. <if test="checkNumber != null">
  340. check_number = #{checkNumber},
  341. </if>
  342. <if test="deviceKind != null">
  343. device_kind = #{deviceKind},
  344. </if>
  345. <if test="checkerPic != null">
  346. checker_pic = #{checkerPic},
  347. </if>
  348. <if test="cTime != null">
  349. c_time= #{cTime} ,
  350. </if>
  351. <if test="cId != null">
  352. c_id= #{cId} ,
  353. </if>
  354. <if test="uTime != null">
  355. u_time= #{uTime} ,
  356. </if>
  357. <if test="uId != null">
  358. u_id= #{uId} ,
  359. </if>
  360. <if test="version != null">
  361. version= #{version}
  362. </if>
  363. </set>
  364. WHERE uuid = #{uuid}
  365. </update>
  366. <delete id="deleteById" parameterType="java.lang.Long">
  367. DELETE FROM device_check
  368. WHERE id = #{id}
  369. </delete>
  370. <delete id="deleteByIds" parameterType="java.util.List">
  371. DELETE FROM device_check WHERE id IN
  372. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  373. #{item}
  374. </foreach>
  375. </delete>
  376. </mapper>