删除之前的来料检验单缺陷记录相关代码

This commit is contained in:
JinLu.Yin 2022-08-31 21:34:31 +08:00
parent 81117ecbd7
commit 90ef14f1eb
11 changed files with 27 additions and 715 deletions

View File

@ -6,7 +6,6 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.qc.domain.QcIqcDefect;
import com.ktg.mes.qc.domain.ValidList;
import com.ktg.mes.qc.service.*;
import org.springframework.security.access.prepost.PreAuthorize;

View File

@ -97,6 +97,7 @@ public class QcIpqcController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:qc:ipqc:add')")
@Log(title = "过程检验单", businessType = BusinessType.INSERT)
@Transactional
@PostMapping
public AjaxResult add(@RequestBody QcIpqc qcIpqc)
{
@ -126,10 +127,15 @@ public class QcIpqcController extends BaseController
return AjaxResult.error("当前工单生产的产品未配置此类型的检验模板!");
}
//先保存
qcIpqcService.insertQcIpqc(qcIpqc);
//生成行信息
generateLine(qcIpqc);
return toAjax(qcIpqcService.insertQcIpqc(qcIpqc));
//将ID返回
Long ipqcId = qcIpqc.getIpqcId();
return AjaxResult.success(ipqcId);
}
/**
@ -137,6 +143,7 @@ public class QcIpqcController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:qc:ipqc:edit')")
@Log(title = "过程检验单", businessType = BusinessType.UPDATE)
@Transactional
@PutMapping
public AjaxResult edit(@RequestBody QcIpqc qcIpqc)
{
@ -166,14 +173,6 @@ public class QcIpqcController extends BaseController
return AjaxResult.error("当前工单生产的产品未配置此类型的检验模板!");
}
//删除行信息删除缺陷记录信息重新生成行信息
qcIpqcLineService.deleteByIpqcId(qcIpqc.getIpqcId());
QcDefectRecord p2 = new QcDefectRecord();
p2.setQcId(qcIpqc.getIpqcId());
p2.setQcType(UserConstants.QC_TYPE_IPQC);
qcDefectRecordService.deleteByQcIdAndType(p2);
generateLine(qcIpqc);
return toAjax(qcIpqcService.updateQcIpqc(qcIpqc));
}

View File

@ -5,9 +5,7 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.qc.domain.QcIqcLine;
import com.ktg.mes.qc.domain.QcTemplateIndex;
import com.ktg.mes.qc.domain.QcTemplateProduct;
import com.ktg.mes.qc.domain.*;
import com.ktg.mes.qc.service.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,7 +22,6 @@ 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.QcIqc;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
@ -51,7 +48,7 @@ public class QcIqcController extends BaseController
private IQcIqcLineService qcIqcLineService;
@Autowired
private IQcIqcDefectService qcIqcDefectService;
private IQcDefectRecordService qcDefectRecordService;
/**
* 查询来料检验单列表
@ -136,9 +133,9 @@ public class QcIqcController extends BaseController
}else{
return AjaxResult.error("当前产品未配置检测模板!");
}
qcIqcLineService.deleteByIqcId(qcIqc.getIqcId());
qcIqcDefectService.deleteByIqcId(qcIqc.getIqcId());
int ret = qcIqcService.updateQcIqc(qcIqc);
generateLine(qcIqc);
return toAjax(ret);
}
@ -155,7 +152,10 @@ public class QcIqcController extends BaseController
for (Long iqcId:iqcIds
) {
qcIqcLineService.deleteByIqcId(iqcId);
qcIqcDefectService.deleteByIqcId(iqcId);
QcDefectRecord p2 = new QcDefectRecord();
p2.setQcId(iqcId);
p2.setQcType(UserConstants.QC_TYPE_IQC);
qcDefectRecordService.deleteByQcIdAndType(p2);//删除对应的缺陷记录
}
return toAjax(qcIqcService.deleteQcIqcByIqcIds(iqcIds));
}

View File

@ -1,151 +0,0 @@
package com.ktg.mes.qc.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.qc.domain.ValidList;
import com.ktg.mes.qc.service.IQcIqcLineService;
import com.ktg.mes.qc.service.IQcIqcService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
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.QcIqcDefect;
import com.ktg.mes.qc.service.IQcIqcDefectService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 来料检验单缺陷记录Controller
*
* @author yinjinlu
* @date 2022-05-19
*/
@RestController
@RequestMapping("/mes/qc/iqcdefect")
public class QcIqcDefectController extends BaseController
{
@Autowired
private IQcIqcDefectService qcIqcDefectService;
@Autowired
private IQcIqcLineService qcIqcLineService;
@Autowired
private IQcIqcService qcIqcService;
/**
* 查询来料检验单缺陷记录列表
*/
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:list')")
@GetMapping("/list")
public TableDataInfo list(QcIqcDefect qcIqcDefect)
{
startPage();
List<QcIqcDefect> list = qcIqcDefectService.selectQcIqcDefectList(qcIqcDefect);
return getDataTable(list);
}
/**
* 导出来料检验单缺陷记录列表
*/
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:export')")
@Log(title = "来料检验单缺陷记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcIqcDefect qcIqcDefect)
{
List<QcIqcDefect> list = qcIqcDefectService.selectQcIqcDefectList(qcIqcDefect);
ExcelUtil<QcIqcDefect> util = new ExcelUtil<QcIqcDefect>(QcIqcDefect.class);
util.exportExcel(response, list, "来料检验单缺陷记录数据");
}
/**
* 获取来料检验单缺陷记录详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:query')")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
{
return AjaxResult.success(qcIqcDefectService.selectQcIqcDefectByRecordId(recordId));
}
/**
* 新增来料检验单缺陷记录
*/
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:add')")
@Log(title = "来料检验单缺陷记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcIqcDefect qcIqcDefect)
{
return toAjax(qcIqcDefectService.insertQcIqcDefect(qcIqcDefect));
}
/**
* 修改来料检验单缺陷记录
*/
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:edit')")
@Log(title = "来料检验单缺陷记录", businessType = BusinessType.UPDATE)
@Transactional
@PutMapping
public AjaxResult updateList(@Validated @RequestBody ValidList<QcIqcDefect> defects){
Long iqcId = -1L;
Long lineId = -1L;
if(CollUtil.isNotEmpty(defects)){
for (QcIqcDefect defect: defects
) {
if(StringUtils.isNotNull(defect.getRecordId())){
qcIqcDefectService.updateQcIqcDefect(defect);
}else {
qcIqcDefectService.insertQcIqcDefect(defect);
}
iqcId = defect.getIqcId();
lineId = defect.getLineId();
}
//更新行上的cr,maj,min数量
qcIqcLineService.updateCrMajMinQuantity(iqcId,lineId);
//更新头上的cr,maj,min数量和比例
qcIqcService.updateCrMajMinQuaAndRate(iqcId);
}
return AjaxResult.success();
}
/**
* 删除来料检验单缺陷记录
*/
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:remove')")
@Log(title = "来料检验单缺陷记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable Long[] recordIds)
{
Long iqcId =-1L;
Long lineId =-1L;
if(recordIds!=null && recordIds.length>0){
QcIqcDefect defect = qcIqcDefectService.selectQcIqcDefectByRecordId(recordIds[0]);
iqcId = defect.getIqcId();
lineId = defect.getLineId();
//更新行上的cr,maj,min数量
qcIqcLineService.updateCrMajMinQuantity(iqcId,lineId);
//更新头上的cr,maj,min数量和比例
qcIqcService.updateCrMajMinQuaAndRate(iqcId);
}
return toAjax(qcIqcDefectService.deleteQcIqcDefectByRecordIds(recordIds));
}
}

View File

@ -1,175 +0,0 @@
package com.ktg.mes.qc.domain;
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;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 来料检验单缺陷记录对象 qc_iqc_defect
*
* @author yinjinlu
* @date 2022-05-19
*/
public class QcIqcDefect extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 缺陷ID */
private Long recordId;
/** 来料检验单ID */
@Excel(name = "来料检验单ID")
private Long iqcId;
/** 来料检验单行ID */
@Excel(name = "来料检验单行ID")
private Long lineId;
/** 缺陷描述 */
@NotBlank(message = "缺陷描述不能为空")
@Excel(name = "缺陷描述")
private String defectName;
/** 缺陷等级 */
@NotBlank(message = "请选择缺陷等级")
@Excel(name = "缺陷等级")
private String defectLevel;
/** 缺陷数量 */
@Excel(name = "缺陷数量")
private Long defectQuantity;
private String flag;
/** 预留字段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 setIqcId(Long iqcId)
{
this.iqcId = iqcId;
}
public Long getIqcId()
{
return iqcId;
}
public void setLineId(Long lineId)
{
this.lineId = lineId;
}
public Long getLineId()
{
return lineId;
}
public void setDefectName(String defectName)
{
this.defectName = defectName;
}
public String getDefectName()
{
return defectName;
}
public void setDefectLevel(String defectLevel)
{
this.defectLevel = defectLevel;
}
public String getDefectLevel()
{
return defectLevel;
}
public void setDefectQuantity(Long defectQuantity)
{
this.defectQuantity = defectQuantity;
}
public Long getDefectQuantity()
{
return defectQuantity;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
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 "QcIqcDefect{" +
"recordId=" + recordId +
", iqcId=" + iqcId +
", lineId=" + lineId +
", defectName='" + defectName + '\'' +
", defectLevel='" + defectLevel + '\'' +
", defectQuantity=" + defectQuantity +
", flag='" + flag + '\'' +
", attr1='" + attr1 + '\'' +
", attr2='" + attr2 + '\'' +
", attr3=" + attr3 +
", attr4=" + attr4 +
'}';
}
}

View File

@ -43,6 +43,13 @@ public interface QcIpqcLineMapper
*/
public int updateQcIpqcLine(QcIpqcLine qcIpqcLine);
/**
* 根据缺陷记录更新过程检验单行上的缺陷数量
* @param qcIpqcLine
* @return
*/
public int updateCrMajMinQuantity(QcIpqcLine qcIpqcLine);
/**
* 删除过程检验单行
*

View File

@ -1,65 +0,0 @@
package com.ktg.mes.qc.mapper;
import java.util.List;
import com.ktg.mes.qc.domain.QcIqcDefect;
/**
* 来料检验单缺陷记录Mapper接口
*
* @author yinjinlu
* @date 2022-05-19
*/
public interface QcIqcDefectMapper
{
/**
* 查询来料检验单缺陷记录
*
* @param recordId 来料检验单缺陷记录主键
* @return 来料检验单缺陷记录
*/
public QcIqcDefect selectQcIqcDefectByRecordId(Long recordId);
/**
* 查询来料检验单缺陷记录列表
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 来料检验单缺陷记录集合
*/
public List<QcIqcDefect> selectQcIqcDefectList(QcIqcDefect qcIqcDefect);
/**
* 新增来料检验单缺陷记录
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 结果
*/
public int insertQcIqcDefect(QcIqcDefect qcIqcDefect);
/**
* 修改来料检验单缺陷记录
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 结果
*/
public int updateQcIqcDefect(QcIqcDefect qcIqcDefect);
/**
* 删除来料检验单缺陷记录
*
* @param recordId 来料检验单缺陷记录主键
* @return 结果
*/
public int deleteQcIqcDefectByRecordId(Long recordId);
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect);
public int deleteByIqcId(Long iqcId);
/**
* 批量删除来料检验单缺陷记录
*
* @param recordIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteQcIqcDefectByRecordIds(Long[] recordIds);
}

View File

@ -1,75 +0,0 @@
package com.ktg.mes.qc.service;
import java.util.List;
import com.ktg.mes.qc.domain.QcIqcDefect;
/**
* 来料检验单缺陷记录Service接口
*
* @author yinjinlu
* @date 2022-05-19
*/
public interface IQcIqcDefectService
{
/**
* 查询来料检验单缺陷记录
*
* @param recordId 来料检验单缺陷记录主键
* @return 来料检验单缺陷记录
*/
public QcIqcDefect selectQcIqcDefectByRecordId(Long recordId);
/**
* 查询来料检验单缺陷记录列表
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 来料检验单缺陷记录集合
*/
public List<QcIqcDefect> selectQcIqcDefectList(QcIqcDefect qcIqcDefect);
/**
* 新增来料检验单缺陷记录
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 结果
*/
public int insertQcIqcDefect(QcIqcDefect qcIqcDefect);
/**
* 修改来料检验单缺陷记录
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 结果
*/
public int updateQcIqcDefect(QcIqcDefect qcIqcDefect);
/**
* 批量删除来料检验单缺陷记录
*
* @param recordIds 需要删除的来料检验单缺陷记录主键集合
* @return 结果
*/
public int deleteQcIqcDefectByRecordIds(Long[] recordIds);
/**
* 删除来料检验单下所有缺陷记录
* @param iqcID
* @return
*/
public int deleteByIqcId(Long iqcID);
/**
* 删除行下所有缺陷记录
* @param qcIqcDefect
* @return
*/
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect);
/**
* 删除来料检验单缺陷记录信息
*
* @param recordId 来料检验单缺陷记录主键
* @return 结果
*/
public int deleteQcIqcDefectByRecordId(Long recordId);
}

View File

@ -72,10 +72,10 @@ public class QcIpqcLineServiceImpl implements IQcIpqcLineService
@Override
public int updateCrMajMinQuantity(Long qcId, Long lineId) {
return 0;
QcIpqcLine line = new QcIpqcLine();
line.setIpqcId(qcId);
line.setLineId(lineId);
return qcIpqcLineMapper.updateCrMajMinQuantity(line);
}
/**

View File

@ -1,106 +0,0 @@
package com.ktg.mes.qc.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.qc.mapper.QcIqcDefectMapper;
import com.ktg.mes.qc.domain.QcIqcDefect;
import com.ktg.mes.qc.service.IQcIqcDefectService;
/**
* 来料检验单缺陷记录Service业务层处理
*
* @author yinjinlu
* @date 2022-05-19
*/
@Service
public class QcIqcDefectServiceImpl implements IQcIqcDefectService
{
@Autowired
private QcIqcDefectMapper qcIqcDefectMapper;
/**
* 查询来料检验单缺陷记录
*
* @param recordId 来料检验单缺陷记录主键
* @return 来料检验单缺陷记录
*/
@Override
public QcIqcDefect selectQcIqcDefectByRecordId(Long recordId)
{
return qcIqcDefectMapper.selectQcIqcDefectByRecordId(recordId);
}
/**
* 查询来料检验单缺陷记录列表
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 来料检验单缺陷记录
*/
@Override
public List<QcIqcDefect> selectQcIqcDefectList(QcIqcDefect qcIqcDefect)
{
return qcIqcDefectMapper.selectQcIqcDefectList(qcIqcDefect);
}
/**
* 新增来料检验单缺陷记录
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 结果
*/
@Override
public int insertQcIqcDefect(QcIqcDefect qcIqcDefect)
{
qcIqcDefect.setCreateTime(DateUtils.getNowDate());
return qcIqcDefectMapper.insertQcIqcDefect(qcIqcDefect);
}
/**
* 修改来料检验单缺陷记录
*
* @param qcIqcDefect 来料检验单缺陷记录
* @return 结果
*/
@Override
public int updateQcIqcDefect(QcIqcDefect qcIqcDefect)
{
qcIqcDefect.setUpdateTime(DateUtils.getNowDate());
return qcIqcDefectMapper.updateQcIqcDefect(qcIqcDefect);
}
/**
* 批量删除来料检验单缺陷记录
*
* @param recordIds 需要删除的来料检验单缺陷记录主键
* @return 结果
*/
@Override
public int deleteQcIqcDefectByRecordIds(Long[] recordIds)
{
return qcIqcDefectMapper.deleteQcIqcDefectByRecordIds(recordIds);
}
@Override
public int deleteByIqcId(Long iqcID) {
return qcIqcDefectMapper.deleteByIqcId(iqcID);
}
@Override
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect) {
return qcIqcDefectMapper.deleteByIqcIdLineId(qcIqcDefect);
}
/**
* 删除来料检验单缺陷记录信息
*
* @param recordId 来料检验单缺陷记录主键
* @return 结果
*/
@Override
public int deleteQcIqcDefectByRecordId(Long recordId)
{
return qcIqcDefectMapper.deleteQcIqcDefectByRecordId(recordId);
}
}

View File

@ -1,121 +0,0 @@
<?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.QcIqcDefectMapper">
<resultMap type="QcIqcDefect" id="QcIqcDefectResult">
<result property="recordId" column="record_id" />
<result property="iqcId" column="iqc_id" />
<result property="lineId" column="line_id" />
<result property="defectName" column="defect_name" />
<result property="defectLevel" column="defect_level" />
<result property="defectQuantity" column="defect_quantity" />
<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="selectQcIqcDefectVo">
select record_id, iqc_id, line_id, defect_name, defect_level, defect_quantity, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_iqc_defect
</sql>
<select id="selectQcIqcDefectList" parameterType="QcIqcDefect" resultMap="QcIqcDefectResult">
<include refid="selectQcIqcDefectVo"/>
<where>
<if test="iqcId != null "> and iqc_id = #{iqcId}</if>
<if test="lineId != null "> and line_id = #{lineId}</if>
<if test="defectName != null and defectName != ''"> and defect_name like concat('%', #{defectName}, '%')</if>
<if test="defectLevel != null and defectLevel != ''"> and defect_level = #{defectLevel}</if>
<if test="defectQuantity != null "> and defect_quantity = #{defectQuantity}</if>
</where>
order by create_time desc
</select>
<select id="selectQcIqcDefectByRecordId" parameterType="Long" resultMap="QcIqcDefectResult">
<include refid="selectQcIqcDefectVo"/>
where record_id = #{recordId}
</select>
<insert id="insertQcIqcDefect" parameterType="QcIqcDefect" useGeneratedKeys="true" keyProperty="recordId">
insert into qc_iqc_defect
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="iqcId != null">iqc_id,</if>
<if test="lineId != null">line_id,</if>
<if test="defectName != null and defectName != ''">defect_name,</if>
<if test="defectLevel != null and defectLevel != ''">defect_level,</if>
<if test="defectQuantity != null">defect_quantity,</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="iqcId != null">#{iqcId},</if>
<if test="lineId != null">#{lineId},</if>
<if test="defectName != null and defectName != ''">#{defectName},</if>
<if test="defectLevel != null and defectLevel != ''">#{defectLevel},</if>
<if test="defectQuantity != null">#{defectQuantity},</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="updateQcIqcDefect" parameterType="QcIqcDefect">
update qc_iqc_defect
<trim prefix="SET" suffixOverrides=",">
<if test="iqcId != null">iqc_id = #{iqcId},</if>
<if test="lineId != null">line_id = #{lineId},</if>
<if test="defectName != null and defectName != ''">defect_name = #{defectName},</if>
<if test="defectLevel != null and defectLevel != ''">defect_level = #{defectLevel},</if>
<if test="defectQuantity != null">defect_quantity = #{defectQuantity},</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="deleteQcIqcDefectByRecordId" parameterType="Long">
delete from qc_iqc_defect where record_id = #{recordId}
</delete>
<delete id="deleteByIqcId" parameterType="Long">
delete from qc_iqc_defect where iqc_id = #{iqcId}
</delete>
<delete id="deleteByIqcIdLineId" parameterType="QcIqcDefect">
delete from qc_iqc_defect where iqc_id = #{iqcId} and line_id =#{lineId}
</delete>
<delete id="deleteQcIqcDefectByRecordIds" parameterType="String">
delete from qc_iqc_defect where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
</mapper>