feat(mes/roll): 扩展磨削记录查询功能,新增班组与轧辊类型筛选

在磨削记录查询接口中新增以下筛选条件:
1. 班组(team)
2. 轧辊类型(rollType)

调整涉及服务接口、控制器、Mapper及XML映射文件,将原有的时间范围和产线筛选扩展为支持多维度查询。调整前,查询仅支持按轧辊ID、产线ID和时间范围筛选;调整后,新增班组和轧辊类型条件,提升查询灵活性与业务分析能力。同时优化SQL查询,通过关联mes_roll_info表获取轧辊类型,并在返回结果中新增rollType字段。
This commit is contained in:
2026-06-02 14:22:55 +08:00
parent cd3b25fa30
commit b7d47a5d9d
6 changed files with 28 additions and 19 deletions

View File

@@ -26,17 +26,19 @@ public class MesRollGrindController extends BaseController {
private final IMesRollGrindService iMesRollGrindService; private final IMesRollGrindService iMesRollGrindService;
/** 查询磨削记录列表(不传 rollId 时返回全部,支持时间范围产线筛选) */ /** 查询磨削记录列表(不传 rollId 时返回全部,支持时间范围产线、班组、轧辊类型筛选) */
@GetMapping("/list") @GetMapping("/list")
public R<List<MesRollGrindVo>> list( public R<List<MesRollGrindVo>> list(
@RequestParam(required = false) Long rollId, @RequestParam(required = false) Long rollId,
@RequestParam(required = false) Long lineId, @RequestParam(required = false) Long lineId,
@RequestParam(required = false) String beginTime, @RequestParam(required = false) String beginTime,
@RequestParam(required = false) String endTime) { @RequestParam(required = false) String endTime,
@RequestParam(required = false) String team,
@RequestParam(required = false) String rollType) {
if (rollId != null) { if (rollId != null) {
return R.ok(iMesRollGrindService.listByRoll(rollId)); return R.ok(iMesRollGrindService.listByRoll(rollId));
} }
return R.ok(iMesRollGrindService.listByQuery(null, lineId, beginTime, endTime)); return R.ok(iMesRollGrindService.listByQuery(null, lineId, beginTime, endTime, team, rollType));
} }
/** 按年份查询月度汇总 */ /** 按年份查询月度汇总 */

View File

@@ -20,6 +20,7 @@ public class MesRollGrindVo {
private Date grindTime; private Date grindTime;
private String team; private String team;
private String rollType;
private BigDecimal diaBefore; private BigDecimal diaBefore;
private BigDecimal diaAfter; private BigDecimal diaAfter;
private BigDecimal grindAmount; private BigDecimal grindAmount;

View File

@@ -20,7 +20,9 @@ public interface MesRollGrindMapper extends BaseMapperPlus<MesRollGrindMapper, M
List<MesRollGrindVo> selectList(@Param("rollId") Long rollId, List<MesRollGrindVo> selectList(@Param("rollId") Long rollId,
@Param("lineId") Long lineId, @Param("lineId") Long lineId,
@Param("beginTime") String beginTime, @Param("beginTime") String beginTime,
@Param("endTime") String endTime); @Param("endTime") String endTime,
@Param("team") String team,
@Param("rollType") String rollType);
/** 按年份统计每月磨削量 { month, grindCount, totalGrindAmount } */ /** 按年份统计每月磨削量 { month, grindCount, totalGrindAmount } */
List<Map<String, Object>> selectMonthlyStats(@Param("rollId") Long rollId, @Param("year") int year); List<Map<String, Object>> selectMonthlyStats(@Param("rollId") Long rollId, @Param("year") int year);

View File

@@ -15,7 +15,7 @@ public interface IMesRollGrindService {
List<MesRollGrindVo> listByRoll(Long rollId); List<MesRollGrindVo> listByRoll(Long rollId);
/** 通用查询(所有参数可选) */ /** 通用查询(所有参数可选) */
List<MesRollGrindVo> listByQuery(Long rollId, Long lineId, String beginTime, String endTime); List<MesRollGrindVo> listByQuery(Long rollId, Long lineId, String beginTime, String endTime, String team, String rollType);
/** 新增磨削记录,同步更新轧辊当前直径和磨削次数 */ /** 新增磨削记录,同步更新轧辊当前直径和磨削次数 */
Long addGrind(MesRollGrindBo bo); Long addGrind(MesRollGrindBo bo);

View File

@@ -35,8 +35,8 @@ public class MesRollGrindServiceImpl implements IMesRollGrindService {
} }
@Override @Override
public List<MesRollGrindVo> listByQuery(Long rollId, Long lineId, String beginTime, String endTime) { public List<MesRollGrindVo> listByQuery(Long rollId, Long lineId, String beginTime, String endTime, String team, String rollType) {
return baseMapper.selectList(rollId, lineId, beginTime, endTime); return baseMapper.selectList(rollId, lineId, beginTime, endTime, team, rollType);
} }
@Override @Override

View File

@@ -14,18 +14,22 @@
</select> </select>
<select id="selectList" resultType="com.klp.mes.roll.domain.vo.MesRollGrindVo"> <select id="selectList" resultType="com.klp.mes.roll.domain.vo.MesRollGrindVo">
SELECT grind_id, roll_id, roll_no, grind_time, team, SELECT g.grind_id, g.roll_id, g.roll_no, g.grind_time, g.team,
dia_before, dia_after, grind_amount, roll_shape, g.dia_before, g.dia_after, g.grind_amount, g.roll_shape,
flaw_result, g.flaw_result,
CASE WHEN hardness = '未倒角' THEN 0 ELSE CAST(hardness AS DECIMAL(10,1)) END AS hardness, CASE WHEN g.hardness = '未倒角' THEN 0 ELSE CAST(g.hardness AS DECIMAL(10,1)) END AS hardness,
operator, remark, create_time g.operator, g.remark, g.create_time,
FROM mes_roll_grind ri.roll_type
WHERE del_flag = 0 FROM mes_roll_grind g
<if test="rollId != null">AND roll_id = #{rollId}</if> LEFT JOIN mes_roll_info ri ON g.roll_id = ri.roll_id
<if test="lineId != null">AND line_id = #{lineId}</if> WHERE g.del_flag = 0
<if test="beginTime != null and beginTime != ''">AND grind_time &gt;= #{beginTime}</if> <if test="rollId != null">AND g.roll_id = #{rollId}</if>
<if test="endTime != null and endTime != ''">AND grind_time &lt;= #{endTime}</if> <if test="lineId != null">AND g.line_id = #{lineId}</if>
ORDER BY grind_time DESC, grind_id ASC <if test="beginTime != null and beginTime != ''">AND g.grind_time &gt;= #{beginTime}</if>
<if test="endTime != null and endTime != ''">AND g.grind_time &lt;= #{endTime}</if>
<if test="team != null and team != ''">AND g.team = #{team}</if>
<if test="rollType != null and rollType != ''">AND ri.roll_type = #{rollType}</if>
ORDER BY g.grind_time DESC, g.grind_id ASC
</select> </select>
<select id="selectMonthlyStats" resultType="map"> <select id="selectMonthlyStats" resultType="map">