存酒接口
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.account.dto.storage.ShopStorageGoodDTO;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.ShopStorageGood;
|
||||
import com.czg.account.service.ShopStorageGoodService;
|
||||
@@ -15,4 +19,22 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class ShopStorageGoodServiceImpl extends ServiceImpl<ShopStorageGoodMapper, ShopStorageGood> implements ShopStorageGoodService{
|
||||
|
||||
@Override
|
||||
public Boolean edit(Long shopId, ShopStorageGoodDTO shopStorageGoodDTO) {
|
||||
ShopStorageGood storageGood = getOne(new QueryWrapper().eq(ShopStorageGood::getShopId, shopId).eq(ShopStorageGood::getId, shopStorageGoodDTO.getId()));
|
||||
if (storageGood == null) {
|
||||
throw new ApiNotPrintException("商品不存在");
|
||||
}
|
||||
|
||||
BeanUtil.copyProperties(shopStorageGoodDTO, storageGood);
|
||||
storageGood.setSource(null);
|
||||
return updateById(storageGood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean saveInfo(Long shopId, ShopStorageGoodDTO shopStorageGoodDTO) {
|
||||
ShopStorageGood shopStorageGood = BeanUtil.copyProperties(shopStorageGoodDTO, ShopStorageGood.class);
|
||||
shopStorageGood.setShopId(shopId);
|
||||
return save(shopStorageGood);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user