店铺区域接口

This commit is contained in:
张松
2025-02-19 11:00:39 +08:00
parent 019fada4b9
commit 0d2efef2a1
6 changed files with 99 additions and 18 deletions

View File

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