存酒接口

This commit is contained in:
张松
2025-02-27 10:12:16 +08:00
parent 4067bc0b0b
commit 2b6345b7ce
4 changed files with 101 additions and 24 deletions

View File

@@ -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);
}
}