feat(flow): 添加排产明细钢卷关系管理功能
- 创建排产明细钢卷关系实体类 SchDetailCoilRel - 定义业务对象 SchDetailCoilRelBo 和视图对象 SchDetailCoilRelVo - 实现排产明细钢卷关系服务接口 ISchDetailCoilRelService - 开发控制器 SchDetailCoilRelController 提供 REST API - 创建数据访问层 SchDetailCoilRelMapper 和 XML 映射文件 - 实现服务层业务逻辑 SchDetailCoilRelServiceImpl - 集成分页查询、新增、修改、删除等基础操作 - 添加 Excel 导出功能和数据验证机制
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.klp.flow.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.flow.domain.vo.SchDetailCoilRelVo;
|
||||
import com.klp.flow.domain.bo.SchDetailCoilRelBo;
|
||||
import com.klp.flow.service.ISchDetailCoilRelService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 排产明细钢卷关系
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/flow/detailCoilRel")
|
||||
public class SchDetailCoilRelController extends BaseController {
|
||||
|
||||
private final ISchDetailCoilRelService iSchDetailCoilRelService;
|
||||
|
||||
/**
|
||||
* 查询排产明细钢卷关系列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SchDetailCoilRelVo> list(SchDetailCoilRelBo bo, PageQuery pageQuery) {
|
||||
return iSchDetailCoilRelService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出排产明细钢卷关系列表
|
||||
*/
|
||||
@Log(title = "排产明细钢卷关系", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SchDetailCoilRelBo bo, HttpServletResponse response) {
|
||||
List<SchDetailCoilRelVo> list = iSchDetailCoilRelService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "排产明细钢卷关系", SchDetailCoilRelVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排产明细钢卷关系详细信息
|
||||
*
|
||||
* @param relId 主键
|
||||
*/
|
||||
@GetMapping("/{relId}")
|
||||
public R<SchDetailCoilRelVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long relId) {
|
||||
return R.ok(iSchDetailCoilRelService.queryById(relId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增排产明细钢卷关系
|
||||
*/
|
||||
@Log(title = "排产明细钢卷关系", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SchDetailCoilRelBo bo) {
|
||||
return toAjax(iSchDetailCoilRelService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排产明细钢卷关系
|
||||
*/
|
||||
@Log(title = "排产明细钢卷关系", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SchDetailCoilRelBo bo) {
|
||||
return toAjax(iSchDetailCoilRelService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除排产明细钢卷关系
|
||||
*
|
||||
* @param relIds 主键串
|
||||
*/
|
||||
@Log(title = "排产明细钢卷关系", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{relIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] relIds) {
|
||||
return toAjax(iSchDetailCoilRelService.deleteWithValidByIds(Arrays.asList(relIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.klp.flow.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 排产明细钢卷关系对象 sch_detail_coil_rel
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sch_detail_coil_rel")
|
||||
public class SchDetailCoilRel extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "rel_id")
|
||||
private Long relId;
|
||||
/**
|
||||
* 排产明细ID(关联 sch_prod_schedule_detail.schedule_detail_id)
|
||||
*/
|
||||
private Long scheduleDetailId;
|
||||
/**
|
||||
* 钢卷ID(关联 wms_material_coil.coil_id)
|
||||
*/
|
||||
private Long coilId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.klp.flow.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 排产明细钢卷关系业务对象 sch_detail_coil_rel
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SchDetailCoilRelBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long relId;
|
||||
|
||||
/**
|
||||
* 排产明细ID(关联 sch_prod_schedule_detail.schedule_detail_id)
|
||||
*/
|
||||
private Long scheduleDetailId;
|
||||
|
||||
/**
|
||||
* 钢卷ID(关联 wms_material_coil.coil_id)
|
||||
*/
|
||||
private Long coilId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.flow.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 排产明细钢卷关系视图对象 sch_detail_coil_rel
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SchDetailCoilRelVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long relId;
|
||||
|
||||
/**
|
||||
* 排产明细ID(关联 sch_prod_schedule_detail.schedule_detail_id)
|
||||
*/
|
||||
@ExcelProperty(value = "排产明细ID", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "关=联,s=ch_prod_schedule_detail.schedule_detail_id")
|
||||
private Long scheduleDetailId;
|
||||
|
||||
/**
|
||||
* 钢卷ID(关联 wms_material_coil.coil_id)
|
||||
*/
|
||||
@ExcelProperty(value = "钢卷ID", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "关=联,w=ms_material_coil.coil_id")
|
||||
private Long coilId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.flow.mapper;
|
||||
|
||||
import com.klp.flow.domain.SchDetailCoilRel;
|
||||
import com.klp.flow.domain.vo.SchDetailCoilRelVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 排产明细钢卷关系Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
public interface SchDetailCoilRelMapper extends BaseMapperPlus<SchDetailCoilRelMapper, SchDetailCoilRel, SchDetailCoilRelVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.flow.service;
|
||||
|
||||
import com.klp.flow.domain.SchDetailCoilRel;
|
||||
import com.klp.flow.domain.vo.SchDetailCoilRelVo;
|
||||
import com.klp.flow.domain.bo.SchDetailCoilRelBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 排产明细钢卷关系Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
public interface ISchDetailCoilRelService {
|
||||
|
||||
/**
|
||||
* 查询排产明细钢卷关系
|
||||
*/
|
||||
SchDetailCoilRelVo queryById(Long relId);
|
||||
|
||||
/**
|
||||
* 查询排产明细钢卷关系列表
|
||||
*/
|
||||
TableDataInfo<SchDetailCoilRelVo> queryPageList(SchDetailCoilRelBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询排产明细钢卷关系列表
|
||||
*/
|
||||
List<SchDetailCoilRelVo> queryList(SchDetailCoilRelBo bo);
|
||||
|
||||
/**
|
||||
* 新增排产明细钢卷关系
|
||||
*/
|
||||
Boolean insertByBo(SchDetailCoilRelBo bo);
|
||||
|
||||
/**
|
||||
* 修改排产明细钢卷关系
|
||||
*/
|
||||
Boolean updateByBo(SchDetailCoilRelBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除排产明细钢卷关系信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.klp.flow.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.flow.domain.bo.SchDetailCoilRelBo;
|
||||
import com.klp.flow.domain.vo.SchDetailCoilRelVo;
|
||||
import com.klp.flow.domain.SchDetailCoilRel;
|
||||
import com.klp.flow.mapper.SchDetailCoilRelMapper;
|
||||
import com.klp.flow.service.ISchDetailCoilRelService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 排产明细钢卷关系Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SchDetailCoilRelServiceImpl implements ISchDetailCoilRelService {
|
||||
|
||||
private final SchDetailCoilRelMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询排产明细钢卷关系
|
||||
*/
|
||||
@Override
|
||||
public SchDetailCoilRelVo queryById(Long relId){
|
||||
return baseMapper.selectVoById(relId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排产明细钢卷关系列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SchDetailCoilRelVo> queryPageList(SchDetailCoilRelBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SchDetailCoilRel> lqw = buildQueryWrapper(bo);
|
||||
Page<SchDetailCoilRelVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排产明细钢卷关系列表
|
||||
*/
|
||||
@Override
|
||||
public List<SchDetailCoilRelVo> queryList(SchDetailCoilRelBo bo) {
|
||||
LambdaQueryWrapper<SchDetailCoilRel> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SchDetailCoilRel> buildQueryWrapper(SchDetailCoilRelBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SchDetailCoilRel> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getScheduleDetailId() != null, SchDetailCoilRel::getScheduleDetailId, bo.getScheduleDetailId());
|
||||
lqw.eq(bo.getCoilId() != null, SchDetailCoilRel::getCoilId, bo.getCoilId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增排产明细钢卷关系
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SchDetailCoilRelBo bo) {
|
||||
SchDetailCoilRel add = BeanUtil.toBean(bo, SchDetailCoilRel.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setRelId(add.getRelId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排产明细钢卷关系
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SchDetailCoilRelBo bo) {
|
||||
SchDetailCoilRel update = BeanUtil.toBean(bo, SchDetailCoilRel.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SchDetailCoilRel entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除排产明细钢卷关系
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.klp.flow.mapper.SchDetailCoilRelMapper">
|
||||
|
||||
<resultMap type="com.klp.flow.domain.SchDetailCoilRel" id="SchDetailCoilRelResult">
|
||||
<result property="relId" column="rel_id"/>
|
||||
<result property="scheduleDetailId" column="schedule_detail_id"/>
|
||||
<result property="coilId" column="coil_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user