商品更新bug修改
This commit is contained in:
parent
6c5713bfda
commit
aab1348b33
@ -221,18 +221,13 @@ public class GoodsService implements IGoodsService {
|
||||
* 如果要更新的商品不存在,报DBException(数据不存在)
|
||||
*/
|
||||
public void updateGoods(Long id, GoodsUpdateVO updateVO, UserVO user) {
|
||||
confirmExist(id);
|
||||
SaleGoods goods = updateVO.convert2DB();
|
||||
goods.setId(id);
|
||||
goods.setUpdateUserId(user.getId());
|
||||
goods.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
saleGoodsDAO.updateByPrimaryKeySelective(goods);
|
||||
}
|
||||
|
||||
private void confirmExist(Long id) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(isExist(id),
|
||||
String.format("id为[%s]的商品不存在", id));
|
||||
SaleGoods entity = getEntityById(id);
|
||||
entity.setName(updateVO.getName());
|
||||
entity.setPrice((long) (updateVO.getPrice() * 100));
|
||||
entity.setRemarks(updateVO.getRemarks());
|
||||
entity.setUpdateUserId(user.getId());
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
saleGoodsDAO.updateByPrimaryKeySelective(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user