Files
FT542-WMS/ruoyi-admin/src/main/resources/mapper/bas/BasContainerDetailsMapper.xml
2025-12-03 16:09:29 +08:00

93 lines
4.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.ruoyi.bas.containerDetails.mapper.BasContainerDetailsMapper">
<resultMap type="BasContainerDetails" id="BasContainerDetailsResult">
<result property="id" column="id" />
<result property="containerId" column="container_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="quantity" column="quantity" />
<result property="unit" column="unit" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="spare3" column="spare3" />
</resultMap>
<sql id="selectBasContainerDetailsVo">
select id, container_id, product_id, product_name, quantity, unit, spare1, spare2, spare3 from bas_container_details
</sql>
<select id="selectBasContainerDetailsList" parameterType="BasContainerDetails" resultMap="BasContainerDetailsResult">
<include refid="selectBasContainerDetailsVo"/>
<where>
<if test="containerId != null and containerId != ''"> and container_id = #{containerId}</if>
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</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>
</where>
</select>
<select id="selectBasContainerDetailsById" parameterType="Long" resultMap="BasContainerDetailsResult">
<include refid="selectBasContainerDetailsVo"/>
where id = #{id}
</select>
<insert id="insertBasContainerDetails" parameterType="BasContainerDetails">
insert into bas_container_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="containerId != null">container_id,</if>
<if test="productId != null">product_id,</if>
<if test="productName != null">product_name,</if>
<if test="quantity != null">quantity,</if>
<if test="unit != null">unit,</if>
<if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare3 != null">spare3,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="containerId != null">#{containerId},</if>
<if test="productId != null">#{productId},</if>
<if test="productName != null">#{productName},</if>
<if test="quantity != null">#{quantity},</if>
<if test="unit != null">#{unit},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare3 != null">#{spare3},</if>
</trim>
</insert>
<update id="updateBasContainerDetails" parameterType="BasContainerDetails">
update bas_container_details
<trim prefix="SET" suffixOverrides=",">
<if test="containerId != null">container_id = #{containerId},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasContainerDetailsById" parameterType="Long">
delete from bas_container_details where id = #{id}
</delete>
<delete id="deleteBasContainerDetailsByIds" parameterType="String">
delete from bas_container_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>