DailyRecordTransferDao.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  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.daily.DailyRecordTransferDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordTransfer" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="house_name" property="houseName"/>
  7. <result column="house_id" property="houseId"/>
  8. <result column="house_property" property="houseProperty"/>
  9. <result column="grain_name" property="grainName"/>
  10. <result column="trans_time" property="transTime"/>
  11. <result column="trans_user" property="transUser"/>
  12. <result column="receive_user" property="receiveUser"/>
  13. <result column="superior_user" property="superiorUser"/>
  14. <result column="type" property="type"/>
  15. <result column="count" property="count"/>
  16. <result column="quality" property="quality"/>
  17. <result column="condition" property="condition"/>
  18. <result column="responsible_user" property="responsibleUser"/>
  19. <result column="remark" property="remark"/>
  20. <result column="c_id" property="cId"/>
  21. <result column="c_time" property="cTime"/>
  22. <result column="u_id" property="uId"/>
  23. <result column="u_time" property="uTime"/>
  24. <result column="version" property="version"/>
  25. <result column="pic" property="pic"/>
  26. <result column="location" property="location"/>
  27. <result column="run_time" property="runTime"/>
  28. <result column="receive_remark" property="receiveRemark"/>
  29. <result column="keeper" property="keeper"/>
  30. <result column="receive_num" property="receiveNum"/>
  31. </resultMap>
  32. <sql id="dailyRecordTransferColumns">
  33. id ,
  34. house_name ,
  35. house_id,
  36. house_property,
  37. grain_name ,
  38. trans_time ,
  39. trans_user ,
  40. receive_user ,
  41. superior_user ,
  42. `type`,
  43. `count`,
  44. quality ,
  45. `condition` ,
  46. responsible_user ,
  47. remark ,
  48. c_id ,
  49. c_time ,
  50. u_id ,
  51. u_time ,
  52. version ,
  53. pic,
  54. location,
  55. run_time,
  56. receive_remark,
  57. keeper,
  58. receive_num
  59. </sql>
  60. <sql id="dailyRecordTransferJoins">
  61. </sql>
  62. <select id="get" resultMap="baseMap" parameterType="java.lang.Long">
  63. SELECT
  64. <include refid="dailyRecordTransferColumns"/>
  65. FROM daily_record_transfer
  66. <!--<include refid="dailyRecordTransferJoins"/>-->
  67. WHERE id = #{id}
  68. </select>
  69. <select id="getByUuid" resultMap="baseMap">
  70. SELECT
  71. <include refid="dailyRecordTransferColumns"/>
  72. FROM daily_record_transfer a
  73. WHERE a.uuid = #{uuid}
  74. </select>
  75. <select id="findNoUuidList" resultMap="baseMap">
  76. SELECT
  77. <include refid="dailyRecordTransferColumns"/>
  78. FROM daily_record_transfer a
  79. WHERE a.uuid is null or trim(a.uuid) = '';
  80. </select>
  81. <select id="findList" resultMap="baseMap">
  82. SELECT
  83. <include refid="dailyRecordTransferColumns"/>
  84. FROM daily_record_transfer a
  85. <include refid="dailyRecordTransferJoins"/>
  86. <where>
  87. <if test="id !=null">
  88. and id = #{id}
  89. </if>
  90. <if test="houseName !=null">
  91. and house_name = #{houseName}
  92. </if>
  93. <if test="houseId !=null">
  94. and house_id = #{houseId}
  95. </if>
  96. <if test="houseName !=null">
  97. and house_property = #{houseProperty}
  98. </if>
  99. <if test="grainName !=null">
  100. and grain_name = #{grainName}
  101. </if>
  102. <if test="transTime !=null">
  103. and trans_time = #{transTime}
  104. </if>
  105. <if test="transUser !=null">
  106. and trans_user = #{transUser}
  107. </if>
  108. <if test="receiveUser !=null">
  109. and receive_user = #{receiveUser}
  110. </if>
  111. <if test="superiorUser !=null">
  112. and superior_user = #{superiorUser}
  113. </if>
  114. <if test="type !=null">
  115. and type = #{type}
  116. </if>
  117. <if test="count !=null">
  118. and count = #{count}
  119. </if>
  120. <if test="quality !=null">
  121. and quality = #{quality}
  122. </if>
  123. <if test="condition !=null">
  124. and condition = #{condition}
  125. </if>
  126. <if test="responsibleUser !=null">
  127. and responsible_user = #{responsibleUser}
  128. </if>
  129. <if test="remark !=null">
  130. and remark = #{remark}
  131. </if>
  132. <!--<if test="searchStartDate!=null and searchEndDate !=null ">-->
  133. <!--and trans_time BETWEEN #{searchStartDate} AND #{searchEndDate}-->
  134. <!--</if>-->
  135. <if test="searchStartDate !=null ">
  136. and trans_time &gt;= #{searchStartDate}
  137. </if>
  138. <if test=" searchEndDate !=null ">
  139. and trans_time &lt;= #{searchEndDate}
  140. </if>
  141. </where>
  142. order by id desc
  143. </select>
  144. <select id="findAllList" resultMap="baseMap">
  145. SELECT
  146. <include refid="dailyRecordTransferColumns"/>
  147. FROM daily_record_transfer a
  148. <include refid="dailyRecordTransferJoins"/>
  149. <where>
  150. <if test="id !=null">
  151. and id = #{id}
  152. </if>
  153. <if test="houseName !=null">
  154. and house_name = #{houseName}
  155. </if>
  156. <if test="houseId !=null">
  157. and house_id = #{houseId}
  158. </if>
  159. <if test="houseProperty !=null">
  160. and house_property = #{houseProperty}
  161. </if>
  162. <if test="grainName !=null">
  163. and grain_name = #{grainName}
  164. </if>
  165. <if test="transTime !=null">
  166. and trans_time = #{transTime}
  167. </if>
  168. <if test="transUser !=null">
  169. and trans_user = #{transUser}
  170. </if>
  171. <if test="receiveUser !=null">
  172. and receive_user = #{receiveUser}
  173. </if>
  174. <if test="superiorUser !=null">
  175. and superior_user = #{superiorUser}
  176. </if>
  177. <if test="type !=null">
  178. and type = #{type}
  179. </if>
  180. <if test="count !=null">
  181. and count = #{count}
  182. </if>
  183. <if test="quality !=null">
  184. and quality = #{quality}
  185. </if>
  186. <if test="condition !=null">
  187. and condition = #{condition}
  188. </if>
  189. <if test="responsibleUser !=null">
  190. and responsible_user = #{responsibleUser}
  191. </if>
  192. <if test="remark !=null">
  193. and remark = #{remark}
  194. </if>
  195. <!--<if test="cId !=null">-->
  196. <!--and c_id = #{cId}-->
  197. <!--</if>-->
  198. <!--<if test="cTime !=null">-->
  199. <!--and c_time = #{cTime}-->
  200. <!--</if>-->
  201. <!--<if test="uId !=null">-->
  202. <!--and u_id = #{uId}-->
  203. <!--</if>-->
  204. <!--<if test="uTime !=null">-->
  205. <!--and u_time = #{uTime}-->
  206. <!--</if>-->
  207. <!--<if test="version !=null">-->
  208. <!--and version = #{version}-->
  209. <!--</if>-->
  210. </where>
  211. <choose>
  212. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  213. ORDER BY ${page.orderBy}
  214. </when>
  215. <otherwise>
  216. </otherwise>
  217. </choose>
  218. </select>
  219. <select id="exportExcel" resultMap="baseMap">
  220. select
  221. <include refid="dailyRecordTransferColumns"/>
  222. from daily_record_transfer order by c_time
  223. </select>
  224. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
  225. INSERT INTO daily_record_transfer
  226. <trim prefix="(" suffix=")" suffixOverrides=",">
  227. <if test=" id != null">
  228. id,
  229. </if>
  230. <if test=" uuid != null">
  231. uuid,
  232. </if>
  233. <if test=" houseName != null">
  234. house_name,
  235. </if>
  236. <if test=" houseId != null">
  237. house_id,
  238. </if>
  239. <if test=" houseProperty != null">
  240. house_property,
  241. </if>
  242. <if test=" grainName != null">
  243. grain_name,
  244. </if>
  245. <if test=" transTime != null">
  246. trans_time,
  247. </if>
  248. <if test=" transUser != null">
  249. trans_user,
  250. </if>
  251. <if test=" receiveUser != null">
  252. receive_user,
  253. </if>
  254. <if test=" superiorUser != null">
  255. superior_user,
  256. </if>
  257. <if test=" type != null">
  258. `type`,
  259. </if>
  260. <if test=" count != null">
  261. `count`,
  262. </if>
  263. <if test=" quality != null">
  264. quality,
  265. </if>
  266. <if test=" condition != null">
  267. `condition`,
  268. </if>
  269. <if test=" responsibleUser != null">
  270. responsible_user,
  271. </if>
  272. <if test=" remark != null">
  273. remark,
  274. </if>
  275. <if test=" cId != null">
  276. c_id,
  277. </if>
  278. c_time,
  279. <if test=" uId != null">
  280. u_id,
  281. </if>
  282. <if test=" uTime != null">
  283. u_time,
  284. </if>
  285. <if test=" version != null">
  286. version,
  287. </if>
  288. <if test=" pic != null">
  289. pic,
  290. </if>
  291. <if test=" location != null">
  292. location,
  293. </if>
  294. <if test=" runTime != null">
  295. run_time,
  296. </if>
  297. <if test=" receiveRemark != null">
  298. receive_remark,
  299. </if>
  300. <if test=" keeper != null">
  301. keeper,
  302. </if>
  303. <if test=" receiveNum != null">
  304. receive_num
  305. </if>
  306. </trim>
  307. <trim prefix="values (" suffix=")" suffixOverrides=",">
  308. <if test=" id != null">
  309. #{id},
  310. </if>
  311. <if test=" uuid != null">
  312. #{uuid},
  313. </if>
  314. <if test=" houseName != null">
  315. #{houseName},
  316. </if>
  317. <if test=" houseId != null">
  318. #{houseId},
  319. </if>
  320. <if test=" houseProperty != null">
  321. #{houseProperty},
  322. </if>
  323. <if test=" grainName != null">
  324. #{grainName},
  325. </if>
  326. <if test=" transTime != null">
  327. #{transTime},
  328. </if>
  329. <if test=" transUser != null">
  330. #{transUser},
  331. </if>
  332. <if test=" receiveUser != null">
  333. #{receiveUser},
  334. </if>
  335. <if test=" superiorUser != null">
  336. #{superiorUser},
  337. </if>
  338. <if test=" type != null">
  339. #{type},
  340. </if>
  341. <if test=" count != null">
  342. #{count},
  343. </if>
  344. <if test=" quality != null">
  345. #{quality},
  346. </if>
  347. <if test=" condition != null">
  348. #{condition},
  349. </if>
  350. <if test=" responsibleUser != null">
  351. #{responsibleUser},
  352. </if>
  353. <if test=" remark != null">
  354. #{remark},
  355. </if>
  356. <if test=" cId != null">
  357. #{cId},
  358. </if>
  359. now(),
  360. <if test=" uId != null">
  361. #{uId},
  362. </if>
  363. <if test=" uTime != null">
  364. #{uTime},
  365. </if>
  366. <if test=" version != null">
  367. #{version},
  368. </if>
  369. <if test=" pic != null">
  370. #{pic},
  371. </if>
  372. <if test=" location != null">
  373. #{location},
  374. </if>
  375. <if test=" runTime != null">
  376. #{runTime},
  377. </if>
  378. <if test=" receiveRemark != null">
  379. #{receiveRemark},
  380. </if>
  381. <if test=" keeper != null">
  382. #{keeper},
  383. </if>
  384. <if test=" receiveNum != null">
  385. #{receiveNum}
  386. </if>
  387. </trim>
  388. </insert>
  389. <update id="update" >
  390. UPDATE daily_record_transfer
  391. <set>
  392. <if test="uuid !=null">
  393. uuid = #{uuid},
  394. </if>
  395. <if test="houseName !=null">
  396. house_name = #{houseName},
  397. </if>
  398. <if test="houseId !=null">
  399. house_id = #{houseId},
  400. </if>
  401. <if test="houseProperty !=null">
  402. house_property = #{houseProperty},
  403. </if>
  404. <if test="grainName !=null">
  405. grain_name = #{grainName},
  406. </if>
  407. <if test="transTime !=null">
  408. trans_time = #{transTime},
  409. </if>
  410. <if test="transUser !=null">
  411. trans_user = #{transUser},
  412. </if>
  413. <if test="receiveUser !=null">
  414. receive_user = #{receiveUser},
  415. </if>
  416. <if test="superiorUser !=null">
  417. superior_user = #{superiorUser},
  418. </if>
  419. <if test="type !=null">
  420. type = #{type},
  421. </if>
  422. <if test="count !=null">
  423. count = #{count},
  424. </if>
  425. <if test="quality !=null">
  426. quality = #{quality},
  427. </if>
  428. <if test="condition !=null">
  429. `condition` = #{condition},
  430. </if>
  431. <if test="responsibleUser !=null">
  432. responsible_user = #{responsibleUser},
  433. </if>
  434. <if test="remark !=null">
  435. remark = #{remark},
  436. </if>
  437. <if test="cId !=null">
  438. c_id = #{cId},
  439. </if>
  440. <if test="cTime !=null">
  441. c_time = #{cTime},
  442. </if>
  443. <if test="uId !=null">
  444. u_id = #{uId},
  445. </if>
  446. <if test="uTime !=null">
  447. u_time = #{uTime},
  448. </if>
  449. <if test="version !=null">
  450. version = #{version},
  451. </if>
  452. <if test=" pic != null">
  453. pic = #{pic},
  454. </if>
  455. <if test=" location != null">
  456. location = #{location},
  457. </if>
  458. <if test=" runTime != null">
  459. run_time = #{runTime},
  460. </if>
  461. <if test=" receiveRemark != null">
  462. receive_remark = #{receiveRemark},
  463. </if>
  464. <if test=" keeper != null">
  465. keeper = #{keeper},
  466. </if>
  467. <if test=" receiveNum != null">
  468. receive_num = #{receiveNum}
  469. </if>
  470. </set>
  471. WHERE id = #{id}
  472. </update>
  473. <update id="updateByHouseId" >
  474. UPDATE daily_record_transfer
  475. <set>
  476. <!--<if test="uuid !=null">
  477. uuid = #{uuid},
  478. </if>
  479. <if test="houseName !=null">
  480. house_name = #{houseName},
  481. </if>
  482. <if test="houseId !=null">
  483. house_id = #{houseId},
  484. </if>
  485. <if test="houseProperty !=null">
  486. house_property = #{houseProperty},
  487. </if>
  488. <if test="grainName !=null">
  489. grain_name = #{grainName},
  490. </if>
  491. <if test="transTime !=null">
  492. trans_time = #{transTime},
  493. </if>
  494. <if test="transUser !=null">
  495. trans_user = #{transUser},
  496. </if>
  497. <if test="receiveUser !=null">
  498. receive_user = #{receiveUser},
  499. </if>
  500. <if test="superiorUser !=null">
  501. superior_user = #{superiorUser},
  502. </if>
  503. <if test="type !=null">
  504. type = #{type},
  505. </if>
  506. <if test="count !=null">
  507. count = #{count},
  508. </if>
  509. <if test="quality !=null">
  510. quality = #{quality},
  511. </if>
  512. <if test="condition !=null">
  513. `condition` = #{condition},
  514. </if>
  515. <if test="remark !=null">
  516. remark = #{remark},
  517. </if>
  518. <if test="cId !=null">
  519. c_id = #{cId},
  520. </if>
  521. <if test="cTime !=null">
  522. c_time = #{cTime},
  523. </if>
  524. <if test="uId !=null">
  525. u_id = #{uId},
  526. </if>
  527. <if test="uTime !=null">
  528. u_time = #{uTime},
  529. </if>
  530. <if test="version !=null">
  531. version = #{version},
  532. </if>
  533. <if test=" pic != null">
  534. pic = #{pic},
  535. </if>
  536. <if test=" receiveRemark != null">
  537. receive_remark = #{receiveRemark},
  538. </if>
  539. <if test=" receiveNum != null">
  540. receive_num = #{receiveNum}
  541. </if>-->
  542. <if test=" location != null">
  543. location = #{location},
  544. </if>
  545. <if test=" runTime != null">
  546. run_time = #{runTime},
  547. </if>
  548. <if test=" keeper != null">
  549. keeper = #{keeper},
  550. </if>
  551. <if test="responsibleUser !=null">
  552. responsible_user = #{responsibleUser}
  553. </if>
  554. </set>
  555. WHERE house_id = #{houseId} and id = #{id}
  556. </update>
  557. <update id="updateByUuid" >
  558. UPDATE daily_record_transfer
  559. <set>
  560. <if test="houseName !=null">
  561. house_name = #{houseName},
  562. </if>
  563. <if test="houseId !=null">
  564. house_id = #{houseId},
  565. </if>
  566. <if test="houseProperty !=null">
  567. house_property = #{houseProperty},
  568. </if>
  569. <if test="grainName !=null">
  570. grain_name = #{grainName},
  571. </if>
  572. <if test="transTime !=null">
  573. trans_time = #{transTime},
  574. </if>
  575. <if test="transUser !=null">
  576. trans_user = #{transUser},
  577. </if>
  578. <if test="receiveUser !=null">
  579. receive_user = #{receiveUser},
  580. </if>
  581. <if test="superiorUser !=null">
  582. superior_user = #{superiorUser},
  583. </if>
  584. <if test="type !=null">
  585. type = #{type},
  586. </if>
  587. <if test="count !=null">
  588. count = #{count},
  589. </if>
  590. <if test="quality !=null">
  591. quality = #{quality},
  592. </if>
  593. <if test="condition !=null">
  594. `condition` = #{condition},
  595. </if>
  596. <if test="responsibleUser !=null">
  597. responsible_user = #{responsibleUser},
  598. </if>
  599. <if test="remark !=null">
  600. remark = #{remark},
  601. </if>
  602. <if test="cId !=null">
  603. c_id = #{cId},
  604. </if>
  605. <if test="cTime !=null">
  606. c_time = #{cTime},
  607. </if>
  608. <if test="uId !=null">
  609. u_id = #{uId},
  610. </if>
  611. <if test="uTime !=null">
  612. u_time = #{uTime},
  613. </if>
  614. <if test="version !=null">
  615. version = #{version},
  616. </if>
  617. <if test=" pic != null">
  618. pic = #{pic},
  619. </if>
  620. <if test=" location != null">
  621. location = #{location},
  622. </if>
  623. <if test=" runTime != null">
  624. run_time = #{runTime},
  625. </if>
  626. <if test=" receiveRemark != null">
  627. receive_remark = #{receiveRemark},
  628. </if>
  629. <if test=" keeper != null">
  630. keeper = #{keeper},
  631. </if>
  632. <if test=" receiveNum != null">
  633. receive_num = #{receiveNum}
  634. </if>
  635. </set>
  636. WHERE uuid = #{uuid}
  637. </update>
  638. <delete id="deleteById" parameterType="java.lang.Long">
  639. DELETE FROM daily_record_transfer
  640. WHERE id = #{id}
  641. </delete>
  642. <delete id="deleteByIds" parameterType="java.util.List">
  643. DELETE FROM daily_record_transfer WHERE id IN
  644. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  645. #{item}
  646. </foreach>
  647. </delete>
  648. <!--todo move-->
  649. <select id="prepareAdd" parameterType="long" resultType="cn.ourwill.module.house.entity.house.Add">
  650. SELECT DISTINCT
  651. gb.`name` AS grainName,
  652. house_info.house_name AS houseName,
  653. dd.`name` AS type
  654. FROM
  655. house_grain gb
  656. LEFT JOIN house_info ON gb.id = house_info.grain_id
  657. LEFT JOIN sys_dic_data dd ON house_info.type = dd.id
  658. WHERE house_info.id = #{value}
  659. </select>
  660. <select id="findByHouseIdNoPage" resultMap="baseMap">
  661. SELECT *
  662. FROM daily_record_transfer
  663. where house_id=#{houseId}
  664. <if test="cTime != null">
  665. AND trans_time <![CDATA[ <= ]]> #{cTime}
  666. </if>
  667. </select>
  668. <select id="findPdfList" resultMap="baseMap">
  669. SELECT *
  670. FROM daily_record_transfer
  671. <where>
  672. <if test="houseId !=null">
  673. and house_id = #{houseId}
  674. </if>
  675. <if test="cTime != null">
  676. and c_time like CONCAT('%',#{cTime},'%')
  677. </if>
  678. </where>
  679. order by id desc limit #{num},#{size}
  680. </select>
  681. <delete id="deleteTransferByHouseId">
  682. DELETE FROM daily_record_transfer
  683. WHERE house_id = #{houseId}
  684. <if test="cTime != null">
  685. AND trans_time <![CDATA[ <= ]]> #{cTime}
  686. </if>
  687. </delete>
  688. </mapper>