完善更新SQL
This commit is contained in:
parent
8bfcc19fe7
commit
9dd6f697a6
@ -3,6 +3,8 @@ package com.xkrs.newpro.dao;
|
|||||||
import com.xkrs.newpro.model.entity.QcItemEntity;
|
import com.xkrs.newpro.model.entity.QcItemEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
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 org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -15,6 +17,8 @@ public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package com.xkrs.newpro.dao;
|
|||||||
import com.xkrs.newpro.model.entity.QcSpecEntity;
|
import com.xkrs.newpro.model.entity.QcSpecEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
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 org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -15,6 +17,8 @@ public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, 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);
|
||||||
|
|
||||||
}
|
}
|
@ -62,7 +62,7 @@ public class QcItemServiceImpl implements QcItemService {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
qcItemDao.updateNameById(id, name);
|
qcItemDao.updateNameById(id, LocalDateUtils.getCurrentSecond(), name);
|
||||||
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,7 @@ public class QcSpecServiceImpl implements QcSpecService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
qcSpecDao.updateQcSpecById(id,
|
qcSpecDao.updateQcSpecById(id,
|
||||||
|
LocalDateUtils.getCurrentSecond(),
|
||||||
LocalStringUtils.formatEmptyValue(max),
|
LocalStringUtils.formatEmptyValue(max),
|
||||||
LocalStringUtils.formatEmptyValue(mean),
|
LocalStringUtils.formatEmptyValue(mean),
|
||||||
LocalStringUtils.formatEmptyValue(min),
|
LocalStringUtils.formatEmptyValue(min),
|
||||||
|
Loading…
Reference in New Issue
Block a user