店铺区域接口
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.area.ShopAreaAddDTO;
|
||||
import com.czg.account.dto.area.ShopAreaEditDTO;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
@@ -28,4 +33,22 @@ public class ShopTableAreaServiceImpl extends ServiceImpl<ShopAreaMapper, ShopTa
|
||||
}
|
||||
return page(PageUtil.buildPage(), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean edit(Long shopId, ShopAreaEditDTO shopAreaEditDTO) {
|
||||
ShopTableArea tableArea = queryChain().eq(ShopTableArea::getShopId, shopId).eq(ShopTableArea::getId, shopAreaEditDTO.getId()).one();
|
||||
if (tableArea == null) {
|
||||
throw new ApiNotPrintException("区域不存在");
|
||||
}
|
||||
|
||||
BeanUtil.copyProperties(shopAreaEditDTO, tableArea);
|
||||
return updateById(tableArea);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean add(ShopAreaAddDTO shopAreaAddDTO) {
|
||||
ShopTableArea shopTableArea = BeanUtil.copyProperties(shopAreaAddDTO, ShopTableArea.class);
|
||||
shopTableArea.setShopId(StpKit.USER.getShopId());
|
||||
return save(shopTableArea);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user