Files
FT577-WMS/ruoyi-admin/src/main/resources/mapper/pd/PdStockpdMapper.xml

161 lines
10 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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.pd.stockpd.mapper.PdStockpdMapper">
<resultMap type="PdStockpd" id="PdStockpdResult">
<result property="stockpdId" column="stockpd_id" />
<result property="pdType" column="pd_type" />
<result property="stockSource" column="stock_source" />
<result property="status" column="status" />
<result property="createDate" column="create_date" />
<result property="startDate" column="start_date" />
<result property="finishDate" column="finish_date" />
<result property="erpBill" column="erp_bill" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
</resultMap>
<sql id="selectPdStockpdVo">
select stockpd_id, pd_type, stock_source, status, create_date, start_date, finish_date, erp_bill, warehouse_id, warehouse_name, user_id, user_name, dept_id, dept_name from pd_stockpd
</sql>
<select id="selectPdStockpdList" parameterType="PdStockpd" resultMap="PdStockpdResult">
<include refid="selectPdStockpdVo"/>
<where>
<if test="pdType != null and pdType != ''"> and pd_type = #{pdType}</if>
<if test="stockSource != null and stockSource != ''"> and stock_source = #{stockSource}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="params.beginCreateDate != null and params.beginCreateDate != '' and params.endCreateDate != null and params.endCreateDate != ''"> and create_date between #{params.beginCreateDate} and #{params.endCreateDate}</if>
<if test="params.beginStartDate != null and params.beginStartDate != '' and params.endStartDate != null and params.endStartDate != ''"> and start_date between #{params.beginStartDate} and #{params.endStartDate}</if>
<if test="params.beginFinishDate != null and params.beginFinishDate != '' and params.endFinishDate != null and params.endFinishDate != ''"> and finish_date between #{params.beginFinishDate} and #{params.endFinishDate}</if>
<if test="erpBill != null and erpBill != ''"> and erp_bill = #{erpBill}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
</where>
</select>
<select id="selectPdStockpdByStockpdId" parameterType="String" resultMap="PdStockpdResult">
<include refid="selectPdStockpdVo"/>
where stockpd_id = #{stockpdId}
</select>
<insert id="insertPdStockpd" parameterType="PdStockpd">
insert into pd_stockpd
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockpdId != null">stockpd_id,</if>
<if test="pdType != null and pdType != ''">pd_type,</if>
<if test="stockSource != null and stockSource != ''">stock_source,</if>
<if test="status != null and status != ''">status,</if>
<if test="createDate != null ">create_date,</if>
<if test="startDate != null">start_date,</if>
<if test="finishDate != null">finish_date,</if>
<if test="erpBill != null">erp_bill,</if>
<if test="warehouseId != null and warehouseId != ''">warehouse_id,</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="deptId != null">dept_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockpdId != null">#{stockpdId},</if>
<if test="pdType != null and pdType != ''">#{pdType},</if>
<if test="stockSource != null and stockSource != ''">#{stockSource},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createDate != null ">#{createDate},</if>
<if test="startDate != null">#{startDate},</if>
<if test="finishDate != null">#{finishDate},</if>
<if test="erpBill != null">#{erpBill},</if>
<if test="warehouseId != null and warehouseId != ''">#{warehouseId},</if>
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="deptId != null">#{deptId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
</trim>
</insert>
<update id="updatePdStockpd" parameterType="PdStockpd">
update pd_stockpd
<trim prefix="SET" suffixOverrides=",">
<if test="pdType != null and pdType != ''">pd_type = #{pdType},</if>
<if test="stockSource != null and stockSource != ''">stock_source = #{stockSource},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="createDate != null and createDate != ''">create_date = #{createDate},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="finishDate != null">finish_date = #{finishDate},</if>
<if test="erpBill != null">erp_bill = #{erpBill},</if>
<if test="warehouseId != null and warehouseId != ''">warehouse_id = #{warehouseId},</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
</trim>
where stockpd_id = #{stockpdId}
</update>
<delete id="deletePdStockpdByStockpdId" parameterType="String">
delete from pd_stockpd where stockpd_id = #{stockpdId}
</delete>
<delete id="deletePdStockpdByStockpdIds" parameterType="String">
delete from pd_stockpd where stockpd_id in
<foreach item="stockpdId" collection="array" open="(" separator="," close=")">
#{stockpdId}
</foreach>
</delete>
<!-- 存储过程:更新盘点单据状态(作废/审核/完成)-->
<select id="updatePdStockpdByProc" parameterType="java.util.Map" statementType="CALLABLE">
{call proc_pd_bill_update_status(
#{v_stockpd_id,mode=IN,jdbcType=VARCHAR},
#{v_status,mode=IN,jdbcType=INTEGER},
#{v_result,mode=OUT,jdbcType=INTEGER},
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
)}
</select>
<!-- 存储过程:自动分配盘点单据 -->
<select id="autoAssignPdStockpdByProc" parameterType="java.util.Map" statementType="CALLABLE">
{call proc_pd_auto_allocation(
#{v_stockpd_detail_id,mode=IN,jdbcType=VARCHAR},
#{v_result,mode=OUT,jdbcType=INTEGER},
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
)}
</select>
<!-- 已完成盘点单据列表(查pd_stockpd_finish表) -->
<sql id="selectPdStockpdFinishVo">
select stockpd_id, pd_type, stock_source, status, create_date, start_date, finish_date, erp_bill, warehouse_id, warehouse_name, user_id, user_name, dept_id, dept_name from pd_stockpd_finish
</sql>
<select id="selectPdStockpdFinishList" parameterType="PdStockpd" resultMap="PdStockpdResult">
<include refid="selectPdStockpdFinishVo"/>
<where>
<if test="pdType != null and pdType != ''"> and pd_type = #{pdType}</if>
<if test="stockSource != null and stockSource != ''"> and stock_source = #{stockSource}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="params.beginCreateDate != null and params.beginCreateDate != '' and params.endCreateDate != null and params.endCreateDate != ''"> and create_date between #{params.beginCreateDate} and #{params.endCreateDate}</if>
<if test="params.beginStartDate != null and params.beginStartDate != '' and params.endStartDate != null and params.endStartDate != ''"> and start_date between #{params.beginStartDate} and #{params.endStartDate}</if>
<if test="params.beginFinishDate != null and params.beginFinishDate != '' and params.endFinishDate != null and params.endFinishDate != ''"> and finish_date between #{params.beginFinishDate} and #{params.endFinishDate}</if>
<if test="erpBill != null and erpBill != ''"> and erp_bill = #{erpBill}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
</where>
</select>
</mapper>