更新质检项名称
This commit is contained in:
		| @@ -8,8 +8,13 @@ import org.springframework.stereotype.Component; | ||||
| import java.util.Optional; | ||||
|  | ||||
| @Component | ||||
| public interface QcItemDao extends JpaRepository<QcItemEntity, Long>, JpaSpecificationExecutor<QcItemEntity> { | ||||
| public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> { | ||||
|  | ||||
|     Optional<QcItemEntity> findByNo(String no); | ||||
|  | ||||
|     /** | ||||
|      * 更新质检项名称 | ||||
|      */ | ||||
|     void updateNameById(Integer itemId, String itemName); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -6,5 +6,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||||
| import org.springframework.stereotype.Component; | ||||
|  | ||||
| @Component | ||||
| public interface QcSourceDao extends JpaRepository<QcSourceEntity, Long>, JpaSpecificationExecutor<QcSourceEntity> { | ||||
| public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> { | ||||
| } | ||||
| @@ -8,7 +8,7 @@ import org.springframework.stereotype.Component; | ||||
| import java.util.Optional; | ||||
|  | ||||
| @Component | ||||
| public interface QcSpecDao extends JpaRepository<QcSpecEntity, Long>, JpaSpecificationExecutor<QcSpecEntity> { | ||||
| public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, JpaSpecificationExecutor<QcSpecEntity> { | ||||
|  | ||||
|     Optional<QcSpecEntity> findByVarietyNoAndQcItemNo(String varietyNo, String qcItemNo); | ||||
|  | ||||
|   | ||||
| @@ -10,6 +10,9 @@ public interface QcItemService { | ||||
|      */ | ||||
|     String insertQcItem(QcItemQoInsert insertQo); | ||||
|  | ||||
|     /** | ||||
|      * 更新质检项名称 | ||||
|      */ | ||||
|     String updateQcItem(QcItemQoUpdate updateQo); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -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<QcItemEntity> entityById = qcItemDao.findById(id); | ||||
|         if (entityById.isEmpty()) { | ||||
|             return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale); | ||||
|         } | ||||
|  | ||||
|         qcItemDao.updateNameById(id, name); | ||||
|  | ||||
|         return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user