生产计划
parent
5f80944898
commit
df41739244
@ -0,0 +1,94 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.zjproduct;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.zjproduct.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct.ZjProductDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.zjproduct.ZjProductService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 质量管理-质检参数")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/zj-product")
|
||||||
|
@Validated
|
||||||
|
public class ZjProductController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ZjProductService zjProductService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建质量管理-质检参数")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:product:create')")
|
||||||
|
public CommonResult<Long> createZjProduct(@Valid @RequestBody ZjProductSaveReqVO createReqVO) {
|
||||||
|
return success(zjProductService.createZjProduct(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新质量管理-质检参数")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:product:update')")
|
||||||
|
public CommonResult<Boolean> updateZjProduct(@Valid @RequestBody ZjProductSaveReqVO updateReqVO) {
|
||||||
|
zjProductService.updateZjProduct(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除质量管理-质检参数")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:product:delete')")
|
||||||
|
public CommonResult<Boolean> deleteZjProduct(@RequestParam("id") Long id) {
|
||||||
|
zjProductService.deleteZjProduct(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得质量管理-质检参数")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:product:query')")
|
||||||
|
public CommonResult<ZjProductRespVO> getZjProduct(@RequestParam("id") Long id) {
|
||||||
|
ZjProductDO zjProduct = zjProductService.getZjProduct(id);
|
||||||
|
return success(BeanUtils.toBean(zjProduct, ZjProductRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得质量管理-质检参数分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:product:query')")
|
||||||
|
public CommonResult<PageResult<ZjProductRespVO>> getZjProductPage(@Valid ZjProductPageReqVO pageReqVO) {
|
||||||
|
PageResult<ZjProductDO> pageResult = zjProductService.getZjProductPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, ZjProductRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出质量管理-质检参数 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('erp:product:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportZjProductExcel(@Valid ZjProductPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<ZjProductDO> list = zjProductService.getZjProductPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "质量管理-质检参数.xls", "数据", ZjProductRespVO.class,
|
||||||
|
BeanUtils.toBean(list, ZjProductRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.zjproduct.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 质量管理-质检参数分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ZjProductPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "工序", example = "2")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "王五")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "上限值")
|
||||||
|
private Double upperVal;
|
||||||
|
|
||||||
|
@Schema(description = "下限值")
|
||||||
|
private Double lowerVal;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "关联产品ID", example = "1")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.zjproduct.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 质量管理-质检参数 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ZjProductRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23555")
|
||||||
|
@ExcelProperty("ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "工序", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("工序")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
@ExcelProperty("单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "上限值")
|
||||||
|
@ExcelProperty("上限值")
|
||||||
|
private Double upperVal;
|
||||||
|
|
||||||
|
@Schema(description = "下限值")
|
||||||
|
@ExcelProperty("下限值")
|
||||||
|
private Double lowerVal;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "关联产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23555")
|
||||||
|
private Long product_id;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.zjproduct.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 质量管理-质检参数新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class ZjProductSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23555")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "工序", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotEmpty(message = "工序不能为空")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
|
@NotEmpty(message = "名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "上限值")
|
||||||
|
private Double upperVal;
|
||||||
|
|
||||||
|
@Schema(description = "下限值")
|
||||||
|
private Double lowerVal;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "关联产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量管理-质检参数 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("mes_zj_product")
|
||||||
|
@KeySequence("mes_zj_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ZjProductDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 工序
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
/**
|
||||||
|
* 上限值
|
||||||
|
*/
|
||||||
|
private Double upperVal;
|
||||||
|
/**
|
||||||
|
* 下限值
|
||||||
|
*/
|
||||||
|
private Double lowerVal;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联产品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.zjproduct;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct.ZjProductDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.zjproduct.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量管理-质检参数 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ZjProductMapper extends BaseMapperX<ZjProductDO> {
|
||||||
|
|
||||||
|
default PageResult<ZjProductDO> selectPage(ZjProductPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ZjProductDO>()
|
||||||
|
.eqIfPresent(ZjProductDO::getProductId, reqVO.getProductId())
|
||||||
|
.eqIfPresent(ZjProductDO::getType, reqVO.getType())
|
||||||
|
.likeIfPresent(ZjProductDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(ZjProductDO::getUnit, reqVO.getUnit())
|
||||||
|
.eqIfPresent(ZjProductDO::getUpperVal, reqVO.getUpperVal())
|
||||||
|
.eqIfPresent(ZjProductDO::getLowerVal, reqVO.getLowerVal())
|
||||||
|
.eqIfPresent(ZjProductDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(ZjProductDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(ZjProductDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.zjproduct;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.zjproduct.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct.ZjProductDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量管理-质检参数 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface ZjProductService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建质量管理-质检参数
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createZjProduct(@Valid ZjProductSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新质量管理-质检参数
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateZjProduct(@Valid ZjProductSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除质量管理-质检参数
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteZjProduct(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得质量管理-质检参数
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 质量管理-质检参数
|
||||||
|
*/
|
||||||
|
ZjProductDO getZjProduct(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得质量管理-质检参数分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 质量管理-质检参数分页
|
||||||
|
*/
|
||||||
|
PageResult<ZjProductDO> getZjProductPage(ZjProductPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.zjproduct;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.zjproduct.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct.ZjProductDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.zjproduct.ZjProductMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量管理-质检参数 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class ZjProductServiceImpl implements ZjProductService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ZjProductMapper zjProductMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createZjProduct(ZjProductSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
ZjProductDO zjProduct = BeanUtils.toBean(createReqVO, ZjProductDO.class);
|
||||||
|
zjProductMapper.insert(zjProduct);
|
||||||
|
// 返回
|
||||||
|
return zjProduct.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateZjProduct(ZjProductSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateZjProductExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
ZjProductDO updateObj = BeanUtils.toBean(updateReqVO, ZjProductDO.class);
|
||||||
|
zjProductMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteZjProduct(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateZjProductExists(id);
|
||||||
|
// 删除
|
||||||
|
zjProductMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateZjProductExists(Long id) {
|
||||||
|
if (zjProductMapper.selectById(id) == null) {
|
||||||
|
throw exception(ZJ_PRODUCT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ZjProductDO getZjProduct(Long id) {
|
||||||
|
return zjProductMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ZjProductDO> getZjProductPage(ZjProductPageReqVO pageReqVO) {
|
||||||
|
return zjProductMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue