RecordMedicineCheckNewDao.xml 14 KB

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