DmDeviceSpotNewDao.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  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.DmDeviceSpotNewDao" >
  4. <resultMap type="cn.ourwill.module.house.entity.new_entity.DmDeviceSpotNew" id="baseMap">
  5. <id column="id" property="id" />
  6. <result column="grain_id" property="grainId" />
  7. <result column="spot_date" property="spotDate" />
  8. <result column="spot_user" property="spotUser"/>
  9. <result column="spot_remark" property="spotRemark" />
  10. <result column="spot_idea" property="spotIdea"/>
  11. <result column="depart_idea" property="departIdea" />
  12. <result column="depart_state" property="departState" />
  13. <result column="sate" property="sate"/>
  14. <result column="uuid" property="uuid" />
  15. <result column="c_id" property="cId" />
  16. <result column="c_time" property="cTime" />
  17. <result column="u_id" property="uId" />
  18. <result column="u_time" property="uTime" />
  19. <result column="model_uuid" property="modelUuid" />
  20. <result column="content_point_one" property="contentPointOne" />
  21. <result column="content_point_two" property="contentPointTwo" />
  22. <result column="content_point_three" property="contentPointThree" />
  23. <result column="inspection_result_one" property="inspectionResultOne" />
  24. <result column="inspection_result_two" property="inspectionResultTwo" />
  25. <result column="inspection_result_three" property="inspectionResultThree" />
  26. <result column="processing_opinion_one" property="processingOpinionOne" />
  27. <result column="processing_opinion_two" property="processingOpinionTwo" />
  28. <result column="processing_opinion_three" property="processingOpinionThree" />
  29. <result column="device_id" property="deviceId" />
  30. </resultMap>
  31. <resultMap type="cn.ourwill.module.house.entity.dm.Device" id="mapOfFind" extends="baseMap">
  32. <result column="name" property="grainName"/>
  33. <result column="device_name" property="deviceName"/>
  34. <result column="device_model" property="deviceModel"/>
  35. <result column="device_no" property="deviceNo"/>
  36. <result column="asset_number" property="assetNumber"/>
  37. </resultMap>
  38. <sql id="columns">
  39. a.id,
  40. a.spot_date,
  41. a.spot_user,
  42. a.spot_remark,
  43. a.spot_idea,
  44. a.depart_idea,
  45. a.depart_state,
  46. a.sate,
  47. a.uuid,
  48. a.model_uuid,
  49. a.content_point_one,
  50. a.content_point_two,
  51. a.content_point_three,
  52. a.inspection_result_one,
  53. a.inspection_result_two,
  54. a.inspection_result_three,
  55. a.processing_opinion_one,
  56. a.processing_opinion_two,
  57. a.processing_opinion_three,
  58. a.device_id,
  59. a.grain_id
  60. </sql>
  61. <sql id = "columsOfFindd">
  62. sg.name AS grainName,
  63. /*ddm.grain_id,
  64. ddm.device_name,
  65. ddm.device_model,
  66. ddm.device_manager ,
  67. ddm.collator,
  68. dd.device_no,
  69. dd.asset_number,*/
  70. </sql>
  71. <sql id="joinCols">
  72. </sql>
  73. <select id="get" resultMap="baseMap">
  74. SELECT
  75. <include refid="columsOfFindd"/>
  76. <include refid="columns"/>
  77. FROM dm_device_spot_new a
  78. LEFT JOIN sys_grain sg ON sg.id = a.grain_id
  79. <include refid="joinCols"/>
  80. WHERE a.id = #{id}
  81. </select>
  82. <!--<select id="getByUuid" resultMap="baseMap">
  83. SELECT
  84. <include refid="columns"/>
  85. FROM dm_device_spot_new a
  86. <include refid="joinCols"/>
  87. WHERE a.uuid = #{uuid}
  88. </select>-->
  89. <select id="findList" resultMap="baseMap">
  90. SELECT
  91. <include refid="columsOfFindd"/>
  92. <include refid="columns"/>
  93. FROM dm_device_spot_new a
  94. /*LEFT JOIN dm_device_model ddm ON a.model_uuid = ddm.uuid
  95. LEFT JOIN dm_device dd ON a.device_id = dd.id*/
  96. LEFT JOIN sys_grain sg ON sg.id = a.grain_id
  97. <include refid="joinCols"/>
  98. <where>
  99. <if test="id !=null">
  100. and a.id = #{id}
  101. </if>
  102. <if test="grainId !=null">
  103. and a.grain_id = #{grainId}
  104. </if>
  105. <if test="grainName !=null">
  106. and sg.name = #{grainName}
  107. </if>
  108. <!--<if test="deviceName !=null">
  109. and ddm.device_name = #{deviceName}
  110. </if>
  111. <if test="deviceModel !=null">
  112. and ddm.device_model = #{deviceModel}
  113. </if>
  114. <if test="assetNumber !=null">
  115. and dd.asset_number = #{assetNumber}
  116. </if>
  117. <if test="deviceNo !=null">
  118. and dd.device_no = #{deviceNo}
  119. </if>-->
  120. <if test="spotDate !=null">
  121. and a.spot_date = #{spotDate}
  122. </if>
  123. <if test="spotUser !=null">
  124. and a.spot_user = #{spotUser}
  125. </if>
  126. <if test="spotDate !=null">
  127. and a.spot_date = #{spotDate}
  128. </if>
  129. <if test="spotRemark !=null">
  130. and a.spot_remark = #{spotRemark}
  131. </if>
  132. <if test="spotIdea !=null">
  133. and a.spot_idea = #{spotIdea}
  134. </if>
  135. <if test="departIdea !=null">
  136. and a.depart_idea = #{departIdea}
  137. </if>
  138. <if test="departState !=null">
  139. and a.depart_state = #{departState}
  140. </if>
  141. <if test="sate !=null">
  142. and a.sate = #{sate}
  143. </if>
  144. <if test="uuid !=null">
  145. and a.uuid = #{uuid}
  146. </if>
  147. <if test="cId !=null">
  148. and a.c_id = #{cId}
  149. </if>
  150. <if test="cTime !=null">
  151. and a.c_time = #{cTime}
  152. </if>
  153. <if test="uId !=null">
  154. and a.u_id = #{uId}
  155. </if>
  156. <if test="uTime !=null">
  157. and a.u_time = #{uTime}
  158. </if>
  159. <if test="modelUuid !=null">
  160. and a.model_uuid = #{modelUuid}
  161. </if>
  162. <if test="contentPointOne !=null">
  163. and a.content_point_one = #{contentPointOne}
  164. </if>
  165. <if test="contentPointTwo !=null">
  166. and a.content_point_two = #{contentPointTwo}
  167. </if>
  168. <if test="contentPointThree !=null">
  169. and a.content_point_three = #{contentPointThree}
  170. </if>
  171. <if test="inspectionResultOne !=null">
  172. and a.inspection_result_one = #{inspectionResultOne}
  173. </if>
  174. <if test="inspectionResultTwo !=null">
  175. and a.inspection_result_two = #{inspectionResultTwo}
  176. </if>
  177. <if test="inspectionResultThree !=null">
  178. and a.inspection_result_three = #{inspectionResultThree}
  179. </if>
  180. <if test="processingOpinionOne !=null">
  181. and a.processing_opinion_one = #{processingOpinionOne}
  182. </if>
  183. <if test="processingOpinionTwo !=null">
  184. and a.processing_opinion_two = #{processingOpinionTwo}
  185. </if>
  186. <if test="processingOpinionThree !=null">
  187. and a.processing_opinion_three = #{processingOpinionThree}
  188. </if>
  189. <if test="deviceId !=null">
  190. and a.device_id = #{deviceId}
  191. </if>
  192. </where>
  193. <choose>
  194. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  195. ORDER BY ${page.orderBy}
  196. </when>
  197. <otherwise>
  198. </otherwise>
  199. </choose>
  200. </select>
  201. <select id="findAllList" resultMap="mapOfFind">
  202. SELECT
  203. <include refid="columsOfFindd"/>
  204. <include refid="columns"/>
  205. FROM dm_device_spot_new a
  206. LEFT JOIN dm_device_model ddm ON a.model_uuid = ddm.uuid
  207. LEFT JOIN dm_device dd ON a.device_id = dd.id
  208. LEFT JOIN sys_grain sg ON sg.id = ddm.grain_id
  209. <include refid="joinCols"/>
  210. <where>
  211. <if test="id !=null">
  212. and a.id = #{id}
  213. </if>
  214. <if test="grainId !=null">
  215. and a.grain_id = #{grainId}
  216. </if>
  217. <if test="grainName !=null">
  218. and sg.name = #{grainName}
  219. </if>
  220. <if test="deviceName !=null">
  221. and ddm.device_name = #{deviceName}
  222. </if>
  223. <if test="deviceModel !=null">
  224. and ddm.device_model = #{deviceModel}
  225. </if>
  226. <if test="assetNumber !=null">
  227. and dd.asset_number = #{assetNumber}
  228. </if>
  229. <if test="deviceNo !=null">
  230. and dd.device_no = #{deviceNo}
  231. </if>
  232. <if test="spotDate !=null">
  233. and a.spot_date = #{spotDate}
  234. </if>
  235. <if test="spotUser !=null">
  236. and a.spot_user = #{spotUser}
  237. </if>
  238. <if test="spotRemark !=null">
  239. and a.spot_remark = #{spotRemark}
  240. </if>
  241. <if test="spotIdea !=null">
  242. and a.spot_idea = #{spotIdea}
  243. </if>
  244. <if test="departIdea !=null">
  245. and a.depart_idea = #{departIdea}
  246. </if>
  247. <if test="departState !=null">
  248. and a.depart_state = #{departState}
  249. </if>
  250. <if test="sate !=null">
  251. and a.sate = #{sate}
  252. </if>
  253. <if test="uuid !=null">
  254. and a.uuid = #{uuid}
  255. </if>
  256. <if test="cId !=null">
  257. and a.c_id = #{cId}
  258. </if>
  259. <if test="cTime !=null">
  260. and a.c_time = #{cTime}
  261. </if>
  262. <if test="uId !=null">
  263. and a.u_id = #{uId}
  264. </if>
  265. <if test="uTime !=null">
  266. and a.u_time = #{uTime}
  267. </if>
  268. <if test="modelUuid !=null">
  269. and a.model_uuid = #{modelUuid}
  270. </if>
  271. <if test="contentPointOne !=null">
  272. and a.content_point_one = #{contentPointOne}
  273. </if>
  274. <if test="contentPointTwo !=null">
  275. and a.content_point_two = #{contentPointTwo}
  276. </if>
  277. <if test="contentPointThree !=null">
  278. and a.content_point_three = #{contentPointThree}
  279. </if>
  280. <if test="inspectionResultOne !=null">
  281. and a.inspection_result_one = #{inspectionResultOne}
  282. </if>
  283. <if test="inspectionResultTwo !=null">
  284. and a.inspection_result_two = #{inspectionResultTwo}
  285. </if>
  286. <if test="inspectionResultThree !=null">
  287. and a.inspection_result_three = #{inspectionResultThree}
  288. </if>
  289. <if test="processingOpinionOne !=null">
  290. and a.processing_opinion_one = #{processingOpinionOne}
  291. </if>
  292. <if test="processingOpinionTwo !=null">
  293. and a.processing_opinion_two = #{processingOpinionTwo}
  294. </if>
  295. <if test="processingOpinionThree !=null">
  296. and a.processing_opinion_three = #{processingOpinionThree}
  297. </if>
  298. <if test="deviceId !=null">
  299. and a.device_id = #{deviceId}
  300. </if>
  301. </where>
  302. <choose>
  303. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  304. ORDER BY ${page.orderBy}
  305. </when>
  306. <otherwise>
  307. </otherwise>
  308. </choose>
  309. </select>
  310. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  311. parameterType="cn.ourwill.module.house.entity.new_entity.DmDeviceSpotNew">
  312. INSERT INTO dm_device_spot_new
  313. <trim prefix="(" suffix=")" suffixOverrides=",">
  314. <if test=" id != null">
  315. id,
  316. </if>
  317. <if test="grainId !=null">
  318. grain_id ,
  319. </if>
  320. <if test="spotDate !=null">
  321. spot_date ,
  322. </if>
  323. <if test="spotUser !=null">
  324. spot_user ,
  325. </if>
  326. <if test="spotRemark !=null">
  327. spot_remark ,
  328. </if>
  329. <if test="spotIdea !=null">
  330. spot_idea ,
  331. </if>
  332. <if test="departIdea !=null">
  333. depart_idea ,
  334. </if>
  335. <if test="departState !=null">
  336. depart_state,
  337. </if>
  338. <if test="sate !=null">
  339. sate ,
  340. </if>
  341. <if test="uuid !=null">
  342. uuid ,
  343. </if>
  344. <if test="cId !=null">
  345. c_id ,
  346. </if>
  347. <if test="cTime !=null">
  348. c_time ,
  349. </if>
  350. <if test="uId !=null">
  351. u_id ,
  352. </if>
  353. <if test="uTime !=null">
  354. u_time ,
  355. </if>
  356. <if test="modelUuid !=null">
  357. model_uuid ,
  358. </if>
  359. <if test="contentPointOne !=null">
  360. content_point_one ,
  361. </if>
  362. <if test="contentPointTwo !=null">
  363. content_point_two ,
  364. </if>
  365. <if test="contentPointThree !=null">
  366. content_point_three ,
  367. </if>
  368. <if test="inspectionResultOne !=null">
  369. inspection_result_one ,
  370. </if>
  371. <if test="inspectionResultTwo !=null">
  372. inspection_result_two ,
  373. </if>
  374. <if test="inspectionResultThree !=null">
  375. inspection_result_three ,
  376. </if>
  377. <if test="processingOpinionOne !=null">
  378. processing_opinion_one ,
  379. </if>
  380. <if test="processingOpinionTwo !=null">
  381. processing_opinion_two ,
  382. </if>
  383. <if test="processingOpinionThree !=null">
  384. processing_opinion_three,
  385. </if>
  386. <if test="deviceId !=null">
  387. device_id
  388. </if>
  389. </trim>
  390. <trim prefix="values (" suffix=")" suffixOverrides=",">
  391. <if test=" id != null">
  392. #{id}, </if>
  393. <if test="grainId !=null">
  394. #{grainId},
  395. </if>
  396. <if test="grainName !=null">
  397. #{grainName},
  398. </if>
  399. <if test="spotDate !=null">
  400. #{spotDate},
  401. </if>
  402. <if test="spotUser !=null">
  403. #{spotUser},
  404. </if>
  405. <if test="spotRemark !=null">
  406. #{spotRemark},
  407. </if>
  408. <if test="spotIdea !=null">
  409. #{spotIdea},
  410. </if>
  411. <if test="departIdea !=null">
  412. #{departIdea},
  413. </if>
  414. <if test="departState !=null">
  415. #{departState},
  416. </if>
  417. <if test="sate !=null">
  418. #{sate},
  419. </if>
  420. <if test="uuid !=null">
  421. #{uuid},
  422. </if>
  423. <if test="cId !=null">
  424. #{cId},
  425. </if>
  426. <if test="cTime !=null">
  427. #{cTime},
  428. </if>
  429. <if test="uId !=null">
  430. #{uId},
  431. </if>
  432. <if test="uTime !=null">
  433. #{uTime},
  434. </if>
  435. <if test="modelUuid !=null">
  436. #{modelUuid},
  437. </if>
  438. <if test="contentPointOne !=null">
  439. #{contentPointOne},
  440. </if>
  441. <if test="contentPointTwo !=null">
  442. #{contentPointTwo},
  443. </if>
  444. <if test="contentPointThree !=null">
  445. #{contentPointThree},
  446. </if>
  447. <if test="inspectionResultOne !=null">
  448. #{inspectionResultOne},
  449. </if>
  450. <if test="inspectionResultTwo !=null">
  451. #{inspectionResultTwo},
  452. </if>
  453. <if test="inspectionResultThree !=null">
  454. #{inspectionResultThree},
  455. </if>
  456. <if test="processingOpinionOne !=null">
  457. #{processingOpinionOne},
  458. </if>
  459. <if test="processingOpinionTwo !=null">
  460. #{processingOpinionTwo},
  461. </if>
  462. <if test="processingOpinionThree !=null">
  463. #{processingOpinionThree},
  464. </if>
  465. <if test="deviceId !=null">
  466. #{deviceId}
  467. </if>
  468. </trim>
  469. </insert>
  470. <update id="update" parameterType="cn.ourwill.module.house.entity.new_entity.DmDeviceSpotNew">
  471. UPDATE dm_device_spot_new <set>
  472. <if test="id != null">
  473. id= #{id} ,
  474. </if>
  475. <if test="grainId !=null">
  476. grain_id = #{grainId},
  477. </if>
  478. <if test="spotDate !=null">
  479. spot_date = #{spotDate},
  480. </if>
  481. <if test="spotUser !=null">
  482. spot_user = #{spotUser},
  483. </if>
  484. <if test="spotRemark !=null">
  485. spot_remark = #{spotRemark},
  486. </if>
  487. <if test="spotIdea !=null">
  488. spot_idea = #{spotIdea},
  489. </if>
  490. <if test="departIdea !=null">
  491. depart_idea = #{departIdea},
  492. </if>
  493. <if test="departState !=null">
  494. depart_state = #{departState},
  495. </if>
  496. <if test="sate !=null">
  497. sate = #{sate},
  498. </if>
  499. <if test="uuid !=null">
  500. uuid = #{uuid},
  501. </if>
  502. <if test="cId !=null">
  503. c_id = #{cId},
  504. </if>
  505. <if test="cTime !=null">
  506. c_time = #{cTime},
  507. </if>
  508. <if test="uId !=null">
  509. u_id = #{uId},
  510. </if>
  511. <if test="uTime !=null">
  512. u_time = #{uTime},
  513. </if>
  514. <if test="modelUuid !=null">
  515. model_uuid = #{modelUuid},
  516. </if>
  517. <if test="contentPointOne !=null">
  518. content_point_one = #{contentPointOne},
  519. </if>
  520. <if test="contentPointTwo !=null">
  521. content_point_two = #{contentPointTwo},
  522. </if>
  523. <if test="contentPointThree !=null">
  524. content_point_three = #{contentPointThree},
  525. </if>
  526. <if test="inspectionResultOne !=null">
  527. inspection_result_one = #{inspectionResultOne},
  528. </if>
  529. <if test="inspectionResultTwo !=null">
  530. inspection_result_two = #{inspectionResultTwo},
  531. </if>
  532. <if test="inspectionResultThree !=null">
  533. inspection_result_three = #{inspectionResultThree},
  534. </if>
  535. <if test="processingOpinionOne !=null">
  536. processing_opinion_one = #{processingOpinionOne},
  537. </if>
  538. <if test="processingOpinionTwo !=null">
  539. processing_opinion_two = #{processingOpinionTwo},
  540. </if>
  541. <if test="processingOpinionThree !=null">
  542. processing_opinion_three = #{processingOpinionThree}
  543. </if>
  544. <if test="deviceId !=null">
  545. device_id = #{deviceId}
  546. </if>
  547. </set>
  548. WHERE id = #{id}
  549. </update>
  550. <delete id="deleteById" parameterType="java.lang.Long">
  551. DELETE FROM dm_device_spot_new WHERE id = #{id}
  552. </delete>
  553. <delete id="deleteByIds" parameterType="java.util.List">
  554. DELETE FROM dm_device_spot_new WHERE id IN
  555. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  556. #{item}
  557. </foreach>
  558. </delete>
  559. </mapper>