diff --git a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java index b3652c9..93fed9d 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java @@ -3,6 +3,8 @@ package com.xkrs.newpro.dao; import com.xkrs.newpro.model.entity.QcItemEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; import java.util.Optional; @@ -15,6 +17,8 @@ public interface QcItemDao extends JpaRepository, JpaSpec /** * 更新质检项名称 */ - void updateNameById(Integer itemId, String itemName); + @Modifying(clearAutomatically = true) + @Query(value = "UPDATE qc_item SET update_time = ?2,name = ?3 WHERE id = ?1", nativeQuery = true) + void updateNameById(Integer id, String updateTime, String name); } diff --git a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java index 69b8429..41496ae 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java @@ -3,6 +3,8 @@ package com.xkrs.newpro.dao; import com.xkrs.newpro.model.entity.QcSpecEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; import java.util.Optional; @@ -15,6 +17,8 @@ public interface QcSpecDao extends JpaRepository, JpaSpec /** * 更新质检规格 */ - void updateQcSpecById(Integer id, String max, String mean, String min, String unit, String method, String standard, String remark); + @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); } \ No newline at end of file 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 edbc81f..c09cdcc 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java @@ -62,7 +62,7 @@ public class QcItemServiceImpl implements QcItemService { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale); } - qcItemDao.updateNameById(id, name); + qcItemDao.updateNameById(id, LocalDateUtils.getCurrentSecond(), name); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); } 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 a5bd36f..6e560a0 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java @@ -91,6 +91,7 @@ public class QcSpecServiceImpl implements QcSpecService { } qcSpecDao.updateQcSpecById(id, + LocalDateUtils.getCurrentSecond(), LocalStringUtils.formatEmptyValue(max), LocalStringUtils.formatEmptyValue(mean), LocalStringUtils.formatEmptyValue(min),