默认初始化页面权限
This commit is contained in:
@@ -4,6 +4,8 @@ import com.czg.account.entity.ShopStaffPagePermission;
|
|||||||
import com.czg.account.service.ShopStaffPagePermissionService;
|
import com.czg.account.service.ShopStaffPagePermissionService;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.service.account.mapper.ShopStaffPagePermissionMapper;
|
||||||
|
import com.czg.service.account.mapper.ShopStaffPermissionMapper;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import com.czg.account.entity.ShopPagePath;
|
import com.czg.account.entity.ShopPagePath;
|
||||||
@@ -27,11 +29,11 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class ShopPagePathServiceImpl extends ServiceImpl<ShopPagePathMapper, ShopPagePath> implements ShopPagePathService{
|
public class ShopPagePathServiceImpl extends ServiceImpl<ShopPagePathMapper, ShopPagePath> implements ShopPagePathService{
|
||||||
@Resource
|
@Resource
|
||||||
private ShopStaffPagePermissionService shopStaffPagePermissionService;
|
private ShopStaffPagePermissionMapper shopStaffPermissionMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ShopPagePath> detail(Long staffId) {
|
public List<ShopPagePath> detail(Long staffId) {
|
||||||
Set<Long> pageIdList = shopStaffPagePermissionService.list(new QueryWrapper().eq(ShopStaffPagePermission::getShopId,
|
Set<Long> pageIdList = shopStaffPermissionMapper.selectListByQuery(new QueryWrapper().eq(ShopStaffPagePermission::getShopId,
|
||||||
StpKit.USER.getShopId()).eq(ShopStaffPagePermission::getStaffId, staffId)).stream().map(ShopStaffPagePermission::getPagePathId).collect(Collectors.toSet());
|
StpKit.USER.getShopId()).eq(ShopStaffPagePermission::getStaffId, staffId)).stream().map(ShopStaffPagePermission::getPagePathId).collect(Collectors.toSet());
|
||||||
if (pageIdList.isEmpty()) {
|
if (pageIdList.isEmpty()) {
|
||||||
list().forEach(item -> {
|
list().forEach(item -> {
|
||||||
@@ -39,7 +41,7 @@ public class ShopPagePathServiceImpl extends ServiceImpl<ShopPagePathMapper, Sho
|
|||||||
permission.setShopId(StpKit.USER.getShopId());
|
permission.setShopId(StpKit.USER.getShopId());
|
||||||
permission.setStaffId(staffId);
|
permission.setStaffId(staffId);
|
||||||
permission.setPagePathId(item.getId());
|
permission.setPagePathId(item.getId());
|
||||||
shopStaffPagePermissionService.save(permission);
|
shopStaffPermissionMapper.insert(permission);
|
||||||
pageIdList.add(permission.getPagePathId());
|
pageIdList.add(permission.getPagePathId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user