出货单后台代码

This commit is contained in:
JinLu.Yin 2022-08-31 22:08:58 +08:00
parent c47e651133
commit 4dfb570898
6 changed files with 1100 additions and 0 deletions

View File

@ -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.QcOqc;
import com.ktg.mes.qc.service.IQcOqcService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 出货检验单Controller
*
* @author yinjinlu
* @date 2022-08-31
*/
@RestController
@RequestMapping("/mes/qc/oqc")
public class QcOqcController extends BaseController
{
@Autowired
private IQcOqcService qcOqcService;
/**
* 查询出货检验单列表
*/
@PreAuthorize("@ss.hasPermi('mes:qc:oqc:list')")
@GetMapping("/list")
public TableDataInfo list(QcOqc qcOqc)
{
startPage();
List<QcOqc> list = qcOqcService.selectQcOqcList(qcOqc);
return getDataTable(list);
}
/**
* 导出出货检验单列表
*/
@PreAuthorize("@ss.hasPermi('mes:qc:oqc:export')")
@Log(title = "出货检验单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcOqc qcOqc)
{
List<QcOqc> list = qcOqcService.selectQcOqcList(qcOqc);
ExcelUtil<QcOqc> util = new ExcelUtil<QcOqc>(QcOqc.class);
util.exportExcel(response, list, "出货检验单数据");
}
/**
* 获取出货检验单详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:qc:oqc:query')")
@GetMapping(value = "/{oqcId}")
public AjaxResult getInfo(@PathVariable("oqcId") Long oqcId)
{
return AjaxResult.success(qcOqcService.selectQcOqcByOqcId(oqcId));
}
/**
* 新增出货检验单
*/
@PreAuthorize("@ss.hasPermi('mes:qc:oqc:add')")
@Log(title = "出货检验单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcOqc qcOqc)
{
if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){
return AjaxResult.error("出货单编号已存在!");
}
return toAjax(qcOqcService.insertQcOqc(qcOqc));
}
/**
* 修改出货检验单
*/
@PreAuthorize("@ss.hasPermi('mes:qc:oqc:edit')")
@Log(title = "出货检验单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcOqc qcOqc)
{
if(UserConstants.NOT_UNIQUE.equals(qcOqcService.checkOqcCodeUnique(qcOqc))){
return AjaxResult.error("出货单编号已存在!");
}
return toAjax(qcOqcService.updateQcOqc(qcOqc));
}
/**
* 删除出货检验单
*/
@PreAuthorize("@ss.hasPermi('mes:qc:oqc:remove')")
@Log(title = "出货检验单", businessType = BusinessType.DELETE)
@DeleteMapping("/{oqcIds}")
public AjaxResult remove(@PathVariable Long[] oqcIds)
{
return toAjax(qcOqcService.deleteQcOqcByOqcIds(oqcIds));
}
}

View File

@ -0,0 +1,505 @@
package com.ktg.mes.qc.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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_oqc
*
* @author yinjinlu
* @date 2022-08-31
*/
public class QcOqc extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 出货检验单ID */
private Long oqcId;
/** 出货检验单编号 */
@Excel(name = "出货检验单编号")
private String oqcCode;
/** 出货检验单名称 */
@Excel(name = "出货检验单名称")
private String oqcName;
/** 检验模板ID */
@Excel(name = "检验模板ID")
private Long templateId;
/** 客户ID */
@Excel(name = "客户ID")
private Long clientId;
/** 客户编码 */
@Excel(name = "客户编码")
private String clientCode;
/** 客户名称 */
@Excel(name = "客户名称")
private String clientName;
/** 批次号 */
@Excel(name = "批次号")
private String batchCode;
/** 产品物料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 BigDecimal quantityMinCheck;
/** 最大不合格数 */
@Excel(name = "最大不合格数")
private BigDecimal quantityMaxUnqualified;
/** 发货数量 */
@Excel(name = "发货数量")
private BigDecimal quantityOut;
/** 本次检测数量 */
@Excel(name = "本次检测数量")
private BigDecimal quantityCheck;
/** 不合格数 */
@Excel(name = "不合格数")
private BigDecimal quantityUnqualified;
/** 合格数量 */
@Excel(name = "合格数量")
private BigDecimal quantityQuanlified;
/** 致命缺陷率 */
@Excel(name = "致命缺陷率")
private BigDecimal crRate;
/** 严重缺陷率 */
@Excel(name = "严重缺陷率")
private BigDecimal majRate;
/** 轻微缺陷率 */
@Excel(name = "轻微缺陷率")
private BigDecimal minRate;
/** 致命缺陷数量 */
@Excel(name = "致命缺陷数量")
private BigDecimal crQuantity;
/** 严重缺陷数量 */
@Excel(name = "严重缺陷数量")
private BigDecimal majQuantity;
/** 轻微缺陷数量 */
@Excel(name = "轻微缺陷数量")
private BigDecimal minQuantity;
/** 检测结果 */
@Excel(name = "检测结果")
private String checkResult;
/** 出货日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出货日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date outDate;
/** 检测日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "检测日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date inspectDate;
/** 检测人员 */
@Excel(name = "检测人员")
private String inspector;
/** 单据状态 */
@Excel(name = "单据状态")
private String status;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setOqcId(Long oqcId)
{
this.oqcId = oqcId;
}
public Long getOqcId()
{
return oqcId;
}
public void setOqcCode(String oqcCode)
{
this.oqcCode = oqcCode;
}
public String getOqcCode()
{
return oqcCode;
}
public void setOqcName(String oqcName)
{
this.oqcName = oqcName;
}
public String getOqcName()
{
return oqcName;
}
public void setTemplateId(Long templateId)
{
this.templateId = templateId;
}
public Long getTemplateId()
{
return templateId;
}
public void setClientId(Long clientId)
{
this.clientId = clientId;
}
public Long getClientId()
{
return clientId;
}
public void setClientCode(String clientCode)
{
this.clientCode = clientCode;
}
public String getClientCode()
{
return clientCode;
}
public void setClientName(String clientName)
{
this.clientName = clientName;
}
public String getClientName()
{
return clientName;
}
public void setBatchCode(String batchCode)
{
this.batchCode = batchCode;
}
public String getBatchCode()
{
return batchCode;
}
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 setQuantityMinCheck(BigDecimal quantityMinCheck)
{
this.quantityMinCheck = quantityMinCheck;
}
public BigDecimal getQuantityMinCheck()
{
return quantityMinCheck;
}
public void setQuantityMaxUnqualified(BigDecimal quantityMaxUnqualified)
{
this.quantityMaxUnqualified = quantityMaxUnqualified;
}
public BigDecimal getQuantityMaxUnqualified()
{
return quantityMaxUnqualified;
}
public void setQuantityOut(BigDecimal quantityOut)
{
this.quantityOut = quantityOut;
}
public BigDecimal getQuantityOut()
{
return quantityOut;
}
public void setQuantityCheck(BigDecimal quantityCheck)
{
this.quantityCheck = quantityCheck;
}
public BigDecimal getQuantityCheck()
{
return quantityCheck;
}
public void setQuantityUnqualified(BigDecimal quantityUnqualified)
{
this.quantityUnqualified = quantityUnqualified;
}
public BigDecimal getQuantityUnqualified()
{
return quantityUnqualified;
}
public void setQuantityQuanlified(BigDecimal quantityQuanlified)
{
this.quantityQuanlified = quantityQuanlified;
}
public BigDecimal getQuantityQuanlified()
{
return quantityQuanlified;
}
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 setCrQuantity(BigDecimal crQuantity)
{
this.crQuantity = crQuantity;
}
public BigDecimal getCrQuantity()
{
return crQuantity;
}
public void setMajQuantity(BigDecimal majQuantity)
{
this.majQuantity = majQuantity;
}
public BigDecimal getMajQuantity()
{
return majQuantity;
}
public void setMinQuantity(BigDecimal minQuantity)
{
this.minQuantity = minQuantity;
}
public BigDecimal getMinQuantity()
{
return minQuantity;
}
public void setCheckResult(String checkResult)
{
this.checkResult = checkResult;
}
public String getCheckResult()
{
return checkResult;
}
public void setOutDate(Date outDate)
{
this.outDate = outDate;
}
public Date getOutDate()
{
return outDate;
}
public void setInspectDate(Date inspectDate)
{
this.inspectDate = inspectDate;
}
public Date getInspectDate()
{
return inspectDate;
}
public void setInspector(String inspector)
{
this.inspector = inspector;
}
public String getInspector()
{
return inspector;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
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("oqcId", getOqcId())
.append("oqcCode", getOqcCode())
.append("oqcName", getOqcName())
.append("templateId", getTemplateId())
.append("clientId", getClientId())
.append("clientCode", getClientCode())
.append("clientName", getClientName())
.append("batchCode", getBatchCode())
.append("itemId", getItemId())
.append("itemCode", getItemCode())
.append("itemName", getItemName())
.append("specification", getSpecification())
.append("unitOfMeasure", getUnitOfMeasure())
.append("quantityMinCheck", getQuantityMinCheck())
.append("quantityMaxUnqualified", getQuantityMaxUnqualified())
.append("quantityOut", getQuantityOut())
.append("quantityCheck", getQuantityCheck())
.append("quantityUnqualified", getQuantityUnqualified())
.append("quantityQuanlified", getQuantityQuanlified())
.append("crRate", getCrRate())
.append("majRate", getMajRate())
.append("minRate", getMinRate())
.append("crQuantity", getCrQuantity())
.append("majQuantity", getMajQuantity())
.append("minQuantity", getMinQuantity())
.append("checkResult", getCheckResult())
.append("outDate", getOutDate())
.append("inspectDate", getInspectDate())
.append("inspector", getInspector())
.append("status", getStatus())
.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();
}
}

View File

@ -0,0 +1,68 @@
package com.ktg.mes.qc.mapper;
import java.util.List;
import com.ktg.mes.qc.domain.QcOqc;
/**
* 出货检验单Mapper接口
*
* @author yinjinlu
* @date 2022-08-31
*/
public interface QcOqcMapper
{
/**
* 查询出货检验单
*
* @param oqcId 出货检验单主键
* @return 出货检验单
*/
public QcOqc selectQcOqcByOqcId(Long oqcId);
/**
* 查询出货检验单列表
*
* @param qcOqc 出货检验单
* @return 出货检验单集合
*/
public List<QcOqc> selectQcOqcList(QcOqc qcOqc);
/**
* 检查出货检验单号是否唯一
* @param qcOqc
* @return
*/
public QcOqc checkOqcCodeUnique(QcOqc qcOqc);
/**
* 新增出货检验单
*
* @param qcOqc 出货检验单
* @return 结果
*/
public int insertQcOqc(QcOqc qcOqc);
/**
* 修改出货检验单
*
* @param qcOqc 出货检验单
* @return 结果
*/
public int updateQcOqc(QcOqc qcOqc);
/**
* 删除出货检验单
*
* @param oqcId 出货检验单主键
* @return 结果
*/
public int deleteQcOqcByOqcId(Long oqcId);
/**
* 批量删除出货检验单
*
* @param oqcIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteQcOqcByOqcIds(Long[] oqcIds);
}

View File

@ -0,0 +1,69 @@
package com.ktg.mes.qc.service;
import java.util.List;
import com.ktg.mes.qc.domain.QcOqc;
/**
* 出货检验单Service接口
*
* @author yinjinlu
* @date 2022-08-31
*/
public interface IQcOqcService
{
/**
* 查询出货检验单
*
* @param oqcId 出货检验单主键
* @return 出货检验单
*/
public QcOqc selectQcOqcByOqcId(Long oqcId);
/**
* 查询出货检验单列表
*
* @param qcOqc 出货检验单
* @return 出货检验单集合
*/
public List<QcOqc> selectQcOqcList(QcOqc qcOqc);
/**
* 检查出货检验单号是否唯一
* @param qcOqc
* @return
*/
public String checkOqcCodeUnique(QcOqc qcOqc);
/**
* 新增出货检验单
*
* @param qcOqc 出货检验单
* @return 结果
*/
public int insertQcOqc(QcOqc qcOqc);
/**
* 修改出货检验单
*
* @param qcOqc 出货检验单
* @return 结果
*/
public int updateQcOqc(QcOqc qcOqc);
/**
* 批量删除出货检验单
*
* @param oqcIds 需要删除的出货检验单主键集合
* @return 结果
*/
public int deleteQcOqcByOqcIds(Long[] oqcIds);
/**
* 删除出货检验单信息
*
* @param oqcId 出货检验单主键
* @return 结果
*/
public int deleteQcOqcByOqcId(Long oqcId);
}

View File

@ -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.QcOqcMapper;
import com.ktg.mes.qc.domain.QcOqc;
import com.ktg.mes.qc.service.IQcOqcService;
/**
* 出货检验单Service业务层处理
*
* @author yinjinlu
* @date 2022-08-31
*/
@Service
public class QcOqcServiceImpl implements IQcOqcService
{
@Autowired
private QcOqcMapper qcOqcMapper;
/**
* 查询出货检验单
*
* @param oqcId 出货检验单主键
* @return 出货检验单
*/
@Override
public QcOqc selectQcOqcByOqcId(Long oqcId)
{
return qcOqcMapper.selectQcOqcByOqcId(oqcId);
}
/**
* 查询出货检验单列表
*
* @param qcOqc 出货检验单
* @return 出货检验单
*/
@Override
public List<QcOqc> selectQcOqcList(QcOqc qcOqc)
{
return qcOqcMapper.selectQcOqcList(qcOqc);
}
@Override
public String checkOqcCodeUnique(QcOqc qcOqc) {
QcOqc oqc = qcOqcMapper.checkOqcCodeUnique(qcOqc);
Long oqcId = qcOqc.getOqcId() == null? -1L : qcOqc.getOqcId();
if(StringUtils.isNotNull(oqc) && oqc.getOqcId().longValue() != oqcId.longValue()){
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 新增出货检验单
*
* @param qcOqc 出货检验单
* @return 结果
*/
@Override
public int insertQcOqc(QcOqc qcOqc)
{
qcOqc.setCreateTime(DateUtils.getNowDate());
return qcOqcMapper.insertQcOqc(qcOqc);
}
/**
* 修改出货检验单
*
* @param qcOqc 出货检验单
* @return 结果
*/
@Override
public int updateQcOqc(QcOqc qcOqc)
{
qcOqc.setUpdateTime(DateUtils.getNowDate());
return qcOqcMapper.updateQcOqc(qcOqc);
}
/**
* 批量删除出货检验单
*
* @param oqcIds 需要删除的出货检验单主键
* @return 结果
*/
@Override
public int deleteQcOqcByOqcIds(Long[] oqcIds)
{
return qcOqcMapper.deleteQcOqcByOqcIds(oqcIds);
}
/**
* 删除出货检验单信息
*
* @param oqcId 出货检验单主键
* @return 结果
*/
@Override
public int deleteQcOqcByOqcId(Long oqcId)
{
return qcOqcMapper.deleteQcOqcByOqcId(oqcId);
}
}

View File

@ -0,0 +1,237 @@
<?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.QcOqcMapper">
<resultMap type="QcOqc" id="QcOqcResult">
<result property="oqcId" column="oqc_id" />
<result property="oqcCode" column="oqc_code" />
<result property="oqcName" column="oqc_name" />
<result property="templateId" column="template_id" />
<result property="clientId" column="client_id" />
<result property="clientCode" column="client_code" />
<result property="clientName" column="client_name" />
<result property="batchCode" column="batch_code" />
<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="quantityMinCheck" column="quantity_min_check" />
<result property="quantityMaxUnqualified" column="quantity_max_unqualified" />
<result property="quantityOut" column="quantity_out" />
<result property="quantityCheck" column="quantity_check" />
<result property="quantityUnqualified" column="quantity_unqualified" />
<result property="quantityQuanlified" column="quantity_quanlified" />
<result property="crRate" column="cr_rate" />
<result property="majRate" column="maj_rate" />
<result property="minRate" column="min_rate" />
<result property="crQuantity" column="cr_quantity" />
<result property="majQuantity" column="maj_quantity" />
<result property="minQuantity" column="min_quantity" />
<result property="checkResult" column="check_result" />
<result property="outDate" column="out_date" />
<result property="inspectDate" column="inspect_date" />
<result property="inspector" column="inspector" />
<result property="status" column="status" />
<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="selectQcOqcVo">
select oqc_id, oqc_code, oqc_name, template_id, client_id, client_code, client_name, batch_code, item_id, item_code, item_name, specification, unit_of_measure, quantity_min_check, quantity_max_unqualified, quantity_out, quantity_check, quantity_unqualified, quantity_quanlified, cr_rate, maj_rate, min_rate, cr_quantity, maj_quantity, min_quantity, check_result, out_date, inspect_date, inspector, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_oqc
</sql>
<select id="selectQcOqcList" parameterType="QcOqc" resultMap="QcOqcResult">
<include refid="selectQcOqcVo"/>
<where>
<if test="oqcCode != null and oqcCode != ''"> and oqc_code = #{oqcCode}</if>
<if test="oqcName != null and oqcName != ''"> and oqc_name like concat('%', #{oqcName}, '%')</if>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="clientId != null "> and client_id = #{clientId}</if>
<if test="clientCode != null and clientCode != ''"> and client_code = #{clientCode}</if>
<if test="clientName != null and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</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="quantityMinCheck != null "> and quantity_min_check = #{quantityMinCheck}</if>
<if test="quantityMaxUnqualified != null "> and quantity_max_unqualified = #{quantityMaxUnqualified}</if>
<if test="quantityOut != null "> and quantity_out = #{quantityOut}</if>
<if test="quantityCheck != null "> and quantity_check = #{quantityCheck}</if>
<if test="quantityUnqualified != null "> and quantity_unqualified = #{quantityUnqualified}</if>
<if test="quantityQuanlified != null "> and quantity_quanlified = #{quantityQuanlified}</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>
<if test="crQuantity != null "> and cr_quantity = #{crQuantity}</if>
<if test="majQuantity != null "> and maj_quantity = #{majQuantity}</if>
<if test="minQuantity != null "> and min_quantity = #{minQuantity}</if>
<if test="checkResult != null and checkResult != ''"> and check_result = #{checkResult}</if>
<if test="outDate != null "> and out_date = #{outDate}</if>
<if test="inspectDate != null "> and inspect_date = #{inspectDate}</if>
<if test="inspector != null and inspector != ''"> and inspector = #{inspector}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectQcOqcByOqcId" parameterType="Long" resultMap="QcOqcResult">
<include refid="selectQcOqcVo"/>
where oqc_id = #{oqcId}
</select>
<select id="checkOqcCodeUnique" parameterType="QcOqc" resultMap="QcOqcResult">
<include refid="selectQcOqcVo"/>
where oqc_code = #{oqcCode}
</select>
<insert id="insertQcOqc" parameterType="QcOqc" useGeneratedKeys="true" keyProperty="oqcId">
insert into qc_oqc
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="oqcCode != null and oqcCode != ''">oqc_code,</if>
<if test="oqcName != null">oqc_name,</if>
<if test="templateId != null">template_id,</if>
<if test="clientId != null">client_id,</if>
<if test="clientCode != null and clientCode != ''">client_code,</if>
<if test="clientName != null and clientName != ''">client_name,</if>
<if test="batchCode != null">batch_code,</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="quantityMinCheck != null">quantity_min_check,</if>
<if test="quantityMaxUnqualified != null">quantity_max_unqualified,</if>
<if test="quantityOut != null">quantity_out,</if>
<if test="quantityCheck != null">quantity_check,</if>
<if test="quantityUnqualified != null">quantity_unqualified,</if>
<if test="quantityQuanlified != null">quantity_quanlified,</if>
<if test="crRate != null">cr_rate,</if>
<if test="majRate != null">maj_rate,</if>
<if test="minRate != null">min_rate,</if>
<if test="crQuantity != null">cr_quantity,</if>
<if test="majQuantity != null">maj_quantity,</if>
<if test="minQuantity != null">min_quantity,</if>
<if test="checkResult != null">check_result,</if>
<if test="outDate != null">out_date,</if>
<if test="inspectDate != null">inspect_date,</if>
<if test="inspector != null">inspector,</if>
<if test="status != null">status,</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="oqcCode != null and oqcCode != ''">#{oqcCode},</if>
<if test="oqcName != null">#{oqcName},</if>
<if test="templateId != null">#{templateId},</if>
<if test="clientId != null">#{clientId},</if>
<if test="clientCode != null and clientCode != ''">#{clientCode},</if>
<if test="clientName != null and clientName != ''">#{clientName},</if>
<if test="batchCode != null">#{batchCode},</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="quantityMinCheck != null">#{quantityMinCheck},</if>
<if test="quantityMaxUnqualified != null">#{quantityMaxUnqualified},</if>
<if test="quantityOut != null">#{quantityOut},</if>
<if test="quantityCheck != null">#{quantityCheck},</if>
<if test="quantityUnqualified != null">#{quantityUnqualified},</if>
<if test="quantityQuanlified != null">#{quantityQuanlified},</if>
<if test="crRate != null">#{crRate},</if>
<if test="majRate != null">#{majRate},</if>
<if test="minRate != null">#{minRate},</if>
<if test="crQuantity != null">#{crQuantity},</if>
<if test="majQuantity != null">#{majQuantity},</if>
<if test="minQuantity != null">#{minQuantity},</if>
<if test="checkResult != null">#{checkResult},</if>
<if test="outDate != null">#{outDate},</if>
<if test="inspectDate != null">#{inspectDate},</if>
<if test="inspector != null">#{inspector},</if>
<if test="status != null">#{status},</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="updateQcOqc" parameterType="QcOqc">
update qc_oqc
<trim prefix="SET" suffixOverrides=",">
<if test="oqcCode != null and oqcCode != ''">oqc_code = #{oqcCode},</if>
<if test="oqcName != null">oqc_name = #{oqcName},</if>
<if test="templateId != null">template_id = #{templateId},</if>
<if test="clientId != null">client_id = #{clientId},</if>
<if test="clientCode != null and clientCode != ''">client_code = #{clientCode},</if>
<if test="clientName != null and clientName != ''">client_name = #{clientName},</if>
<if test="batchCode != null">batch_code = #{batchCode},</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="quantityMinCheck != null">quantity_min_check = #{quantityMinCheck},</if>
<if test="quantityMaxUnqualified != null">quantity_max_unqualified = #{quantityMaxUnqualified},</if>
<if test="quantityOut != null">quantity_out = #{quantityOut},</if>
<if test="quantityCheck != null">quantity_check = #{quantityCheck},</if>
<if test="quantityUnqualified != null">quantity_unqualified = #{quantityUnqualified},</if>
<if test="quantityQuanlified != null">quantity_quanlified = #{quantityQuanlified},</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="crQuantity != null">cr_quantity = #{crQuantity},</if>
<if test="majQuantity != null">maj_quantity = #{majQuantity},</if>
<if test="minQuantity != null">min_quantity = #{minQuantity},</if>
<if test="checkResult != null">check_result = #{checkResult},</if>
<if test="outDate != null">out_date = #{outDate},</if>
<if test="inspectDate != null">inspect_date = #{inspectDate},</if>
<if test="inspector != null">inspector = #{inspector},</if>
<if test="status != null">status = #{status},</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 oqc_id = #{oqcId}
</update>
<delete id="deleteQcOqcByOqcId" parameterType="Long">
delete from qc_oqc where oqc_id = #{oqcId}
</delete>
<delete id="deleteQcOqcByOqcIds" parameterType="String">
delete from qc_oqc where oqc_id in
<foreach item="oqcId" collection="array" open="(" separator="," close=")">
#{oqcId}
</foreach>
</delete>
</mapper>