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

145 lines
5.3 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.op.mes.mapper.MesBoxMapper">
<resultMap type="MesBox" id="MesBoxResult">
<result property="boxId" column="box_id"/>
<result property="boxName" column="box_name"/>
<result property="boxType" column="box_type"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectMesBoxVo">
select box_id, box_name, box_type, status, create_by, create_time, update_by, update_time, remark from mes_box
</sql>
<select id="selectMesBoxList" parameterType="MesBox" resultMap="MesBoxResult">
<include refid="selectMesBoxVo"/>
<where>
del_flag = '0'
<if test="boxName != null and boxName != ''">
and box_name like concat('%', #{boxName}, '%')
</if>
<if test="boxType != null and boxType != ''">
and box_type = #{boxType}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
</select>
<select id="selectMesBoxByBoxId" parameterType="Long"
resultMap="MesBoxResult">
<include refid="selectMesBoxVo"/>
where box_id = #{boxId} and del_flag = '0'
</select>
<insert id="insertMesBox" parameterType="MesBox">
insert into mes_box
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="boxId != null">box_id,
</if>
<if test="boxName != null">box_name,
</if>
<if test="boxType != null">box_type,
</if>
<if test="status != null">status,
</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>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="boxId != null">#{boxId},
</if>
<if test="boxName != null">#{boxName},
</if>
<if test="boxType != null">#{boxType},
</if>
<if test="status != null">#{status},
</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>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateMesBox" parameterType="MesBox">
update mes_box
<trim prefix="SET" suffixOverrides=",">
<if test="boxName != null">box_name =
#{boxName},
</if>
<if test="boxType != null">box_type =
#{boxType},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where box_id = #{boxId}
</update>
<select id="selectDictTypeAll" resultMap="MesBoxResult">
<include refid="selectMesBoxVo"/>
</select>
<select id="countBoxDataByType" resultType="Integer">
select count(1) from mes_box_detail where box_type=#{boxType}
</select>
<delete id="deleteMesBoxByBoxId" parameterType="Long">
update mes_box set del_flag = '1' where box_id = #{boxId}
</delete>
<delete id="deleteMesBoxByBoxIds" parameterType="String">
update mes_box set del_flag = '1' where box_id in
<foreach item="boxId" collection="array" open="(" separator="," close=")">
#{boxId}
</foreach>
</delete>
<select id="checkBoxTypeUnique" parameterType="String" resultMap="MesBoxResult">
select top 1 box_id, box_name, box_type, status, create_by, create_time, remark
from mes_box
where box_type = #{boxType}
</select>
</mapper>