RmsPwarehouseGridMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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.RmsPwarehouseGridMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.RmsPwarehouseGrid">
  5. <id column="GRID_ID" jdbcType="DECIMAL" property="gridId" />
  6. <result column="WAREHOUSE_ID" jdbcType="DECIMAL" property="warehouseId" />
  7. <result column="PLATFORM_ID" jdbcType="DECIMAL" property="platformId" />
  8. <result column="STACKING_ID" jdbcType="DECIMAL" property="stackingId" />
  9. <result column="GRID_GRADATION_NUMBER" jdbcType="DECIMAL" property="gridGradationNumber" />
  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="GRID_SEQUENCE_NUMBER" jdbcType="DECIMAL" property="gridSequenceNumber" />
  16. </resultMap>
  17. <sql id="columns">
  18. GRID_ID, WAREHOUSE_ID, PLATFORM_ID, STACKING_ID, GRID_GRADATION_NUMBER, INSERT_USERNAME,
  19. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, GRID_SEQUENCE_NUMBER
  20. </sql>
  21. <sql id="columns_alias">
  22. t.GRID_ID, t.WAREHOUSE_ID, t.PLATFORM_ID, t.STACKING_ID, t.GRID_GRADATION_NUMBER,
  23. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  24. t.GRID_SEQUENCE_NUMBER
  25. </sql>
  26. <sql id="select">
  27. SELECT <include refid="columns"/> FROM RMS_PWAREHOUSE_GRID
  28. </sql>
  29. <sql id="select_alias">
  30. SELECT <include refid="columns_alias"/> FROM RMS_PWAREHOUSE_GRID t
  31. </sql>
  32. <sql id="where">
  33. <where>
  34. <if test="gridId != null">
  35. and GRID_ID = #{gridId}
  36. </if>
  37. <if test="warehouseId != null">
  38. and WAREHOUSE_ID = #{warehouseId}
  39. </if>
  40. <if test="platformId != null">
  41. and PLATFORM_ID = #{platformId}
  42. </if>
  43. <if test="stackingId != null">
  44. and STACKING_ID = #{stackingId}
  45. </if>
  46. <if test="gridGradationNumber != null">
  47. and GRID_GRADATION_NUMBER = #{gridGradationNumber}
  48. </if>
  49. <if test="insertUsername != null and insertUsername != ''">
  50. and INSERT_USERNAME = #{insertUsername}
  51. </if>
  52. <if test="insertTime != null">
  53. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  54. </if>
  55. <if test="updateUsername != null and updateUsername != ''">
  56. and UPDATE_USERNAME = #{updateUsername}
  57. </if>
  58. <if test="updateTime != null">
  59. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  60. </if>
  61. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  62. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  63. </if>
  64. <if test="gridSequenceNumber != null">
  65. and GRID_SEQUENCE_NUMBER = #{gridSequenceNumber}
  66. </if>
  67. </where>
  68. </sql>
  69. <sql id="whereLike">
  70. <where>
  71. <if test="gridId != null">
  72. and GRID_ID = #{gridId}
  73. </if>
  74. <if test="warehouseId != null">
  75. and WAREHOUSE_ID = #{warehouseId}
  76. </if>
  77. <if test="platformId != null">
  78. and PLATFORM_ID = #{platformId}
  79. </if>
  80. <if test="stackingId != null">
  81. and STACKING_ID = #{stackingId}
  82. </if>
  83. <if test="gridGradationNumber != null">
  84. and GRID_GRADATION_NUMBER = #{gridGradationNumber}
  85. </if>
  86. <if test="insertUsername != null and insertUsername != ''">
  87. and INSERT_USERNAME LIKE '%${insertUsername}%'
  88. </if>
  89. <if test="insertTime != null">
  90. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  91. </if>
  92. <if test="updateUsername != null and updateUsername != ''">
  93. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  94. </if>
  95. <if test="updateTime != null">
  96. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  97. </if>
  98. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  99. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  100. </if>
  101. <if test="gridSequenceNumber != null">
  102. and GRID_SEQUENCE_NUMBER = #{gridSequenceNumber}
  103. </if>
  104. </where>
  105. </sql>
  106. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  107. delete from RMS_PWAREHOUSE_GRID
  108. where GRID_ID = #{gridId,jdbcType=DECIMAL}
  109. </delete>
  110. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  111. delete from RMS_PWAREHOUSE_GRID
  112. where 1!=1
  113. <if test="platformId != null">
  114. or PLATFORM_ID = #{platformId}
  115. </if>
  116. <if test="stackingId != null">
  117. or STACKING_ID = #{stackingId}
  118. </if>
  119. <if test="gridGradationNumber != null">
  120. or GRID_GRADATION_NUMBER = #{gridGradationNumber}
  121. </if>
  122. <if test="insertUsername != null and insertUsername != ''">
  123. or INSERT_USERNAME = #{insertUsername}
  124. </if>
  125. <if test="insertTime != null">
  126. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  127. </if>
  128. <if test="updateUsername != null and updateUsername != ''">
  129. or UPDATE_USERNAME = #{updateUsername}
  130. </if>
  131. <if test="updateTime != null">
  132. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  133. </if>
  134. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  135. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  136. </if>
  137. <if test="gridSequenceNumber != null">
  138. or GRID_SEQUENCE_NUMBER = #{gridSequenceNumber}
  139. </if>
  140. </delete>
  141. <insert id="insert" parameterType="com.steerinfo.dil.model.RmsPwarehouseGrid" keyProperty="gridId">
  142. insert into RMS_PWAREHOUSE_GRID (GRID_ID, WAREHOUSE_ID, PLATFORM_ID,
  143. STACKING_ID, GRID_GRADATION_NUMBER, INSERT_USERNAME,
  144. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  145. INSERT_UPDATE_REMARK, GRID_SEQUENCE_NUMBER)
  146. values (#{gridId,jdbcType=DECIMAL}, #{warehouseId,jdbcType=DECIMAL}, #{platformId,jdbcType=DECIMAL},
  147. #{stackingId,jdbcType=DECIMAL}, #{gridGradationNumber,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
  148. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  149. #{insertUpdateRemark,jdbcType=VARCHAR}, #{gridSequenceNumber,jdbcType=DECIMAL})
  150. </insert>
  151. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.RmsPwarehouseGrid">
  152. insert into RMS_PWAREHOUSE_GRID
  153. <trim prefix="(" suffix=")" suffixOverrides=",">
  154. <if test="gridId != null">
  155. GRID_ID,
  156. </if>
  157. <if test="warehouseId != null">
  158. WAREHOUSE_ID,
  159. </if>
  160. <if test="platformId != null">
  161. PLATFORM_ID,
  162. </if>
  163. <if test="stackingId != null">
  164. STACKING_ID,
  165. </if>
  166. <if test="gridGradationNumber != null">
  167. GRID_GRADATION_NUMBER,
  168. </if>
  169. <if test="insertUsername != null">
  170. INSERT_USERNAME,
  171. </if>
  172. <if test="insertTime != null">
  173. INSERT_TIME,
  174. </if>
  175. <if test="updateUsername != null">
  176. UPDATE_USERNAME,
  177. </if>
  178. <if test="updateTime != null">
  179. UPDATE_TIME,
  180. </if>
  181. <if test="insertUpdateRemark != null">
  182. INSERT_UPDATE_REMARK,
  183. </if>
  184. <if test="gridSequenceNumber != null">
  185. GRID_SEQUENCE_NUMBER,
  186. </if>
  187. </trim>
  188. <trim prefix="values (" suffix=")" suffixOverrides=",">
  189. <if test="gridId != null">
  190. #{gridId,jdbcType=DECIMAL},
  191. </if>
  192. <if test="warehouseId != null">
  193. #{warehouseId,jdbcType=DECIMAL},
  194. </if>
  195. <if test="platformId != null">
  196. #{platformId,jdbcType=DECIMAL},
  197. </if>
  198. <if test="stackingId != null">
  199. #{stackingId,jdbcType=DECIMAL},
  200. </if>
  201. <if test="gridGradationNumber != null">
  202. #{gridGradationNumber,jdbcType=DECIMAL},
  203. </if>
  204. <if test="insertUsername != null">
  205. #{insertUsername,jdbcType=VARCHAR},
  206. </if>
  207. <if test="insertTime != null">
  208. #{insertTime,jdbcType=TIMESTAMP},
  209. </if>
  210. <if test="updateUsername != null">
  211. #{updateUsername,jdbcType=VARCHAR},
  212. </if>
  213. <if test="updateTime != null">
  214. #{updateTime,jdbcType=TIMESTAMP},
  215. </if>
  216. <if test="insertUpdateRemark != null">
  217. #{insertUpdateRemark,jdbcType=VARCHAR},
  218. </if>
  219. <if test="gridSequenceNumber != null">
  220. #{gridSequenceNumber,jdbcType=DECIMAL},
  221. </if>
  222. </trim>
  223. </insert>
  224. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.RmsPwarehouseGrid">
  225. update RMS_PWAREHOUSE_GRID
  226. set WAREHOUSE_ID = #{warehouseId,jdbcType=DECIMAL},
  227. PLATFORM_ID = #{platformId,jdbcType=DECIMAL},
  228. STACKING_ID = #{stackingId,jdbcType=DECIMAL},
  229. GRID_GRADATION_NUMBER = #{gridGradationNumber,jdbcType=DECIMAL},
  230. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  231. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  232. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  233. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  234. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  235. GRID_SEQUENCE_NUMBER = #{gridSequenceNumber,jdbcType=DECIMAL}
  236. where GRID_ID = #{gridId,jdbcType=DECIMAL}
  237. </update>
  238. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.RmsPwarehouseGrid">
  239. update RMS_PWAREHOUSE_GRID
  240. <set>
  241. <if test="warehouseId != null">
  242. WAREHOUSE_ID = #{warehouseId,jdbcType=DECIMAL},
  243. </if>
  244. <if test="platformId != null">
  245. PLATFORM_ID = #{platformId,jdbcType=DECIMAL},
  246. </if>
  247. <if test="stackingId != null">
  248. STACKING_ID = #{stackingId,jdbcType=DECIMAL},
  249. </if>
  250. <if test="gridGradationNumber != null">
  251. GRID_GRADATION_NUMBER = #{gridGradationNumber,jdbcType=DECIMAL},
  252. </if>
  253. <if test="insertUsername != null">
  254. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  255. </if>
  256. <if test="insertTime != null">
  257. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  258. </if>
  259. <if test="updateUsername != null">
  260. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  261. </if>
  262. <if test="updateTime != null">
  263. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  264. </if>
  265. <if test="insertUpdateRemark != null">
  266. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  267. </if>
  268. <if test="gridSequenceNumber != null">
  269. GRID_SEQUENCE_NUMBER = #{gridSequenceNumber,jdbcType=DECIMAL},
  270. </if>
  271. </set>
  272. where GRID_ID = #{gridId,jdbcType=DECIMAL}
  273. </update>
  274. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  275. <include refid="select"/>
  276. where GRID_ID = #{gridId,jdbcType=DECIMAL}
  277. </select>
  278. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  279. <include refid="select"/>
  280. <include refid="where"/>
  281. </select>
  282. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  283. <include refid="select"/>
  284. <include refid="whereLike"/>
  285. </select>
  286. <insert id="batchInsert" parameterType="java.util.List">
  287. insert into RMS_PWAREHOUSE_GRID
  288. (GRID_ID,
  289. WAREHOUSE_ID, PLATFORM_ID, STACKING_ID,
  290. GRID_GRADATION_NUMBER, INSERT_USERNAME,
  291. INSERT_TIME, UPDATE_USERNAME,
  292. UPDATE_TIME, INSERT_UPDATE_REMARK,
  293. GRID_SEQUENCE_NUMBER)
  294. ( <foreach collection="list" item="item" separator="union all">
  295. select
  296. #{item.gridId,jdbcType=DECIMAL},
  297. #{item.warehouseId,jdbcType=DECIMAL}, #{item.platformId,jdbcType=DECIMAL}, #{item.stackingId,jdbcType=DECIMAL},
  298. #{item.gridGradationNumber,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  299. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  300. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  301. #{item.gridSequenceNumber,jdbcType=DECIMAL} from dual
  302. </foreach> )
  303. </insert>
  304. <update id="batchUpdate" parameterType="java.util.List">
  305. update RMS_PWAREHOUSE_GRID
  306. set
  307. GRID_ID=
  308. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  309. when #{item.gridId,jdbcType=DECIMAL} then #{item.gridId,jdbcType=DECIMAL}
  310. </foreach>
  311. ,WAREHOUSE_ID=
  312. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  313. when #{item.gridId,jdbcType=DECIMAL} then #{item.warehouseId,jdbcType=DECIMAL}
  314. </foreach>
  315. ,PLATFORM_ID=
  316. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  317. when #{item.gridId,jdbcType=DECIMAL} then #{item.platformId,jdbcType=DECIMAL}
  318. </foreach>
  319. ,STACKING_ID=
  320. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  321. when #{item.gridId,jdbcType=DECIMAL} then #{item.stackingId,jdbcType=DECIMAL}
  322. </foreach>
  323. ,GRID_GRADATION_NUMBER=
  324. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  325. when #{item.gridId,jdbcType=DECIMAL} then #{item.gridGradationNumber,jdbcType=DECIMAL}
  326. </foreach>
  327. ,INSERT_USERNAME=
  328. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  329. when #{item.gridId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  330. </foreach>
  331. ,INSERT_TIME=
  332. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  333. when #{item.gridId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  334. </foreach>
  335. ,UPDATE_USERNAME=
  336. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  337. when #{item.gridId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  338. </foreach>
  339. ,UPDATE_TIME=
  340. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  341. when #{item.gridId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  342. </foreach>
  343. ,INSERT_UPDATE_REMARK=
  344. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  345. when #{item.gridId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  346. </foreach>
  347. ,GRID_SEQUENCE_NUMBER=
  348. <foreach collection="list" item="item" index="index" separator=" " open="case GRID_ID" close="end">
  349. when #{item.gridId,jdbcType=DECIMAL} then #{item.gridSequenceNumber,jdbcType=DECIMAL}
  350. </foreach>
  351. where GRID_ID in
  352. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  353. #{item.gridId,jdbcType=DECIMAL}
  354. </foreach>
  355. </update>
  356. <delete id="batchDelete" parameterType="java.util.List">
  357. delete from RMS_PWAREHOUSE_GRID
  358. where GRID_ID in
  359. <foreach collection="list" item="id" open="(" close=")" separator=",">
  360. #{id}
  361. </foreach>
  362. </delete>
  363. <!-- 友情提示!!!-->
  364. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  365. <!-- 查询最大id-->
  366. <select id="selectMaxId" resultType="DECIMAL">
  367. SELECT MAX(GRID_ID) from RMS_PWAREHOUSE_GRID
  368. </select>
  369. <!-- 根据层序和垛位,仓库和层次查询钢材与物资对应关系表 -->
  370. <select id="selectGridId" resultType="java.math.BigDecimal">
  371. SELECT
  372. RPG.GRID_ID
  373. FROM
  374. RMS_PWAREHOUSE_GRID RPG
  375. <where>
  376. <if test="warehouseId!=null">
  377. RPG.WAREHOUSE_ID=#{warehouseId}
  378. </if>
  379. <if test="stackingID!=null">
  380. and RPG.STACKING_ID=#{stackingID}
  381. </if>
  382. <if test="gradationNumber!=null">
  383. and RPG.GRID_GRADATION_NUMBER=#{gradationNumber}
  384. </if>
  385. <if test="sequenceNumber!=null">
  386. and RPG.GRID_SEQUENCE_NUMBER=#{sequenceNumber}
  387. </if>
  388. </where>
  389. </select>
  390. <select id="getStackingId" resultType="java.util.LinkedHashMap">
  391. select *
  392. from (select distinct rpg.stacking_id "stackingId",rs.stacking_sequence
  393. from rms_pwarehouse_grid rpg
  394. left join wmsp_grid_material wgm
  395. on wgm.grid_id = rpg.grid_id
  396. left join rms_material_steel rms
  397. on wgm.material_id = rms.material_steel_id
  398. left join rms_material rm
  399. on rm.material_id = rms.material_id
  400. left join rms_stacking rs
  401. on rs.stacking_id = rpg.stacking_id
  402. where rpg.warehouse_id = #{warehouseId}
  403. and rm.material_code = #{materialCode}
  404. and rs.stacking_status = 1
  405. order by rs.stacking_sequence)
  406. where rownum = 1
  407. </select>
  408. <select id="getStackingStatus" resultType="java.lang.Integer" parameterType="DECIMAL">
  409. select rs.stacking_status
  410. from rms_stacking rs
  411. where rs.stacking_id = #{stackingId}
  412. </select>
  413. <select id="getCountMaterial" resultType="java.lang.Integer">
  414. select count(*)
  415. from wmsp_grid_material wgm
  416. left join rms_pwarehouse_grid rpg
  417. on rpg.grid_id = wgm.grid_id
  418. where rpg.stacking_id = #{stackingId}
  419. and wgm.deleted = 0
  420. </select>
  421. <select id="getMaxStackingLayers" resultType="java.lang.Integer">
  422. select rs.stacking_max_layers
  423. from rms_stacking rs
  424. where rs.stacking_id = #{stackingId}
  425. </select>
  426. <select id="getNullStackingId" resultType="java.util.LinkedHashMap">
  427. select distinct rs.stacking_id "stackingId", rs.stacking_sequence
  428. from rms_pwarehouse_grid rpg
  429. left join rms_stacking rs
  430. on rs.stacking_id = rpg.stacking_id
  431. where rpg.warehouse_id = #{warehouseId}
  432. order by rs.stacking_sequence
  433. </select>
  434. </mapper>