Merge remote-tracking branch 'origin/master'

master
mengjiao 1 year ago
commit cff213a3d0

@ -77,8 +77,7 @@ public class QcCheckProjectController extends BaseController {
ExcelUtil<QcCheckProject> util = new ExcelUtil<QcCheckProject>(QcCheckProject.class); ExcelUtil<QcCheckProject> util = new ExcelUtil<QcCheckProject>(QcCheckProject.class);
List<QcCheckProject> projectList = util.importExcel(file.getInputStream()); List<QcCheckProject> projectList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername(); String operName = SecurityUtils.getUsername();
String message = qcCheckProjectService.importCheckProject(projectList, updateSupport, operName); return qcCheckProjectService.importCheckProject(projectList, updateSupport, operName);
return success(message);
} }
/** /**

@ -44,6 +44,12 @@ public class QcMaterialGroupController extends BaseController {
List<QcMaterialGroup> list = qcMaterialGroupService.selectQcMaterialGroupList(qcMaterialGroup); List<QcMaterialGroup> list = qcMaterialGroupService.selectQcMaterialGroupList(qcMaterialGroup);
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/getOriginalGroupList")
public TableDataInfo getOriginalGroupList(QcMaterialGroup qcMaterialGroup) {
List<QcMaterialGroup> list = qcMaterialGroupService.getOriginalGroupList(qcMaterialGroup);
return getDataTable(list);
}
/** /**
* *

@ -34,7 +34,7 @@ public class QcCheckProject extends BaseEntity {
/** /**
* *
*/ */
@Excel(name = "检验规则属性") @Excel(name = "检验规则属性", readConverterExp = "0=定性,1=定量")
private String propertyCode; private String propertyCode;
/** /**
@ -80,6 +80,8 @@ public class QcCheckProject extends BaseEntity {
private String defectLevel; private String defectLevel;
@Excel(name = "检验方案类型") @Excel(name = "检验方案类型")
private String projectType; private String projectType;
@Excel(name = "排序")
private Integer sort;
private String materialCode; private String materialCode;
private String typeCode; private String typeCode;
private String groupId; private String groupId;
@ -243,6 +245,14 @@ public class QcCheckProject extends BaseEntity {
this.serialNumber = serialNumber; this.serialNumber = serialNumber;
} }
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -28,6 +28,11 @@ public class QcMaterialGroup extends BaseEntity {
*/ */
@Excel(name = "物料组名称") @Excel(name = "物料组名称")
private String groupName; private String groupName;
/**
*
*/
@Excel(name = "物料组名称")
private String groupCode;
/** /**
* 1 * 1
@ -116,6 +121,14 @@ public class QcMaterialGroup extends BaseEntity {
this.children = children; this.children = children;
} }
public String getGroupCode() {
return groupCode;
}
public void setGroupCode(String groupCode) {
this.groupCode = groupCode;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -29,6 +29,8 @@ public interface QcMaterialGroupMapper {
*/ */
public List<QcMaterialGroup> selectQcMaterialGroupList(QcMaterialGroup qcMaterialGroup); public List<QcMaterialGroup> selectQcMaterialGroupList(QcMaterialGroup qcMaterialGroup);
public List<QcMaterialGroup> getOriginalGroupList(QcMaterialGroup qcMaterialGroup);
/** /**
* *
* *

@ -2,6 +2,7 @@ package com.op.quality.service;
import java.util.List; import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.quality.domain.QcCheckProject; import com.op.quality.domain.QcCheckProject;
/** /**
@ -64,5 +65,5 @@ public interface IQcCheckProjectService {
* *
* @return * @return
*/ */
public String importCheckProject(List<QcCheckProject> projectList, Boolean isUpdateSupport, String operName); public AjaxResult importCheckProject(List<QcCheckProject> projectList, Boolean isUpdateSupport, String operName);
} }

