EmsProdplanRoundWeightMapper.xml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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="com.steerinfo.ems.emsprodplanroundweight.mapper.EmsProdplanRoundWeightMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
  5. <id column="FID" jdbcType="VARCHAR" property="fid" />
  6. <result column="PRODATE" jdbcType="VARCHAR" property="prodate" />
  7. <result column="MATERIALCODE" jdbcType="VARCHAR" property="materialcode" />
  8. <result column="MATERIALNAME" jdbcType="VARCHAR" property="materialname" />
  9. <result column="QTY" jdbcType="DECIMAL" property="qty" />
  10. <result column="UNIT" jdbcType="VARCHAR" property="unit" />
  11. <result column="LC_ID" jdbcType="VARCHAR" property="lcId" />
  12. </resultMap>
  13. <sql id="columns">
  14. FID, PRODATE, MATERIALCODE, MATERIALNAME, QTY, UNIT, LC_ID
  15. </sql>
  16. <sql id="columns_alias">
  17. t.FID, t.PRODATE, t.MATERIALCODE, t.MATERIALNAME, t.QTY, t.UNIT, t.LC_ID
  18. </sql>
  19. <sql id="select">
  20. SELECT <include refid="columns"/> FROM EMS_PRODPLAN_ROUND_WEIGHT
  21. </sql>
  22. <sql id="select_alias">
  23. SELECT <include refid="columns_alias"/> FROM EMS_PRODPLAN_ROUND_WEIGHT t
  24. </sql>
  25. <sql id="where">
  26. <where>
  27. <if test="fid != null and fid != ''">
  28. and FID = #{fid}
  29. </if>
  30. <if test="prodate != null and prodate != ''">
  31. and PRODATE = #{prodate}
  32. </if>
  33. <if test="materialcode != null and materialcode != ''">
  34. and MATERIALCODE = #{materialcode}
  35. </if>
  36. <if test="materialname != null and materialname != ''">
  37. and MATERIALNAME = #{materialname}
  38. </if>
  39. <if test="qty != null">
  40. and QTY = #{qty}
  41. </if>
  42. <if test="unit != null and unit != ''">
  43. and UNIT = #{unit}
  44. </if>
  45. <if test="lcId != null and lcId != ''">
  46. and LC_ID = #{lcId}
  47. </if>
  48. </where>
  49. </sql>
  50. <sql id="whereLike">
  51. <where>
  52. <if test="fid != null and fid != ''">
  53. and FID LIKE '%${fid}%'
  54. </if>
  55. <if test="prodate != null and prodate != ''">
  56. and PRODATE LIKE '%${prodate}%'
  57. </if>
  58. <if test="materialcode != null and materialcode != ''">
  59. and MATERIALCODE LIKE '%${materialcode}%'
  60. </if>
  61. <if test="materialname != null and materialname != ''">
  62. and MATERIALNAME LIKE '%${materialname}%'
  63. </if>
  64. <if test="qty != null">
  65. and QTY = #{qty}
  66. </if>
  67. <if test="unit != null and unit != ''">
  68. and UNIT LIKE '%${unit}%'
  69. </if>
  70. <if test="lcId != null and lcId != ''">
  71. and LC_ID LIKE '%${lcId}%'
  72. </if>
  73. </where>
  74. </sql>
  75. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  76. delete from EMS_PRODPLAN_ROUND_WEIGHT
  77. where FID = #{fid,jdbcType=VARCHAR}
  78. </delete>
  79. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  80. delete from EMS_PRODPLAN_ROUND_WEIGHT
  81. where 1!=1
  82. <if test="prodate != null and prodate != ''">
  83. or PRODATE = #{prodate}
  84. </if>
  85. <if test="materialcode != null and materialcode != ''">
  86. or MATERIALCODE = #{materialcode}
  87. </if>
  88. <if test="materialname != null and materialname != ''">
  89. or MATERIALNAME = #{materialname}
  90. </if>
  91. <if test="qty != null">
  92. or QTY = #{qty}
  93. </if>
  94. <if test="unit != null and unit != ''">
  95. or UNIT = #{unit}
  96. </if>
  97. <if test="lcId != null and lcId != ''">
  98. or LC_ID = #{lcId}
  99. </if>
  100. </delete>
  101. <insert id="insert" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
  102. insert into EMS_PRODPLAN_ROUND_WEIGHT (FID, PRODATE, MATERIALCODE,
  103. MATERIALNAME, QTY, UNIT,LC_ID,REMARK)
  104. values (#{fid,jdbcType=VARCHAR}, #{prodate,jdbcType=VARCHAR}, #{materialcode,jdbcType=VARCHAR},
  105. #{materialname,jdbcType=VARCHAR}, #{qty,jdbcType=DECIMAL}, #{unit,jdbcType=VARCHAR},
  106. #{lcId,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR})
  107. </insert>
  108. <insert id="insertSelective" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
  109. insert into EMS_PRODPLAN_ROUND_WEIGHT
  110. <trim prefix="(" suffix=")" suffixOverrides=",">
  111. <if test="fid != null">
  112. FID,
  113. </if>
  114. <if test="prodate != null">
  115. PRODATE,
  116. </if>
  117. <if test="materialcode != null">
  118. MATERIALCODE,
  119. </if>
  120. <if test="materialname != null">
  121. MATERIALNAME,
  122. </if>
  123. <if test="qty != null">
  124. QTY,
  125. </if>
  126. <if test="unit != null">
  127. UNIT,
  128. </if>
  129. <if test="lcId != null">
  130. LC_ID,
  131. </if>
  132. </trim>
  133. <trim prefix="values (" suffix=")" suffixOverrides=",">
  134. <if test="fid != null">
  135. #{fid,jdbcType=VARCHAR},
  136. </if>
  137. <if test="prodate != null">
  138. #{prodate,jdbcType=VARCHAR},
  139. </if>
  140. <if test="materialcode != null">
  141. #{materialcode,jdbcType=VARCHAR},
  142. </if>
  143. <if test="materialname != null">
  144. #{materialname,jdbcType=VARCHAR},
  145. </if>
  146. <if test="qty != null">
  147. #{qty,jdbcType=DECIMAL},
  148. </if>
  149. <if test="unit != null">
  150. #{unit,jdbcType=VARCHAR},
  151. </if>
  152. <if test="lcId != null">
  153. #{lcId,jdbcType=VARCHAR},
  154. </if>
  155. </trim>
  156. </insert>
  157. <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
  158. update EMS_PRODPLAN_ROUND_WEIGHT
  159. set PRODATE = #{prodate,jdbcType=VARCHAR},
  160. MATERIALCODE = #{materialcode,jdbcType=VARCHAR},
  161. MATERIALNAME = #{materialname,jdbcType=VARCHAR},
  162. QTY = #{qty,jdbcType=DECIMAL},
  163. UNIT = #{unit,jdbcType=VARCHAR},
  164. LC_ID = #{lcId,jdbcType=VARCHAR}
  165. where FID = #{fid,jdbcType=VARCHAR}
  166. </update>
  167. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emsprodplanroundweight.model.EmsProdplanRoundWeight">
  168. update EMS_PRODPLAN_ROUND_WEIGHT
  169. <set>
  170. <if test="prodate != null">
  171. PRODATE = #{prodate,jdbcType=VARCHAR},
  172. </if>
  173. <if test="materialcode != null">
  174. MATERIALCODE = #{materialcode,jdbcType=VARCHAR},
  175. </if>
  176. <if test="materialname != null">
  177. MATERIALNAME = #{materialname,jdbcType=VARCHAR},
  178. </if>
  179. <if test="qty != null">
  180. QTY = #{qty,jdbcType=DECIMAL},
  181. </if>
  182. <if test="unit != null">
  183. UNIT = #{unit,jdbcType=VARCHAR},
  184. </if>
  185. <if test="lcId != null">
  186. LC_ID = #{lcId,jdbcType=VARCHAR},
  187. </if>
  188. <if test="remark != null">
  189. REMARK = #{remark,jdbcType=VARCHAR},
  190. </if>
  191. </set>
  192. where FID = #{fid,jdbcType=VARCHAR}
  193. <if test="lcId != null">
  194. and LC_ID = #{lcId,jdbcType=VARCHAR}
  195. </if>
  196. </update>
  197. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  198. <include refid="select"/>
  199. where FID = #{fid,jdbcType=VARCHAR}
  200. </select>
  201. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  202. <include refid="select"/>
  203. <include refid="where"/>
  204. </select>
  205. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  206. <include refid="select"/>
  207. <include refid="whereLike"/>
  208. </select>
  209. <insert id="batchInsert" parameterType="java.util.List">
  210. insert into EMS_PRODPLAN_ROUND_WEIGHT
  211. (FID,
  212. PRODATE, MATERIALCODE, MATERIALNAME,
  213. QTY, UNIT, LC_ID
  214. )
  215. ( <foreach collection="list" item="item" separator="union all">
  216. select
  217. #{item.fid,jdbcType=VARCHAR},
  218. #{item.prodate,jdbcType=VARCHAR}, #{item.materialcode,jdbcType=VARCHAR}, #{item.materialname,jdbcType=VARCHAR},
  219. #{item.qty,jdbcType=DECIMAL}, #{item.unit,jdbcType=VARCHAR}, #{item.lcId,jdbcType=VARCHAR}
  220. from dual
  221. </foreach> )
  222. </insert>
  223. <update id="batchUpdate" parameterType="java.util.List">
  224. update EMS_PRODPLAN_ROUND_WEIGHT
  225. set
  226. FID=
  227. <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
  228. when #{item.fid,jdbcType=VARCHAR} then #{item.fid,jdbcType=VARCHAR}
  229. </foreach>
  230. ,PRODATE=
  231. <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
  232. when #{item.fid,jdbcType=VARCHAR} then #{item.prodate,jdbcType=VARCHAR}
  233. </foreach>
  234. ,MATERIALCODE=
  235. <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
  236. when #{item.fid,jdbcType=VARCHAR} then #{item.materialcode,jdbcType=VARCHAR}
  237. </foreach>
  238. ,MATERIALNAME=
  239. <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
  240. when #{item.fid,jdbcType=VARCHAR} then #{item.materialname,jdbcType=VARCHAR}
  241. </foreach>
  242. ,QTY=
  243. <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
  244. when #{item.fid,jdbcType=VARCHAR} then #{item.qty,jdbcType=DECIMAL}
  245. </foreach>
  246. ,UNIT=
  247. <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
  248. when #{item.fid,jdbcType=VARCHAR} then #{item.unit,jdbcType=VARCHAR}
  249. </foreach>
  250. ,LC_ID=
  251. <foreach collection="list" item="item" index="index" separator=" " open="case FID" close="end">
  252. when #{item.fid,jdbcType=VARCHAR} then #{item.lcId,jdbcType=VARCHAR}
  253. </foreach>
  254. where FID in
  255. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  256. #{item.fid,jdbcType=VARCHAR}
  257. </foreach>
  258. </update>
  259. <delete id="batchDelete" parameterType="java.util.List">
  260. delete from EMS_PRODPLAN_ROUND_WEIGHT
  261. where FID in
  262. <foreach collection="list" item="id" open="(" close=")" separator=",">
  263. #{id}
  264. </foreach>
  265. </delete>
  266. <!-- 友情提示!!!-->
  267. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  268. </mapper>