页面权限

This commit is contained in:
张松 2025-04-02 15:55:53 +08:00
parent 99e7cbe1de
commit ee1661e20b
3 changed files with 25 additions and 0 deletions

View File

@ -21,6 +21,10 @@ public class ShopStaffAddDTO {
* 店铺权限id集合
*/
private List<Long> shopPermissionIds;
/**
* 页面路径权限
*/
private List<Long> pagePathIdList;
/**
* 员工姓名
*/

View File

@ -19,6 +19,10 @@ public class ShopStaffEditDTO {
* 店铺权限id集合
*/
private List<Long> shopPermissionIds;
/**
* 页面权限
*/
private List<Long> pagePathIdList;
/**
* 角色id
*/

View File

@ -2,6 +2,7 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.pagepath.PagePathPermissionAddDTO;
import com.czg.account.dto.staff.ShopStaffAddDTO;
import com.czg.account.dto.staff.ShopStaffEditDTO;
import com.czg.account.dto.staff.ShopStaffRemoveDTO;
@ -39,6 +40,8 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
private ShopPermissionService shopPermissionService;
@Resource
private ShopStaffPermissionService shopStaffPermissionService;
@Resource
private ShopStaffPagePermissionService pagePermissionService;
@Override
@Transactional(rollbackFor = Exception.class)
@ -54,6 +57,13 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
if (shopStaffAddDTO.getShopPermissionIds() != null && !shopStaffAddDTO.getShopPermissionIds().isEmpty()) {
addPermission(shopStaff, shopStaffAddDTO.getShopPermissionIds());
}
if (shopStaffAddDTO.getPagePathIdList() != null && !shopStaffAddDTO.getPagePathIdList().isEmpty()) {
PagePathPermissionAddDTO pagePathPermissionAddDTO = new PagePathPermissionAddDTO();
pagePathPermissionAddDTO.setPagePathIdList(shopStaffAddDTO.getPagePathIdList());
pagePathPermissionAddDTO.setStaffId(shopStaff.getId());
pagePermissionService.add(StpKit.USER.getShopId(), pagePathPermissionAddDTO);
}
return true;
}
@ -98,6 +108,13 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
// 权限添加
addPermission(shopStaff, shopStaffEditDTO.getShopPermissionIds());
}
if (shopStaffEditDTO.getPagePathIdList() != null && !shopStaffEditDTO.getPagePathIdList().isEmpty()) {
PagePathPermissionAddDTO pagePathPermissionAddDTO = new PagePathPermissionAddDTO();
pagePathPermissionAddDTO.setPagePathIdList(shopStaffEditDTO.getPagePathIdList());
pagePathPermissionAddDTO.setStaffId(shopStaff.getId());
pagePermissionService.add(StpKit.USER.getShopId(), pagePathPermissionAddDTO);
}
return true;
}