@ -22,6 +22,13 @@ public interface IQcMaterialGroupService {
*/ */
public QcMaterialGroup selectQcMaterialGroupById(String id); public QcMaterialGroup selectQcMaterialGroupById(String id);
/**
*
* @param qcMaterialGroup
* @return
*/
public List<QcMaterialGroup> getOriginalGroupList(QcMaterialGroup qcMaterialGroup);
/** /**
* *
* *

@ -1,6 +1,7 @@
package com.op.quality.service.impl; package com.op.quality.service.impl;
import java.util.List; import java.util.List;
import java.util.Optional;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.exception.ServiceException; import com.op.common.core.exception.ServiceException;
@ -8,7 +9,10 @@ import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.bean.BeanValidators; import com.op.common.core.utils.bean.BeanValidators;
import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils; import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcProjectType;
import com.op.quality.mapper.QcProjectTypeMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -24,6 +28,9 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.Validator; import javax.validation.Validator;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/** /**
* Service * Service
* *
@ -40,6 +47,9 @@ public class QcCheckProjectServiceImpl implements IQcCheckProjectService {
@Autowired @Autowired
protected Validator validator; protected Validator validator;
@Autowired
private QcProjectTypeMapper qcProjectTypeMapper;
/** /**
* *
* *
@ -127,7 +137,7 @@ public class QcCheckProjectServiceImpl implements IQcCheckProjectService {
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public String importCheckProject(List<QcCheckProject> projectList, Boolean isUpdateSupport, String operName) { public AjaxResult importCheckProject(List<QcCheckProject> projectList, Boolean isUpdateSupport, String operName) {
if (CollectionUtils.isEmpty(projectList)) { if (CollectionUtils.isEmpty(projectList)) {
throw new ServiceException("导入的检测项目数据为空!"); throw new ServiceException("导入的检测项目数据为空!");
} }
@ -139,44 +149,49 @@ public class QcCheckProjectServiceImpl implements IQcCheckProjectService {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName"; String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_", ""); String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
for (QcCheckProject project : projectList) { //校验数据
try { AjaxResult checkResult = checkImportProject(projectList);
QcCheckProject pro = qcCheckProjectMapper.selectCheckProjectByRuleName(project.getRuleName(), project.getProjectType()); if (checkResult.isSuccess()) {
if (ObjectUtils.isEmpty(pro)) { for (QcCheckProject project : projectList) {
BeanValidators.validateWithException(validator, project); try {
project.setId(IdUtils.fastSimpleUUID()); QcCheckProject pro = qcCheckProjectMapper.selectCheckProjectByRuleName(project.getRuleName(), project.getProjectType());
project.setCreateTime(DateUtils.getNowDate()); if (ObjectUtils.isEmpty(pro)) {
project.setCreateBy(operName); BeanValidators.validateWithException(validator, project);
project.setFactoryCode(factoryCode); project.setId(IdUtils.fastSimpleUUID());
qcCheckProjectMapper.insertQcCheckProject(project); project.setCreateTime(DateUtils.getNowDate());
successNum++; project.setCreateBy(operName);
successMsg.append("<br/>" + successNum + "。检测项目" + project.getRuleName() + "导入成功"); project.setFactoryCode(factoryCode);
} else if (isUpdateSupport) { qcCheckProjectMapper.insertQcCheckProject(project);
BeanValidators.validateWithException(validator, project); successNum++;
project.setId(pro.getId()); successMsg.append("<br/>" + successNum + "。检测项目" + project.getRuleName() + "导入成功");
project.setUpdateTime(DateUtils.getNowDate()); } else if (isUpdateSupport) {
project.setUpdateBy(operName); BeanValidators.validateWithException(validator, project);
qcCheckProjectMapper.updateQcCheckProject(project); project.setId(pro.getId());
successNum++; project.setUpdateTime(DateUtils.getNowDate());
successMsg.append("<br/>" + successNum + "。检测项目[" + project.getRuleName() + "]更新成功"); project.setUpdateBy(operName);
} else { qcCheckProjectMapper.updateQcCheckProject(project);
successNum++;
successMsg.append("<br/>" + successNum + "。检测项目[" + project.getRuleName() + "]更新成功");
} else {
failproNum++;
failproMsg.append("<br/>" + failproNum + "。检测项目[" + project.getRuleName() + "]已存在");
}
} catch (Exception e) {
failproNum++; failproNum++;
failproMsg.append("<br/>" + failproNum + "。检测项目[" + project.getRuleName() + "]已存在"); String msg = "<br/>" + failproNum + "、检测项目[" + project.getRuleName() + "]导入失败";
failproMsg.append(msg + e.getMessage());
log.error(msg, e);
} }
} catch (Exception e) {
failproNum++;
String msg = "<br/>" + failproNum + "、检测项目[" + project.getRuleName() + "]导入失败";
failproMsg.append(msg + e.getMessage());
log.error(msg, e);
} }
if (failproNum > 0) {
failproMsg.insert(0, "很抱歉,导入失败!共" + failproNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failproMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功! 共" + successNum + " 条,数据如下:");
}
return success(successMsg.toString());
} }
if (failproNum > 0) { return checkResult;
failproMsg.insert(0, "很抱歉,导入失败!共" + failproNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failproMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功! 共" + successNum + " 条,数据如下:");
}
return successMsg.toString();
} }
private String getOrderNum() { private String getOrderNum() {
@ -187,4 +202,53 @@ public class QcCheckProjectServiceImpl implements IQcCheckProjectService {
orderNum = now + "0" + checkProject.getSerialNumber(); orderNum = now + "0" + checkProject.getSerialNumber();
return orderNum; return orderNum;
} }
public AjaxResult checkImportProject(List<QcCheckProject> qcCheckProjectList) {
if (CollectionUtils.isEmpty(qcCheckProjectList)) {
return error(500,"导入的订单信息不能为空!信息导入失败");
}
for (QcCheckProject project : qcCheckProjectList) {
if (StringUtils.isEmpty(project.getOrderNum())) {
return error(500,"检验规则编号不能为空,信息导入失败,请检查是否存在空数据项");
}
if (StringUtils.isEmpty(project.getRuleName())) {
return error(500,"检验规则名称不能为空,信息导入失败");
}
if (StringUtils.isEmpty(project.getPropertyCode())) {
return error(500,"检验规则属性不能为空,信息导入失败");
}
if (StringUtils.isEmpty(project.getProjectType())) {
return error(500,"检验方案类型不能为空,信息导入失败");
}else {
boolean flag = typeConverter(project);
if (!flag) {
String ruleName = project.getRuleName();
return error(500,"检验规则名称:"+ ruleName +"检验方案类型不规范,信息导入失败");
}
}
if (project.getSort() == null) {
return error(500,"排序不能为空,信息导入失败");
}
}
return success();
}
/**
*
*/
public boolean typeConverter(QcCheckProject project) {
String projectType = project.getProjectType();
List<QcProjectType> projectTypes = qcProjectTypeMapper.selectQcProjectTypeList(new QcProjectType());
//筛选出检验方案类型名称相同的项目
Optional<QcProjectType> matchedType = projectTypes.stream()
.filter(item -> projectType.equals(item.getProjectTypeName()))
.findFirst();
//使用code替换名称
if (matchedType.isPresent()) {
project.setProjectType(matchedType.get().getProjectTypeCode());
return true;
}else {
return false;
}
}
} }

