质量统计

highway
zhaoxiaolin 1 year ago
parent bddcdd4181
commit 4a6323cd46

@ -0,0 +1,45 @@
package com.op.system.api.domain.quality;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.List;
/**
*
*echart
* @author zxl
* @date 2023-07-18
*/
public class ChartDTO {
private String name;
private String type;
private List<Integer> data;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<Integer> getData() {
return data;
}
public void setData(List<Integer> data) {
this.data = data;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,92 @@
package com.op.quality.controller;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcDefectType;
import com.op.quality.service.IQcDefectTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author wws
* @date 2023-10-12
*/
@RestController
@RequestMapping("/defectType")
public class QcDefectTypeController extends BaseController {
@Autowired
private IQcDefectTypeService qcDefectTypeService;
/**
*
*/
@RequiresPermissions("quality:defectType:list")
@GetMapping("/list")
public TableDataInfo list(QcDefectType qcDefectType) {
startPage();
List<QcDefectType> list = qcDefectTypeService.selectQcDefectTypeList(qcDefectType);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("quality:defectType:export")
@Log(title = "不良类型维护", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcDefectType qcDefectType) {
List<QcDefectType> list = qcDefectTypeService.selectQcDefectTypeList(qcDefectType);
ExcelUtil<QcDefectType> util = new ExcelUtil<QcDefectType>(QcDefectType.class);
util.exportExcel(response, list, "不良类型维护数据");
}
/**
*
*/
@RequiresPermissions("quality:defectType:query")
@GetMapping(value = "/{defectId}")
public AjaxResult getInfo(@PathVariable("defectId") String defectId) {
return success(qcDefectTypeService.selectQcDefectTypeByDefectId(defectId));
}
/**
*
*/
@RequiresPermissions("quality:defectType:add")
@Log(title = "不良类型维护", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcDefectType qcDefectType) {
return qcDefectTypeService.insertQcDefectType(qcDefectType);
}
/**
*
*/
@RequiresPermissions("quality:defectType:edit")
@Log(title = "不良类型维护", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcDefectType qcDefectType) {
return qcDefectTypeService.updateQcDefectType(qcDefectType);
}
/**
*
*/
@RequiresPermissions("quality:defectType:remove")
@Log(title = "不良类型维护", businessType = BusinessType.DELETE)
@DeleteMapping("/{defectIds}")
public AjaxResult remove(@PathVariable String[] defectIds) {
return toAjax(qcDefectTypeService.deleteQcDefectTypeByDefectIds(defectIds));
}
}

@ -1,9 +1,11 @@
package com.op.quality.controller;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils;
@ -72,18 +74,86 @@ public class QcStaticTableController extends BaseController {
*
*/
@RequiresPermissions("quality:gcTableProduce:list")
@GetMapping("/getProduceTableList")
public TableDataInfo getProduceList(QcStaticTable qcStaticTable) {
startPage();
List<QcStaticTable> list = qcStaticTableService.selectQcStaticTableList(qcStaticTable);
return getDataTable(list);
@GetMapping("/getProduceChartData")
public QcStaticTable getProduceList(QcStaticTable qcStaticTable) {
QcStaticTable resultdto = new QcStaticTable();
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcStaticTable.getYmArrayStart())){
LocalDate date = LocalDate.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM");
String ymStr = dtf.format(date);
qcStaticTable.setYmArrayStart(ymStr);
qcStaticTable.setYmArrayEnd(ymStr);
}
//xAxis;
if(qcStaticTable.getYmArrayStart().equals(qcStaticTable.getYmArrayEnd())){
/**月内每日**/
List<String> days = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ymd");
resultdto.setxAxis(days);
}else{
/**年内各月**/
List<String> months = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ym");
resultdto.setxAxis(months);
}
List<QcStaticTable> seriesdto= qcStaticTableService.selectQcStaticTableList(qcStaticTable);
//legend.data
//series;
resultdto.setSeries(null);
return resultdto;
}
public List<String> getXNames(String startMonth,String endMonth,String type){
// 返回的日期集合
List<String> days = new ArrayList<String>();
DateFormat dateFormat = null;
try {
if("ymd".equals(type)){
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
}else{
dateFormat = new SimpleDateFormat("yyyy-MM");
}
Date start = dateFormat.parse(startMonth);//开始
Date end = dateFormat.parse(endMonth);//结束
String endTimeStr1 = endMonth;
String[] endTime2 = endTimeStr1.split(" ");
String endTime3 = endTime2[1].split(":")[1];
if(Integer.parseInt(endTime3)!=0){
Calendar calendar = Calendar.getInstance();
calendar.setTime(end);
calendar.add(Calendar.MONTH, 1);
end = calendar.getTime();
}
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
while (tempStart.before(tempEnd)) {
days.add(dateFormat.format(tempStart.getTime()));
if("ymd".equals(type)) {
tempStart.add(Calendar.DAY_OF_MONTH, 1);
}else{
tempStart.add(Calendar.MONTH, 1);
}
}
} catch (ParseException e) {
e.printStackTrace();
}
return days;
}
@RequiresPermissions("quality:gcTableProduce:list")
@Log(title = "质量系统报", businessType = BusinessType.EXPORT)
@PostMapping("/exportTableList")
public void exportTableList(HttpServletResponse response, QcStaticTable qcStaticTable) {
List<QcStaticTable> list = qcStaticTableService.selectQcStaticTableList(qcStaticTable);
ExcelUtil<QcStaticTable> util = new ExcelUtil<QcStaticTable>(QcStaticTable.class);
util.exportExcel(response, list, "质量系统报数据");
}
}

@ -0,0 +1,215 @@
package com.op.quality.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.util.List;
/**
* qc_defect_type
*
* @author wws
* @date 2023-10-12
*/
public class QcDefectType extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
private String defectId;
/** 不良类型编码 */
@Excel(name = "不良类型编码")
private String defectCode;
/** 不良类型 */
@Excel(name = "不良类型")
private String defectType;
/** 不良子类 */
@Excel(name = "不良子类")
private String defectSubclass;
/** 备注 */
@Excel(name = "备注")
private String defectRemark;
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
/** 备用字段1 */
@Excel(name = "备用字段1")
private String attr1;
/** 备用字段2 */
@Excel(name = "备用字段2")
private String attr2;
/** 备用字段3 */
@Excel(name = "备用字段3")
private String attr3;
/** 删除标志 */
@Excel(name = "删除标志")
private String delFlag;
// 创建日期范围list
private List<Date> createTimeArray;
// 更新日期范围list
private List<Date> updateTimeArray;
// 更新日期开始
private String updateTimeStart;
// 更新日期结束
private String updateTimeEnd;
// 创建日期开始
private String createTimeStart;
// 创建日期结束
private String createTimeEnd;
public List<Date> getCreateTimeArray() {
return createTimeArray;
}
public void setCreateTimeArray(List<Date> createTimeArray) {
this.createTimeArray = createTimeArray;
}
public List<Date> getUpdateTimeArray() {
return updateTimeArray;
}
public void setUpdateTimeArray(List<Date> updateTimeArray) {
this.updateTimeArray = updateTimeArray;
}
public String getUpdateTimeStart() {
return updateTimeStart;
}
public void setUpdateTimeStart(String updateTimeStart) {
this.updateTimeStart = updateTimeStart;
}
public String getUpdateTimeEnd() {
return updateTimeEnd;
}
public void setUpdateTimeEnd(String updateTimeEnd) {
this.updateTimeEnd = updateTimeEnd;
}
public String getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(String createTimeStart) {
this.createTimeStart = createTimeStart;
}
public String getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(String createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public void setDefectId(String defectId) {
this.defectId = defectId;
}
public String getDefectId() {
return defectId;
}
public void setDefectCode(String defectCode) {
this.defectCode = defectCode;
}
public String getDefectCode() {
return defectCode;
}
public void setDefectType(String defectType) {
this.defectType = defectType;
}
public String getDefectType() {
return defectType;
}
public void setDefectSubclass(String defectSubclass) {
this.defectSubclass = defectSubclass;
}
public String getDefectSubclass() {
return defectSubclass;
}
public void setDefectRemark(String defectRemark) {
this.defectRemark = defectRemark;
}
public String getDefectRemark() {
return defectRemark;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
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(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("defectId", getDefectId())
.append("defectCode", getDefectCode())
.append("defectType", getDefectType())
.append("defectSubclass", getDefectSubclass())
.append("defectRemark", getDefectRemark())
.append("factoryCode", getFactoryCode())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -2,6 +2,7 @@ package com.op.quality.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import com.op.system.api.domain.quality.ChartDTO;
import java.util.List;
@ -36,6 +37,51 @@ public class QcStaticTable extends BaseEntity {
private String checkResult;
private String noOkBatchRate;
private String noOkNumRate;
private String ymArrayStart;
private String ymArrayEnd;
private List<String> legendData;
private List<String> xAxis;
private List<ChartDTO> series;
public String getYmArrayStart() {
return ymArrayStart;
}
public void setYmArrayStart(String ymArrayStart) {
this.ymArrayStart = ymArrayStart;
}
public String getYmArrayEnd() {
return ymArrayEnd;
}
public void setYmArrayEnd(String ymArrayEnd) {
this.ymArrayEnd = ymArrayEnd;
}
public List<ChartDTO> getSeries() {
return series;
}
public void setSeries(List<ChartDTO> series) {
this.series = series;
}
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<String> getLegendData() {
return legendData;
}
public void setLegendData(List<String> legendData) {
this.legendData = legendData;
}
public String getNoOkNumRate() {
return noOkNumRate;

@ -0,0 +1,70 @@
package com.op.quality.mapper;
import com.op.quality.domain.QcDefectType;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* Mapper
*
* @author wws
* @date 2023-10-12
*/
@Mapper
public interface QcDefectTypeMapper {
/**
*
*
* @param faultId
* @return
*/
public QcDefectType selectQcDefectTypeByDefectId(String faultId);
/**
*
*
* @param qcDefectType
* @return
*/
public List<QcDefectType> selectQcDefectTypeList(QcDefectType qcDefectType);
/**
*
*
* @param qcDefectType
* @return
*/
public int insertQcDefectType(QcDefectType qcDefectType);
/**
*
*
* @param qcDefectType
* @return
*/
public int updateQcDefectType(QcDefectType qcDefectType);
/**
* -
*
* @param faultId
* @return
*/
public int deleteQcDefectTypeByDefectId(String faultId);
/**
* -
*
* @param faultIds
* @return
*/
public int deleteQcDefectTypeByDefectIds(String[] faultIds);
/**
*
* @return
*/
int selectSerialNumber();
}

@ -0,0 +1,62 @@
package com.op.quality.service;
import com.op.common.core.web.domain.AjaxResult;
import com.op.quality.domain.QcDefectType;
import java.util.List;
/**
* Service
*
* @author zxl
* @date 2023-10-12
*/
public interface IQcDefectTypeService {
/**
*
*
* @param defectId
* @return
*/
public QcDefectType selectQcDefectTypeByDefectId(String defectId);
/**
*
*
* @param equDefectType
* @return
*/
public List<QcDefectType> selectQcDefectTypeList(QcDefectType equDefectType);
/**
*
*
* @param equDefectType
* @return
*/
public AjaxResult insertQcDefectType(QcDefectType equDefectType);
/**
*
*
* @param equDefectType
* @return
*/
public AjaxResult updateQcDefectType(QcDefectType equDefectType);
/**
*
*
* @param defectIds
* @return
*/
public int deleteQcDefectTypeByDefectIds(String[] defectIds);
/**
*
*
* @param defectId
* @return
*/
public int deleteQcDefectTypeByDefectId(String defectId);
}

@ -0,0 +1,169 @@
package com.op.quality.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.quality.domain.QcDefectType;
import com.op.quality.mapper.QcDefectTypeMapper;
import com.op.quality.service.IQcDefectTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.List;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
* Service
*
* @author wws
* @date 2023-10-12
*/
@Service
public class QcDefectTypeServiceImpl implements IQcDefectTypeService {
@Autowired
private QcDefectTypeMapper qcDefectTypeMapper;
/**
*
*
* @param defectId
* @return
*/
@Override
@DS("#header.poolName")
public QcDefectType selectQcDefectTypeByDefectId(String defectId) {
return qcDefectTypeMapper.selectQcDefectTypeByDefectId(defectId);
}
/**
*
*
* @param qcDefectType
* @return
*/
@Override
@DS("#header.poolName")
public List<QcDefectType> selectQcDefectTypeList(QcDefectType qcDefectType) {
if (qcDefectType.getCreateTimeArray() != null) {
// 设置创建日期开始和结束值
if (qcDefectType.getCreateTimeArray().size() == 2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
qcDefectType.setCreateTimeStart(formatter.format(qcDefectType.getCreateTimeArray().get(0)));
qcDefectType.setCreateTimeEnd(formatter.format(qcDefectType.getCreateTimeArray().get(1)));
}
}
if (qcDefectType.getUpdateTimeArray() != null) {
// 设置更新日期开始和结束
if (qcDefectType.getUpdateTimeArray().size() == 2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
qcDefectType.setUpdateTimeStart(formatter.format(qcDefectType.getUpdateTimeArray().get(0)));
qcDefectType.setUpdateTimeEnd(formatter.format(qcDefectType.getUpdateTimeArray().get(1)));
}
}
return qcDefectTypeMapper.selectQcDefectTypeList(qcDefectType);
}
/**
*
*
* @param qcDefectType
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult insertQcDefectType(QcDefectType qcDefectType) {
// 检验
QcDefectType checkQuery = new QcDefectType();
checkQuery.setDefectType(qcDefectType.getDefectType());
checkQuery.setDefectSubclass(qcDefectType.getDefectSubclass());
List<QcDefectType> check = qcDefectTypeMapper.selectQcDefectTypeList(checkQuery);
if (check.size() > 0) {
return error(500,"不良子类已存在!不可添加!");
}
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String str = request.getHeader(key.substring(8));
int index = str.indexOf("_");
String factory = str.substring(index + 1);
// 获取检查项流水号
String serialNum = String.format("%03d", qcDefectTypeMapper.selectSerialNumber());
// 处理不良信息
qcDefectType.setDefectId(IdUtils.fastSimpleUUID());
qcDefectType.setDefectCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + serialNum);
qcDefectType.setFactoryCode(factory);
qcDefectType.setCreateBy(SecurityContextHolder.getUserName());
qcDefectType.setCreateTime(DateUtils.getNowDate());
qcDefectType.setUpdateBy(SecurityContextHolder.getUserName());
qcDefectType.setUpdateTime(DateUtils.getNowDate());
// 插入数据库
qcDefectTypeMapper.insertQcDefectType(qcDefectType);
return success();
}
/**
*
*
* @param qcDefectType
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult updateQcDefectType(QcDefectType qcDefectType) {
// 检验
QcDefectType checkQuery = new QcDefectType();
checkQuery.setDefectType(qcDefectType.getDefectType());
checkQuery.setDefectSubclass(qcDefectType.getDefectSubclass());
List<QcDefectType> check = qcDefectTypeMapper.selectQcDefectTypeList(checkQuery);
if (check.size() > 0) {
if (!check.get(0).equals(qcDefectType.getDefectCode())) {
return error(500,"不良子类已存在!修改失败!");
}
}
qcDefectType.setUpdateBy(SecurityContextHolder.getUserName());
qcDefectType.setUpdateTime(DateUtils.getNowDate());
// 插入数据库
qcDefectTypeMapper.updateQcDefectType(qcDefectType);
return success("修改成功");
}
/**
*
*
* @param defectIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcDefectTypeByDefectIds(String[] defectIds) {
return qcDefectTypeMapper.deleteQcDefectTypeByDefectIds(defectIds);
}
/**
*
*
* @param defectId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcDefectTypeByDefectId(String defectId) {
return qcDefectTypeMapper.deleteQcDefectTypeByDefectId(defectId);
}
}

@ -0,0 +1,131 @@
<?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.op.quality.mapper.QcDefectTypeMapper">
<resultMap type="com.op.quality.domain.QcDefectType" id="QcDefectTypeResult">
<result property="defectId" column="defect_id" />
<result property="defectCode" column="defect_code" />
<result property="defectType" column="defect_type" />
<result property="defectSubclass" column="defect_subclass" />
<result property="defectRemark" column="defect_remark" />
<result property="factoryCode" column="factory_code" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="delFlag" column="del_flag" />
<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="selectQcDefectTypeVo">
select defect_id, defect_code, defect_type, defect_subclass, defect_remark,
factory_code, attr1, attr2, attr3,
del_flag, create_by, create_time, update_by, update_time
from qc_defect_type
</sql>
<select id="selectQcDefectTypeList" parameterType="QcDefectType" resultMap="QcDefectTypeResult">
<include refid="selectQcDefectTypeVo"/>
<where>
<if test="defectCode != null and defectCode != ''"> and defect_code like concat('%', #{defectCode}, '%')</if>
<if test="defectType != null and defectType != ''"> and defect_type like concat('%', #{defectType}, '%')</if>
<if test="defectSubclass != null and defectSubclass != ''"> and defect_subclass like concat('%', #{defectSubclass}, '%')</if>
<if test="defectRemark != null and defectRemark != ''"> and defect_remark = #{defectRemark}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="createTimeStart != null "> and CONVERT(date,create_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,create_time)</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="updateTimeStart != null "> and CONVERT(date,update_time) >= #{updateTimeStart}</if>
<if test="updateTimeEnd != null "> and #{updateTimeEnd} >= CONVERT(date,update_time)</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
and del_flag = '0'
</where>
ORDER BY create_time DESC
</select>
<select id="selectQcDefectTypeByDefectId" parameterType="String" resultMap="QcDefectTypeResult">
<include refid="selectQcDefectTypeVo"/>
where defect_id = #{defectId} and del_flag = '0'
</select>
<select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(defect_id)+1 AS serialNum
FROM qc_defect_type
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0'
</select>
<insert id="insertQcDefectType" parameterType="QcDefectType">
insert into qc_defect_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="defectId != null">defect_id,</if>
<if test="defectCode != null and defectCode != ''">defect_code,</if>
<if test="defectType != null and defectType != ''">defect_type,</if>
<if test="defectSubclass != null and defectSubclass != ''">defect_subclass,</if>
<if test="defectRemark != null">defect_remark,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="defectId != null">#{defectId},</if>
<if test="defectCode != null and defectCode != ''">#{defectCode},</if>
<if test="defectType != null and defectType != ''">#{defectType},</if>
<if test="defectSubclass != null and defectSubclass != ''">#{defectSubclass},</if>
<if test="defectRemark != null">#{defectRemark},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQcDefectType" parameterType="QcDefectType">
update qc_defect_type
<trim prefix="SET" suffixOverrides=",">
<if test="defectCode != null and defectCode != ''">defect_code = #{defectCode},</if>
<if test="defectType != null and defectType != ''">defect_type = #{defectType},</if>
<if test="defectSubclass != null and defectSubclass != ''">defect_subclass = #{defectSubclass},</if>
<if test="defectRemark != null">defect_remark = #{defectRemark},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where defect_id = #{defectId} and del_flag = '0'
</update>
<delete id="deleteQcDefectTypeByDefectId" parameterType="String">
delete qc_defect_type set del_flag = '1' where defect_id = #{defectId}
</delete>
<delete id="deleteQcDefectTypeByDefectIds" parameterType="String">
update qc_defect_type set del_flag = '1' where defect_id in
<foreach item="defectId" collection="array" open="(" separator="," close=")">
#{defectId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save