质量统计
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));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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…
Reference in New Issue