OmstruckOrderMaterialMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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.dil.mapper.OmstruckOrderMaterialMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.OmstruckOrderMaterial">
  5. <id column="ORDER_MATERIAL_ID" jdbcType="DECIMAL" property="orderMaterialId" />
  6. <result column="ORDER_ID" jdbcType="DECIMAL" property="orderId" />
  7. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  8. <result column="ORDER_MATERIAL_NUMBER" jdbcType="DECIMAL" property="orderMaterialNumber" />
  9. <result column="ORDER_MATERIAL_WEIGHT" jdbcType="DECIMAL" property="orderMaterialWeight" />
  10. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  11. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  12. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  13. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  15. <result column="MATERIAL_DIRECTION" jdbcType="DECIMAL" property="materialDirection" />
  16. <result column="MATERIAL_PRIORITY" jdbcType="DECIMAL" property="materialPriority" />
  17. </resultMap>
  18. <sql id="columns">
  19. ORDER_MATERIAL_ID, ORDER_ID, MATERIAL_ID, ORDER_MATERIAL_NUMBER, ORDER_MATERIAL_WEIGHT,
  20. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  21. MATERIAL_DIRECTION, MATERIAL_PRIORITY
  22. </sql>
  23. <sql id="columns_alias">
  24. t.ORDER_MATERIAL_ID, t.ORDER_ID, t.MATERIAL_ID, t.ORDER_MATERIAL_NUMBER, t.ORDER_MATERIAL_WEIGHT,
  25. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  26. t.MATERIAL_DIRECTION, t.MATERIAL_PRIORITY
  27. </sql>
  28. <sql id="select">
  29. SELECT <include refid="columns" /> FROM OMSTRUCK_ORDER_MATERIAL
  30. </sql>
  31. <sql id="select_alias">
  32. SELECT <include refid="columns_alias" /> FROM OMSTRUCK_ORDER_MATERIAL t
  33. </sql>
  34. <sql id="where">
  35. <where>
  36. <if test="orderMaterialId != null">
  37. and ORDER_MATERIAL_ID = #{orderMaterialId}
  38. </if>
  39. <if test="orderId != null">
  40. and ORDER_ID = #{orderId}
  41. </if>
  42. <if test="materialId != null">
  43. and MATERIAL_ID = #{materialId}
  44. </if>
  45. <if test="orderMaterialNumber != null">
  46. and ORDER_MATERIAL_NUMBER = #{orderMaterialNumber}
  47. </if>
  48. <if test="orderMaterialWeight != null">
  49. and ORDER_MATERIAL_WEIGHT = #{orderMaterialWeight}
  50. </if>
  51. <if test="insertUsername != null and insertUsername != ''">
  52. and INSERT_USERNAME = #{insertUsername}
  53. </if>
  54. <if test="insertTime != null">
  55. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  56. </if>
  57. <if test="updateUsername != null and updateUsername != ''">
  58. and UPDATE_USERNAME = #{updateUsername}
  59. </if>
  60. <if test="updateTime != null">
  61. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  62. </if>
  63. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  64. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  65. </if>
  66. <if test="materialDirection != null">
  67. and MATERIAL_DIRECTION = #{materialDirection}
  68. </if>
  69. <if test="materialPriority != null">
  70. and MATERIAL_PRIORITY = #{materialPriority}
  71. </if>
  72. </where>
  73. </sql>
  74. <sql id="whereLike">
  75. <where>
  76. <if test="orderMaterialId != null">
  77. and ORDER_MATERIAL_ID = #{orderMaterialId}
  78. </if>
  79. <if test="orderId != null">
  80. and ORDER_ID = #{orderId}
  81. </if>
  82. <if test="materialId != null">
  83. and MATERIAL_ID = #{materialId}
  84. </if>
  85. <if test="orderMaterialNumber != null">
  86. and ORDER_MATERIAL_NUMBER = #{orderMaterialNumber}
  87. </if>
  88. <if test="orderMaterialWeight != null">
  89. and ORDER_MATERIAL_WEIGHT = #{orderMaterialWeight}
  90. </if>
  91. <if test="insertUsername != null and insertUsername != ''">
  92. and INSERT_USERNAME LIKE '%${insertUsername}%'
  93. </if>
  94. <if test="insertTime != null">
  95. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  96. </if>
  97. <if test="updateUsername != null and updateUsername != ''">
  98. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  99. </if>
  100. <if test="updateTime != null">
  101. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  102. </if>
  103. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  104. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  105. </if>
  106. <if test="materialDirection != null">
  107. and MATERIAL_DIRECTION = #{materialDirection}
  108. </if>
  109. <if test="materialPriority != null">
  110. and MATERIAL_PRIORITY = #{materialPriority}
  111. </if>
  112. </where>
  113. </sql>
  114. <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
  115. delete from OMSTRUCK_ORDER_MATERIAL
  116. where ORDER_MATERIAL_ID = #{orderMaterialId,jdbcType=DECIMAL}
  117. </delete>
  118. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  119. delete from OMSTRUCK_ORDER_MATERIAL
  120. where 1!=1
  121. <if test="orderId != null">
  122. or ORDER_ID = #{orderId}
  123. </if>
  124. <if test="materialId != null">
  125. or MATERIAL_ID = #{materialId}
  126. </if>
  127. <if test="orderMaterialNumber != null">
  128. or ORDER_MATERIAL_NUMBER = #{orderMaterialNumber}
  129. </if>
  130. <if test="orderMaterialWeight != null">
  131. or ORDER_MATERIAL_WEIGHT = #{orderMaterialWeight}
  132. </if>
  133. <if test="insertUsername != null and insertUsername != ''">
  134. or INSERT_USERNAME = #{insertUsername}
  135. </if>
  136. <if test="insertTime != null">
  137. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  138. </if>
  139. <if test="updateUsername != null and updateUsername != ''">
  140. or UPDATE_USERNAME = #{updateUsername}
  141. </if>
  142. <if test="updateTime != null">
  143. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  144. </if>
  145. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  146. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  147. </if>
  148. <if test="materialDirection != null">
  149. or MATERIAL_DIRECTION = #{materialDirection}
  150. </if>
  151. <if test="materialPriority != null">
  152. or MATERIAL_PRIORITY = #{materialPriority}
  153. </if>
  154. </delete>
  155. <insert id="insert" parameterType="com.steerinfo.dil.model.OmstruckOrderMaterial">
  156. insert into OMSTRUCK_ORDER_MATERIAL (ORDER_MATERIAL_ID, ORDER_ID, MATERIAL_ID,
  157. ORDER_MATERIAL_NUMBER, ORDER_MATERIAL_WEIGHT,
  158. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  159. UPDATE_TIME, INSERT_UPDATE_REMARK, MATERIAL_DIRECTION,
  160. MATERIAL_PRIORITY)
  161. values (#{orderMaterialId,jdbcType=DECIMAL}, #{orderId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL},
  162. #{orderMaterialNumber,jdbcType=DECIMAL}, #{orderMaterialWeight,jdbcType=DECIMAL},
  163. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  164. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{materialDirection,jdbcType=DECIMAL},
  165. #{materialPriority,jdbcType=DECIMAL})
  166. </insert>
  167. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.OmstruckOrderMaterial">
  168. insert into OMSTRUCK_ORDER_MATERIAL
  169. <trim prefix="(" suffix=")" suffixOverrides=",">
  170. <if test="orderMaterialId != null">
  171. ORDER_MATERIAL_ID,
  172. </if>
  173. <if test="orderId != null">
  174. ORDER_ID,
  175. </if>
  176. <if test="materialId != null">
  177. MATERIAL_ID,
  178. </if>
  179. <if test="orderMaterialNumber != null">
  180. ORDER_MATERIAL_NUMBER,
  181. </if>
  182. <if test="orderMaterialWeight != null">
  183. ORDER_MATERIAL_WEIGHT,
  184. </if>
  185. <if test="insertUsername != null">
  186. INSERT_USERNAME,
  187. </if>
  188. <if test="insertTime != null">
  189. INSERT_TIME,
  190. </if>
  191. <if test="updateUsername != null">
  192. UPDATE_USERNAME,
  193. </if>
  194. <if test="updateTime != null">
  195. UPDATE_TIME,
  196. </if>
  197. <if test="insertUpdateRemark != null">
  198. INSERT_UPDATE_REMARK,
  199. </if>
  200. <if test="materialDirection != null">
  201. MATERIAL_DIRECTION,
  202. </if>
  203. <if test="materialPriority != null">
  204. MATERIAL_PRIORITY,
  205. </if>
  206. </trim>
  207. <trim prefix="values (" suffix=")" suffixOverrides=",">
  208. <if test="orderMaterialId != null">
  209. #{orderMaterialId,jdbcType=DECIMAL},
  210. </if>
  211. <if test="orderId != null">
  212. #{orderId,jdbcType=DECIMAL},
  213. </if>
  214. <if test="materialId != null">
  215. #{materialId,jdbcType=DECIMAL},
  216. </if>
  217. <if test="orderMaterialNumber != null">
  218. #{orderMaterialNumber,jdbcType=DECIMAL},
  219. </if>
  220. <if test="orderMaterialWeight != null">
  221. #{orderMaterialWeight,jdbcType=DECIMAL},
  222. </if>
  223. <if test="insertUsername != null">
  224. #{insertUsername,jdbcType=VARCHAR},
  225. </if>
  226. <if test="insertTime != null">
  227. #{insertTime,jdbcType=TIMESTAMP},
  228. </if>
  229. <if test="updateUsername != null">
  230. #{updateUsername,jdbcType=VARCHAR},
  231. </if>
  232. <if test="updateTime != null">
  233. #{updateTime,jdbcType=TIMESTAMP},
  234. </if>
  235. <if test="insertUpdateRemark != null">
  236. #{insertUpdateRemark,jdbcType=VARCHAR},
  237. </if>
  238. <if test="materialDirection != null">
  239. #{materialDirection,jdbcType=DECIMAL},
  240. </if>
  241. <if test="materialPriority != null">
  242. #{materialPriority,jdbcType=DECIMAL},
  243. </if>
  244. </trim>
  245. </insert>
  246. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.OmstruckOrderMaterial">
  247. update OMSTRUCK_ORDER_MATERIAL
  248. set ORDER_ID = #{orderId,jdbcType=DECIMAL},
  249. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  250. ORDER_MATERIAL_NUMBER = #{orderMaterialNumber,jdbcType=DECIMAL},
  251. ORDER_MATERIAL_WEIGHT = #{orderMaterialWeight,jdbcType=DECIMAL},
  252. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  253. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  254. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  255. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  256. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  257. MATERIAL_DIRECTION = #{materialDirection,jdbcType=DECIMAL},
  258. MATERIAL_PRIORITY = #{materialPriority,jdbcType=DECIMAL}
  259. where ORDER_MATERIAL_ID = #{orderMaterialId,jdbcType=DECIMAL}
  260. </update>
  261. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.OmstruckOrderMaterial">
  262. update OMSTRUCK_ORDER_MATERIAL
  263. <set>
  264. <if test="orderId != null">
  265. ORDER_ID = #{orderId,jdbcType=DECIMAL},
  266. </if>
  267. <if test="materialId != null">
  268. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  269. </if>
  270. <if test="orderMaterialNumber != null">
  271. ORDER_MATERIAL_NUMBER = #{orderMaterialNumber,jdbcType=DECIMAL},
  272. </if>
  273. <if test="orderMaterialWeight != null">
  274. ORDER_MATERIAL_WEIGHT = #{orderMaterialWeight,jdbcType=DECIMAL},
  275. </if>
  276. <if test="insertUsername != null">
  277. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  278. </if>
  279. <if test="insertTime != null">
  280. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  281. </if>
  282. <if test="updateUsername != null">
  283. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  284. </if>
  285. <if test="updateTime != null">
  286. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  287. </if>
  288. <if test="insertUpdateRemark != null">
  289. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  290. </if>
  291. <if test="materialDirection != null">
  292. MATERIAL_DIRECTION = #{materialDirection,jdbcType=DECIMAL},
  293. </if>
  294. <if test="materialPriority != null">
  295. MATERIAL_PRIORITY = #{materialPriority,jdbcType=DECIMAL},
  296. </if>
  297. </set>
  298. where ORDER_MATERIAL_ID = #{orderMaterialId,jdbcType=DECIMAL}
  299. </update>
  300. <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
  301. <include refid="select" />
  302. where ORDER_MATERIAL_ID = #{orderMaterialId,jdbcType=DECIMAL}
  303. </select>
  304. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  305. <include refid="select" />
  306. <include refid="where" />
  307. </select>
  308. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  309. <include refid="select" />
  310. <include refid="whereLike" />
  311. </select>
  312. <insert id="batchInsert" parameterType="java.util.List">
  313. insert into OMSTRUCK_ORDER_MATERIAL
  314. (ORDER_MATERIAL_ID,
  315. ORDER_ID, MATERIAL_ID, ORDER_MATERIAL_NUMBER,
  316. ORDER_MATERIAL_WEIGHT, INSERT_USERNAME,
  317. INSERT_TIME, UPDATE_USERNAME,
  318. UPDATE_TIME, INSERT_UPDATE_REMARK,
  319. MATERIAL_DIRECTION, MATERIAL_PRIORITY
  320. )
  321. ( <foreach collection="list" item="item" separator="union all">
  322. select
  323. #{item.orderMaterialId,jdbcType=DECIMAL},
  324. #{item.orderId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.orderMaterialNumber,jdbcType=DECIMAL},
  325. #{item.orderMaterialWeight,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  326. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  327. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  328. #{item.materialDirection,jdbcType=DECIMAL}, #{item.materialPriority,jdbcType=DECIMAL}
  329. from dual
  330. </foreach> )
  331. </insert>
  332. <update id="batchUpdate" parameterType="java.util.List">
  333. update OMSTRUCK_ORDER_MATERIAL
  334. set
  335. ORDER_MATERIAL_ID=
  336. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  337. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.orderMaterialId,jdbcType=DECIMAL}
  338. </foreach>
  339. ,ORDER_ID=
  340. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  341. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
  342. </foreach>
  343. ,MATERIAL_ID=
  344. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  345. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  346. </foreach>
  347. ,ORDER_MATERIAL_NUMBER=
  348. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  349. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.orderMaterialNumber,jdbcType=DECIMAL}
  350. </foreach>
  351. ,ORDER_MATERIAL_WEIGHT=
  352. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  353. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.orderMaterialWeight,jdbcType=DECIMAL}
  354. </foreach>
  355. ,INSERT_USERNAME=
  356. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  357. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  358. </foreach>
  359. ,INSERT_TIME=
  360. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  361. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  362. </foreach>
  363. ,UPDATE_USERNAME=
  364. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  365. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  366. </foreach>
  367. ,UPDATE_TIME=
  368. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  369. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  370. </foreach>
  371. ,INSERT_UPDATE_REMARK=
  372. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  373. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  374. </foreach>
  375. ,MATERIAL_DIRECTION=
  376. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  377. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.materialDirection,jdbcType=DECIMAL}
  378. </foreach>
  379. ,MATERIAL_PRIORITY=
  380. <foreach close="end" collection="list" index="index" item="item" open="case ORDER_MATERIAL_ID" separator=" ">
  381. when #{item.orderMaterialId,jdbcType=DECIMAL} then #{item.materialPriority,jdbcType=DECIMAL}
  382. </foreach>
  383. where ORDER_MATERIAL_ID in
  384. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  385. #{item.orderMaterialId,jdbcType=DECIMAL}
  386. </foreach>
  387. </update>
  388. <delete id="batchDelete" parameterType="java.util.List">
  389. delete from OMSTRUCK_ORDER_MATERIAL
  390. where ORDER_MATERIAL_ID in
  391. <foreach close=")" collection="list" item="id" open="(" separator=",">
  392. #{id}
  393. </foreach>
  394. </delete>
  395. <!-- 友情提示!!!-->
  396. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  397. <select id="getMaterialList" parameterType="DECIMAL" resultType="java.util.Map">
  398. SELECT OOM.MATERIAL_ID "materialId",
  399. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  400. OOM.ORDER_MATERIAL_ID "orderMaterialId"
  401. FROM OMSTRUCK_ORDER_MATERIAL OOM
  402. WHERE OOM.ORDER_ID = #{orderId}
  403. </select>
  404. </mapper>