Files
FT546MWS/ruoyi-admin/src/main/resources/mapper/receive/ReceiveStockinFinishMapper.xml
张怡蓉 d427ebf6d0 初始化
2025-12-23 13:36:18 +08:00

237 lines
14 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.ruoyi.receive.stockinfinish.mapper.ReceiveStockinFinishMapper">
<resultMap type="ReceiveStockinFinish" id="ReceiveStockinFinishResult">
<result property="stockinGuid" column="stockin_guid" />
<result property="stockinId" column="stockin_id" />
<result property="inType" column="in_type" />
<result property="createDate" column="create_date" />
<result property="createManId" column="create_man_id" />
<result property="status" column="status" />
<result property="warehouseId" column="warehouse_id" />
<result property="spare5" column="spare5" />
<result property="spare4" column="spare4" />
<result property="spare3" column="spare3" />
<result property="finishDate" column="finish_date" />
<result property="spare2" column="spare2" />
<result property="spare1" column="spare1" />
<result property="erpBill" column="erp_bill" />
<result property="stockSource" column="stock_source" />
<result property="departmentNo" column="department_no" />
<result property="customerNo" column="customer_no" />
<result property="classNo" column="class_no" />
<result property="supplierNo" column="supplier_no" />
</resultMap>
<resultMap type="ReceiveStockin" id="ReceiveStockinResult">
<result property="stockinGuid" column="stockin_guid" />
<result property="stockinId" column="stockin_id" />
<result property="inType" column="in_type" />
<result property="createDate" column="create_date" />
<result property="createManId" column="create_man_id" />
<result property="createManName" column="user_name" />
<result property="status" column="status" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="spare5" column="spare5" />
<result property="spare4" column="spare4" />
<result property="spare3" column="spare3" />
<result property="finishDate" column="finish_date" />
<result property="spare2" column="spare2" />
<result property="spare1" column="spare1" />
<result property="erpBill" column="erp_bill" />
<result property="stockSource" column="stock_source" />
<result property="departmentNo" column="department_no" />
<result property="departmentName" column="dept_name" />
<result property="customerNo" column="customer_no" />
<result property="classNo" column="class_no" />
<result property="supplierNo" column="supplier_no" />
<result property="supplierName" column="supplier_name" />
</resultMap>
<sql id="selectReceiveStockinFinishVo">
select
rs.stockin_guid ,
rs.stockin_id ,
rs.in_type ,
rs.create_date ,
rs.create_man_id ,
rs.status ,
rs.warehouse_id ,
bw.warehouse_name ,
rs.spare5 ,
rs.spare4 ,
rs.spare3 ,
rs.finish_date ,
rs.spare2 ,
rs.spare1,
rs.erp_bill ,
rs.stock_source,
rs.department_no,
rs.customer_no,
rs.class_no,
rs.supplier_no,
bs.supplier_name,
sd.dept_name,
su.user_name
from receive_stockin_finish rs
left join bas_warehouse bw on rs.warehouse_id = bw.warehouse_id
left join bas_supplier bs on rs.supplier_no = bs.supplier_no
left join sys_dept sd on rs.department_no = sd.dept_id
left join sys_user su on su.user_id = rs.create_man_id
</sql>
<select id="selectReceiveStockinFinishList" parameterType="ReceiveStockinFinish" resultMap="ReceiveStockinFinishResult">
<include refid="selectReceiveStockinFinishVo"/>
<where>
<if test="stockinId != null and stockinId != ''"> and rs.stockin_id = #{stockinId}</if>
<if test="inType != null and inType != ''"> and rs.in_type = #{inType}</if>
<if test="createDate != null and createDate != ''"> and rs.create_date = #{createDate}</if>
<if test="createManId != null and createManId != ''"> and rs.create_man_id = #{createManId}</if>
<if test="status != null and status != ''"> and rs.status = #{status}</if>
<if test="warehouseId != null and warehouseId != ''"> and rs.warehouse_id = #{warehouseId}</if>
<if test="spare5 != null and spare5 != ''"> and rs.spare5 = #{spare5}</if>
<if test="spare4 != null and spare4 != ''"> and rs.spare4 = #{spare4}</if>
<if test="spare3 != null and spare3 != ''"> and rs.spare3 = #{spare3}</if>
<if test="finishDate != null and finishDate != ''"> and rs.finish_date = #{finishDate}</if>
<if test="spare2 != null and spare2 != ''"> and rs.spare2 = #{spare2}</if>
<if test="spare1 != null and spare1 != ''"> and rs.spare1 = #{spare1}</if>
<if test="erpBill != null and erpBill != ''"> and rs.erp_bill = #{erpBill}</if>
<if test="stockSource != null and stockSource != ''"> and rs.stock_source = #{stockSource}</if>
<if test="departmentNo != null and departmentNo != ''"> and rs.department_no = #{departmentNo}</if>
<if test="customerNo != null and customerNo != ''"> and rs.customer_no = #{customerNo}</if>
<if test="classNo != null and classNo != ''"> and rs.class_no = #{classNo}</if>
<if test="supplierNo != null and supplierNo != ''"> and rs.supplier_no = #{supplierNo}</if>
</where>
</select>
<select id="selectReceiveStockinFinishByStockinGuid" parameterType="String" resultMap="ReceiveStockinFinishResult">
<include refid="selectReceiveStockinFinishVo"/>
where stockin_guid = #{stockinGuid}
</select>
<select id="selectReceiveStockinList" resultMap="ReceiveStockinResult">
<include refid="selectReceiveStockinFinishVo"/>
<where>
<if test="stockinId != null and stockinId != ''"> and rs.stockin_id = #{stockinId}</if>
<if test="inType != null and inType != ''"> and rs.in_type = #{inType}</if>
<if test="createDate != null and createDate != ''"> and rs.create_date = #{createDate}</if>
<if test="createManId != null and createManId != ''"> and rs.create_man_id = #{createManId}</if>
<if test="status != null and status != ''"> and rs.status = #{status}</if>
<if test="warehouseId != null and warehouseId != ''"> and rs.warehouse_id = #{warehouseId}</if>
<if test="spare5 != null and spare5 != ''"> and rs.spare5 = #{spare5}</if>
<if test="spare4 != null and spare4 != ''"> and rs.spare4 = #{spare4}</if>
<if test="spare3 != null and spare3 != ''"> and rs.spare3 = #{spare3}</if>
<if test="finishDate != null and finishDate != ''"> and rs.finish_date = #{finishDate}</if>
<if test="spare2 != null and spare2 != ''"> and rs.spare2 = #{spare2}</if>
<if test="spare1 != null and spare1 != ''"> and rs.spare1 = #{spare1}</if>
<if test="erpBill != null and erpBill != ''"> and rs.erp_bill = #{erpBill}</if>
<if test="stockSource != null and stockSource != ''"> and rs.stock_source = #{stockSource}</if>
<if test="departmentNo != null and departmentNo != ''"> and rs.department_no = #{departmentNo}</if>
<if test="customerNo != null and customerNo != ''"> and rs.customer_no = #{customerNo}</if>
<if test="classNo != null and classNo != ''"> and rs.class_no = #{classNo}</if>
<if test="supplierNo != null and supplierNo != ''"> and rs.supplier_no = #{supplierNo}</if>
<if test="materialDesc !=null and materialDesc!=''">
and rs.stockin_id in (
select distinct stockin_id from receive_stockin_detail_finish rsd
left join bas_product bp on rsd.product_id = bp.product_id
where bp.product_name like concat('%',#{materialDesc},'%')
)
</if>
<if test="lotNo !=null and lotNo!=''">
and rs.stockin_id in (
select distinct stockin_id from receive_stockin_detail_finish rsd
where rsd.lot_no like concat('%',#{lotNo},'%')
)
</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
order by rs.create_date desc
</select>
<insert id="insertReceiveStockinFinish" parameterType="ReceiveStockinFinish">
insert into receive_stockin_finish
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockinGuid != null">stockin_guid,</if>
<if test="stockinId != null and stockinId != ''">stockin_id,</if>
<if test="inType != null and inType != ''">in_type,</if>
<if test="createDate != null and createDate != ''">create_date,</if>
<if test="createManId != null">create_man_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="spare5 != null">spare5,</if>
<if test="spare4 != null">spare4,</if>
<if test="spare3 != null">spare3,</if>
<if test="finishDate != null">finish_date,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare1 != null">spare1,</if>
<if test="erpBill != null">erp_bill,</if>
<if test="stockSource != null">stock_source,</if>
<if test="departmentNo != null">department_no,</if>
<if test="customerNo != null">customer_no,</if>
<if test="classNo != null">class_no,</if>
<if test="supplierNo != null">supplier_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockinGuid != null">#{stockinGuid},</if>
<if test="stockinId != null and stockinId != ''">#{stockinId},</if>
<if test="inType != null and inType != ''">#{inType},</if>
<if test="createDate != null and createDate != ''">#{createDate},</if>
<if test="createManId != null">#{createManId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="spare5 != null">#{spare5},</if>
<if test="spare4 != null">#{spare4},</if>
<if test="spare3 != null">#{spare3},</if>
<if test="finishDate != null">#{finishDate},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="erpBill != null">#{erpBill},</if>
<if test="stockSource != null">#{stockSource},</if>
<if test="departmentNo != null">#{departmentNo},</if>
<if test="customerNo != null">#{customerNo},</if>
<if test="classNo != null">#{classNo},</if>
<if test="supplierNo != null">#{supplierNo},</if>
</trim>
</insert>
<update id="updateReceiveStockinFinish" parameterType="ReceiveStockinFinish">
update receive_stockin_finish
<trim prefix="SET" suffixOverrides=",">
<if test="stockinId != null and stockinId != ''">stockin_id = #{stockinId},</if>
<if test="inType != null and inType != ''">in_type = #{inType},</if>
<if test="createDate != null and createDate != ''">create_date = #{createDate},</if>
<if test="createManId != null">create_man_id = #{createManId},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="spare5 != null">spare5 = #{spare5},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="finishDate != null">finish_date = #{finishDate},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="erpBill != null">erp_bill = #{erpBill},</if>
<if test="stockSource != null">stock_source = #{stockSource},</if>
<if test="departmentNo != null">department_no = #{departmentNo},</if>
<if test="customerNo != null">customer_no = #{customerNo},</if>
<if test="classNo != null">class_no = #{classNo},</if>
<if test="supplierNo != null">supplier_no = #{supplierNo},</if>
</trim>
where stockin_guid = #{stockinGuid}
</update>
<delete id="deleteReceiveStockinFinishByStockinGuid" parameterType="String">
delete from receive_stockin_finish where stockin_guid = #{stockinGuid}
</delete>
<delete id="deleteReceiveStockinFinishByStockinGuids" parameterType="String">
delete from receive_stockin_finish where stockin_guid in
<foreach item="stockinGuid" collection="array" open="(" separator="," close=")">
#{stockinGuid}
</foreach>
</delete>
</mapper>