feat(app): 新增工作台菜单权限过滤功能

- 在AppIndexServiceImpl中实现基于角色权限的菜单过滤
- 新增WORKBENCH页面类型枚举
- 为AppRole添加menuId字段存储权限菜单
- 扩展AppRoleService提供菜单查询接口
- 优化AppArticleCollectEntity增加image和visit字段
This commit is contained in:
PIG AI committed 2025-06-23 16:15:39 +08:00
1 parent 404d7bf6c2
commit 64cdd035e1
9 files changed
+385 -259

No files matched your search

@@ -22,65 +22,77 @@ import java.time.LocalDateTime;
@Schema(description = "文章收藏表")
public class AppArticleCollectEntity extends Model<AppArticleCollectEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private Long id;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private Long id;
/**
* 用户ID
*/
@Schema(description = "用户ID")
private Long userId;
/**
* 用户ID
*/
@Schema(description = "用户ID")
private Long userId;
/**
* 文章ID
*/
@Schema(description = "文章ID")
private Long articleId;
/**
* 文章ID
*/
@Schema(description = "文章ID")
private Long articleId;
/**
* 文章标题
*/
@TableField(exist = false)
private String title;
/**
* 文章标题
*/
@TableField(exist = false)
private String title;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "更新人")
private String updateBy;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "是否删除")
private String delFlag;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "是否删除")
private String delFlag;
/**
* 图片
*/
@TableField(exist = false)
private String image;
/**
* 访问次数
*/
@TableField(exist = false)
private Long visit;
}
@@ -6,6 +6,7 @@ import com.pig4cloud.pigx.common.core.util.TenantTable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants;
import java.time.LocalDateTime;
@@ -18,6 +19,7 @@ import java.time.LocalDateTime;
@Data
@TenantTable
@TableName("app_page")
@FieldNameConstants
@EqualsAndHashCode(callSuper = true)
@Schema(description = "页面")
public class AppPageEntity extends Model<AppPageEntity> {
@@ -63,11 +63,17 @@ public class AppRole extends Model<AppRole> {
private String roleCode;
/**
* roleDesc
* 角色描述
*/
@Schema(description = "roleDesc")
@Schema(description = "角色描述")
private String roleDesc;
/**
* 菜单ID列表
*/
@Schema(description = "菜单ID列表")
private String menuId;
/**
* 创建人
*/
@@ -18,7 +18,12 @@ public enum PageTypeEnums {
/**
* 客服设置
*/
SERVICE(3, "客服设置");
SERVICE(3, "客服设置"),
/**
* 工作台属性
*/
WORKBENCH(4, "工作台");
private final Integer pageType;
@@ -35,92 +35,97 @@ import java.util.List;
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class AppArticleCollectController {
private final AppArticleCollectService appArticleCollectService;
private final AppArticleCollectService appArticleCollectService;
/**
* 分页查询
* @param page 分页对象
* @param appArticleCollect 文章收藏表
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
public R getAppArticleCollectPage(@ParameterObject Page page) {
MPJLambdaWrapper<AppArticleCollectEntity> wrapper = new MPJLambdaWrapper<AppArticleCollectEntity>()
.selectAll(AppArticleCollectEntity.class)
.select(AppArticleEntity::getTitle)
.leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
.eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
return R.ok(appArticleCollectService.selectJoinListPage(page, AppArticleCollectEntity.class, wrapper));
}
/**
* 分页查询文章收藏信息。
*
* @param page 分页查询参数对象
* @return 返回分页结果对象,包含文章收藏信息列表
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
public R getAppArticleCollectPage(@ParameterObject Page page) {
MPJLambdaWrapper<AppArticleCollectEntity> wrapper = new MPJLambdaWrapper<AppArticleCollectEntity>()
.selectAll(AppArticleCollectEntity.class)
.select(AppArticleEntity::getTitle, AppArticleEntity::getImage, AppArticleEntity::getVisit)
.leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
.eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
return R.ok(appArticleCollectService.selectJoinListPage(page, AppArticleCollectEntity.class, wrapper));
}
/**
* 通过id查询文章收藏表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R getById(@PathVariable("id") Long id) {
return R.ok(appArticleCollectService.getById(id));
}
/**
* 通过id查询文章收藏表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R getById(@PathVariable("id") Long id) {
return R.ok(appArticleCollectService.getById(id));
}
/**
* 新增文章收藏表
* @param appArticleCollect 文章收藏表
* @return R
*/
@Operation(summary = "新增文章收藏表", description = "新增文章收藏表")
@SysLog("新增文章收藏表")
@PostMapping
public R save(@RequestBody AppArticleCollectEntity appArticleCollect) {
return R.ok(appArticleCollectService.saveArticleCollect(appArticleCollect));
}
/**
* 新增文章收藏表
*
* @param appArticleCollect 文章收藏表
* @return R
*/
@Operation(summary = "新增文章收藏表", description = "新增文章收藏表")
@SysLog("新增文章收藏表")
@PostMapping
public R save(@RequestBody AppArticleCollectEntity appArticleCollect) {
return R.ok(appArticleCollectService.saveArticleCollect(appArticleCollect));
}
/**
* 修改文章收藏表
* @param appArticleCollect 文章收藏表
* @return R
*/
@Operation(summary = "修改文章收藏表", description = "修改文章收藏表")
@SysLog("修改文章收藏表")
@PutMapping
public R updateById(@RequestBody AppArticleCollectEntity appArticleCollect) {
return R.ok(appArticleCollectService.updateById(appArticleCollect));
}
/**
* 修改文章收藏表
*
* @param appArticleCollect 文章收藏表
* @return R
*/
@Operation(summary = "修改文章收藏表", description = "修改文章收藏表")
@SysLog("修改文章收藏表")
@PutMapping
public R updateById(@RequestBody AppArticleCollectEntity appArticleCollect) {
return R.ok(appArticleCollectService.updateById(appArticleCollect));
}
/**
* 通过id删除文章收藏表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除文章收藏表", description = "通过id删除文章收藏表")
@SysLog("通过id删除文章收藏表")
@DeleteMapping
public R removeById(@RequestBody Long[] ids) {
return R.ok(appArticleCollectService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 通过id删除文章收藏表
*
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除文章收藏表", description = "通过id删除文章收藏表")
@SysLog("通过id删除文章收藏表")
@DeleteMapping
public R removeById(@RequestBody Long[] ids) {
return R.ok(appArticleCollectService.removeBatchByIds(CollUtil.toList(ids)));
}
@Operation(summary = "通过文章id删除文章收藏表", description = "通过文章id删除文章收藏表")
@SysLog("通过文章id删除文章收藏表")
@DeleteMapping("/{articleId}")
public R removeByArticleId(@PathVariable String articleId) {
Long id = SecurityUtils.getUser().getId();
return R.ok(appArticleCollectService.remove(Wrappers.<AppArticleCollectEntity>lambdaQuery()
.eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, articleId)));
}
@Operation(summary = "通过文章id删除文章收藏表", description = "通过文章id删除文章收藏表")
@SysLog("通过文章id删除文章收藏表")
@DeleteMapping("/{articleId}")
public R removeByArticleId(@PathVariable String articleId) {
Long id = SecurityUtils.getUser().getId();
return R.ok(appArticleCollectService.remove(Wrappers.<AppArticleCollectEntity>lambdaQuery()
.eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, articleId)));
}
/**
* 导出excel 表格
* @param appArticleCollect 查询条件
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@HasPermission("app_collect_export")
public List<AppArticleCollectEntity> export(AppArticleCollectEntity appArticleCollect) {
return appArticleCollectService.list(Wrappers.query(appArticleCollect));
}
/**
* 导出excel 表格
*
* @param appArticleCollect 查询条件
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@HasPermission("app_collect_export")
public List<AppArticleCollectEntity> export(AppArticleCollectEntity appArticleCollect) {
return appArticleCollectService.list(Wrappers.query(appArticleCollect));
}
}
@@ -51,125 +51,146 @@ import java.util.List;
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class AppRoleController {
private final AppRoleService appRoleService;
private final AppRoleService appRoleService;
/**
* 分页查询
* @param page 分页对象
* @param appRole app角色表
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
public R getAppRolePage(Page page, AppRole appRole) {
return R.ok(appRoleService.page(page, Wrappers.<AppRole>lambdaQuery()
.like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
}
/**
* 分页查询
*
* @param page 分页对象
* @param appRole app角色表
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
public R getAppRolePage(Page page, AppRole appRole) {
return R.ok(appRoleService.page(page, Wrappers.<AppRole>lambdaQuery()
.like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
}
/**
* 查询全部角色
* @return
*/
@Operation(summary = "查询全部", description = "查询全部")
@GetMapping("/list")
public R list() {
return R.ok(appRoleService.list(Wrappers.emptyWrapper()));
}
/**
* 查询全部角色
*
* @return
*/
@Operation(summary = "查询全部", description = "查询全部")
@GetMapping("/list")
public R list() {
return R.ok(appRoleService.list(Wrappers.emptyWrapper()));
}
/**
* 通过id查询app角色表
* @param roleId id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{roleId}")
public R getById(@PathVariable("roleId") Long roleId) {
return R.ok(appRoleService.getById(roleId));
}
/**
* 通过id查询app角色表
*
* @param roleId id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{roleId}")
public R getById(@PathVariable("roleId") Long roleId) {
return R.ok(appRoleService.getById(roleId));
}
/**
* 通过roleName查询app角色表
* @param roleName roleName
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/details/{roleName}")
public R getByUserName(@PathVariable("roleName") String roleName) {
return R.ok(appRoleService.getOne(Wrappers.<AppRole>lambdaQuery().eq(AppRole::getRoleName, roleName)));
}
/**
* 通过roleName查询app角色表
*
* @param roleName roleName
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/details/{roleName}")
public R getByUserName(@PathVariable("roleName") String roleName) {
return R.ok(appRoleService.getOne(Wrappers.<AppRole>lambdaQuery().eq(AppRole::getRoleName, roleName)));
}
/**
* 通过roleCode查询app角色表
* @param roleCode roleCode
* @return R
*/
@Operation(summary = "通过roleCode查询", description = "通过roleCode查询")
@GetMapping("/detailsByCode/{roleCode}")
public R getByPhone(@PathVariable("roleCode") String roleCode) {
return R.ok(appRoleService.getOne(Wrappers.<AppRole>lambdaQuery().eq(AppRole::getRoleCode, roleCode)));
}
/**
* 通过roleCode查询app角色表
*
* @param roleCode roleCode
* @return R
*/
@Operation(summary = "通过roleCode查询", description = "通过roleCode查询")
@GetMapping("/detailsByCode/{roleCode}")
public R getByPhone(@PathVariable("roleCode") String roleCode) {
return R.ok(appRoleService.getOne(Wrappers.<AppRole>lambdaQuery().eq(AppRole::getRoleCode, roleCode)));
}
/**
* 新增app角色表
* @param appRole app角色表
* @return R
*/
@Operation(summary = "新增app角色表", description = "新增app角色表")
@SysLog("新增app角色表")
@PostMapping
@HasPermission("app_approle_add")
public R save(@RequestBody AppRole appRole) {
return R.ok(appRoleService.save(appRole));
}
/**
* 新增app角色表
*
* @param appRole app角色表
* @return R
*/
@Operation(summary = "新增app角色表", description = "新增app角色表")
@SysLog("新增app角色表")
@PostMapping
@HasPermission("app_approle_add")
public R save(@RequestBody AppRole appRole) {
return R.ok(appRoleService.save(appRole));
}
/**
* 修改app角色表
* @param appRole app角色表
* @return R
*/
@Operation(summary = "修改app角色表", description = "修改app角色表")
@SysLog("修改app角色表")
@PutMapping
@HasPermission("app_approle_edit")
public R updateById(@RequestBody AppRole appRole) {
return R.ok(appRoleService.updateById(appRole));
}
/**
* 修改app角色表
*
* @param appRole app角色表
* @return R
*/
@Operation(summary = "修改app角色表", description = "修改app角色表")
@SysLog("修改app角色表")
@PutMapping
@HasPermission("app_approle_edit")
public R updateById(@RequestBody AppRole appRole) {
return R.ok(appRoleService.updateById(appRole));
}
/**
* 通过ids批量删除app角色表
* @param ids roleIds
* @return R
*/
@Operation(summary = "通过ids批量删除app角色表", description = "通过ids批量删除app角色表")
@SysLog("通过ids批量删除app角色表")
@DeleteMapping
@HasPermission("app_approle_del")
public R removeById(@RequestBody Long[] ids) {
return R.ok(appRoleService.deleteRoleByIds(ids));
}
/**
* 通过ids批量删除app角色表
*
* @param ids roleIds
* @return R
*/
@Operation(summary = "通过ids批量删除app角色表", description = "通过ids批量删除app角色表")
@SysLog("通过ids批量删除app角色表")
@DeleteMapping
@HasPermission("app_approle_del")
public R removeById(@RequestBody Long[] ids) {
return R.ok(appRoleService.deleteRoleByIds(ids));
}
/**
* 导出excel 表格
* @param appRole 查询条件
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@HasPermission("app_approle_export")
public List<AppRole> export(AppRole appRole) {
return appRoleService.list(Wrappers.query(appRole));
}
/**
* 导出excel 表格
*
* @param appRole 查询条件
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@HasPermission("app_approle_export")
public List<AppRole> export(AppRole appRole) {
return appRoleService.list(Wrappers.query(appRole));
}
/**
* 导入角色
*
* @param excelVOList 角色列表
* @param bindingResult 错误信息列表
* @return ok fail
*/
@PostMapping("/import")
@HasPermission("app_approle_export")
public R importRole(@RequestExcel List<AppRoleExcelVO> excelVOList, BindingResult bindingResult) {
return appRoleService.importRole(excelVOList, bindingResult);
}
/**
* 获取工作台菜单列表
*
* @return 返回封装了菜单列表的结果对象
*/
@GetMapping("/menu")
public R menu() {
return R.ok(appRoleService.listMenu());
}
/**
* 导入角色
* @param excelVOList 角色列表
* @param bindingResult 错误信息列表
* @return ok fail
*/
@PostMapping("/import")
@HasPermission("app_approle_export")
public R importRole(@RequestExcel List<AppRoleExcelVO> excelVOList, BindingResult bindingResult) {
return appRoleService.importRole(excelVOList, bindingResult);
}
}
@@ -18,6 +18,7 @@
package com.pig4cloud.pigx.app.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pigx.app.api.entity.AppPageEntity;
import com.pig4cloud.pigx.app.api.entity.AppRole;
import com.pig4cloud.pigx.app.api.vo.AppRoleExcelVO;
import com.pig4cloud.pigx.common.core.util.R;
@@ -33,6 +34,12 @@ import java.util.List;
*/
public interface AppRoleService extends IService<AppRole> {
/**
* 根据用户ID查询角色列表
*
* @param userId 用户ID
* @return 对应用户ID的角色列表
*/
List<AppRole> findRolesByUserId(Long userId);
/**
@@ -41,6 +48,18 @@ public interface AppRoleService extends IService<AppRole> {
*/
Boolean deleteRoleByIds(Long[] ids);
/**
* 导入角色信息方法
*
* @param excelVOList 角色信息的Excel视图对象列表
* @param bindingResult 数据绑定结果,用于校验
*/
R importRole(List<AppRoleExcelVO> excelVOList, BindingResult bindingResult);
/**
* 获取列表菜单对象
*
* @return 列表菜单对象的实例
*/
AppPageEntity listMenu();
}
@@ -1,12 +1,18 @@
package com.pig4cloud.pigx.app.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pig4cloud.pigx.app.api.entity.AppArticleEntity;
import com.pig4cloud.pigx.app.api.entity.AppPageEntity;
import com.pig4cloud.pigx.app.api.entity.AppRole;
import com.pig4cloud.pigx.app.api.entity.AppTabbarEntity;
import com.pig4cloud.pigx.app.api.enums.PageTypeEnums;
import com.pig4cloud.pigx.app.mapper.AppArticleMapper;
import com.pig4cloud.pigx.app.mapper.AppPageMapper;
import com.pig4cloud.pigx.app.mapper.AppRoleMapper;
import com.pig4cloud.pigx.app.mapper.AppTabbarMapper;
import com.pig4cloud.pigx.app.service.AppIndexService;
import lombok.RequiredArgsConstructor;
@@ -15,6 +21,7 @@ import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* app 页面控制
@@ -27,10 +34,10 @@ import java.util.Map;
@RequiredArgsConstructor
public class AppIndexServiceImpl implements AppIndexService {
private final AppArticleMapper appArticleMapper;
private final AppTabbarMapper appTabbarMapper;
private final AppRoleMapper appRoleMapper;
private final AppPageMapper appPageMapper;
/**
@@ -44,10 +51,7 @@ public class AppIndexServiceImpl implements AppIndexService {
.orderByDesc(AppPageEntity::getCreateTime),
false
);
List<AppArticleEntity> articleList = appArticleMapper
.selectList(Wrappers.<AppArticleEntity>lambdaQuery().orderByDesc(AppArticleEntity::getSort));
response.put("pages", appPageEntity);
response.put("article", articleList);
return response;
}
@@ -73,8 +77,39 @@ public class AppIndexServiceImpl implements AppIndexService {
*/
@Override
public AppPageEntity decorate(Integer pageType) {
return appPageMapper.selectOne(Wrappers.<AppPageEntity>lambdaQuery().eq(AppPageEntity::getPageType, pageType)
.orderByDesc(AppPageEntity::getCreateTime), false);
AppPageEntity appPage = appPageMapper.selectOne(
Wrappers.<AppPageEntity>lambdaQuery()
.eq(AppPageEntity::getPageType, pageType)
.orderByDesc(AppPageEntity::getCreateTime),
false
);
// 如果是工作台页面类型
if (!Objects.equals(PageTypeEnums.WORKBENCH.getPageType(), pageType) || appPage == null) {
return appPage;
}
AppRole appRole = appRoleMapper.selectById(1); // 角色ID根据实际业务调整
List<String> menuIdList = StrUtil.split(appRole.getMenuId(), CharUtil.COMMA);
if (CollUtil.isEmpty(menuIdList)) {
return appPage;
}
JSONArray pageDataArray = JSONUtil.parseArray(appPage.getPageData());
for (Object groupObj : pageDataArray) {
JSONObject group = (JSONObject) groupObj;
JSONArray itemArray = group.getJSONObject("content").getJSONArray("data");
// 使用 removeIf 进行过滤
itemArray.removeIf(item -> {
String menuId = ((JSONObject) item).getStr(AppPageEntity.Fields.id);
return StrUtil.isNotBlank(menuId) && !menuIdList.contains(menuId);
});
}
appPage.setPageData(pageDataArray.toStringPretty());
return appPage;
}
}
@@ -17,16 +17,20 @@
package com.pig4cloud.pigx.app.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pigx.app.api.entity.AppPageEntity;
import com.pig4cloud.pigx.app.api.entity.AppRole;
import com.pig4cloud.pigx.app.api.enums.PageTypeEnums;
import com.pig4cloud.pigx.app.api.vo.AppRoleExcelVO;
import com.pig4cloud.pigx.app.mapper.AppPageMapper;
import com.pig4cloud.pigx.app.mapper.AppRoleMapper;
import com.pig4cloud.pigx.app.service.AppRoleService;
import com.pig4cloud.pigx.common.core.exception.ErrorCodes;
import com.pig4cloud.pigx.common.core.util.MsgUtils;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.excel.vo.ErrorMessage;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
@@ -35,15 +39,21 @@ import java.util.List;
import java.util.Set;
/**
* app角色表
* APP角色服务实现类
* <p>
* 提供对APP角色相关的业务操作实现。
*
* @author aeizzz
* @date 2022-12-07 09:52:03
* @author lengleng
* @date 2025/05/29
*/
@Service
@AllArgsConstructor
@RequiredArgsConstructor
public class AppRoleServiceImpl extends ServiceImpl<AppRoleMapper, AppRole> implements AppRoleService {
private final AppPageMapper appPageMapper;
private final AppRoleMapper appRoleMapper;
@Override
public List<AppRole> findRolesByUserId(Long userId) {
return baseMapper.listRolesByUserId(userId);
@@ -102,6 +112,17 @@ public class AppRoleServiceImpl extends ServiceImpl<AppRoleMapper, AppRole> impl
}
/**
* 获取列表菜单对象
*
* @return 列表菜单对象的实例
*/
@Override
public AppPageEntity listMenu() {
return appPageMapper.selectOne(Wrappers.<AppPageEntity>lambdaQuery()
.eq(AppPageEntity::getPageType, PageTypeEnums.WORKBENCH.getPageType()));
}
private void insertExcelRole(AppRoleExcelVO excel) {
AppRole appRole = new AppRole();
appRole.setRoleName(excel.getRoleName());