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

166 lines
8.6 KiB

<?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.stock.mapper.WarehouseMapper">
<resultMap type="Warehouse" id="WarehouseResult">
<result property="id" column="id"/>
<result property="wlCode" column="wlCode"/>
<result property="itemName" column="itemName"/>
<result property="itemStandard" column="itemStandard"/>
<result property="machineNo" column="machineNo"/>
<result property="stockDw" column="stockDw"/>
<result property="qty" column="qty"/>
<result property="warehouseName" column="warehouseName"/>
<result property="warehouseNo" column="warehouseNo"/>
<result property="depositPosition" column="depositPosition"/>
<result property="inClass" column="inClass"/>
<result property="spare1" column="spare1"/>
<result property="spare2" column="spare2"/>
<result property="spare3" column="spare3"/>
<result property="spare4" column="spare4"/>
<result property="spare5" column="spare5"/>
<result property="spare6" column="spare6"/>
<result property="wlType" column="wlType"/>
<result property="batchNumber" column="batchNumber"/>
</resultMap>
<sql id="selectWarehouseVo">
select id, wlCode, itemName, itemStandard, machineNo, stockDw, qty, warehouseName, warehouseNo, depositPosition, inClass, spare1, spare2, spare3, spare4, spare5, spare6, wlType, batchNumber from warehouse
</sql>
<select id="selectWarehouseList" parameterType="Warehouse" resultMap="WarehouseResult">
<include refid="selectWarehouseVo"/>
<where>
<if test="wlCode != null and wlCode != ''">and wlCode like concat('%', #{wlCode}, '%')</if>
<if test="itemName != null and itemName != ''">and itemName like concat('%', #{itemName}, '%')</if>
<if test="itemStandard != null and itemStandard != ''">and itemStandard like concat('%', #{itemStandard},
'%')
</if>
<if test="machineNo != null and machineNo != ''">and machineNo like concat('%', #{machineNo}, '%')</if>
<if test="stockDw != null and stockDw != ''">and stockDw like concat('%', #{stockDw}, '%')</if>
<if test="qty != null ">and qty = #{qty}</if>
<if test="warehouseName != null and warehouseName != ''">and warehouseName = #{warehouseName}</if>
<if test="warehouseNo != null and warehouseNo != ''">and warehouseNo = #{warehouseNo}</if>
<if test="depositPosition != null and depositPosition != ''">and depositPosition = #{depositPosition}</if>
<if test="inClass != null and inClass != ''">and inClass = #{inClass}</if>
<if test="spare1 != null and spare1 != ''">and spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''">and spare2 = #{spare2}</if>
<if test="spare3 != null and spare3 != ''">and spare3 = #{spare3}</if>
<if test="spare4 != null and spare4 != ''">and spare4 = #{spare4}</if>
<if test="spare5 != null and spare5 != ''">and spare5 = #{spare5}</if>
<if test="spare6 != null and spare6 != ''">and spare6 = #{spare6}</if>
<if test="wlType != null and wlType != ''">and wlType = #{wlType}</if>
<if test="batchNumber != null and batchNumber != ''">and batchNumber = #{batchNumber}</if>
</where>
</select>
<select id="selectWarehouseById" parameterType="Long" resultMap="WarehouseResult">
<include refid="selectWarehouseVo"/>
where id = #{id}
</select>
<insert id="insertWarehouse" parameterType="Warehouse" useGeneratedKeys="true" keyProperty="id">
insert into warehouse
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wlCode != null">wlCode,</if>
<if test="itemName != null">itemName,</if>
<if test="itemStandard != null">itemStandard,</if>
<if test="machineNo != null">machineNo,</if>
<if test="stockDw != null">stockDw,</if>
<if test="qty != null">qty,</if>
<if test="warehouseName != null">warehouseName,</if>
<if test="warehouseNo != null">warehouseNo,</if>
<if test="depositPosition != null">depositPosition,</if>
<if test="inClass != null">inClass,</if>
<if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare3 != null">spare3,</if>
<if test="spare4 != null">spare4,</if>
<if test="spare5 != null">spare5,</if>
<if test="spare6 != null">spare6,</if>
<if test="wlType != null">wlType,</if>
<if test="batchNumber != null">batchNumber,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wlCode != null">#{wlCode},</if>
<if test="itemName != null">#{itemName},</if>
<if test="itemStandard != null">#{itemStandard},</if>
<if test="machineNo != null">#{machineNo},</if>
<if test="stockDw != null">#{stockDw},</if>
<if test="qty != null">#{qty},</if>
<if test="warehouseName != null">#{warehouseName},</if>
<if test="warehouseNo != null">#{warehouseNo},</if>
<if test="depositPosition != null">#{depositPosition},</if>
<if test="inClass != null">#{inClass},</if>
<if test="spare1 != null">now(),</if>
<if test="spare2 != null">now(),</if>
<if test="spare3 != null">#{spare3},</if>
<if test="spare4 != null">#{spare4},</if>
<if test="spare5 != null">#{spare5},</if>
<if test="spare6 != null">#{spare6},</if>
<if test="wlType != null">#{wlType},</if>
<if test="batchNumber != null">#{batchNumber},</if>
</trim>
</insert>
<update id="updateWarehouse" parameterType="Warehouse">
update warehouse
<trim prefix="SET" suffixOverrides=",">
<if test="wlCode != null">wlCode = #{wlCode},</if>
<if test="itemName != null">itemName = #{itemName},</if>
<if test="itemStandard != null">itemStandard = #{itemStandard},</if>
<if test="machineNo != null">machineNo = #{machineNo},</if>
<if test="stockDw != null">stockDw = #{stockDw},</if>
<if test="qty != null">qty = #{qty},</if>
<if test="warehouseName != null">warehouseName = #{warehouseName},</if>
<if test="warehouseNo != null">warehouseNo = #{warehouseNo},</if>
<if test="depositPosition != null">depositPosition = #{depositPosition},</if>
<if test="inClass != null">inClass = #{inClass},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="spare5 != null">spare5 = #{spare5},</if>
<if test="spare6 != null">spare6 = #{spare6},</if>
<if test="wlType != null">wlType = #{wlType},</if>
<if test="batchNumber != null">batchNumber = #{batchNumber},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWarehouseById" parameterType="Long">
delete from warehouse where id = #{id}
</delete>
<delete id="deleteWarehouseByIds" parameterType="String">
delete from warehouse where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="addQty" parameterType="Warehouse">
update warehouse set qty=qty+#{qty},spare1=now() where wlCode=#{wlCode}
</update>
<update id="minusQty" parameterType="Warehouse">
update warehouse set qty=qty-#{qty},spare2=now() where wlCode=#{wlCode}
</update>
<select id="selectByCode" parameterType="Warehouse" resultMap="WarehouseResult">
select * from warehouse where wlCode=#{wlCode}
</select>
<select id="selectSlowMovingItemByPut" parameterType="Warehouse" resultMap="WarehouseResult">
select * from warehouse where to_days(now()) - to_days(spare1) > 30
<if test="wlType != null and wlType != ''"> and wlType = #{wlType}</if>
</select>
<select id="selectSlowMovingItemByOut" parameterType="Warehouse" resultMap="WarehouseResult">
select * from warehouse where to_days(now()) - to_days(spare2) > 30
<if test="wlType != null and wlType != ''"> and wlType = #{wlType}</if>
</select>
</mapper>