diff --git a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java index 754310f..b10b2ee 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java @@ -11,6 +11,9 @@ import java.util.List; import java.util.Map; import java.util.Optional; +/** + * 检验项目Dao + */ @Component public interface QcItemDao extends JpaRepository, JpaSpecificationExecutor { diff --git a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java index 65e6a1f..722ac99 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java @@ -9,6 +9,9 @@ import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; +/** + * 检验数据Dao + */ @Component public interface QcSourceDao extends JpaRepository, JpaSpecificationExecutor { diff --git a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java index 20210ae..31cd51d 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java @@ -17,14 +17,14 @@ public interface QcSpecDao extends JpaRepository, JpaSpec Optional findByVarietyNoAndQcItemNo(String varietyNo, String qcItemNo); /** - * 更新质检规格 + * 更新检验规格 */ @Modifying(clearAutomatically = true) @Query(value = "UPDATE qc_spec SET update_time = ?2, max = ?3, mean = ?4, min = ?5, unit = ?6, method = ?7, standard = ?8, remark = ?9 WHERE id = ?1", nativeQuery = true) void updateQcSpecById(Integer id, String updateTime, String max, String mean, String min, String unit, String method, String standard, String remark); /** - * 查询质检规格 + * 查询检验规格 */ @Query(value = "SELECT id, variety_no AS varietyNo, qc_item_no AS qcItemNo, max, mean, min, unit, method, standard, remark FROM qc_spec WHERE variety_no LIKE %?1% AND qc_item_no LIKE %?2% ORDER BY create_time ASC", nativeQuery = true) List> queryQcSpec(String varietyNo, String qcItemNo); diff --git a/src/main/java/com/xkrs/newpro/model/entity/QcSourceEntity.java b/src/main/java/com/xkrs/newpro/model/entity/QcSourceEntity.java index ded322d..0dc3890 100644 --- a/src/main/java/com/xkrs/newpro/model/entity/QcSourceEntity.java +++ b/src/main/java/com/xkrs/newpro/model/entity/QcSourceEntity.java @@ -3,7 +3,7 @@ package com.xkrs.newpro.model.entity; import javax.persistence.*; /** - * 质检数据 + * 检验数据 */ @Entity @Table(name = "qc_source") @@ -142,16 +142,6 @@ public class QcSourceEntity { @Override public String toString() { - return "QcSourceEntity{" + - "id=" + id + - ", createTime='" + createTime + '\'' + - ", batchNo='" + batchNo + '\'' + - ", machineNo='" + machineNo + '\'' + - ", materialNo='" + materialNo + '\'' + - ", mouldNo='" + mouldNo + '\'' + - ", varietyNo='" + varietyNo + '\'' + - ", qcItemNo='" + qcItemNo + '\'' + - ", qcValue='" + qcValue + '\'' + - '}'; + return "QcSourceEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/entity/QcSpecEntity.java b/src/main/java/com/xkrs/newpro/model/entity/QcSpecEntity.java index 4c62767..ba1bdb7 100644 --- a/src/main/java/com/xkrs/newpro/model/entity/QcSpecEntity.java +++ b/src/main/java/com/xkrs/newpro/model/entity/QcSpecEntity.java @@ -3,7 +3,7 @@ package com.xkrs.newpro.model.entity; import javax.persistence.*; /** - * 质检规格 + * 检验规格 */ @Entity @Table(name = "qc_spec") @@ -184,19 +184,6 @@ public class QcSpecEntity { @Override public String toString() { - return "QcSpecEntity{" + - "id=" + id + - ", createTime='" + createTime + '\'' + - ", updateTime='" + updateTime + '\'' + - ", varietyNo='" + varietyNo + '\'' + - ", qcItemNo='" + qcItemNo + '\'' + - ", max='" + max + '\'' + - ", mean='" + mean + '\'' + - ", min='" + min + '\'' + - ", unit='" + unit + '\'' + - ", method='" + method + '\'' + - ", standard='" + standard + '\'' + - ", remark='" + remark + '\'' + - '}'; + return "QcSpecEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcItemQoDelete.java b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoDelete.java new file mode 100644 index 0000000..adf64d1 --- /dev/null +++ b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoDelete.java @@ -0,0 +1,28 @@ +package com.xkrs.newpro.model.qo; + +/** + * 删除检验项目接收类 + */ +public class QcItemQoDelete { + + /** + * 主键id + */ + private Integer id; + + public QcItemQoDelete() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + @Override + public String toString() { + return "QcItemQoDelete{" + "id=" + id + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcItemQoInsert.java b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoInsert.java index cdacced..00b16b6 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcItemQoInsert.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoInsert.java @@ -1,7 +1,7 @@ package com.xkrs.newpro.model.qo; /** - * 新增检验项目接收类(编号、名称、类型) + * 新增检验项目接收类 */ public class QcItemQoInsert { @@ -49,10 +49,6 @@ public class QcItemQoInsert { @Override public String toString() { - return "QcItemQoInsert{" + - "no='" + no + '\'' + - ", name='" + name + '\'' + - ", type='" + type + '\'' + - '}'; + return "QcItemQoInsert{" + "no='" + no + '\'' + ", name='" + name + '\'' + ", type='" + type + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcItemQoQuery.java b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoQuery.java index a41668c..03d37a2 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcItemQoQuery.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoQuery.java @@ -1,8 +1,18 @@ package com.xkrs.newpro.model.qo; +/** + * 查询检验项目接收类 + */ public class QcItemQoQuery { + /** + * 编号 + */ private String no; + + /** + * 名称 + */ private String name; public QcItemQoQuery() { @@ -26,9 +36,6 @@ public class QcItemQoQuery { @Override public String toString() { - return "QcItemQoQuery{" + - "no='" + no + '\'' + - ", name='" + name + '\'' + - '}'; + return "QcItemQoQuery{" + "no='" + no + '\'' + ", name='" + name + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcItemQoUpdate.java b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoUpdate.java index b775295..046dfa4 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcItemQoUpdate.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcItemQoUpdate.java @@ -1,7 +1,7 @@ package com.xkrs.newpro.model.qo; /** - * 更新检验项目接收类(根据id更新名称) + * 更新检验项目接收类 */ public class QcItemQoUpdate { @@ -36,9 +36,6 @@ public class QcItemQoUpdate { @Override public String toString() { - return "QcItemQoUpdate{" + - "id=" + id + - ", name='" + name + '\'' + - '}'; + return "QcItemQoUpdate{" + "id=" + id + ", name='" + name + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoDelete.java b/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoDelete.java new file mode 100644 index 0000000..b749189 --- /dev/null +++ b/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoDelete.java @@ -0,0 +1,28 @@ +package com.xkrs.newpro.model.qo; + +/** + * 删除检验数据接收类 + */ +public class QcSourceQoDelete { + + /** + * 主键id + */ + private Integer id; + + public QcSourceQoDelete() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + @Override + public String toString() { + return "QcSourceQoDelete{" + "id=" + id + '}'; + } +} diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoInsert.java b/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoInsert.java index e9009fd..d92f66c 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoInsert.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoInsert.java @@ -1,7 +1,7 @@ package com.xkrs.newpro.model.qo; /** - * 新增质检数据接收类 + * 新增检验数据接收类 */ public class QcSourceQoInsert { @@ -101,14 +101,6 @@ public class QcSourceQoInsert { @Override public String toString() { - return "QcSourceQoInsert{" + - "batchNo='" + batchNo + '\'' + - ", machineNo='" + machineNo + '\'' + - ", materialNo='" + materialNo + '\'' + - ", mouldNo='" + mouldNo + '\'' + - ", varietyNo='" + varietyNo + '\'' + - ", qcItemNo='" + qcItemNo + '\'' + - ", qcValue='" + qcValue + '\'' + - '}'; + return "QcSourceQoInsert{" + "batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoQuery.java b/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoQuery.java index bac36b9..90842fe 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoQuery.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcSourceQoQuery.java @@ -1,11 +1,33 @@ package com.xkrs.newpro.model.qo; +/** + * 查询检验数据接收类 + */ public class QcSourceQoQuery { + /** + * 批次号 + */ private String batchNo; + + /** + * 机器号 + */ private String machineNo; + + /** + * 物料号 + */ private String materialNo; + + /** + * 模具号 + */ private String mouldNo; + + /** + * 机种号 + */ private String varietyNo; public QcSourceQoQuery() { @@ -53,12 +75,6 @@ public class QcSourceQoQuery { @Override public String toString() { - return "QcSourceQoQuery{" + - "batchNo='" + batchNo + '\'' + - ", machineNo='" + machineNo + '\'' + - ", materialNo='" + materialNo + '\'' + - ", mouldNo='" + mouldNo + '\'' + - ", varietyNo='" + varietyNo + '\'' + - '}'; + return "QcSourceQoQuery{" + "batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoDelete.java b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoDelete.java new file mode 100644 index 0000000..7106ea2 --- /dev/null +++ b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoDelete.java @@ -0,0 +1,28 @@ +package com.xkrs.newpro.model.qo; + +/** + * 删除检验规格接收类 + */ +public class QcSpecQoDelete { + + /** + * 主键id + */ + private Integer id; + + public QcSpecQoDelete() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + @Override + public String toString() { + return "QcSpecQoDelete{" + "id=" + id + '}'; + } +} diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoInsert.java b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoInsert.java index 7495f75..676ba7c 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoInsert.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoInsert.java @@ -1,7 +1,7 @@ package com.xkrs.newpro.model.qo; /** - * 新增质检规格接收类 + * 新增检验规格接收类 */ public class QcSpecQoInsert { @@ -127,16 +127,6 @@ public class QcSpecQoInsert { @Override public String toString() { - return "QcSpecQoInsert{" + - "varietyNo='" + varietyNo + '\'' + - ", qcItemNo='" + qcItemNo + '\'' + - ", max='" + max + '\'' + - ", mean='" + mean + '\'' + - ", min='" + min + '\'' + - ", unit='" + unit + '\'' + - ", method='" + method + '\'' + - ", standard='" + standard + '\'' + - ", remark='" + remark + '\'' + - '}'; + return "QcSpecQoInsert{" + "varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoQuery.java b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoQuery.java index 7f3fd9d..6d5a8c4 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoQuery.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoQuery.java @@ -1,8 +1,18 @@ package com.xkrs.newpro.model.qo; +/** + * 查询检验规格接收类 + */ public class QcSpecQoQuery { + /** + * 机种号 + */ private String varietyNo; + + /** + * 检验项目编号 + */ private String qcItemNo; public QcSpecQoQuery() { @@ -26,9 +36,6 @@ public class QcSpecQoQuery { @Override public String toString() { - return "QcSpecQoQuery{" + - "varietyNo='" + varietyNo + '\'' + - ", qcItemNo='" + qcItemNo + '\'' + - '}'; + return "QcSpecQoQuery{" + "varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoUpdate.java b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoUpdate.java index 151699c..24f011e 100644 --- a/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoUpdate.java +++ b/src/main/java/com/xkrs/newpro/model/qo/QcSpecQoUpdate.java @@ -1,7 +1,7 @@ package com.xkrs.newpro.model.qo; /** - * 更新质检规格接收类 + * 更新检验规格接收类 */ public class QcSpecQoUpdate { @@ -114,15 +114,6 @@ public class QcSpecQoUpdate { @Override public String toString() { - return "QcSpecQoUpdate{" + - "id=" + id + - ", max='" + max + '\'' + - ", mean='" + mean + '\'' + - ", min='" + min + '\'' + - ", unit='" + unit + '\'' + - ", method='" + method + '\'' + - ", standard='" + standard + '\'' + - ", remark='" + remark + '\'' + - '}'; + return "QcSpecQoUpdate{" + "id=" + id + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/newpro/model/va/QcItemQoDeleteVa.java b/src/main/java/com/xkrs/newpro/model/va/QcItemQoDeleteVa.java new file mode 100644 index 0000000..974bc06 --- /dev/null +++ b/src/main/java/com/xkrs/newpro/model/va/QcItemQoDeleteVa.java @@ -0,0 +1,4 @@ +package com.xkrs.newpro.model.va; + +public interface QcItemQoDeleteVa { +} diff --git a/src/main/java/com/xkrs/newpro/model/va/QcSourceQoDeleteVa.java b/src/main/java/com/xkrs/newpro/model/va/QcSourceQoDeleteVa.java new file mode 100644 index 0000000..98009da --- /dev/null +++ b/src/main/java/com/xkrs/newpro/model/va/QcSourceQoDeleteVa.java @@ -0,0 +1,4 @@ +package com.xkrs.newpro.model.va; + +public interface QcSourceQoDeleteVa { +} diff --git a/src/main/java/com/xkrs/newpro/model/va/QcSpecQoDeleteVa.java b/src/main/java/com/xkrs/newpro/model/va/QcSpecQoDeleteVa.java new file mode 100644 index 0000000..08472b3 --- /dev/null +++ b/src/main/java/com/xkrs/newpro/model/va/QcSpecQoDeleteVa.java @@ -0,0 +1,4 @@ +package com.xkrs.newpro.model.va; + +public interface QcSpecQoDeleteVa { +} diff --git a/src/main/java/com/xkrs/newpro/service/QcItemService.java b/src/main/java/com/xkrs/newpro/service/QcItemService.java index ee0eba0..f8f2a3e 100644 --- a/src/main/java/com/xkrs/newpro/service/QcItemService.java +++ b/src/main/java/com/xkrs/newpro/service/QcItemService.java @@ -1,5 +1,6 @@ package com.xkrs.newpro.service; +import com.xkrs.newpro.model.qo.QcItemQoDelete; import com.xkrs.newpro.model.qo.QcItemQoInsert; import com.xkrs.newpro.model.qo.QcItemQoQuery; import com.xkrs.newpro.model.qo.QcItemQoUpdate; @@ -11,6 +12,11 @@ public interface QcItemService { */ String insertQcItem(QcItemQoInsert insertQo); + /** + * 删除检验项目 + */ + String deleteQcItem(QcItemQoDelete deleteQo); + /** * 更新检验项目名称 */ diff --git a/src/main/java/com/xkrs/newpro/service/QcSourceService.java b/src/main/java/com/xkrs/newpro/service/QcSourceService.java index 9894321..99cfacd 100644 --- a/src/main/java/com/xkrs/newpro/service/QcSourceService.java +++ b/src/main/java/com/xkrs/newpro/service/QcSourceService.java @@ -1,17 +1,23 @@ package com.xkrs.newpro.service; +import com.xkrs.newpro.model.qo.QcSourceQoDelete; import com.xkrs.newpro.model.qo.QcSourceQoInsert; import com.xkrs.newpro.model.qo.QcSourceQoQuery; public interface QcSourceService { /** - * 添加质检数据 + * 添加检验数据 */ String insertQcSource(QcSourceQoInsert insertQo); /** - * 查询质检数据 + * 删除检验数据 + */ + String deleteQcSource(QcSourceQoDelete deleteQo); + + /** + * 查询检验数据 */ String queryQcSource(QcSourceQoQuery queryQo); diff --git a/src/main/java/com/xkrs/newpro/service/QcSpecService.java b/src/main/java/com/xkrs/newpro/service/QcSpecService.java index 5d68e8d..d302a47 100644 --- a/src/main/java/com/xkrs/newpro/service/QcSpecService.java +++ b/src/main/java/com/xkrs/newpro/service/QcSpecService.java @@ -1,5 +1,6 @@ package com.xkrs.newpro.service; +import com.xkrs.newpro.model.qo.QcSpecQoDelete; import com.xkrs.newpro.model.qo.QcSpecQoInsert; import com.xkrs.newpro.model.qo.QcSpecQoQuery; import com.xkrs.newpro.model.qo.QcSpecQoUpdate; @@ -7,17 +8,22 @@ import com.xkrs.newpro.model.qo.QcSpecQoUpdate; public interface QcSpecService { /** - * 添加质检规格 + * 添加检验规格 */ String insertQcSpec(QcSpecQoInsert insertQo); /** - * 更新质检规格 + * 删除检验规格 + */ + String deleteQcSpec(QcSpecQoDelete deleteQo); + + /** + * 更新检验规格 */ String updateQcSpec(QcSpecQoUpdate updateQo); /** - * 查询质检规格 + * 查询检验规格 */ String queryQcSpec(QcSpecQoQuery queryQo); diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java index 12cff2d..bd49fb3 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java @@ -3,6 +3,7 @@ package com.xkrs.newpro.service.impl; import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.newpro.dao.QcItemDao; import com.xkrs.newpro.model.entity.QcItemEntity; +import com.xkrs.newpro.model.qo.QcItemQoDelete; import com.xkrs.newpro.model.qo.QcItemQoInsert; import com.xkrs.newpro.model.qo.QcItemQoQuery; import com.xkrs.newpro.model.qo.QcItemQoUpdate; @@ -32,16 +33,13 @@ public class QcItemServiceImpl implements QcItemService { */ @Override public String insertQcItem(QcItemQoInsert insertQo) { - String no = insertQo.getNo(); String name = insertQo.getName(); String type = insertQo.getType(); - Optional entityByNo = qcItemDao.findByNo(no); if (entityByNo.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该检验项目已存在,请勿重复添加!", locale); } - QcItemEntity entity = new QcItemEntity(); entity.setCreateTime(LocalDateUtils.getCurrentSecond()); entity.setUpdateTime(""); @@ -49,28 +47,37 @@ public class QcItemServiceImpl implements QcItemService { entity.setName(LocalStringUtils.formatEmptyValue(name)); entity.setType(LocalStringUtils.formatEmptyValue(type)); qcItemDao.save(entity); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); } + /** + * 删除检验项目 + */ + @Override + public String deleteQcItem(QcItemQoDelete deleteQo) { + Integer id = deleteQo.getId(); + Optional entityById = qcItemDao.findById(id); + if (entityById.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale); + } + qcItemDao.deleteById(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除成功!", locale); + } + /** * 更新检验项目名称 */ @Transactional(rollbackOn = Exception.class) @Override public String updateQcItem(QcItemQoUpdate updateQo) { - Integer id = updateQo.getId(); String name = updateQo.getName(); - Optional entityById = qcItemDao.findById(id); if (entityById.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale); } - qcItemDao.updateNameById(id, LocalDateUtils.getCurrentSecond(), LocalStringUtils.formatEmptyValue(name)); - - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "更新成功!", locale); } /** @@ -78,7 +85,6 @@ public class QcItemServiceImpl implements QcItemService { */ @Override public String queryQcItem(QcItemQoQuery queryQo) { - String no = queryQo.getNo(); String name = queryQo.getName(); List> resultList = qcItemDao.queryQcItem(LocalStringUtils.formatEmptyValue(no), LocalStringUtils.formatEmptyValue(name)); diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java index dfbd643..76bffe1 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java @@ -3,6 +3,7 @@ package com.xkrs.newpro.service.impl; import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.newpro.dao.QcSourceDao; import com.xkrs.newpro.model.entity.QcSourceEntity; +import com.xkrs.newpro.model.qo.QcSourceQoDelete; import com.xkrs.newpro.model.qo.QcSourceQoInsert; import com.xkrs.newpro.model.qo.QcSourceQoQuery; import com.xkrs.newpro.service.QcSourceService; @@ -14,6 +15,7 @@ import javax.annotation.Resource; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -25,7 +27,7 @@ public class QcSourceServiceImpl implements QcSourceService { private QcSourceDao qcSourceDao; /** - * 添加质检数据 + * 添加检验数据 */ @Override public String insertQcSource(QcSourceQoInsert insertQo) { @@ -53,7 +55,21 @@ public class QcSourceServiceImpl implements QcSourceService { } /** - * 查询质检数据 + * 删除检验数据 + */ + @Override + public String deleteQcSource(QcSourceQoDelete deleteQo) { + Integer id = deleteQo.getId(); + Optional entityById = qcSourceDao.findById(id); + if (entityById.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验数据,请先添加检验数据!", locale); + } + qcSourceDao.deleteById(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除成功!", locale); + } + + /** + * 查询检验数据 */ @Override public String queryQcSource(QcSourceQoQuery queryQo) { @@ -65,7 +81,7 @@ public class QcSourceServiceImpl implements QcSourceService { String varietyNo = queryQo.getVarietyNo(); List> resultList = qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo)); if (resultList == null || resultList.isEmpty()) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验项目的信息!", locale); + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验数据的信息!", locale); } return null; diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java index bd6a93e..7e7b5a7 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java @@ -5,6 +5,7 @@ import com.xkrs.newpro.dao.QcItemDao; import com.xkrs.newpro.dao.QcSpecDao; import com.xkrs.newpro.model.entity.QcItemEntity; import com.xkrs.newpro.model.entity.QcSpecEntity; +import com.xkrs.newpro.model.qo.QcSpecQoDelete; import com.xkrs.newpro.model.qo.QcSpecQoInsert; import com.xkrs.newpro.model.qo.QcSpecQoQuery; import com.xkrs.newpro.model.qo.QcSpecQoUpdate; @@ -32,7 +33,7 @@ public class QcSpecServiceImpl implements QcSpecService { private QcSpecDao qcSpecDao; /** - * 添加质检规格 + * 添加检验规格 */ @Override public String insertQcSpec(QcSpecQoInsert insertQo) { @@ -49,7 +50,7 @@ public class QcSpecServiceImpl implements QcSpecService { Optional entityByNo = qcItemDao.findByNo(qcItemNo); if (entityByNo.isEmpty()) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale); + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验规格,请先添加检验规格!", locale); } Optional entityByVarietyNoAndQcItemNo = qcSpecDao.findByVarietyNoAndQcItemNo(varietyNo, qcItemNo); @@ -74,7 +75,21 @@ public class QcSpecServiceImpl implements QcSpecService { } /** - * 更新质检规格 + * 删除检验规格 + */ + @Override + public String deleteQcSpec(QcSpecQoDelete deleteQo) { + Integer id = deleteQo.getId(); + Optional entityById = qcSpecDao.findById(id); + if (entityById.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验规格,请先添加检验规格!", locale); + } + qcSpecDao.deleteById(id); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除成功!", locale); + } + + /** + * 更新检验规格 */ @Override public String updateQcSpec(QcSpecQoUpdate updateQo) { @@ -99,7 +114,7 @@ public class QcSpecServiceImpl implements QcSpecService { } /** - * 查询质检规格 + * 查询检验规格 */ @Override public String queryQcSpec(QcSpecQoQuery queryQo) {