RecordDeviceMachineNewDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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.ourwill.module.house.dao.new_dao.RecordDeviceMachineNewDao" >
  4. <resultMap type="cn.ourwill.module.house.entity.new_entity.RecordDeviceMachineNew" id="baseMap" >
  5. <id column="id" property="id" />
  6. <result column="grain_id" property="grainId" />
  7. <result column="code" property="code"/>
  8. <result column="repair_time" property="repairTime" />
  9. <result column="address" property="address" />
  10. <result column="repair_method" property="repairMethod" />
  11. <result column="repair_debug" property="repairDebug" />
  12. <result column="repair_user" property="repairUser" />
  13. <result column="keep_user" property="keepUser" />
  14. <result column="chief_idea" property="chiefIdea" />
  15. <result column="device_id" property="deviceId" />
  16. <result column="model_uuid" property="modelUuid" />
  17. <result column="uuid" property="uuid" />
  18. <result column="c_id" property="cId" />
  19. <result column="c_time" property="cTime" />
  20. <result column="u_id" property="uId" />
  21. <result column="u_time" property="uTime" />
  22. <result column="record_number" property="recordNumber" />
  23. <result column="remark" property="remark" />
  24. <result column="is_inout" property="isInout" />
  25. </resultMap>
  26. <!--<resultMap type="cn.ourwill.module.house.entity.dm.Device" id="mapOfFind" extends="baseMap">
  27. <result column="name" property="grainName"/>
  28. <result column="device_name" property="deviceName"/>
  29. <result column="device_model" property="deviceModel"/>
  30. <result column="device_no" property="deviceNo"/>
  31. <result column="asset_number" property="assetNumber"/>
  32. </resultMap>-->
  33. <sql id="columns">
  34. a.id,
  35. a.grain_id,
  36. a.code,
  37. a.repair_time,
  38. a.address,
  39. a.repair_method,
  40. a.repair_debug,
  41. a.repair_user,
  42. a.keep_user,
  43. a.chief_idea,
  44. a.device_id,
  45. a.uuid,
  46. a.model_uuid,
  47. a.record_number,
  48. a.remark,
  49. a.is_inout
  50. </sql>
  51. <sql id = "columsOfFindd">
  52. sg.name AS grainName,
  53. ddm.device_name,
  54. ddm.device_model,
  55. ddm.device_manager ,
  56. ddm.collator,
  57. dd.device_no,
  58. dd.asset_number,
  59. dd.place_of_origin,
  60. dd.device_unit,
  61. dd.price,
  62. </sql>
  63. <sql id="joinCols">
  64. </sql>
  65. <select id="get" resultMap="baseMap">
  66. SELECT
  67. <include refid="columsOfFindd"/>
  68. <include refid="columns"/>
  69. FROM record_device_machine_new a
  70. LEFT JOIN dm_device_model ddm on a.model_uuid = ddm.uuid
  71. LEFT JOIN dm_device dd ON a.device_id = dd.id
  72. LEFT JOIN sys_grain sg on sg.id = a.grain_id
  73. <include refid="joinCols"/>
  74. WHERE a.id = #{id}
  75. </select>
  76. <select id="findList" resultMap="baseMap">
  77. SELECT
  78. <include refid="columsOfFindd"/>
  79. <include refid="columns"/>
  80. FROM record_device_machine_new a
  81. LEFT JOIN dm_device_model ddm on a.model_uuid = ddm.uuid
  82. LEFT JOIN dm_device dd ON a.device_id = dd.id
  83. LEFT JOIN sys_grain sg on sg.id = a.grain_id
  84. <include refid="joinCols"/>
  85. <where>
  86. <if test="id !=null">
  87. and a.id = #{id}
  88. </if>
  89. <if test="grainId !=null">
  90. and a.grain_id = #{grainId}
  91. </if>
  92. <if test="cityId !=null and cityId !=''">
  93. and sg.parentId = #{cityId}
  94. </if>
  95. <if test="grainName !=null">
  96. and sg.name = #{grainName}
  97. </if>
  98. <if test="deviceName !=null">
  99. and ddm.device_name = #{deviceName}
  100. </if>
  101. <if test="deviceModel !=null">
  102. and ddm.device_model = #{deviceModel}
  103. </if>
  104. <if test="assetNumber !=null">
  105. and dd.asset_number = #{assetNumber}
  106. </if>
  107. <if test="deviceNo !=null">
  108. and dd.device_no = #{deviceNo}
  109. </if>
  110. <if test="code !=null">
  111. and a.code = #{code}
  112. </if>
  113. <if test="repairTime !=null">
  114. and a.repair_time = #{repairTime}
  115. </if>
  116. <if test="address !=null">
  117. and a.address = #{address}
  118. </if>
  119. <if test="repairMethod !=null">
  120. and a.repair_method = #{repairMethod}
  121. </if>
  122. <if test="repairDebug !=null">
  123. and a.repair_debug = #{repairDebug}
  124. </if>
  125. <if test="repairUser !=null">
  126. and a.repair_user = #{repairUser}
  127. </if>
  128. <if test="keepUser !=null">
  129. and a.keep_user = #{keepUser}
  130. </if>
  131. <if test="chiefIdea !=null">
  132. and a.chief_idea = #{chiefIdea}
  133. </if>
  134. <if test="deviceId !=null">
  135. and a.device_id = #{deviceId}
  136. </if>
  137. <if test="uuid !=null">
  138. and a.uuid = #{uuid}
  139. </if>
  140. <if test="cId !=null">
  141. and a.c_id = #{cId}
  142. </if>
  143. <if test="cTime !=null">
  144. and a.c_time = #{cTime}
  145. </if>
  146. <if test="uId !=null">
  147. and a.u_id = #{uId}
  148. </if>
  149. <if test="uTime !=null">
  150. and a.u_time = #{uTime}
  151. </if>
  152. <if test="modelUuid !=null">
  153. and a.model_uuid = #{modelUuid}
  154. </if>
  155. <if test="recordNumber !=null">
  156. and a.record_number = #{recordNumber}
  157. </if>
  158. </where>
  159. <choose>
  160. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  161. ORDER BY ${page.orderBy}
  162. </when>
  163. <otherwise>
  164. </otherwise>
  165. </choose>
  166. </select>
  167. <select id="findAllList" resultMap="baseMap">
  168. SELECT
  169. <include refid="columsOfFindd"/>
  170. <include refid="columns"/>
  171. FROM record_device_machine_new a
  172. LEFT JOIN dm_device_model ddm on a.model_uuid = ddm.uuid
  173. LEFT JOIN dm_device dd ON a.device_id = dd.id
  174. LEFT JOIN sys_grain sg on sg.id = a.grain_id
  175. <include refid="joinCols"/>
  176. <where>
  177. <if test="id !=null">
  178. and a.id = #{id}
  179. </if>
  180. <if test="grainId !=null">
  181. and a.grain_id = #{grainId}
  182. </if>
  183. <if test="grainName !=null">
  184. and sg.name = #{grainName}
  185. </if>
  186. <if test="deviceName !=null">
  187. and ddm.device_name = #{deviceName}
  188. </if>
  189. <if test="deviceModel !=null">
  190. and ddm.device_model = #{deviceModel}
  191. </if>
  192. <if test="assetNumber !=null">
  193. and dd.asset_number = #{assetNumber}
  194. </if>
  195. <if test="deviceNo !=null">
  196. and dd.device_no = #{deviceNo}
  197. </if>
  198. <if test="code !=null">
  199. and a.code = #{code}
  200. </if>
  201. <if test="repairTime !=null">
  202. and a.repair_time = #{repairTime}
  203. </if>
  204. <if test="address !=null">
  205. and a.address = #{address}
  206. </if>
  207. <if test="repairMethod !=null">
  208. and a.repair_method = #{repairMethod}
  209. </if>
  210. <if test="repairDebug !=null">
  211. and a.repair_debug = #{repairDebug}
  212. </if>
  213. <if test="repairUser !=null">
  214. and a.repair_user = #{repairUser}
  215. </if>
  216. <if test="keepUser !=null">
  217. and a.keep_user = #{keepUser}
  218. </if>
  219. <if test="chiefIdea !=null">
  220. and a.chief_idea = #{chiefIdea}
  221. </if>
  222. <if test="deviceId !=null">
  223. and a.device_id = #{deviceId}
  224. </if>
  225. <if test="uuid !=null">
  226. and a.uuid = #{uuid}
  227. </if>
  228. <if test="cId !=null">
  229. and a.c_id = #{cId}
  230. </if>
  231. <if test="cTime !=null">
  232. and a.c_time = #{cTime}
  233. </if>
  234. <if test="uId !=null">
  235. and a.u_id = #{uId}
  236. </if>
  237. <if test="uTime !=null">
  238. and a.u_time = #{uTime}
  239. </if>
  240. <if test="modelUuid !=null">
  241. and a.model_uuid = #{modelUuid}
  242. </if>
  243. <if test="recordNumber !=null">
  244. and a.record_number = #{recordNumber}
  245. </if>
  246. </where>
  247. <choose>
  248. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  249. ORDER BY ${page.orderBy}
  250. </when>
  251. <otherwise>
  252. </otherwise>
  253. </choose>
  254. </select>
  255. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  256. parameterType="cn.ourwill.module.house.entity.new_entity.RecordDeviceMachineNew">
  257. INSERT INTO record_device_machine_new
  258. <trim prefix="(" suffix=")" suffixOverrides=",">
  259. <if test=" id != null">
  260. id,
  261. </if>
  262. <if test="grainId !=null">
  263. grain_id ,
  264. </if>
  265. <if test="code !=null">
  266. code ,
  267. </if>
  268. <if test="repairTime !=null">
  269. repair_time ,
  270. </if>
  271. <if test="address !=null">
  272. address,
  273. </if>
  274. <if test="repairMethod !=null">
  275. repair_method ,
  276. </if>
  277. <if test="repairDebug !=null">
  278. repair_debug ,
  279. </if>
  280. <if test="repairUser !=null">
  281. repair_user ,
  282. </if>
  283. <if test="keepUser !=null">
  284. keep_user ,
  285. </if>
  286. <if test="chiefIdea !=null">
  287. chief_idea ,
  288. </if>
  289. <if test="deviceId !=null">
  290. device_id ,
  291. </if>
  292. <if test="uuid !=null">
  293. uuid ,
  294. </if>
  295. <if test="cId !=null">
  296. c_id ,
  297. </if>
  298. <if test="cTime !=null">
  299. c_time ,
  300. </if>
  301. <if test="uId !=null">
  302. u_id ,
  303. </if>
  304. <if test="uTime !=null">
  305. u_time ,
  306. </if>
  307. <if test="modelUuid !=null">
  308. model_uuid,
  309. </if>
  310. <if test="recordNumber !=null">
  311. record_number
  312. </if>
  313. </trim>
  314. <trim prefix="values (" suffix=")" suffixOverrides=",">
  315. <if test=" id != null">
  316. #{id}, </if>
  317. <if test="grainId !=null">
  318. #{grainId},
  319. </if>
  320. <if test="code !=null">
  321. #{code},
  322. </if>
  323. <if test="repairTime !=null">
  324. #{repairTime},
  325. </if>
  326. <if test="address !=null">
  327. #{address},
  328. </if>
  329. <if test="repairMethod !=null">
  330. #{repairMethod},
  331. </if>
  332. <if test="repairDebug !=null">
  333. #{repairDebug},
  334. </if>
  335. <if test="repairUser !=null">
  336. #{repairUser},
  337. </if>
  338. <if test="keepUser !=null">
  339. #{keepUser},
  340. </if>
  341. <if test="chiefIdea !=null">
  342. #{chiefIdea},
  343. </if>
  344. <if test="deviceId !=null">
  345. #{deviceId},
  346. </if>
  347. <if test="uuid !=null">
  348. #{uuid},
  349. </if>
  350. <if test="cId !=null">
  351. #{cId},
  352. </if>
  353. <if test="cTime !=null">
  354. #{cTime},
  355. </if>
  356. <if test="uId !=null">
  357. #{uId},
  358. </if>
  359. <if test="uTime !=null">
  360. #{uTime},
  361. </if>
  362. <if test="modelUuid !=null">
  363. #{modelUuid},
  364. </if>
  365. <if test="recordNumber !=null">
  366. #{recordNumber}
  367. </if>
  368. </trim>
  369. </insert>
  370. <update id="update" parameterType="cn.ourwill.module.house.entity.new_entity.RecordDeviceMachineNew">
  371. UPDATE record_device_machine_new <set>
  372. <if test="id != null">
  373. id= #{id} ,
  374. </if>
  375. <if test="grainId !=null">
  376. grain_id = #{grainId},
  377. </if>
  378. <if test="code !=null">
  379. code = #{code},
  380. </if>
  381. <if test="repairTime !=null">
  382. repair_time = #{repairTime},
  383. </if>
  384. <if test="address !=null">
  385. address = #{address},
  386. </if>
  387. <if test="repairMethod !=null">
  388. repair_method = #{repairMethod},
  389. </if>
  390. <if test="repairDebug !=null">
  391. repair_debug = #{repairDebug},
  392. </if>
  393. <if test="repairUser !=null">
  394. repair_user = #{repairUser},
  395. </if>
  396. <if test="keepUser !=null">
  397. keep_user = #{keepUser},
  398. </if>
  399. <if test="chiefIdea !=null">
  400. chief_idea = #{chiefIdea},
  401. </if>
  402. <if test="deviceId !=null">
  403. device_id = #{deviceId},
  404. </if>
  405. <if test="uuid !=null">
  406. uuid = #{uuid},
  407. </if>
  408. <if test="cId !=null">
  409. c_id = #{cId},
  410. </if>
  411. <if test="cTime !=null">
  412. c_time = #{cTime},
  413. </if>
  414. <if test="uId !=null">
  415. u_id = #{uId},
  416. </if>
  417. <if test="uTime !=null">
  418. u_time = #{uTime},
  419. </if>
  420. <if test="modelUuid !=null">
  421. model_uuid = #{modelUuid}
  422. </if>
  423. <if test="recordNumber !=null">
  424. record_number = #{recordNumber}
  425. </if>
  426. </set>
  427. WHERE id = #{id}
  428. </update>
  429. <delete id="deleteById" parameterType="java.lang.Long">
  430. DELETE FROM record_device_machine_new WHERE id = #{id}
  431. </delete>
  432. <delete id="deleteByIds" parameterType="java.util.List">
  433. DELETE FROM record_device_machine_new WHERE id IN
  434. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  435. #{item}
  436. </foreach>
  437. </delete>
  438. </mapper>