@ -48,10 +48,22 @@ public class QcMaterialGroupServiceImpl implements IQcMaterialGroupService {
* @return * @return
*/ */
@Override @Override
@DS("#header.poolName")
public QcMaterialGroup selectQcMaterialGroupById(String id) { public QcMaterialGroup selectQcMaterialGroupById(String id) {
return qcMaterialGroupMapper.selectQcMaterialGroupById(id); return qcMaterialGroupMapper.selectQcMaterialGroupById(id);
} }
/**
*
* @param qcMaterialGroup
* @return
*/
@Override
@DS("#header.poolName")
public List<QcMaterialGroup> getOriginalGroupList(QcMaterialGroup qcMaterialGroup) {
return qcMaterialGroupMapper.getOriginalGroupList(qcMaterialGroup);
}
@Override @Override
//@DataScope(deptAlias = "d") //@DataScope(deptAlias = "d")
@DS("#header.poolName") @DS("#header.poolName")

@ -24,13 +24,13 @@
<result property="judge" column="judge"/> <result property="judge" column="judge"/>
<result property="defectLevel" column="defect_level"/> <result property="defectLevel" column="defect_level"/>
<result property="projectType" column="project_type"/> <result property="projectType" column="project_type"/>
<result property="sort" column="sort" />
</resultMap> </resultMap>
<sql id="selectQcCheckProjectVo"> <sql id="selectQcCheckProjectVo">
select id, order_num, rule_name, property_code, check_mode, check_tool, unit_code, check_standard, select id, order_num, rule_name, property_code, check_mode, check_tool, unit_code, check_standard,
attr1, create_by, create_time, update_by, update_time, factory_code, del_flag,sample_plan, attr1, create_by, create_time, update_by, update_time, factory_code, del_flag,sample_plan,
judge,defect_level,project_type judge,defect_level,project_type,sort
from qc_check_project from qc_check_project
</sql> </sql>
@ -48,6 +48,7 @@
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if> <if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="judge != null and judge != ''">and judge = #{judge}</if> <if test="judge != null and judge != ''">and judge = #{judge}</if>
<if test="projectType != null and projectType != ''">project_type = #{projectType}</if> <if test="projectType != null and projectType != ''">project_type = #{projectType}</if>
and del_flag = '0'
</where> </where>
order by create_time order by create_time
</select> </select>
@ -79,7 +80,7 @@
<if test="judge != null">judge,</if> <if test="judge != null">judge,</if>
<if test="defectLevel != null">defect_level,</if> <if test="defectLevel != null">defect_level,</if>
<if test="projectType != null">project_type,</if> <if test="projectType != null">project_type,</if>
<if test="sort != null">sort,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@ -101,6 +102,7 @@
<if test="judge != null">#{judge},</if> <if test="judge != null">#{judge},</if>
<if test="defectLevel != null">#{defectLevel},</if> <if test="defectLevel != null">#{defectLevel},</if>
<if test="projectType != null">#{projectType},</if> <if test="projectType != null">#{projectType},</if>
<if test="sort != null">#{sort},</if>
</trim> </trim>
</insert> </insert>
@ -125,16 +127,17 @@
<if test="judge != null">judge = #{judge},</if> <if test="judge != null">judge = #{judge},</if>
<if test="defectLevel != null">defect_level = #{defectLevel},</if> <if test="defectLevel != null">defect_level = #{defectLevel},</if>
<if test="projectType != null">project_type = #{projectType},</if> <if test="projectType != null">project_type = #{projectType},</if>
<if test="sort != null">sort = #{sort},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteQcCheckProjectById" parameterType="String"> <delete id="deleteQcCheckProjectById" parameterType="String">
delete from qc_check_project where id = #{id} update qc_check_project set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteQcCheckProjectByIds" parameterType="String"> <delete id="deleteQcCheckProjectByIds" parameterType="String">
delete from qc_check_project where id in update qc_check_project set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

@ -125,7 +125,7 @@
qcp.check_mode checkMode qcp.check_mode checkMode
<!--,qcp.check_standard checkStandard--> <!--,qcp.check_standard checkStandard-->
from qc_check_type_project qctp from qc_check_type_project qctp
left join qc_check_project qcp on qcp.id = qctp.project_id left join qc_check_project qcp on qcp.id = qctp.project_id and qcp.del_flag = '0'
where qctp.del_flag = '0' and qctp.status = '1' where qctp.del_flag = '0' and qctp.status = '1'
and qctp.material_code = #{materialCode} and qctp.material_code = #{materialCode}
and qctp.type_id = #{typeId} and qctp.type_id = #{typeId}
@ -284,11 +284,11 @@
</update> </update>
<delete id="deleteQcCheckTypeProjectById" parameterType="String"> <delete id="deleteQcCheckTypeProjectById" parameterType="String">
delete from qc_check_type_project where id = #{id} update qc_check_type_project set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteQcCheckTypeProjectByIds" parameterType="String"> <delete id="deleteQcCheckTypeProjectByIds" parameterType="String">
delete from qc_check_type_project where id in update qc_check_type_project set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -304,6 +304,7 @@
unit_code unitCode, unit_code unitCode,
check_standard checkStandard, check_standard checkStandard,
sample_plan samplePlan, sample_plan samplePlan,
sort,
judge , judge ,
defect_level defectLevel defect_level defectLevel
from qc_check_project from qc_check_project
@ -312,7 +313,7 @@
<if test="ruleName != null">and rule_name like concat('%',#{ruleName},'%')</if> <if test="ruleName != null">and rule_name like concat('%',#{ruleName},'%')</if>
and id not in( and id not in(
select project_id from qc_check_type_project select project_id from qc_check_type_project
where type_id = #{typeCode} where del_flag = '0' and type_id = #{typeCode}
<if test="samplePlan != null">and sample_plan = #{samplePlan}</if> <if test="samplePlan != null">and sample_plan = #{samplePlan}</if>
<if test="materialCode != null">and material_code = #{materialCode}</if> <if test="materialCode != null">and material_code = #{materialCode}</if>
) )

@ -5,178 +5,193 @@
<mapper namespace="com.op.quality.mapper.QcGoalDistributeMapper"> <mapper namespace="com.op.quality.mapper.QcGoalDistributeMapper">
<resultMap type="QcGoalDistribute" id="QcGoalDistributeResult"> <resultMap type="QcGoalDistribute" id="QcGoalDistributeResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="belongGoalId" column="belong_goal_id"/> <result property="belongGoalId" column="belong_goal_id"/>
<result property="supplierCode" column="supplier_code"/> <result property="supplierCode" column="supplier_code"/>
<result property="supplierName" column="supplier_name"/> <result property="supplierName" column="supplier_name"/>
<result property="attr1" column="attr1"/> <result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/> <result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/> <result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/> <result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="factoryCode" column="factory_code"/> <result property="factoryCode" column="factory_code"/>
<result property="delFlag" column="del_flag"/> <result property="delFlag" column="del_flag"/>
</resultMap> </resultMap>
<sql id="selectQcGoalDistributeVo"> <sql id="selectQcGoalDistributeVo">
select id, belong_goal_id, supplier_code, supplier_name, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_goal_distribute select id,
</sql> belong_goal_id,
supplier_code,
supplier_name,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time,
factory_code,
del_flag
from qc_goal_distribute
</sql>
<select id="selectQcGoalDistributeList" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult"> <select id="selectQcGoalDistributeList" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult">
<include refid="selectQcGoalDistributeVo"/> <include refid="selectQcGoalDistributeVo"/>
<where> <where>
<if test="belongGoalId != null and belongGoalId != ''"> <if test="belongGoalId != null and belongGoalId != ''">
and belong_goal_id = #{belongGoalId} and belong_goal_id = #{belongGoalId}
</if> </if>
<if test="supplierCode != null and supplierCode != ''"> <if test="supplierCode != null and supplierCode != ''">
and supplier_code = #{supplierCode} and supplier_code = #{supplierCode}
</if> </if>
<if test="supplierName != null and supplierName != ''"> <if test="supplierName != null and supplierName != ''">
and supplier_name like concat('%', #{supplierName}, '%') and supplier_name like concat('%', #{supplierName}, '%')
</if> </if>
<if test="attr1 != null and attr1 != ''"> <if test="attr1 != null and attr1 != ''">
and attr1 = #{attr1} and attr1 = #{attr1}
</if> </if>
<if test="attr2 != null and attr2 != ''"> <if test="attr2 != null and attr2 != ''">
and attr2 = #{attr2} and attr2 = #{attr2}
</if> </if>
<if test="attr3 != null and attr3 != ''"> <if test="attr3 != null and attr3 != ''">
and attr3 = #{attr3} and attr3 = #{attr3}
</if> </if>
<if test="attr4 != null and attr4 != ''"> <if test="attr4 != null and attr4 != ''">
and attr4 = #{attr4} and attr4 = #{attr4}
</if> </if>
<if test="factoryCode != null and factoryCode != ''"> <if test="factoryCode != null and factoryCode != ''">
and factory_code = #{factoryCode} and factory_code = #{factoryCode}
</if> </if>
and del_flag = '0'
</where> </where>
</select> </select>
<select id="selectQcGoalDistributeById" parameterType="String" <select id="selectQcGoalDistributeById" parameterType="String"
resultMap="QcGoalDistributeResult"> resultMap="QcGoalDistributeResult">
<include refid="selectQcGoalDistributeVo"/> <include refid="selectQcGoalDistributeVo"/>
where id = #{id} where del_flag = '0' and id = #{id}
</select> </select>
<insert id="insertQcGoalDistribute" parameterType="QcGoalDistribute"> <insert id="insertQcGoalDistribute" parameterType="QcGoalDistribute">
insert into qc_goal_distribute insert into qc_goal_distribute
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id, <if test="id != null">id,
</if> </if>
<if test="belongGoalId != null">belong_goal_id, <if test="belongGoalId != null">belong_goal_id,
</if> </if>
<if test="supplierCode != null">supplier_code, <if test="supplierCode != null">supplier_code,
</if> </if>
<if test="supplierName != null">supplier_name, <if test="supplierName != null">supplier_name,
</if> </if>
<if test="attr1 != null">attr1, <if test="attr1 != null">attr1,
</if> </if>
<if test="attr2 != null">attr2, <if test="attr2 != null">attr2,
</if> </if>
<if test="attr3 != null">attr3, <if test="attr3 != null">attr3,
</if> </if>
<if test="attr4 != null">attr4, <if test="attr4 != null">attr4,
</if> </if>
<if test="createBy != null">create_by, <if test="createBy != null">create_by,
</if> </if>
<if test="createTime != null">create_time, <if test="createTime != null">create_time,
</if> </if>
<if test="updateBy != null">update_by, <if test="updateBy != null">update_by,
</if> </if>
<if test="updateTime != null">update_time, <if test="updateTime != null">update_time,
</if> </if>
<if test="factoryCode != null and factoryCode != ''">factory_code, <if test="factoryCode != null and factoryCode != ''">factory_code,
</if> </if>
<if test="delFlag != null">del_flag, <if test="delFlag != null">del_flag,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id}, <if test="id != null">#{id},
</if> </if>
<if test="belongGoalId != null">#{belongGoalId}, <if test="belongGoalId != null">#{belongGoalId},
</if> </if>
<if test="supplierCode != null">#{supplierCode}, <if test="supplierCode != null">#{supplierCode},
</if> </if>
<if test="supplierName != null">#{supplierName}, <if test="supplierName != null">#{supplierName},
</if> </if>
<if test="attr1 != null">#{attr1}, <if test="attr1 != null">#{attr1},
</if> </if>
<if test="attr2 != null">#{attr2}, <if test="attr2 != null">#{attr2},
</if> </if>
<if test="attr3 != null">#{attr3}, <if test="attr3 != null">#{attr3},
</if> </if>
<if test="attr4 != null">#{attr4}, <if test="attr4 != null">#{attr4},
</if> </if>
<if test="createBy != null">#{createBy}, <if test="createBy != null">#{createBy},
</if> </if>
<if test="createTime != null">#{createTime}, <if test="createTime != null">#{createTime},
</if> </if>
<if test="updateBy != null">#{updateBy}, <if test="updateBy != null">#{updateBy},
</if> </if>
<if test="updateTime != null">#{updateTime}, <if test="updateTime != null">#{updateTime},
</if> </if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode}, <if test="factoryCode != null and factoryCode != ''">#{factoryCode},
</if> </if>
<if test="delFlag != null">#{delFlag}, <if test="delFlag != null">#{delFlag},
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateQcGoalDistribute" parameterType="QcGoalDistribute"> <update id="updateQcGoalDistribute" parameterType="QcGoalDistribute">
update qc_goal_distribute update qc_goal_distribute
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="belongGoalId != null">belong_goal_id = <if test="belongGoalId != null">belong_goal_id =
#{belongGoalId}, #{belongGoalId},
</if> </if>
<if test="supplierCode != null">supplier_code = <if test="supplierCode != null">supplier_code =
#{supplierCode}, #{supplierCode},
</if> </if>
<if test="supplierName != null">supplier_name = <if test="supplierName != null">supplier_name =
#{supplierName}, #{supplierName},
</if> </if>
<if test="attr1 != null">attr1 = <if test="attr1 != null">attr1 =
#{attr1}, #{attr1},
</if> </if>
<if test="attr2 != null">attr2 = <if test="attr2 != null">attr2 =
#{attr2}, #{attr2},
</if> </if>
<if test="attr3 != null">attr3 = <if test="attr3 != null">attr3 =
#{attr3}, #{attr3},
</if> </if>
<if test="attr4 != null">attr4 = <if test="attr4 != null">attr4 =
#{attr4}, #{attr4},
</if> </if>
<if test="createBy != null">create_by = <if test="createBy != null">create_by =
#{createBy}, #{createBy},
</if> </if>
<if test="createTime != null">create_time = <if test="createTime != null">create_time =
#{createTime}, #{createTime},
</if> </if>
<if test="updateBy != null">update_by = <if test="updateBy != null">update_by =
#{updateBy}, #{updateBy},
</if> </if>
<if test="updateTime != null">update_time = <if test="updateTime != null">update_time =
#{updateTime}, #{updateTime},
</if> </if>
<if test="factoryCode != null and factoryCode != ''">factory_code = <if test="factoryCode != null and factoryCode != ''">factory_code =
#{factoryCode}, #{factoryCode},
</if> </if>
<if test="delFlag != null">del_flag = <if test="delFlag != null">del_flag =
#{delFlag}, #{delFlag},
</if> </if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteQcGoalDistributeById" parameterType="String"> <delete id="deleteQcGoalDistributeById" parameterType="String">
delete from qc_goal_distribute where id = #{id} update qc_goal_distribute set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteQcGoalDistributeByIds" parameterType="String"> <delete id="deleteQcGoalDistributeByIds" parameterType="String">
delete from qc_goal_distribute where id in update qc_goal_distribute set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -193,9 +208,9 @@
from base_supplier bs from base_supplier bs
where bs.active_flag = '1' and bs.del_flag = '0' where bs.active_flag = '1' and bs.del_flag = '0'
and bs.supplier_code not in ( and bs.supplier_code not in (
select gd.supplier_code select gd.supplier_code
from qc_goal_distribute gd from qc_goal_distribute gd
where gd.belong_goal_id =#{belongGoalId} where gd.belong_goal_id =#{belongGoalId}
) )
<if test="supplierName != null and supplierName != ''">and bs.zh_desc like concat('%', #{supplierName}, <if test="supplierName != null and supplierName != ''">and bs.zh_desc like concat('%', #{supplierName},
'%') '%')
@ -204,8 +219,8 @@
<select id="getGoalDistributeDo" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult"> <select id="getGoalDistributeDo" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult">
select distinct select distinct
gd.supplier_code, gd.supplier_code,
concat(bs.zh_desc,'(',bs.supplier_code,')') label concat(bs.zh_desc,'(',bs.supplier_code,')') label
from qc_goal_distribute gd from qc_goal_distribute gd
left join base_supplier bs on gd.supplier_code = bs.supplier_code left join base_supplier bs on gd.supplier_code = bs.supplier_code
where gd.belong_goal_id =#{belongGoalId} where gd.belong_goal_id =#{belongGoalId}
@ -224,11 +239,12 @@
bp.active_flag = '1' bp.active_flag = '1'
AND bp.del_flag = '0' AND bp.del_flag = '0'
AND bp.product_code NOT IN ( AND bp.product_code NOT IN (
SELECT gd.supplier_code SELECT gd.supplier_code
FROM qc_goal_distribute gd FROM qc_goal_distribute gd
WHERE gd.belong_goal_id =#{ belongGoalId } WHERE gd.belong_goal_id =#{ belongGoalId }
) )
<if test="supplierName != null and supplierName != ''">and bp.product_desc_zh like concat('%', #{supplierName},'%') <if test="supplierName != null and supplierName != ''">and bp.product_desc_zh like concat('%',
#{supplierName},'%')
</if> </if>
</select> </select>

@ -60,6 +60,7 @@
<if test="parentGoal != null and parentGoal != ''"> <if test="parentGoal != null and parentGoal != ''">
and parent_goal = #{parentGoal} and parent_goal = #{parentGoal}
</if> </if>
and del_flag = '0'
</where> </where>
order by id desc order by id desc
</select> </select>
@ -94,6 +95,7 @@
<if test="parentGoal != null and parentGoal != ''"> <if test="parentGoal != null and parentGoal != ''">
and parent_goal = #{parentGoal} and parent_goal = #{parentGoal}
</if> </if>
and del_flag = '0'
</where> </where>
order by id asc order by id asc
</select> </select>
@ -101,7 +103,7 @@
<select id="selectQcGoalById" parameterType="String" <select id="selectQcGoalById" parameterType="String"
resultMap="QcGoalResult"> resultMap="QcGoalResult">
<include refid="selectQcGoalVo"/> <include refid="selectQcGoalVo"/>
where id = #{id} where del_flag= = '0' id = #{id}
</select> </select>
<insert id="insertQcGoal" parameterType="QcGoal"> <insert id="insertQcGoal" parameterType="QcGoal">
@ -249,11 +251,11 @@
</select> </select>
<delete id="deleteQcGoalById" parameterType="String"> <delete id="deleteQcGoalById" parameterType="String">
delete from qc_goal where id = #{id} update qc_goal set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteQcGoalByIds" parameterType="String"> <delete id="deleteQcGoalByIds" parameterType="String">
delete from qc_goal where id in update qc_goal set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

@ -33,6 +33,7 @@
</if> </if>
<if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if> <if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if> <if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
and del_flag = '0'
</where> </where>
</select> </select>
@ -96,11 +97,11 @@
</update> </update>
<delete id="deleteQcMaterialGroupDetailById" parameterType="String"> <delete id="deleteQcMaterialGroupDetailById" parameterType="String">
delete from qc_material_group_detail where id = #{id} update qc_material_group_detail set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteQcMaterialGroupDetailByIds" parameterType="String"> <delete id="deleteQcMaterialGroupDetailByIds" parameterType="String">
delete from qc_material_group_detail where id in update qc_material_group_detail set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

@ -26,6 +26,7 @@
<if test="groupName != null and groupName != ''">and group_name like concat('%', #{groupName}, '%')</if> <if test="groupName != null and groupName != ''">and group_name like concat('%', #{groupName}, '%')</if>
<if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if> <if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if> <if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
and del_flag = '0'
</where> </where>
/*select /*select
mg.id, mg.id,
@ -37,6 +38,14 @@
WHERE mg.del_flag = '0'*/ WHERE mg.del_flag = '0'*/
</select> </select>
<select id="getOriginalGroupList" parameterType="QcMaterialGroup" resultType="QcMaterialGroup">
SELECT DISTINCT
product_group groupCode,
concat(product_group_name,'(',product_group,')') groupName
FROM base_product
WHERE del_flag = '0'
</select>
<select id="getMaterialChildrenList" parameterType="QcMaterialGroup" resultMap="QcMaterialGroupResult"> <select id="getMaterialChildrenList" parameterType="QcMaterialGroup" resultMap="QcMaterialGroupResult">
select select
id, id,
@ -61,6 +70,7 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>
<if test="groupName != null">group_name,</if> <if test="groupName != null">group_name,</if>
<if test="groupCode != null">group_code,</if>
<if test="attr1 != null">attr1,</if> <if test="attr1 != null">attr1,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
@ -72,6 +82,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
<if test="groupName != null">#{groupName},</if> <if test="groupName != null">#{groupName},</if>
<if test="groupCode != null">#{groupCode},</if>
<if test="attr1 != null">#{attr1},</if> <if test="attr1 != null">#{attr1},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
@ -86,6 +97,7 @@
update qc_material_group update qc_material_group
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="groupName != null">group_name = #{groupName},</if> <if test="groupName != null">group_name = #{groupName},</if>
<if test="groupCode != null">group_code = #{groupCode},</if>
<if test="attr1 != null">attr1 = #{attr1},</if> <if test="attr1 != null">attr1 = #{attr1},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
@ -98,11 +110,11 @@
</update> </update>
<delete id="deleteQcMaterialGroupById" parameterType="String"> <delete id="deleteQcMaterialGroupById" parameterType="String">
delete from qc_material_group where id = #{id} update qc_material_group set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteQcMaterialGroupByIds" parameterType="String"> <delete id="deleteQcMaterialGroupByIds" parameterType="String">
delete from qc_material_group where id in update qc_material_group set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

@ -36,6 +36,7 @@
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if> <if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="standardNo != null and standardNo != ''">and standard_no = #{standardNo}</if> <if test="standardNo != null and standardNo != ''">and standard_no = #{standardNo}</if>
<if test="version != null and version != ''">and version = #{version}</if> <if test="version != null and version != ''">and version = #{version}</if>
and del_flag = '0'
</where> </where>
</select> </select>

@ -34,6 +34,7 @@
<if test="sampleQuality != null ">and sample_quality = #{sampleQuality}</if> <if test="sampleQuality != null ">and sample_quality = #{sampleQuality}</if>
<if test="checkType != null and checkType != ''">and check_type = #{checkType}</if> <if test="checkType != null and checkType != ''">and check_type = #{checkType}</if>
<if test="typeCode != null and typeCode != ''">and type_code = #{typeCode}</if> <if test="typeCode != null and typeCode != ''">and type_code = #{typeCode}</if>
and del_flag = '0'
</where> </where>
</select> </select>
@ -102,11 +103,11 @@
</update> </update>
<delete id="deleteQcSampleRuleById" parameterType="String"> <delete id="deleteQcSampleRuleById" parameterType="String">
delete from qc_sample_rule where id = #{id} update qc_sample_rule set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteQcSampleRuleByIds" parameterType="String"> <delete id="deleteQcSampleRuleByIds" parameterType="String">
delete from qc_sample_rule where id in update qc_sample_rule set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

Loading…
Cancel
Save