You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
5.6 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.wms.mapper.WmsLocationBarcodeMapper">
<resultMap type="WmsLocationBarcode" id="WmsLocationBarcodeResult">
<result property="locationBarcodeId" column="location_barcode_id"/>
<result property="locationCode" column="location_code"/>
<result property="materialId" column="material_id"/>
<result property="barcodeInfo" column="barcode_info"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="poNo" column="po_no"/>
</resultMap>
<sql id="selectWmsLocationBarcodeVo">
select location_barcode_id, location_code, material_id, barcode_info, remark, create_by, create_time
from wms_location_barcode
</sql>
<select id="selectWmsLocationBarcodeList" parameterType="WmsLocationBarcode" resultMap="WmsLocationBarcodeResult">
<include refid="selectWmsLocationBarcodeVo"/>
<where>
<if test="locationCode != null and locationCode != ''">and location_code = #{locationCode}</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
<if test="barcodeInfo != null and barcodeInfo != ''">and barcode_info = #{barcodeInfo}</if>
</where>
</select>
<select id="selectWmsLocationBarcodeByLocationBarcodeId" parameterType="Long" resultMap="WmsLocationBarcodeResult">
<include refid="selectWmsLocationBarcodeVo"/>
where location_barcode_id = #{locationBarcodeId}
</select>
<insert id="insertWmsLocationBarcode" parameterType="WmsLocationBarcode" useGeneratedKeys="true"
keyProperty="locationBarcodeId">
insert into wms_location_barcode
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code,</if>
<if test="materialId != null">material_id,</if>
<if test="barcodeInfo != null and barcodeInfo != ''">barcode_info,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="barcodeInfo != null and barcodeInfo != ''">#{barcodeInfo},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWmsLocationBarcode" parameterType="WmsLocationBarcode">
update wms_location_barcode
<trim prefix="SET" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="barcodeInfo != null and barcodeInfo != ''">barcode_info = #{barcodeInfo},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where location_barcode_id = #{locationBarcodeId}
</update>
<delete id="deleteWmsLocationBarcodeByLocationBarcodeId" parameterType="Long">
delete
from wms_location_barcode
where location_barcode_id = #{locationBarcodeId}
</delete>
<delete id="deleteWmsLocationBarcodeByLocationBarcodeIds" parameterType="String">
delete from wms_location_barcode where location_barcode_id in
<foreach item="locationBarcodeId" collection="array" open="(" separator="," close=")">
#{locationBarcodeId}
</foreach>
</delete>
<insert id="batchWmsLocationBarcode">
insert into wms_location_barcode( location_barcode_id, location_code, material_id, barcode_info, remark, create_by, create_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.locationBarcodeId}, #{item.locationCode}, #{item.materialId}, #{item.barcodeInfo}, #{item.remark}, #{item.createBy}, #{item.createTime})
</foreach>
</insert>
<select id="selectWmsLocationBarcodeJoinList" parameterType="WmsLocationBarcode" resultMap="WmsLocationBarcodeResult">
select wlb.location_barcode_id, wlb.location_code, wlb.material_id, wlb.barcode_info,
mbmi.material_code,mbmi.material_name,mbmi.material_spec,ifnull(mbbi.po_no,'无采购订单') as po_no
from wms_location_barcode wlb left join mes_base_material_info mbmi on wlb.material_id=mbmi.material_id
left join mes_base_barcode_info mbbi on wlb.barcode_info=mbbi.barcode_info
<where>
<if test="locationCode != null and locationCode != ''">and wlb.location_code = #{locationCode}</if>
<if test="materialId != null ">and wlb.material_id = #{materialId}</if>
<if test="barcodeInfo != null and barcodeInfo != ''">and wlb.barcode_info = #{barcodeInfo}</if>
</where>
</select>
</mapper>