RecordMedicineInoutputDao.xml 21 KB

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