DeviceCheckItemDao.xml 12 KB

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