Files
double-rack/ruoyi-mill/src/main/resources/mapper/mill/MillRollMapper.xml

93 lines
3.6 KiB
XML
Raw Normal View History

<?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.mill.mapper.MillRollMapper">
<resultMap id="BaseRM" type="com.ruoyi.mill.domain.MillRoll">
<id property="rollId" column="roll_id"/>
<result property="rollNo" column="roll_no"/>
<result property="rollType" column="roll_type"/>
<result property="status" column="status"/>
<result property="initialDia" column="initial_dia"/>
<result property="currentDia" column="current_dia"/>
<result property="flag" column="flag"/>
<result property="delFlag" column="del_flag"/>
<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="cols">
roll_id, roll_no, roll_type, status, initial_dia, current_dia,
flag, del_flag, create_by, create_time, update_by, update_time, remark
</sql>
<select id="selectList" resultMap="BaseRM">
SELECT <include refid="cols"/> FROM mill_roll
WHERE del_flag = '0'
<if test="rollNo != null and rollNo != ''">
AND roll_no LIKE CONCAT('%', #{rollNo}, '%')
</if>
<if test="rollType != null and rollType != ''">
AND roll_type = #{rollType}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
ORDER BY roll_id ASC
</select>
<select id="selectById" resultMap="BaseRM">
SELECT <include refid="cols"/> FROM mill_roll
WHERE roll_id = #{rollId} AND del_flag = '0'
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="rollId">
INSERT INTO mill_roll (
roll_no, roll_type, status, initial_dia, current_dia,
flag, del_flag, create_by, create_time, update_by, update_time, remark
) VALUES (
#{rollNo}, #{rollType},
<choose>
<when test="status != null and status != ''">#{status}</when>
<otherwise>'Offline'</otherwise>
</choose>,
#{initialDia}, #{currentDia},
#{flag}, '0',
#{createBy}, NOW(), #{updateBy}, NOW(), #{remark}
)
</insert>
<update id="update">
UPDATE mill_roll
<set>
<if test="rollNo != null and rollNo != ''">roll_no = #{rollNo},</if>
<if test="rollType != null and rollType != ''">roll_type = #{rollType},</if>
<if test="status != null">status = #{status},</if>
<if test="initialDia != null">initial_dia = #{initialDia},</if>
<if test="currentDia != null">current_dia = #{currentDia},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="remark != null">remark = #{remark},</if>
update_by = #{updateBy},
update_time = NOW()
</set>
WHERE roll_id = #{rollId} AND del_flag = '0'
</update>
<update id="deleteByIds">
UPDATE mill_roll SET del_flag = '2', update_time = NOW()
WHERE roll_id IN
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="updateStatus">
UPDATE mill_roll SET status = #{status}, update_time = NOW()
WHERE roll_id = #{rollId}
</update>
</mapper>