105 lines
4.6 KiB
XML
105 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.traycode.mapper.BasTraycodeMapper">
|
|
|
|
<resultMap type="BasTraycode" id="BasTraycodeResult">
|
|
<result property="id" column="id" />
|
|
<result property="formatId" column="format_id" />
|
|
<result property="formatName" column="format_name" />
|
|
<result property="trayCode" column="tray_code" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="spare1" column="spare1" />
|
|
<result property="spare2" column="spare2" />
|
|
<result property="spare3" column="spare3" />
|
|
</resultMap>
|
|
|
|
<sql id="selectBasTraycodeVo">
|
|
select bt.id, bt.format_id, bt.tray_code, bt.create_time, bt.update_time, bt.spare1, bt.spare2, bt.spare3,btf.remarks as format_name
|
|
from bas_traycode bt
|
|
left join bas_traycode_format btf on btf.id = bt.format_id
|
|
|
|
</sql>
|
|
|
|
<select id="selectBasTraycodeList" parameterType="BasTraycode" resultMap="BasTraycodeResult">
|
|
<include refid="selectBasTraycodeVo"/>
|
|
<where>
|
|
<if test="formatId != null "> and bt.format_id = #{formatId}</if>
|
|
<if test="trayCode != null and trayCode != ''"> and bt.tray_code like concat('%',#{trayCode}, '%')</if>
|
|
<if test="spare1 != null and spare1 != ''"> and bt.spare1 = #{spare1}</if>
|
|
<if test="spare2 != null and spare2 != ''"> and bt.spare2 = #{spare2}</if>
|
|
<if test="spare3 != null and spare3 != ''"> and bt.spare3 = #{spare3}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectBasTraycodeById" parameterType="Long" resultMap="BasTraycodeResult">
|
|
<include refid="selectBasTraycodeVo"/>
|
|
where bt.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertBasTraycode" parameterType="BasTraycode">
|
|
insert into bas_traycode
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="formatId != null">format_id,</if>
|
|
<if test="trayCode != null">tray_code,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</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="formatId != null">#{formatId},</if>
|
|
<if test="trayCode != null">#{trayCode},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="spare1 != null">#{spare1},</if>
|
|
<if test="spare2 != null">#{spare2},</if>
|
|
<if test="spare3 != null">#{spare3},</if>
|
|
</trim>
|
|
</insert>
|
|
<insert id="insertBasTraycodeList">
|
|
insert into bas_traycode( format_id, tray_code) values
|
|
<foreach item="item" collection="list" separator=",">
|
|
(
|
|
|
|
<if test="item.formatId != null">#{item.formatId},</if>
|
|
<if test="item.trayCode != null">#{item.trayCode}</if>
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateBasTraycode" parameterType="BasTraycode">
|
|
update bas_traycode
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="formatId != null">format_id = #{formatId},</if>
|
|
<if test="trayCode != null">tray_code = #{trayCode},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</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="deleteBasTraycodeById" parameterType="Long">
|
|
delete from bas_traycode where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteBasTraycodeByIds" parameterType="String">
|
|
delete from bas_traycode where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectBasTrayCodeMax" resultType="Integer">
|
|
select max(cast(tray_code as int)) from bas_traycode
|
|
</select>
|
|
</mapper>
|