多店铺需求

This commit is contained in:
Tankaikai 2025-04-07 18:11:48 +08:00
parent 1eafd54536
commit 18b2c536f3
5 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package com.czg.controller.admin;
import com.czg.account.dto.ShopBranchDTO;
import com.czg.account.param.ShopBranchParam;
import com.czg.account.service.ShopBranchService;
import com.czg.log.annotation.OperationLog;
import com.czg.resp.CzgResult;
@ -27,9 +28,10 @@ public class ShopBranchController {
*/
@GetMapping("page")
@OperationLog("分店管理-分页")
public CzgResult<Page<ShopBranchDTO>> getBranchPage() {
public CzgResult<Page<ShopBranchDTO>> getBranchPage(ShopBranchParam param) {
Long shopId = StpKit.USER.getShopId(0L);
Page<ShopBranchDTO> data = shopBranchService.findPage(shopId);
param.setShopId(shopId);
Page<ShopBranchDTO> data = shopBranchService.findPage(param);
return CzgResult.success(data);
}

View File

@ -1,6 +1,7 @@
package com.czg.account.service;
import com.czg.account.dto.ShopBranchDTO;
import com.czg.account.param.ShopBranchParam;
import com.mybatisflex.core.paginate.Page;
/**
@ -13,10 +14,10 @@ public interface ShopBranchService {
/**
* 查询分店列表
*
* @param shopId 主店id
* @param param 查询入参
* @return 分店列表
*/
Page<ShopBranchDTO> findPage(Long shopId);
Page<ShopBranchDTO> findPage(ShopBranchParam param);
/**
* 设计数据同步方式

View File

@ -2,9 +2,9 @@ package com.czg.service.account.mapper;
import com.czg.account.dto.ShopBranchDTO;
import com.czg.account.entity.ShopConfig;
import com.czg.account.param.ShopBranchParam;
import com.mybatisflex.core.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -17,6 +17,6 @@ import java.util.List;
@Mapper
public interface ShopConfigMapper extends BaseMapper<ShopConfig> {
List<ShopBranchDTO> findBranchList(@Param("shopId") Long shopId);
List<ShopBranchDTO> findBranchList(ShopBranchParam param);
}

View File

@ -6,6 +6,7 @@ import com.czg.account.entity.ShopConfig;
import com.czg.account.entity.ShopInfo;
import com.czg.account.enums.BranchDataSyncMethodEnum;
import com.czg.account.enums.ShopTypeEnum;
import com.czg.account.param.ShopBranchParam;
import com.czg.account.service.ShopBranchService;
import com.czg.enums.YesNoEnum;
import com.czg.exception.CzgException;
@ -38,9 +39,9 @@ public class ShopBranchServiceImpl implements ShopBranchService {
private ShopInfoMapper shopInfoMapper;
@Override
public Page<ShopBranchDTO> findPage(Long shopId) {
public Page<ShopBranchDTO> findPage(ShopBranchParam param) {
PageHelper.startPage(PageUtil.buildPageHelp());
List<ShopBranchDTO> branchList = shopConfigMapper.findBranchList(shopId);
List<ShopBranchDTO> branchList = shopConfigMapper.findBranchList(param);
return PageUtil.convert(new PageInfo<>(branchList));
}

View File

@ -12,5 +12,8 @@
left join tb_shop_info t2 on t1.id = t2.id
left join sys_user t3 on t1.id = t3.id
where t1.main_id = #{shopId}
<if test="branchName != null and branchName != ''">
and t2.shop_name like concat('%', #{branchName}, '%')
</if>
</select>
</mapper>