diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionItem.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionItem.java index 7604ec44..209f20cf 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionItem.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionItem.java @@ -6,6 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serial; +import java.math.BigDecimal; /** * 检测项定义对象 qc_inspection_item @@ -48,7 +49,7 @@ public class QcInspectionItem extends TenantEntity { private Long categoryId; /** - * 检测单类型 + * 检测类型(关联检测类型表主键) */ private Long inspectionType; @@ -70,17 +71,17 @@ public class QcInspectionItem extends TenantEntity { /** * 标准值 */ - private Long standardValue; + private BigDecimal standardValue; /** * 控制上限 */ - private Long upperLimit; + private BigDecimal upperLimit; /** * 控制下限 */ - private Long lowerLimit; + private BigDecimal lowerLimit; /** * 规格名称 @@ -90,12 +91,12 @@ public class QcInspectionItem extends TenantEntity { /** * 规格上限 */ - private Long specUpper; + private BigDecimal specUpper; /** * 规格下限 */ - private Long specLower; + private BigDecimal specLower; /** * 检测项说明 @@ -123,5 +124,23 @@ public class QcInspectionItem extends TenantEntity { @TableLogic private String delFlag; + /** + * 检测项类别名称 + */ + @TableField(exist = false) + private String categoryName;//JOIN + + /** + * 检测类型编码 + */ + @TableField(exist = false) + private String typeCode;//join + + /** + * 检测类型名称 + */ + @TableField(exist = false) + private String typeName;//join + } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionItemBo.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionItemBo.java index d48cb0ad..3f0b39de 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionItemBo.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionItemBo.java @@ -9,6 +9,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; +import java.math.BigDecimal; + /** * 检测项定义业务对象 qc_inspection_item * @@ -47,7 +49,7 @@ public class QcInspectionItemBo extends BaseEntity { private Long categoryId; /** - * 检测单类型 + * 检测类型(关联检测类型表主键) */ private Long inspectionType; @@ -69,17 +71,17 @@ public class QcInspectionItemBo extends BaseEntity { /** * 标准值 */ - private Long standardValue; + private BigDecimal standardValue; /** * 控制上限 */ - private Long upperLimit; + private BigDecimal upperLimit; /** * 控制下限 */ - private Long lowerLimit; + private BigDecimal lowerLimit; /** * 规格名称 @@ -89,12 +91,12 @@ public class QcInspectionItemBo extends BaseEntity { /** * 规格上限 */ - private Long specUpper; + private BigDecimal specUpper; /** * 规格下限 */ - private Long specLower; + private BigDecimal specLower; /** * 检测项说明 diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionItemVo.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionItemVo.java index 6cc86fdd..0b9b2d6b 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionItemVo.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionItemVo.java @@ -10,6 +10,7 @@ import lombok.Data; import java.io.Serial; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; @@ -60,9 +61,9 @@ public class QcInspectionItemVo implements Serializable { private Long categoryId; /** - * 检测单类型 + * 检测类型(关联检测类型表主键) */ - @ExcelProperty(value = "检测单类型") + @ExcelProperty(value = "检测类型") private Long inspectionType; /** @@ -90,19 +91,19 @@ public class QcInspectionItemVo implements Serializable { * 标准值 */ @ExcelProperty(value = "标准值") - private Long standardValue; + private BigDecimal standardValue; /** * 控制上限 */ @ExcelProperty(value = "控制上限") - private Long upperLimit; + private BigDecimal upperLimit; /** * 控制下限 */ @ExcelProperty(value = "控制下限") - private Long lowerLimit; + private BigDecimal lowerLimit; /** * 规格名称 @@ -114,13 +115,13 @@ public class QcInspectionItemVo implements Serializable { * 规格上限 */ @ExcelProperty(value = "规格上限") - private Long specUpper; + private BigDecimal specUpper; /** * 规格下限 */ @ExcelProperty(value = "规格下限") - private Long specLower; + private BigDecimal specLower; /** * 检测项说明 @@ -148,4 +149,20 @@ public class QcInspectionItemVo implements Serializable { private String isDefault; + /** + * 检测项类别名称 + */ + private String categoryName;//JOIN + + /** + * 检测类型编码 + */ + private String typeCode;//join + + /** + * 检测类型名称 + */ + private String typeName;//join + + } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionItemCategoryMapper.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionItemCategoryMapper.java index e812fc08..b5f8af8d 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionItemCategoryMapper.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionItemCategoryMapper.java @@ -21,7 +21,7 @@ public interface QcInspectionItemCategoryMapper extends BaseMapperPlus selectVoList(QcInspectionItemCategoryBo bo); + List selectQcInspectionItemCategoryList(QcInspectionItemCategoryBo bo); /** * 根据主键查询检测项类别 @@ -29,6 +29,6 @@ public interface QcInspectionItemCategoryMapper extends BaseMapperPlus selectVoList(QcInspectionItemBo bo); + List selectQcInspectionItemList(QcInspectionItemBo bo); /** * 根据主键查询检测项定义 @@ -29,6 +29,6 @@ public interface QcInspectionItemMapper extends BaseMapperPlus selectVoList(QcInspectionMainBo bo); + List selectQcInspectionMainList(QcInspectionMainBo bo); /** * 根据主键查询质检主表 @@ -29,6 +29,6 @@ public interface QcInspectionMainMapper extends BaseMapperPlus selectVoList(QcInspectionResultBo bo); + List selectQcInspectionResultList(QcInspectionResultBo bo); /** * 根据主键查询质检结果子表 @@ -29,6 +29,6 @@ public interface QcInspectionResultMapper extends BaseMapperPlus selectVoList(QcInspectionTemplateBo bo); + List selectQcInspectionTemplateList(QcInspectionTemplateBo bo); /** * 根据主键查询检测模板主 @@ -29,6 +29,6 @@ public interface QcInspectionTemplateMapper extends BaseMapperPlus selectVoList(QcInspectionTypeBo bo); + List selectQcInspectionTypeList(QcInspectionTypeBo bo); /** * 根据主键查询检测类型 @@ -29,6 +29,6 @@ public interface QcInspectionTypeMapper extends BaseMapperPlus selectVoList(QcTemplateItemBo bo); + List selectQcTemplateItemList(QcTemplateItemBo bo); /** * 根据主键查询检测模板子表 @@ -29,6 +29,8 @@ public interface QcTemplateItemMapper extends BaseMapperPlus selectVoList(QcUnqualifiedRecordBo bo); + List selectQcUnqualifiedRecordList(QcUnqualifiedRecordBo bo); /** * 根据主键查询不合格品评审记录 @@ -29,6 +29,6 @@ public interface QcUnqualifiedRecordMapper extends BaseMapperPlus selectVoList(QcUnqualifiedReviewBo bo); + List selectQcUnqualifiedReviewList(QcUnqualifiedReviewBo bo); /** * 根据主键查询不合格品待评审 @@ -29,6 +29,6 @@ public interface QcUnqualifiedReviewMapper extends BaseMapperPlus params = bo.getParams(); MPJLambdaWrapper lqw = JoinWrappers.lambda(QcInspectionItem.class) .selectAll(QcInspectionItem.class) + + //检测项类别名称 + .select(QcInspectionItemCategory::getCategoryName) + .leftJoin(QcInspectionItemCategory.class,QcInspectionItemCategory::getCategoryId,QcInspectionItem::getCategoryId) + + .select(QcInspectionType::getTypeName,QcInspectionType::getTypeCode) + .leftJoin(QcInspectionType.class,QcInspectionType::getTypeId,QcInspectionItem::getInspectionType) + .eq(bo.getItemId() != null, QcInspectionItem::getItemId, bo.getItemId()) .eq(StringUtils.isNotBlank(bo.getItemCode()), QcInspectionItem::getItemCode, bo.getItemCode()) .like(StringUtils.isNotBlank(bo.getItemName()), QcInspectionItem::getItemName, bo.getItemName()) @@ -120,9 +142,35 @@ public class QcInspectionItemServiceImpl implements IQcInspectionItemService { * @return 是否修改成功 */ @Override + @Transactional public Boolean updateByBo(QcInspectionItemBo bo) { QcInspectionItem update = MapstructUtils.convert(bo, QcInspectionItem.class); validEntityBeforeSave(update); + + // 创建一个新的QcTemplateItemBo对象 + QcTemplateItem qcTemplateItem = new QcTemplateItem(); + QcTemplateItemVo newQcTemplateItem = qcTemplateItemMapper.selectQcTemplateItemByItemId(update.getItemId()); + newQcTemplateItem.setItemCode(update.getItemCode()); + newQcTemplateItem.setItemName(update.getItemName()); + newQcTemplateItem.setInspectionItemCode(update.getItemCode()); + newQcTemplateItem.setInspectionItemName(update.getItemName()); + newQcTemplateItem.setInspectionPosition(update.getInspectionPosition()); + newQcTemplateItem.setCategoryName(update.getCategoryName()); + newQcTemplateItem.setInspectionType(update.getInspectionType()); + newQcTemplateItem.setDetectType(update.getDetectType()); + newQcTemplateItem.setControlType(update.getControlType()); + newQcTemplateItem.setStandardValue(update.getStandardValue()); + newQcTemplateItem.setUpperLimit(update.getUpperLimit()); + newQcTemplateItem.setLowerLimit(update.getLowerLimit()); + newQcTemplateItem.setSpecName(update.getSpecName()); + newQcTemplateItem.setSpecUpper(update.getSpecUpper()); + newQcTemplateItem.setSpecLower(update.getSpecLower()); + newQcTemplateItem.setDescription(update.getDescription()); + + BeanUtils.copyProperties(newQcTemplateItem, qcTemplateItem); +// qcTemplateItemService.updateByBo(qcTemplateItemBo); + qcTemplateItemMapper.updateById(qcTemplateItem); + return baseMapper.updateById(update) > 0; } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcTemplateItemServiceImpl.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcTemplateItemServiceImpl.java index 94b7cc5c..c25e02d1 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcTemplateItemServiceImpl.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcTemplateItemServiceImpl.java @@ -1,5 +1,6 @@ package org.dromara.qms.service.impl; +import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -18,6 +19,7 @@ import org.dromara.qms.domain.vo.QcTemplateItemVo; import org.dromara.qms.domain.QcTemplateItem; import org.dromara.qms.mapper.QcTemplateItemMapper; import org.dromara.qms.service.IQcTemplateItemService; +import org.springframework.util.ObjectUtils; import java.util.List; import java.util.Map; @@ -143,6 +145,14 @@ public class QcTemplateItemServiceImpl implements IQcTemplateItemService { */ private void validEntityBeforeSave(QcTemplateItem entity){ //TODO 做一些数据校验,如唯一约束 + //同一主表下的检测项不能重复 + QcTemplateItemBo query = new QcTemplateItemBo(); + query.setTemplateId(entity.getTemplateId()); + query.setItemId(entity.getItemId()); + List list = queryList(query); + if ( !ObjectUtils.isEmpty(list)) { + throw new ServiceException("同一主表下的检测项不能重复"); + } } /** diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemCategoryMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemCategoryMapper.xml index 269b7ab4..07fa004c 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemCategoryMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemCategoryMapper.xml @@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select category_id, tenant_id, parent_id, ancestors, category_code, category_name, type_id, description, create_by, create_dept, create_time, update_by, update_time, del_flag from qc_inspection_item_category + where del_flag = '0' where category_id = #{categoryId} + AND del_flag = '0' diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemMapper.xml index 4d4d587a..28daa448 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionItemMapper.xml @@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -61,11 +60,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and option_name like concat('%', #{optionName}, '%') and is_default = #{isDefault} + AND del_flag = '0' diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml index 6e6c755d..a0bbdb86 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml @@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -68,11 +67,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and barcode = #{barcode} and supplier_name like concat('%', #{supplierName}, '%') + AND del_flag = '0' diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml index a6e1b3dd..7b809936 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml @@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -37,11 +36,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and spec_inspection = #{specInspection} and problem_detail = #{problemDetail} + AND del_flag = '0' diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTemplateMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTemplateMapper.xml index 6fab7963..77663240 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTemplateMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTemplateMapper.xml @@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -49,11 +48,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and supplier_name like concat('%', #{supplierName}, '%') and description = #{description} + AND del_flag = '0' diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTypeMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTypeMapper.xml index 0ea0409d..1ed5ed5a 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTypeMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionTypeMapper.xml @@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -33,11 +32,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and qc_inspection_type = #{qcInspectionType} and create_method = #{createMethod} + AND del_flag = '0' diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcTemplateItemMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcTemplateItemMapper.xml index 00ed84bf..e509a9a5 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcTemplateItemMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcTemplateItemMapper.xml @@ -4,9 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - @@ -23,16 +22,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - + - select template_item_id, tenant_id, template_id, item_id, item_code, item_name, inspection_position, category_name, inspection_type, detect_type, control_type, standard_value, upper_limit, lower_limit, spec_name, spec_upper, spec_lower, description, create_dept, create_by, create_time, update_by, update_time, del_flag + select template_item_id, tenant_id, template_id, item_id, item_code, item_name, inspection_position, category_name, inspection_type, detect_type, control_type, standard_value, upper_limit, lower_limit, spec_name, spec_upper, spec_lower, description, del_flag from qc_template_item @@ -57,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and spec_lower = #{specLower} and description = #{description} + AND del_flag = '0' + + diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedRecordMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedRecordMapper.xml index a33090ae..096764ee 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedRecordMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedRecordMapper.xml @@ -4,9 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - @@ -28,11 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and record_id = #{recordId} and review_id = #{reviewId} + AND del_flag = '0' diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedReviewMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedReviewMapper.xml index 439bf0f5..4a265a6d 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedReviewMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcUnqualifiedReviewMapper.xml @@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -51,11 +50,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and reviewer = #{reviewer} and review_time = #{reviewTime} + AND del_flag = '0'