添加耗材功能

This commit is contained in:
韩鹏辉 2024-07-05 17:06:52 +08:00
parent 32401b3ca9
commit 329b3872f8
3 changed files with 18 additions and 3 deletions

View File

@ -49,7 +49,7 @@ public interface TbConsInfoService {
* 编辑
* @param resources /
*/
void update(TbConsInfo resources);
void update(TbConsInfo resources) throws Exception;
/**
* 多选删除

View File

@ -30,4 +30,7 @@ public class TbConsInfoQueryCriteria{
/** 精确 */
@Query
private Integer shopId;
@Query
private String status;
}

View File

@ -114,9 +114,21 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbConsInfo resources) {
public void update(TbConsInfo resources) throws Exception {
TbConsInfo tbConsInfo = tbConsInfoRepository.findById(resources.getId()).orElseGet(TbConsInfo::new);
ValidationUtil.isNull( tbConsInfo.getId(),"TbConsInfo","id",resources.getId());
if(Objects.isNull(tbConsInfo)){
throw new Exception("耗材信息不存在");
}
tbConsInfo.setConCode(resources.getConCode());
tbConsInfo.setConName(resources.getConName());
tbConsInfo.setPrice(resources.getPrice());
tbConsInfo.setConUnit(resources.getConUnit());
tbConsInfo.setConWarning(resources.getConWarning());
tbConsInfo.setStatus(resources.getStatus());
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoRepository.save(tbConsInfo);
}