Files
double-rack/ruoyi-mill/src/main/resources/mapper/mill/MesRollStandbyMapper.xml
Joshi 6acb7b4b40 refactor(mill): 优化轧辊备用管理的数据查询和状态更新逻辑
- 修改 MesRollInfoMapper 中条件更新状态方法的参数命名,提升可读性
- 更新 MesRollStandbyMapper 查询接口返回类型为 MesRollStandbyVo
- 重构 MesRollStandbyMapper XML 映射文件中的查询语句,增加位置标签字段
- 将清空操作从物理删除改为逻辑删除,保留数据记录
- 在 MesRollStandbyVo 中新增 positionLabel、remark 和 createTime 字段
- 调整控制器注解配置,移除权限校验并简化接口定义
2026-06-12 10:26:47 +08:00

151 lines
7.5 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.mill.mapper.MesRollStandbyMapper">
<resultMap type="MesRollStandby" id="MesRollStandbyResult">
<result property="standbyId" column="standby_id" />
<result property="lineId" column="line_id" />
<result property="standNo" column="stand_no" />
<result property="rollNo" column="roll_no" />
<result property="rollType" column="roll_type" />
<result property="position" column="position" />
<result property="diameter" column="diameter" />
<result property="roughness" column="roughness" />
<result property="crown" column="crown" />
<result property="readyTime" column="ready_time" />
<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="selectMesRollStandbyVo">
select standby_id, line_id, stand_no, roll_no, roll_type, position, diameter, roughness, crown, ready_time, del_flag, create_by, create_time, update_by, update_time, remark from mes_roll_standby
</sql>
<select id="selectMesRollStandbyList" parameterType="MesRollStandby" resultMap="MesRollStandbyResult">
<include refid="selectMesRollStandbyVo"/>
<where>
<if test="lineId != null "> and line_id = #{lineId}</if>
<if test="standNo != null and standNo != ''"> and stand_no = #{standNo}</if>
<if test="rollNo != null and rollNo != ''"> and roll_no = #{rollNo}</if>
<if test="rollType != null and rollType != ''"> and roll_type = #{rollType}</if>
<if test="position != null and position != ''"> and position = #{position}</if>
<if test="diameter != null "> and diameter = #{diameter}</if>
<if test="roughness != null "> and roughness = #{roughness}</if>
<if test="crown != null "> and crown = #{crown}</if>
<if test="readyTime != null "> and ready_time = #{readyTime}</if>
</where>
</select>
<select id="selectMesRollStandbyByStandbyId" parameterType="Long" resultMap="MesRollStandbyResult">
<include refid="selectMesRollStandbyVo"/>
where standby_id = #{standbyId}
</select>
<insert id="insertMesRollStandby" parameterType="MesRollStandby" useGeneratedKeys="true" keyProperty="standbyId">
insert into mes_roll_standby
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lineId != null">line_id,</if>
<if test="standNo != null">stand_no,</if>
<if test="rollNo != null">roll_no,</if>
<if test="rollType != null">roll_type,</if>
<if test="position != null">position,</if>
<if test="diameter != null">diameter,</if>
<if test="roughness != null">roughness,</if>
<if test="crown != null">crown,</if>
<if test="readyTime != null">ready_time,</if>
<if test="delFlag != null">del_flag,</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="lineId != null">#{lineId},</if>
<if test="standNo != null">#{standNo},</if>
<if test="rollNo != null">#{rollNo},</if>
<if test="rollType != null">#{rollType},</if>
<if test="position != null">#{position},</if>
<if test="diameter != null">#{diameter},</if>
<if test="roughness != null">#{roughness},</if>
<if test="crown != null">#{crown},</if>
<if test="readyTime != null">#{readyTime},</if>
<if test="delFlag != null">#{delFlag},</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="updateMesRollStandby" parameterType="MesRollStandby">
update mes_roll_standby
<trim prefix="SET" suffixOverrides=",">
<if test="lineId != null">line_id = #{lineId},</if>
<if test="standNo != null">stand_no = #{standNo},</if>
<if test="rollNo != null">roll_no = #{rollNo},</if>
<if test="rollType != null">roll_type = #{rollType},</if>
<if test="position != null">position = #{position},</if>
<if test="diameter != null">diameter = #{diameter},</if>
<if test="roughness != null">roughness = #{roughness},</if>
<if test="crown != null">crown = #{crown},</if>
<if test="readyTime != null">ready_time = #{readyTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</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 standby_id = #{standbyId}
</update>
<delete id="deleteMesRollStandbyByStandbyId" parameterType="Long">
delete from mes_roll_standby where standby_id = #{standbyId}
</delete>
<delete id="deleteMesRollStandbyByStandbyIds" parameterType="String">
delete from mes_roll_standby where standby_id in
<foreach item="standbyId" collection="array" open="(" separator="," close=")">
#{standbyId}
</foreach>
</delete>
<select id="selectByStand" resultType="com.ruoyi.mill.domain.MesRollStandbyVo">
SELECT
standby_id, line_id, stand_no, roll_no, roll_type, position,
CASE
WHEN roll_type = 'BR' AND position = 'UP' THEN '上支撑辊'
WHEN roll_type = 'WR' AND position = 'UP' THEN '上工作辊'
WHEN roll_type = 'WR' AND position = 'DOWN' THEN '下工作辊'
WHEN roll_type = 'BR' AND position = 'DOWN' THEN '下支撑辊'
ELSE CONCAT(position, roll_type)
END AS position_label,
diameter, roughness, crown, ready_time, remark, create_time
FROM mes_roll_standby
WHERE del_flag = 0
AND stand_no = #{standNo}
<if test="lineId != null">AND line_id = #{lineId}</if>
ORDER BY
FIELD(roll_type, 'BR', 'WR', 'WR', 'BR'),
FIELD(position, 'UP', 'UP', 'DOWN', 'DOWN')
</select>
<!-- 逻辑删除指定产线+机架所有下批轧辊(清空) -->
<update id="clearByStand">
UPDATE mes_roll_standby
SET del_flag = 1
WHERE del_flag = 0
AND stand_no = #{standNo}
<if test="lineId != null">AND line_id = #{lineId}</if>
</update>
</mapper>