收音机页面路径配置

This commit is contained in:
张松
2025-04-02 14:33:48 +08:00
parent dfc6f5a1f5
commit ef3a612c58
3 changed files with 12 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ public class ShopPagePermissionController {
} }
/** /**
* 获取当前用户已拥有页面路径 * 获取当前员工已拥有页面路径权限
*/ */
@GetMapping("/mine") @GetMapping("/mine")
public CzgResult<List<ShopPagePath>> mine() { public CzgResult<List<ShopPagePath>> mine() {

View File

@@ -1,6 +1,7 @@
package com.czg.account.entity; package com.czg.account.entity;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table; import com.mybatisflex.annotation.Table;
import java.io.Serializable; import java.io.Serializable;
@@ -26,7 +27,8 @@ public class ShopStaffPagePermission implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/** /**
* 店铺id * 店铺id
*/ */

View File

@@ -13,6 +13,7 @@ import com.czg.account.service.ShopStaffPagePermissionService;
import com.czg.service.account.mapper.ShopStaffPagePermissionMapper; import com.czg.service.account.mapper.ShopStaffPagePermissionMapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
@@ -30,6 +31,7 @@ public class ShopStaffPagePermissionServiceImpl extends ServiceImpl<ShopStaffPag
private ShopStaffService shopStaffService; private ShopStaffService shopStaffService;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Boolean add(Long shopId, PagePathPermissionAddDTO pagePathPermissionAddDTO) { public Boolean add(Long shopId, PagePathPermissionAddDTO pagePathPermissionAddDTO) {
ShopStaff shopStaff = shopStaffService.getOne(new QueryWrapper().eq(ShopStaff::getId, pagePathPermissionAddDTO.getStaffId()).eq(ShopStaff::getShopId, shopId)); ShopStaff shopStaff = shopStaffService.getOne(new QueryWrapper().eq(ShopStaff::getId, pagePathPermissionAddDTO.getStaffId()).eq(ShopStaff::getShopId, shopId));
if (shopStaff == null) { if (shopStaff == null) {
@@ -42,7 +44,13 @@ public class ShopStaffPagePermissionServiceImpl extends ServiceImpl<ShopStaffPag
} }
ArrayList<ShopStaffPagePermission> pagePermissions = new ArrayList<>(); ArrayList<ShopStaffPagePermission> pagePermissions = new ArrayList<>();
ArrayList<ShopStaffPagePermission> updatePagePermissions = new ArrayList<>();
remove(new QueryWrapper().eq(ShopStaffPagePermission::getStaffId, pagePathPermissionAddDTO.getStaffId()));
pagePathPermissionAddDTO.getPagePathIdList().forEach(item -> { pagePathPermissionAddDTO.getPagePathIdList().forEach(item -> {
long count1 = count(new QueryWrapper().eq(ShopStaffPagePermission::getStaffId, shopStaff).eq(ShopStaffPagePermission::getPagePathId, item));
if (count1 > 0) {
return;
}
ShopStaffPagePermission permission = new ShopStaffPagePermission(); ShopStaffPagePermission permission = new ShopStaffPagePermission();
permission.setShopId(shopId); permission.setShopId(shopId);
permission.setPagePathId(item); permission.setPagePathId(item);