更新质检项名称

This commit is contained in:
liuchengqian 2022-03-11 08:58:20 +08:00
parent c2b9050fd6
commit fc748f6f94
5 changed files with 26 additions and 4 deletions

View File

@ -8,8 +8,13 @@ import org.springframework.stereotype.Component;
import java.util.Optional; import java.util.Optional;
@Component @Component
public interface QcItemDao extends JpaRepository<QcItemEntity, Long>, JpaSpecificationExecutor<QcItemEntity> { public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> {
Optional<QcItemEntity> findByNo(String no); Optional<QcItemEntity> findByNo(String no);
/**
* 更新质检项名称
*/
void updateNameById(Integer itemId, String itemName);
} }

View File

@ -6,5 +6,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public interface QcSourceDao extends JpaRepository<QcSourceEntity, Long>, JpaSpecificationExecutor<QcSourceEntity> { public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> {
} }

View File

@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
import java.util.Optional; import java.util.Optional;
@Component @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); Optional<QcSpecEntity> findByVarietyNoAndQcItemNo(String varietyNo, String qcItemNo);

View File

@ -10,6 +10,9 @@ public interface QcItemService {
*/ */
String insertQcItem(QcItemQoInsert insertQo); String insertQcItem(QcItemQoInsert insertQo);
/**
* 更新质检项名称
*/
String updateQcItem(QcItemQoUpdate updateQo); String updateQcItem(QcItemQoUpdate updateQo);
} }

View File

@ -48,8 +48,22 @@ public class QcItemServiceImpl implements QcItemService {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
} }
/**
* 更新质检项名称
*/
@Override @Override
public String updateQcItem(QcItemQoUpdate updateQo) { 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);
} }
} }