MedicineInputDao.xml 14 KB

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