diff --git a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java index c634c45..b3652c9 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java @@ -8,8 +8,13 @@ import org.springframework.stereotype.Component; import java.util.Optional; @Component -public interface QcItemDao extends JpaRepository, JpaSpecificationExecutor { +public interface QcItemDao extends JpaRepository, JpaSpecificationExecutor { Optional findByNo(String no); + /** + * 更新质检项名称 + */ + void updateNameById(Integer itemId, String itemName); + } diff --git a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java index a498204..7ca02a3 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java @@ -6,5 +6,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.stereotype.Component; @Component -public interface QcSourceDao extends JpaRepository, JpaSpecificationExecutor { +public interface QcSourceDao extends JpaRepository, JpaSpecificationExecutor { } \ No newline at end of file diff --git a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java index 407feef..715cce9 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java @@ -8,7 +8,7 @@ import org.springframework.stereotype.Component; import java.util.Optional; @Component -public interface QcSpecDao extends JpaRepository, JpaSpecificationExecutor { +public interface QcSpecDao extends JpaRepository, JpaSpecificationExecutor { Optional findByVarietyNoAndQcItemNo(String varietyNo, String qcItemNo); diff --git a/src/main/java/com/xkrs/newpro/service/QcItemService.java b/src/main/java/com/xkrs/newpro/service/QcItemService.java index f7d676f..d8aea29 100644 --- a/src/main/java/com/xkrs/newpro/service/QcItemService.java +++ b/src/main/java/com/xkrs/newpro/service/QcItemService.java @@ -10,6 +10,9 @@ public interface QcItemService { */ String insertQcItem(QcItemQoInsert insertQo); + /** + * 更新质检项名称 + */ String updateQcItem(QcItemQoUpdate updateQo); } 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 e5f164f..edbc81f 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java @@ -48,8 +48,22 @@ public class QcItemServiceImpl implements QcItemService { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); } + /** + * 更新质检项名称 + */ @Override public String updateQcItem(QcItemQoUpdate updateQo) { - return null; + + 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, name); + + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); } }