检测模板-产品
This commit is contained in:
parent
0c9920eca8
commit
a01d2f2b8d
@ -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<QcTemplateProduct> 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<QcTemplateProduct> list = qcTemplateProductService.selectQcTemplateProductList(qcTemplateProduct);
|
||||
ExcelUtil<QcTemplateProduct> util = new ExcelUtil<QcTemplateProduct>(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));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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<QcTemplateProduct> 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);
|
||||
}
|
@ -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<QcTemplateProduct> 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);
|
||||
}
|
@ -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<QcTemplateProduct> 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);
|
||||
}
|
||||
}
|
147
ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml
Normal file
147
ktg-mes/src/main/resources/mapper/qc/QcTemplateProductMapper.xml
Normal file
@ -0,0 +1,147 @@
|
||||
<?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.ktg.mes.qc.mapper.QcTemplateProductMapper">
|
||||
|
||||
<resultMap type="QcTemplateProduct" id="QcTemplateProductResult">
|
||||
<result property="recordId" column="record_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="itemId" column="item_id" />
|
||||
<result property="itemCode" column="item_code" />
|
||||
<result property="itemName" column="item_name" />
|
||||
<result property="specification" column="specification" />
|
||||
<result property="unitOfMeasure" column="unit_of_measure" />
|
||||
<result property="quantityCheck" column="quantity_check" />
|
||||
<result property="quantityUnqualified" column="quantity_unqualified" />
|
||||
<result property="crRate" column="cr_rate" />
|
||||
<result property="majRate" column="maj_rate" />
|
||||
<result property="minRate" column="min_rate" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="attr1" column="attr1" />
|
||||
<result property="attr2" column="attr2" />
|
||||
<result property="attr3" column="attr3" />
|
||||
<result property="attr4" column="attr4" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectQcTemplateProductVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectQcTemplateProductList" parameterType="QcTemplateProduct" resultMap="QcTemplateProductResult">
|
||||
<include refid="selectQcTemplateProductVo"/>
|
||||
<where>
|
||||
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||
<if test="itemId != null "> and item_id = #{itemId}</if>
|
||||
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
|
||||
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
|
||||
<if test="specification != null and specification != ''"> and specification = #{specification}</if>
|
||||
<if test="unitOfMeasure != null and unitOfMeasure != ''"> and unit_of_measure = #{unitOfMeasure}</if>
|
||||
<if test="quantityCheck != null "> and quantity_check = #{quantityCheck}</if>
|
||||
<if test="quantityUnqualified != null "> and quantity_unqualified = #{quantityUnqualified}</if>
|
||||
<if test="crRate != null "> and cr_rate = #{crRate}</if>
|
||||
<if test="majRate != null "> and maj_rate = #{majRate}</if>
|
||||
<if test="minRate != null "> and min_rate = #{minRate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectQcTemplateProductByRecordId" parameterType="Long" resultMap="QcTemplateProductResult">
|
||||
<include refid="selectQcTemplateProductVo"/>
|
||||
where record_id = #{recordId}
|
||||
</select>
|
||||
|
||||
<select id="checkProductUnique" parameterType="QcTemplateProduct" resultMap="QcTemplateProductResult">
|
||||
<include refid="selectQcTemplateProductVo"/>
|
||||
where item_id = #{itemId}
|
||||
</select>
|
||||
|
||||
<insert id="insertQcTemplateProduct" parameterType="QcTemplateProduct" useGeneratedKeys="true" keyProperty="recordId">
|
||||
insert into qc_template_product
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="itemId != null">item_id,</if>
|
||||
<if test="itemCode != null">item_code,</if>
|
||||
<if test="itemName != null">item_name,</if>
|
||||
<if test="specification != null">specification,</if>
|
||||
<if test="unitOfMeasure != null">unit_of_measure,</if>
|
||||
<if test="quantityCheck != null">quantity_check,</if>
|
||||
<if test="quantityUnqualified != null">quantity_unqualified,</if>
|
||||
<if test="crRate != null">cr_rate,</if>
|
||||
<if test="majRate != null">maj_rate,</if>
|
||||
<if test="minRate != null">min_rate,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="attr1 != null">attr1,</if>
|
||||
<if test="attr2 != null">attr2,</if>
|
||||
<if test="attr3 != null">attr3,</if>
|
||||
<if test="attr4 != null">attr4,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="itemId != null">#{itemId},</if>
|
||||
<if test="itemCode != null">#{itemCode},</if>
|
||||
<if test="itemName != null">#{itemName},</if>
|
||||
<if test="specification != null">#{specification},</if>
|
||||
<if test="unitOfMeasure != null">#{unitOfMeasure},</if>
|
||||
<if test="quantityCheck != null">#{quantityCheck},</if>
|
||||
<if test="quantityUnqualified != null">#{quantityUnqualified},</if>
|
||||
<if test="crRate != null">#{crRate},</if>
|
||||
<if test="majRate != null">#{majRate},</if>
|
||||
<if test="minRate != null">#{minRate},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="attr1 != null">#{attr1},</if>
|
||||
<if test="attr2 != null">#{attr2},</if>
|
||||
<if test="attr3 != null">#{attr3},</if>
|
||||
<if test="attr4 != null">#{attr4},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateQcTemplateProduct" parameterType="QcTemplateProduct">
|
||||
update qc_template_product
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="itemId != null">item_id = #{itemId},</if>
|
||||
<if test="itemCode != null">item_code = #{itemCode},</if>
|
||||
<if test="itemName != null">item_name = #{itemName},</if>
|
||||
<if test="specification != null">specification = #{specification},</if>
|
||||
<if test="unitOfMeasure != null">unit_of_measure = #{unitOfMeasure},</if>
|
||||
<if test="quantityCheck != null">quantity_check = #{quantityCheck},</if>
|
||||
<if test="quantityUnqualified != null">quantity_unqualified = #{quantityUnqualified},</if>
|
||||
<if test="crRate != null">cr_rate = #{crRate},</if>
|
||||
<if test="majRate != null">maj_rate = #{majRate},</if>
|
||||
<if test="minRate != null">min_rate = #{minRate},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||
<if test="attr4 != null">attr4 = #{attr4},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where record_id = #{recordId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteQcTemplateProductByRecordId" parameterType="Long">
|
||||
delete from qc_template_product where record_id = #{recordId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteQcTemplateProductByRecordIds" parameterType="String">
|
||||
delete from qc_template_product where record_id in
|
||||
<foreach item="recordId" collection="array" open="(" separator="," close=")">
|
||||
#{recordId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user