DilBatchMapper.xml 12 KB

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