From a01d2f2b8d69bfad23488736d030a29f8e40ceae Mon Sep 17 00:00:00 2001 From: "JinLu.Yin" <411641505@qq.com> Date: Wed, 18 May 2022 16:13:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=A8=A1=E6=9D=BF-=E4=BA=A7?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QcTemplateProductController.java | 112 ++++++++ .../ktg/mes/qc/domain/QcTemplateProduct.java | 249 ++++++++++++++++++ .../qc/mapper/QcTemplateProductMapper.java | 64 +++++ .../qc/service/IQcTemplateProductService.java | 63 +++++ .../impl/QcTemplateProductServiceImpl.java | 109 ++++++++ .../mapper/qc/QcTemplateProductMapper.xml | 147 +++++++++++ 6 files changed, 744 insertions(+) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateProductController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateProduct.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateProductMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateProductService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateProductServiceImpl.java create mode 100644 ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateProductController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateProductController.java new file mode 100644 index 0000000..f7b5c37 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcTemplateProductController.java @@ -0,0 +1,112 @@ +package com.ktg.mes.qc.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.QcTemplateProduct; +import com.ktg.mes.qc.service.IQcTemplateProductService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 检测模板-产品Controller + * + * @author yinjinlu + * @date 2022-05-18 + */ +@RestController +@RequestMapping("/mes/qc/templateproduct") +public class QcTemplateProductController extends BaseController +{ + @Autowired + private IQcTemplateProductService qcTemplateProductService; + + /** + * 查询检测模板-产品列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:templateproduct:list')") + @GetMapping("/list") + public TableDataInfo list(QcTemplateProduct qcTemplateProduct) + { + startPage(); + List list = qcTemplateProductService.selectQcTemplateProductList(qcTemplateProduct); + return getDataTable(list); + } + + /** + * 导出检测模板-产品列表 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:templateproduct:export')") + @Log(title = "检测模板-产品", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcTemplateProduct qcTemplateProduct) + { + List list = qcTemplateProductService.selectQcTemplateProductList(qcTemplateProduct); + ExcelUtil util = new ExcelUtil(QcTemplateProduct.class); + util.exportExcel(response, list, "检测模板-产品数据"); + } + + /** + * 获取检测模板-产品详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:templateproduct:query')") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") Long recordId) + { + return AjaxResult.success(qcTemplateProductService.selectQcTemplateProductByRecordId(recordId)); + } + + /** + * 新增检测模板-产品 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:templateproduct:add')") + @Log(title = "检测模板-产品", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcTemplateProduct qcTemplateProduct) + { + if(UserConstants.NOT_UNIQUE.equals(qcTemplateProductService.checkProductUnique(qcTemplateProduct))){ + return AjaxResult.error("产品已设置检测模板!"); + } + return toAjax(qcTemplateProductService.insertQcTemplateProduct(qcTemplateProduct)); + } + + /** + * 修改检测模板-产品 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:templateproduct:edit')") + @Log(title = "检测模板-产品", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcTemplateProduct qcTemplateProduct) + { + if(UserConstants.NOT_UNIQUE.equals(qcTemplateProductService.checkProductUnique(qcTemplateProduct))){ + return AjaxResult.error("产品已设置检测模板!"); + } + return toAjax(qcTemplateProductService.updateQcTemplateProduct(qcTemplateProduct)); + } + + /** + * 删除检测模板-产品 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:templateproduct:remove')") + @Log(title = "检测模板-产品", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable Long[] recordIds) + { + return toAjax(qcTemplateProductService.deleteQcTemplateProductByRecordIds(recordIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateProduct.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateProduct.java new file mode 100644 index 0000000..50eda72 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/QcTemplateProduct.java @@ -0,0 +1,249 @@ +package com.ktg.mes.qc.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 检测模板-产品对象 qc_template_product + * + * @author yinjinlu + * @date 2022-05-18 + */ +public class QcTemplateProduct extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 记录ID */ + private Long recordId; + + /** 检测模板ID */ + @Excel(name = "检测模板ID") + private Long templateId; + + /** 产品物料ID */ + @Excel(name = "产品物料ID") + private Long itemId; + + /** 产品物料编码 */ + @Excel(name = "产品物料编码") + private String itemCode; + + /** 产品物料名称 */ + @Excel(name = "产品物料名称") + private String itemName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String specification; + + /** 单位 */ + @Excel(name = "单位") + private String unitOfMeasure; + + /** 最低检测数 */ + @Excel(name = "最低检测数") + private Long quantityCheck; + + /** 最大不合格数 */ + @Excel(name = "最大不合格数") + private Long quantityUnqualified; + + /** 最大致命缺陷率 */ + @Excel(name = "最大致命缺陷率") + private BigDecimal crRate; + + /** 最大严重缺陷率 */ + @Excel(name = "最大严重缺陷率") + private BigDecimal majRate; + + /** 最大轻微缺陷率 */ + @Excel(name = "最大轻微缺陷率") + private BigDecimal minRate; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRecordId(Long recordId) + { + this.recordId = recordId; + } + + public Long getRecordId() + { + return recordId; + } + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + public void setItemId(Long itemId) + { + this.itemId = itemId; + } + + public Long getItemId() + { + return itemId; + } + public void setItemCode(String itemCode) + { + this.itemCode = itemCode; + } + + public String getItemCode() + { + return itemCode; + } + public void setItemName(String itemName) + { + this.itemName = itemName; + } + + public String getItemName() + { + return itemName; + } + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + public void setUnitOfMeasure(String unitOfMeasure) + { + this.unitOfMeasure = unitOfMeasure; + } + + public String getUnitOfMeasure() + { + return unitOfMeasure; + } + public void setQuantityCheck(Long quantityCheck) + { + this.quantityCheck = quantityCheck; + } + + public Long getQuantityCheck() + { + return quantityCheck; + } + public void setQuantityUnqualified(Long quantityUnqualified) + { + this.quantityUnqualified = quantityUnqualified; + } + + public Long getQuantityUnqualified() + { + return quantityUnqualified; + } + public void setCrRate(BigDecimal crRate) + { + this.crRate = crRate; + } + + public BigDecimal getCrRate() + { + return crRate; + } + public void setMajRate(BigDecimal majRate) + { + this.majRate = majRate; + } + + public BigDecimal getMajRate() + { + return majRate; + } + public void setMinRate(BigDecimal minRate) + { + this.minRate = minRate; + } + + public BigDecimal getMinRate() + { + return minRate; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("templateId", getTemplateId()) + .append("itemId", getItemId()) + .append("itemCode", getItemCode()) + .append("itemName", getItemName()) + .append("specification", getSpecification()) + .append("unitOfMeasure", getUnitOfMeasure()) + .append("quantityCheck", getQuantityCheck()) + .append("quantityUnqualified", getQuantityUnqualified()) + .append("crRate", getCrRate()) + .append("majRate", getMajRate()) + .append("minRate", getMinRate()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateProductMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateProductMapper.java new file mode 100644 index 0000000..2824619 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateProductMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.qc.mapper; + +import java.util.List; +import com.ktg.mes.qc.domain.QcTemplateProduct; + +/** + * 检测模板-产品Mapper接口 + * + * @author yinjinlu + * @date 2022-05-18 + */ +public interface QcTemplateProductMapper +{ + /** + * 查询检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 检测模板-产品 + */ + public QcTemplateProduct selectQcTemplateProductByRecordId(Long recordId); + + /** + * 查询检测模板-产品列表 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 检测模板-产品集合 + */ + public List selectQcTemplateProductList(QcTemplateProduct qcTemplateProduct); + + public QcTemplateProduct checkProductUnique(QcTemplateProduct qcTemplateProduct); + + + /** + * 新增检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int insertQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 修改检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int updateQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 删除检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordId(Long recordId); + + /** + * 批量删除检测模板-产品 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordIds(Long[] recordIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateProductService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateProductService.java new file mode 100644 index 0000000..a6cdf5b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcTemplateProductService.java @@ -0,0 +1,63 @@ +package com.ktg.mes.qc.service; + +import java.util.List; +import com.ktg.mes.qc.domain.QcTemplateProduct; + +/** + * 检测模板-产品Service接口 + * + * @author yinjinlu + * @date 2022-05-18 + */ +public interface IQcTemplateProductService +{ + /** + * 查询检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 检测模板-产品 + */ + public QcTemplateProduct selectQcTemplateProductByRecordId(Long recordId); + + /** + * 查询检测模板-产品列表 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 检测模板-产品集合 + */ + public List selectQcTemplateProductList(QcTemplateProduct qcTemplateProduct); + + public String checkProductUnique(QcTemplateProduct qcTemplateProduct); + + /** + * 新增检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int insertQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 修改检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + public int updateQcTemplateProduct(QcTemplateProduct qcTemplateProduct); + + /** + * 批量删除检测模板-产品 + * + * @param recordIds 需要删除的检测模板-产品主键集合 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordIds(Long[] recordIds); + + /** + * 删除检测模板-产品信息 + * + * @param recordId 检测模板-产品主键 + * @return 结果 + */ + public int deleteQcTemplateProductByRecordId(Long recordId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateProductServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateProductServiceImpl.java new file mode 100644 index 0000000..b5cb289 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcTemplateProductServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.qc.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.qc.mapper.QcTemplateProductMapper; +import com.ktg.mes.qc.domain.QcTemplateProduct; +import com.ktg.mes.qc.service.IQcTemplateProductService; + +/** + * 检测模板-产品Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-18 + */ +@Service +public class QcTemplateProductServiceImpl implements IQcTemplateProductService +{ + @Autowired + private QcTemplateProductMapper qcTemplateProductMapper; + + /** + * 查询检测模板-产品 + * + * @param recordId 检测模板-产品主键 + * @return 检测模板-产品 + */ + @Override + public QcTemplateProduct selectQcTemplateProductByRecordId(Long recordId) + { + return qcTemplateProductMapper.selectQcTemplateProductByRecordId(recordId); + } + + /** + * 查询检测模板-产品列表 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 检测模板-产品 + */ + @Override + public List selectQcTemplateProductList(QcTemplateProduct qcTemplateProduct) + { + return qcTemplateProductMapper.selectQcTemplateProductList(qcTemplateProduct); + } + + @Override + public String checkProductUnique(QcTemplateProduct qcTemplateProduct) { + QcTemplateProduct product = qcTemplateProductMapper.checkProductUnique(qcTemplateProduct); + Long recordId = qcTemplateProduct.getRecordId() ==null? -1L:qcTemplateProduct.getRecordId(); + if(StringUtils.isNotNull(product) && product.getRecordId().longValue()!=recordId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + @Override + public int insertQcTemplateProduct(QcTemplateProduct qcTemplateProduct) + { + qcTemplateProduct.setCreateTime(DateUtils.getNowDate()); + return qcTemplateProductMapper.insertQcTemplateProduct(qcTemplateProduct); + } + + /** + * 修改检测模板-产品 + * + * @param qcTemplateProduct 检测模板-产品 + * @return 结果 + */ + @Override + public int updateQcTemplateProduct(QcTemplateProduct qcTemplateProduct) + { + qcTemplateProduct.setUpdateTime(DateUtils.getNowDate()); + return qcTemplateProductMapper.updateQcTemplateProduct(qcTemplateProduct); + } + + /** + * 批量删除检测模板-产品 + * + * @param recordIds 需要删除的检测模板-产品主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateProductByRecordIds(Long[] recordIds) + { + return qcTemplateProductMapper.deleteQcTemplateProductByRecordIds(recordIds); + } + + /** + * 删除检测模板-产品信息 + * + * @param recordId 检测模板-产品主键 + * @return 结果 + */ + @Override + public int deleteQcTemplateProductByRecordId(Long recordId) + { + return qcTemplateProductMapper.deleteQcTemplateProductByRecordId(recordId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml new file mode 100644 index 0000000..3909d3c --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, template_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_check, quantity_unqualified, cr_rate, maj_rate, min_rate, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_template_product + + + + + + + + + + insert into qc_template_product + + template_id, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + quantity_check, + quantity_unqualified, + cr_rate, + maj_rate, + min_rate, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{templateId}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{quantityCheck}, + #{quantityUnqualified}, + #{crRate}, + #{majRate}, + #{minRate}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update qc_template_product + + template_id = #{templateId}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + quantity_check = #{quantityCheck}, + quantity_unqualified = #{quantityUnqualified}, + cr_rate = #{crRate}, + maj_rate = #{majRate}, + min_rate = #{minRate}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where record_id = #{recordId} + + + + delete from qc_template_product where record_id = #{recordId} + + + + delete from qc_template_product where record_id in + + #{recordId} + + + \ No newline at end of file