多店铺需求
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.dto.ShopBranchDTO;
|
||||
import com.czg.account.service.ShopBranchService;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 分店管理
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-04-07 14:05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/shop/branch")
|
||||
public class ShopBranchController {
|
||||
|
||||
@Resource
|
||||
private ShopBranchService shopBranchService;
|
||||
|
||||
/**
|
||||
* 分店列表
|
||||
*/
|
||||
@GetMapping("page")
|
||||
@OperationLog("分店管理-分页")
|
||||
public CzgResult<Page<ShopBranchDTO>> getBranchPage() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Page<ShopBranchDTO> data = shopBranchService.findPage(shopId);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置数据同步方式
|
||||
*
|
||||
* @param dataSyncMethod 数据同步方式 auto-实时自动同步 manual-手动同步
|
||||
*/
|
||||
@PostMapping("/setting/dataSyncMethod")
|
||||
@OperationLog("分店管理-设置数据同步方式")
|
||||
public CzgResult<Void> settingDataSyncMethod(@RequestParam String dataSyncMethod) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
shopBranchService.settingDataSyncMethod(shopId, dataSyncMethod);
|
||||
CzgResult<Void> ret = CzgResult.success();
|
||||
ret.setMsg("设置成功,数据正在后台同步中...");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步启用
|
||||
*
|
||||
* @param branchShopId 分店id
|
||||
*/
|
||||
@PostMapping("/data/sync/enable")
|
||||
@OperationLog("分店管理-同步启用")
|
||||
public CzgResult<Void> dataSyncEnable(@RequestParam Long branchShopId) {
|
||||
shopBranchService.dataSyncEnable(branchShopId);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号启用
|
||||
*
|
||||
* @param branchShopId 分店id
|
||||
*/
|
||||
@PostMapping("/account/enable")
|
||||
@OperationLog("分店管理-账号启用")
|
||||
public CzgResult<Void> accountEnable(@RequestParam Long branchShopId) {
|
||||
shopBranchService.accountEnable(branchShopId);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号禁用
|
||||
*
|
||||
* @param branchShopId 分店id
|
||||
*/
|
||||
@PostMapping("/account/disable")
|
||||
@OperationLog("分店管理-账号禁用")
|
||||
public CzgResult<Void> accountDisable(@RequestParam Long branchShopId) {
|
||||
shopBranchService.accountDisable(branchShopId);
|
||||
return CzgResult.success();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.dto.PageDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopBranchSelectDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopDetailDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoAddDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoEditDTO;
|
||||
@@ -15,6 +16,8 @@ import com.mybatisflex.core.query.QueryWrapper;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺管理
|
||||
*
|
||||
@@ -85,4 +88,14 @@ public class ShopInfoController {
|
||||
return CzgResult.success(shopInfoService.remove(new QueryWrapper().eq(ShopInfo::getId, id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺分店列表(下拉展示主店和分店使用,默认第一个是主店,其余是分店)
|
||||
*/
|
||||
@GetMapping("branchList")
|
||||
public CzgResult<List<ShopBranchSelectDTO>> findShopBranch() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
List<ShopBranchSelectDTO> data = shopInfoService.findShopBranch(shopId);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user