wms_serve_xugongteji/ruoyi-system/src/main/resources/mapper/app/AppStockMapper.xml

178 lines
10 KiB
XML
Raw Normal View History

2025-01-15 10:28:03 +08:00
<?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.app.mapper.AppStockMapper">
<resultMap type="AppStock" id="AppStockResult">
<result property="stockId" column="stock_id" />
<result property="vehicleId" column="vehicle_id" />
<result property="locationId" column="location_id" />
<result property="goodsId" column="goods_id" />
<result property="goodsName" column="goods_name" />
<result property="goodsUnit" column="goods_unit" />
<result property="providerId" column="provider_id" />
<result property="providerName" column="provider_name" />
<result property="remainNum" column="remain_num" />
<result property="originNum" column="origin_num" />
<result property="batchNo" column="batch_no" />
<result property="invAge" column="inv_age" />
<result property="goodsStatus" column="goods_status" />
<result property="stockStatus" column="stock_status" />
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
<result property="lastUpdateTime" column="last_update_time" />
<result property="lastUpdateUser" column="last_update_user" />
<result property="remark" column="remark" />
2025-03-06 02:59:02 +08:00
<result property="wareDate" column="ware_date" />
<result property="storageMode" column="storage_mode" />
<result property="storageId" column="storage_id" />
<result property="areaId" column="area_id" />
<result property="goodsTypeId" column="goods_type_id" />
<result property="occupyNum" column="occupy_num" />
<result property="packingNum" column="packing_num" />
<result property="productionDate" column="production_date" />
2025-01-15 10:28:03 +08:00
</resultMap>
<sql id="selectAppStockVo">
2025-03-06 02:59:02 +08:00
select stock_id, vehicle_id, location_id, goods_id, goods_name, goods_unit, provider_id, provider_name, remain_num, origin_num, batch_no, inv_age, goods_status, stock_status, create_time, create_user, last_update_time, last_update_user, remark ,
ware_date, storage_mode,storage_id, area_id, goods_type_id, occupy_num, packing_num, production_date from app_stock
2025-01-15 10:28:03 +08:00
</sql>
<select id="selectAppStockList" parameterType="AppStock" resultMap="AppStockResult">
<include refid="selectAppStockVo"/>
<where>
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="providerId != null and providerId != ''"> and provider_id = #{providerId}</if>
<if test="providerName != null and providerName != ''"> and provider_name like concat('%', #{providerName}, '%')</if>
<if test="batchNo != null and batchNo != ''"> and batch_no = #{batchNo}</if>
<if test="goodsStatus != null "> and goods_status = #{goodsStatus}</if>
<if test="stockStatus != null "> and stock_status = #{stockStatus}</if>
2025-03-06 10:15:39 +08:00
<if test="storageId != null"> and storage_id = #{storageId}</if>
2025-01-15 10:28:03 +08:00
</where>
</select>
2025-03-06 02:59:02 +08:00
<select id="selectStockByGoodsId" parameterType="AppStock" resultMap="AppStockResult">
<include refid="selectAppStockVo"/>
where goods_id = #{goodsId} and stock_status = '0'
order by ware_date asc
</select>
2025-01-15 10:28:03 +08:00
<select id="selectAppStockByStockId" parameterType="String" resultMap="AppStockResult">
<include refid="selectAppStockVo"/>
where stock_id = #{stockId}
</select>
2025-03-06 02:59:02 +08:00
<update id="updateSts" parameterType="AppStock">
update app_stock set stock_status = #{stockStatus} where UPPER(vehicle_id) = UPPER(#{vehicleId})
</update>
2025-01-15 10:28:03 +08:00
<insert id="insertAppStock" parameterType="AppStock">
insert into app_stock
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockId != null">stock_id,</if>
<if test="vehicleId != null and vehicleId != ''">vehicle_id,</if>
<if test="locationId != null and locationId != ''">location_id,</if>
<if test="goodsId != null and goodsId != ''">goods_id,</if>
<if test="goodsName != null">goods_name,</if>
<if test="goodsUnit != null">goods_unit,</if>
<if test="providerId != null and providerId != ''">provider_id,</if>
<if test="providerName != null">provider_name,</if>
<if test="remainNum != null">remain_num,</if>
<if test="originNum != null">origin_num,</if>
<if test="batchNo != null">batch_no,</if>
<if test="invAge != null">inv_age,</if>
<if test="goodsStatus != null">goods_status,</if>
<if test="stockStatus != null">stock_status,</if>
<if test="createTime != null">create_time,</if>
<if test="createUser != null">create_user,</if>
<if test="lastUpdateTime != null">last_update_time,</if>
<if test="lastUpdateUser != null">last_update_user,</if>
<if test="remark != null">remark,</if>
2025-03-06 02:59:02 +08:00
<if test="wareDate != null">ware_date,</if>
<if test="storageMode != null">storage_mode,</if>
<if test="storageId != null">storage_id,</if>
<if test="areaId != null">area_id,</if>
<if test="goodsTypeId != null">goods_type_id,</if>
<if test="occupyNum != null">occupy_num,</if>
<if test="packingNum != null">packing_num,</if>
<if test="productionDate != null">production_date,</if>
2025-01-15 10:28:03 +08:00
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockId != null">#{stockId},</if>
<if test="vehicleId != null and vehicleId != ''">#{vehicleId},</if>
<if test="locationId != null and locationId != ''">#{locationId},</if>
<if test="goodsId != null and goodsId != ''">#{goodsId},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="goodsUnit != null">#{goodsUnit},</if>
<if test="providerId != null and providerId != ''">#{providerId},</if>
<if test="providerName != null">#{providerName},</if>
<if test="remainNum != null">#{remainNum},</if>
<if test="originNum != null">#{originNum},</if>
<if test="batchNo != null">#{batchNo},</if>
<if test="invAge != null">#{invAge},</if>
<if test="goodsStatus != null">#{goodsStatus},</if>
<if test="stockStatus != null">#{stockStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if>
<if test="lastUpdateTime != null">#{lastUpdateTime},</if>
<if test="lastUpdateUser != null">#{lastUpdateUser},</if>
<if test="remark != null">#{remark},</if>
2025-03-06 02:59:02 +08:00
<if test="wareDate != null">#{wareDate},</if>
<if test="storageMode != null">#{storageMode},</if>
<if test="storageId != null">#{storageId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="goodsTypeId != null">#{goodsTypeId},</if>
<if test="occupyNum != null">#{occupyNum},</if>
<if test="packingNum != null">#{packingNum},</if>
<if test="productionDate != null">#{productionDate},</if>
2025-01-15 10:28:03 +08:00
</trim>
</insert>
<update id="updateAppStock" parameterType="AppStock">
update app_stock
<trim prefix="SET" suffixOverrides=",">
<if test="vehicleId != null and vehicleId != ''">vehicle_id = #{vehicleId},</if>
<if test="locationId != null and locationId != ''">location_id = #{locationId},</if>
<if test="goodsId != null and goodsId != ''">goods_id = #{goodsId},</if>
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="goodsUnit != null">goods_unit = #{goodsUnit},</if>
<if test="providerId != null and providerId != ''">provider_id = #{providerId},</if>
<if test="providerName != null">provider_name = #{providerName},</if>
<if test="remainNum != null">remain_num = #{remainNum},</if>
<if test="originNum != null">origin_num = #{originNum},</if>
<if test="batchNo != null">batch_no = #{batchNo},</if>
<if test="invAge != null">inv_age = #{invAge},</if>
<if test="goodsStatus != null">goods_status = #{goodsStatus},</if>
<if test="stockStatus != null">stock_status = #{stockStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUser != null">create_user = #{createUser},</if>
<if test="lastUpdateTime != null">last_update_time = #{lastUpdateTime},</if>
<if test="lastUpdateUser != null">last_update_user = #{lastUpdateUser},</if>
<if test="remark != null">remark = #{remark},</if>
2025-03-06 02:59:02 +08:00
<if test="wareDate != null">ware_date = #{wareDate},</if>
<if test="storageMode != null">storage_mode = #{storageMode},</if>
<if test="storageId != null">storage_id = #{storageId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="goodsTypeId != null">goods_type_id = #{goodsTypeId},</if>
<if test="occupyNum != null">occupy_num = #{occupyNum},</if>
<if test="packingNum != null">packing_num = #{packingNum},</if>
<if test="productionDate != null">production_date = #{productionDate},</if>
2025-01-15 10:28:03 +08:00
</trim>
where stock_id = #{stockId}
</update>
2025-03-06 01:52:48 +08:00
<update id="updateNewLocation">
update app_stock set location_id = #{newLocation} where location_id = #{oldLocation}
</update>
2025-01-15 10:28:03 +08:00
<delete id="deleteAppStockByStockId" parameterType="String">
delete from app_stock where stock_id = #{stockId}
</delete>
<delete id="deleteAppStockByStockIds" parameterType="String">
delete from app_stock where stock_id in
<foreach item="stockId" collection="array" open="(" separator="," close=")">
#{stockId}
</foreach>
</delete>
2025-03-06 01:52:48 +08:00
</mapper>