Files
FTC25009/ruoyi-admin/src/main/resources/mapper/bas/BasTrayRuleMapper.xml
2026-06-24 09:13:18 +08:00

112 lines
6.1 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.trayrule.mapper.BasTrayRuleMapper">
<resultMap type="BasTrayRule" id="BasTrayRuleResult">
<result property="id" column="id" />
<result property="ruleName" column="rule_name" />
<result property="trayType" column="tray_type" />
<result property="trayLength" column="tray_length" />
<result property="trayWidth" column="tray_width" />
<result property="allowedWarehouses" column="allowed_warehouses" />
<result property="allowedWarehouseNames" column="allowed_warehouse_names" />
<result property="allowedCargoType" column="allowed_cargo_type" />
<result property="allowedCargoTypeName" column="allowed_cargo_type_name" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectBasTrayRuleVo">
select id, rule_name, tray_type, tray_length, tray_width, allowed_warehouses,
allowed_warehouse_names, allowed_cargo_type, allowed_cargo_type_name,
remark, create_by, create_time, update_by, update_time
from bas_tray_rule
</sql>
<select id="selectBasTrayRuleList" parameterType="BasTrayRule" resultMap="BasTrayRuleResult">
<include refid="selectBasTrayRuleVo"/>
<where>
<if test="ruleName != null and ruleName != ''"> and rule_name like concat('%', #{ruleName}, '%')</if>
<if test="trayType != null and trayType != ''"> and tray_type = #{trayType}</if>
<if test="allowedWarehouses != null and allowedWarehouses != ''"> and charindex(',' + #{allowedWarehouses} + ',', ',' + allowed_warehouses + ',') &gt; 0</if>
<if test="allowedCargoType != null and allowedCargoType != ''"> and allowed_cargo_type = #{allowedCargoType}</if>
</where>
order by tray_type, id
</select>
<select id="selectBasTrayRuleById" parameterType="Long" resultMap="BasTrayRuleResult">
<include refid="selectBasTrayRuleVo"/>
where id = #{id}
</select>
<insert id="insertBasTrayRule" parameterType="BasTrayRule">
insert into bas_tray_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="ruleName != null and ruleName != ''">rule_name,</if>
<if test="trayType != null and trayType != ''">tray_type,</if>
<if test="trayLength != null">tray_length,</if>
<if test="trayWidth != null">tray_width,</if>
<if test="allowedWarehouses != null and allowedWarehouses != ''">allowed_warehouses,</if>
<if test="allowedWarehouseNames != null">allowed_warehouse_names,</if>
<if test="allowedCargoType != null and allowedCargoType != ''">allowed_cargo_type,</if>
<if test="allowedCargoTypeName != null">allowed_cargo_type_name,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="ruleName != null and ruleName != ''">#{ruleName},</if>
<if test="trayType != null and trayType != ''">#{trayType},</if>
<if test="trayLength != null">#{trayLength},</if>
<if test="trayWidth != null">#{trayWidth},</if>
<if test="allowedWarehouses != null and allowedWarehouses != ''">#{allowedWarehouses},</if>
<if test="allowedWarehouseNames != null">#{allowedWarehouseNames},</if>
<if test="allowedCargoType != null and allowedCargoType != ''">#{allowedCargoType},</if>
<if test="allowedCargoTypeName != null">#{allowedCargoTypeName},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBasTrayRule" parameterType="BasTrayRule">
update bas_tray_rule
<trim prefix="SET" suffixOverrides=",">
<if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
<if test="trayType != null and trayType != ''">tray_type = #{trayType},</if>
<if test="trayLength != null">tray_length = #{trayLength},</if>
<if test="trayWidth != null">tray_width = #{trayWidth},</if>
<if test="allowedWarehouses != null and allowedWarehouses != ''">allowed_warehouses = #{allowedWarehouses},</if>
<if test="allowedWarehouseNames != null">allowed_warehouse_names = #{allowedWarehouseNames},</if>
<if test="allowedCargoType != null and allowedCargoType != ''">allowed_cargo_type = #{allowedCargoType},</if>
<if test="allowedCargoTypeName != null">allowed_cargo_type_name = #{allowedCargoTypeName},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasTrayRuleById" parameterType="Long">
delete from bas_tray_rule where id = #{id}
</delete>
<delete id="deleteBasTrayRuleByIds" parameterType="String">
delete from bas_tray_rule where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>