WmsBoxInfoMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.ams.box.mapper.WmsBoxInfoMapper">
  6. <resultMap type="WmsBoxInfo" id="WmsBoxInfoResult">
  7. <result property="id" column="id" />
  8. <result property="boxNo" column="box_no" />
  9. <result property="boxType" column="box_type" />
  10. <result property="boxRemark" column="box_remark" />
  11. <result property="boxState" column="box_state" />
  12. <result property="isEmpty" column="is_empty" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="userdefine1" column="userdefine1" />
  18. <result property="userdefine2" column="userdefine2" />
  19. <result property="locationId" column="location_id" />
  20. <result property="isFull" column="is_full" />
  21. <result property="locationNo" column="location_no"/>
  22. </resultMap>
  23. <sql id="selectWmsBoxInfoVo">
  24. select id, box_no, box_type, box_remark, box_state, is_empty, create_by, create_time, update_by, update_time, userdefine1, userdefine2, location_id, is_full from wms_box_info
  25. </sql>
  26. <select id="selectWmsBoxInfoList" parameterType="WmsBoxInfo" resultMap="WmsBoxInfoResult">
  27. select t1.*,t2.location_no
  28. from wms_box_info t1
  29. left join base_location_info t2 on t2.id = t1.location_id
  30. <where>
  31. <if test="isFull != null and isFull != ''"> and is_full = #{isFull}</if>
  32. <if test="boxNo != null and boxNo != ''"> and box_no = #{boxNo}</if>
  33. <if test="locationNo != null and locationNo != ''"> and t2.location_no = #{locationNo}</if>
  34. <if test="locationId != null and locationId != ''"> and t1.location_id = #{locationId}</if>
  35. </where>
  36. </select>
  37. <select id="selectWmsBoxInfoById" parameterType="Long" resultMap="WmsBoxInfoResult">
  38. <include refid="selectWmsBoxInfoVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertWmsBoxInfo" parameterType="WmsBoxInfo" useGeneratedKeys="true" keyProperty="id">
  42. insert into wms_box_info
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="boxNo != null">box_no,</if>
  45. <if test="boxType != null">box_type,</if>
  46. <if test="boxRemark != null">box_remark,</if>
  47. <if test="boxState != null">box_state,</if>
  48. <if test="isEmpty != null">is_empty,</if>
  49. <if test="createBy != null">create_by,</if>
  50. <if test="createTime != null">create_time,</if>
  51. <if test="updateBy != null">update_by,</if>
  52. <if test="updateTime != null">update_time,</if>
  53. <if test="userdefine1 != null">userdefine1,</if>
  54. <if test="userdefine2 != null">userdefine2,</if>
  55. <if test="locationId != null">location_id,</if>
  56. <if test="isFull != null">is_full,</if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides=",">
  59. <if test="boxNo != null">#{boxNo},</if>
  60. <if test="boxType != null">#{boxType},</if>
  61. <if test="boxRemark != null">#{boxRemark},</if>
  62. <if test="boxState != null">#{boxState},</if>
  63. <if test="isEmpty != null">#{isEmpty},</if>
  64. <if test="createBy != null">#{createBy},</if>
  65. <if test="createTime != null">#{createTime},</if>
  66. <if test="updateBy != null">#{updateBy},</if>
  67. <if test="updateTime != null">#{updateTime},</if>
  68. <if test="userdefine1 != null">#{userdefine1},</if>
  69. <if test="userdefine2 != null">#{userdefine2},</if>
  70. <if test="locationId != null">#{locationId},</if>
  71. <if test="isFull != null">#{isFull},</if>
  72. </trim>
  73. </insert>
  74. <update id="updateWmsBoxInfo" parameterType="WmsBoxInfo">
  75. update wms_box_info
  76. <trim prefix="SET" suffixOverrides=",">
  77. <if test="boxNo != null">box_no = #{boxNo},</if>
  78. <if test="boxType != null">box_type = #{boxType},</if>
  79. <if test="boxRemark != null">box_remark = #{boxRemark},</if>
  80. <if test="boxState != null">box_state = #{boxState},</if>
  81. <if test="isEmpty != null">is_empty = #{isEmpty},</if>
  82. <if test="createBy != null">create_by = #{createBy},</if>
  83. <if test="createTime != null">create_time = #{createTime},</if>
  84. <if test="updateBy != null">update_by = #{updateBy},</if>
  85. <if test="updateTime != null">update_time = #{updateTime},</if>
  86. <if test="userdefine1 != null">userdefine1 = #{userdefine1},</if>
  87. <if test="userdefine2 != null">userdefine2 = #{userdefine2},</if>
  88. <if test="locationId != null">location_id = #{locationId},</if>
  89. <if test="isFull != null">is_full = #{isFull},</if>
  90. </trim>
  91. where id = #{id}
  92. </update>
  93. <update id="updateWmsBoxInfoIsNull" parameterType="WmsBoxInfo">
  94. update wms_box_info
  95. <trim prefix="SET" suffixOverrides=",">
  96. location_id = null,
  97. <if test="boxNo != null">box_no = #{boxNo},</if>
  98. <if test="boxType != null">box_type = #{boxType},</if>
  99. <if test="boxRemark != null">box_remark = #{boxRemark},</if>
  100. <if test="boxState != null">box_state = #{boxState},</if>
  101. <if test="isEmpty != null">is_empty = #{isEmpty},</if>
  102. <if test="createBy != null">create_by = #{createBy},</if>
  103. <if test="createTime != null">create_time = #{createTime},</if>
  104. <if test="updateBy != null">update_by = #{updateBy},</if>
  105. <if test="updateTime != null">update_time = #{updateTime},</if>
  106. <if test="userdefine1 != null">userdefine1 = #{userdefine1},</if>
  107. <if test="userdefine2 != null">userdefine2 = #{userdefine2},</if>
  108. <if test="isFull != null">is_full = #{isFull},</if>
  109. </trim>
  110. where id = #{id}
  111. </update>
  112. <delete id="deleteWmsBoxInfoById" parameterType="Long">
  113. delete from wms_box_info where id = #{id}
  114. </delete>
  115. <delete id="deleteWmsBoxInfoByIds" parameterType="String">
  116. delete from wms_box_info where id in
  117. <foreach item="id" collection="array" open="(" separator="," close=")">
  118. #{id}
  119. </foreach>
  120. </delete>
  121. <update id="updateLocationBind">
  122. update wms_box_info
  123. <trim prefix="SET" suffixOverrides=",">
  124. <if test="locationTo != null">location_id = #{locationTo},</if>
  125. <if test="isFull != null">is_full = #{isFull},</if>
  126. </trim>
  127. where location_id = #{locationFrom}
  128. </update>
  129. <update id="updateLocationBindByPalletNo">
  130. update wms_box_info
  131. <trim prefix="SET" suffixOverrides=",">
  132. <if test="locationTo != null">location_id = #{locationTo},</if>
  133. <if test="isFull != null">is_full = #{isFull},</if>
  134. </trim>
  135. where location_id = #{locationFrom} and box_no =#{palletNo}
  136. </update>
  137. <update id="unbindBox">
  138. update wms_box_info set location_id = '',is_full = 'N',is_empty='Y'
  139. where location_id = #{locationId}
  140. </update>
  141. <select id="selectWmsBoxInfoByBoxNo" parameterType="string" resultMap="WmsBoxInfoResult">
  142. <include refid="selectWmsBoxInfoVo"/>
  143. where box_no = #{boxNo}
  144. </select>
  145. <select id="selectByLocationId" parameterType="string" resultMap="WmsBoxInfoResult">
  146. <include refid="selectWmsBoxInfoVo"/>
  147. where location_id = #{locationId}
  148. </select>
  149. </mapper>