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;
/** 查询磨削记录列表(不传 rollId 时返回全部,支持时间范围产线筛选) */
/** 查询磨削记录列表(不传 rollId 时返回全部,支持时间范围产线、班组、轧辊类型筛选) */
@GetMapping("/list")
public R<List<MesRollGrindVo>> list(
@RequestParam(required = false) Long rollId,
@RequestParam(required = false) Long lineId,
@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) {
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 String team;
private String rollType;
private BigDecimal diaBefore;
private BigDecimal diaAfter;
private BigDecimal grindAmount;

View File

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

View File

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

View File

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