Browse Source

Merge branch 'develop' of gitadmin/tuoheng_oidc into release

tags/v2.4.1
xuziqing 1 year ago
parent
commit
9bff799666
13 changed files with 47 additions and 53 deletions
  1. +3
    -4
      tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/op/MenuController.java
  2. +4
    -4
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/op/MenusMapper.java
  3. +2
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/RoleMenuPermissionDto.java
  4. +2
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/entity/Menu.java
  5. +2
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/MenuVo.java
  6. +1
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/MenuindexVo.java
  7. +2
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/RolePermissionVo.java
  8. +10
    -14
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/Impl/MenusServiceImpl.java
  9. +6
    -6
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/Impl/PermissionsServiceImpl.java
  10. +7
    -7
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/Impl/RolesServiceImpl.java
  11. +3
    -3
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/MenusService.java
  12. +2
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/third/vo/RoleMenuVo.java
  13. +3
    -3
      tuoheng_oidc_admin/src/main/resources/mapper/MenusMapper.xml

+ 3
- 4
tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/op/MenuController.java View File

@@ -1,12 +1,11 @@
package com.tuoheng.controller.op;

import com.tuoheng.model.dto.LoginUser;
import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import com.tuoheng.model.query.MenuQuery;
import com.tuoheng.service.CurrentUser;
import com.tuoheng.service.op.MenusService;
import com.tuoheng.until.JsonResult;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@@ -39,7 +38,7 @@ public class MenuController {
* @return
*/
@PostMapping("/add")
public JsonResult add(@RequestBody Menus entity, @CurrentUser LoginUser loginUser) {
public JsonResult add(@RequestBody Menu entity, @CurrentUser LoginUser loginUser) {
return menuService.edit(entity, loginUser);
}

@@ -50,7 +49,7 @@ public class MenuController {
* @return
*/
@PostMapping("/edit")
public JsonResult edit(@RequestBody Menus entity, @CurrentUser LoginUser loginUser) {
public JsonResult edit(@RequestBody Menu entity, @CurrentUser LoginUser loginUser) {
return menuService.edit(entity, loginUser);
}


+ 4
- 4
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/op/MenusMapper.java View File

@@ -1,6 +1,6 @@
package com.tuoheng.mapper.op;

import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -14,11 +14,11 @@ import java.util.List;
* @Entity com.tuoheng.model.entity.Menus
*/
@Mapper
public interface MenusMapper extends BaseMapper<Menus> {
public interface MenusMapper extends BaseMapper<Menu> {

List<Menus> getOpMenusByRoleId(@Param("roleId") Integer roleId);
List<Menu> getOpMenusByRoleId(@Param("roleId") Integer roleId);

List<Menus> getChildrenMenuByPid(@Param("parentId") Integer parentId);
List<Menu> getChildrenMenuByPid(@Param("parentId") Integer parentId);


}

+ 2
- 2
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/RoleMenuPermissionDto.java View File

@@ -1,6 +1,6 @@
package com.tuoheng.model.dto;

import com.tuoheng.model.vo.MenusVo;
import com.tuoheng.model.vo.MenuVo;
import com.tuoheng.model.vo.OpPermissionsVo;
import lombok.Data;

@@ -19,7 +19,7 @@ public class RoleMenuPermissionDto {
/**
*对应的菜单集合->及子菜单(按钮)
*/
private List<MenusVo> opMenusList;
private List<MenuVo> opMenusList;
/**
* 对应的权限集合
*/

tuoheng_oidc_admin/src/main/java/com/tuoheng/model/entity/Menus.java → tuoheng_oidc_admin/src/main/java/com/tuoheng/model/entity/Menu.java View File

@@ -18,7 +18,7 @@ import java.util.List;
*/
@TableName(value ="op_menus")
@Data
public class Menus implements Serializable {
public class Menu implements Serializable {
/**
* id
*/
@@ -109,7 +109,7 @@ public class Menus implements Serializable {
* 子级菜单
*/
@TableField(exist = false)
private List<Menus> children;
private List<Menu> children;

/**
* 是否选中

tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/MenusVo.java → tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/MenuVo.java View File

@@ -1,6 +1,6 @@
package com.tuoheng.model.vo;

import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import lombok.Data;

/**
@@ -8,7 +8,7 @@ import lombok.Data;
* @Date 2022/11/28 11:55
*/
@Data
public class MenusVo extends Menus {
public class MenuVo extends Menu {
/**
* 标识id
*/

+ 1
- 2
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/MenuindexVo.java View File

@@ -1,6 +1,5 @@
package com.tuoheng.model.vo;

import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Permissions;
import lombok.Data;

@@ -15,7 +14,7 @@ public class MenuindexVo {
/**
* 菜单集合
*/
private List<MenusVo> menuListVoList;
private List<MenuVo> menuListVoList;
/**
* 权限集合
*/

+ 2
- 2
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/RolePermissionVo.java View File

@@ -1,6 +1,6 @@
package com.tuoheng.model.vo;

import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import com.tuoheng.model.entity.Permissions;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -21,7 +21,7 @@ public class RolePermissionVo {
/**
*对应的菜单集合->及子菜单(按钮)
*/
private List<Menus> opMenusList;
private List<Menu> opMenusList;
/**
* 对应的权限集合
*/

+ 10
- 14
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/Impl/MenusServiceImpl.java View File

@@ -2,21 +2,18 @@ package com.tuoheng.service.op.Impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tuoheng.common.BaseQuery;
import com.tuoheng.enums.MarkTypeEnum;
import com.tuoheng.mapper.op.PermissionsMapper;
import com.tuoheng.mapper.op.RoleMenuMapper;
import com.tuoheng.model.dto.LoginUser;
import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import com.tuoheng.model.entity.Permissions;
import com.tuoheng.model.entity.RoleMenu;
import com.tuoheng.model.query.MenuQuery;
import com.tuoheng.model.vo.MenuindexVo;
import com.tuoheng.model.vo.MenusVo;
import com.tuoheng.model.vo.MenuVo;
import com.tuoheng.service.op.MenusService;
import com.tuoheng.mapper.op.MenusMapper;
import com.tuoheng.until.JsonResult;
@@ -24,7 +21,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@@ -34,7 +30,7 @@ import java.util.stream.Collectors;
* @createDate 2023-03-20 14:50:28
*/
@Service
public class MenusServiceImpl extends ServiceImpl<MenusMapper, Menus>
public class MenusServiceImpl extends ServiceImpl<MenusMapper, Menu>
implements MenusService {

@Autowired
@@ -61,13 +57,13 @@ public class MenusServiceImpl extends ServiceImpl<MenusMapper, Menus>

vo.setPermissionList(permissions);
//获取菜单列表
List<Menus> menus = menusMapper.selectList(Wrappers.<Menus>lambdaQuery()
.like(ObjectUtil.isNotEmpty(query.getName()), Menus::getName, query.getName())
.eq(Menus::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(Menus::getSort));
List<Menu> menus = menusMapper.selectList(Wrappers.<Menu>lambdaQuery()
.like(ObjectUtil.isNotEmpty(query.getName()), Menu::getName, query.getName())
.eq(Menu::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(Menu::getSort));
//封装
List<MenusVo> collect = menus.stream().map(item -> {
MenusVo menuListVo = new MenusVo();
List<MenuVo> collect = menus.stream().map(item -> {
MenuVo menuListVo = new MenuVo();
BeanUtils.copyProperties(item, menuListVo);
return menuListVo;
}).collect(Collectors.toList());
@@ -83,7 +79,7 @@ public class MenusServiceImpl extends ServiceImpl<MenusMapper, Menus>
* @return
*/
@Override
public JsonResult edit(Menus entity, LoginUser loginUser) {
public JsonResult edit(Menu entity, LoginUser loginUser) {
if (entity == null) {
return JsonResult.error("实体对象不存在");
}

+ 6
- 6
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/Impl/PermissionsServiceImpl.java View File

@@ -8,7 +8,7 @@ import com.tuoheng.mapper.op.PermissionsMapper;
import com.tuoheng.mapper.op.RoleMenuMapper;
import com.tuoheng.mapper.op.RolePermissionMapper;
import com.tuoheng.model.dto.LoginUser;
import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import com.tuoheng.model.entity.Permissions;
import com.tuoheng.model.entity.RoleMenu;
import com.tuoheng.model.entity.RolePermission;
@@ -47,10 +47,10 @@ public class PermissionsServiceImpl extends ServiceImpl<PermissionsMapper, Permi
public JsonResult getRolePermissionByRoleId(RoleClientQuery query) {
RolePermissionVo vo = new RolePermissionVo();
//根据角色id查询出对应的菜单列表 -> 无父级
List<Menus> opMenusDtoList = menusMapper.getOpMenusByRoleId(query.getRoleId());
List<Menu> opMenusDtoList = menusMapper.getOpMenusByRoleId(query.getRoleId());


for (Menus menus : opMenusDtoList) {
for (Menu menus : opMenusDtoList) {
//根据父级id查询出对应所属的菜单
extracted(query, menus);
}
@@ -95,15 +95,15 @@ public class PermissionsServiceImpl extends ServiceImpl<PermissionsMapper, Permi
* @param query
* @param item
*/
private void extracted(RoleClientQuery query, Menus item) {
List<Menus> list = menusMapper.getChildrenMenuByPid(item.getId());
private void extracted(RoleClientQuery query, Menu item) {
List<Menu> list = menusMapper.getChildrenMenuByPid(item.getId());
if (ObjectUtil.isNotEmpty(list)) {
// 获取角色菜单列表
List<RoleMenu> roleMenuList = roleMenuMapper.selectList(Wrappers.<RoleMenu>lambdaQuery()
.eq(RoleMenu::getRoleId, query.getRoleId())
.select(RoleMenu::getMenuId));
List<Integer> menuIds = roleMenuList.stream().map(p -> p.getMenuId()).collect(Collectors.toList());
List<Menus> collect = list.stream().map(t -> {
List<Menu> collect = list.stream().map(t -> {
if (menuIds.contains(t.getId())) {
t.setChecked(true);
t.setOpen(true);

+ 7
- 7
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/Impl/RolesServiceImpl.java View File

@@ -18,7 +18,7 @@ import com.tuoheng.model.entity.*;
import com.tuoheng.model.po.UserPo;
import com.tuoheng.model.query.RoleClientQuery;
import com.tuoheng.model.query.RoleQuery;
import com.tuoheng.model.vo.MenusVo;
import com.tuoheng.model.vo.MenuVo;
import com.tuoheng.model.vo.OpPermissionsVo;
import com.tuoheng.model.vo.RoleListVo;
import com.tuoheng.service.op.RoleMenuService;
@@ -152,10 +152,10 @@ public class RolesServiceImpl extends ServiceImpl<RolesMapper, Roles>

RoleMenuPermissionDto dto = new RoleMenuPermissionDto();
Integer roleId = query.getRoleId();
List<Menus> menuList = menusMapper.selectList(Wrappers.<Menus>lambdaQuery()
.eq(Menus::getMark, MarkTypeEnum.VALID.getCode())
.eq(Menus::getStatus, CommonConstant.ONE)
.orderByAsc(Menus::getSort));
List<Menu> menuList = menusMapper.selectList(Wrappers.<Menu>lambdaQuery()
.eq(Menu::getMark, MarkTypeEnum.VALID.getCode())
.eq(Menu::getStatus, CommonConstant.ONE)
.orderByAsc(Menu::getSort));
if (!menuList.isEmpty()) {
// 获取角色菜单列表
List<RoleMenu> roleMenuList = roleMenuMapper.selectList(Wrappers.<RoleMenu>lambdaQuery()
@@ -169,8 +169,8 @@ public class RolesServiceImpl extends ServiceImpl<RolesMapper, Roles>
}
});
}
List<MenusVo> collect = menuList.stream().map(t -> {
MenusVo menusVo = new MenusVo();
List<MenuVo> collect = menuList.stream().map(t -> {
MenuVo menusVo = new MenuVo();
BeanUtils.copyProperties(t, menusVo);
menusVo.setIdentificationId(t.getId().toString());
return menusVo;

+ 3
- 3
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/op/MenusService.java View File

@@ -1,7 +1,7 @@
package com.tuoheng.service.op;

import com.tuoheng.model.dto.LoginUser;
import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tuoheng.model.query.MenuQuery;
import com.tuoheng.until.JsonResult;
@@ -11,9 +11,9 @@ import com.tuoheng.until.JsonResult;
* @description 针对表【op_menus(菜单表)】的数据库操作Service
* @createDate 2023-03-20 14:50:28
*/
public interface MenusService extends IService<Menus> {
public interface MenusService extends IService<Menu> {

JsonResult getList(MenuQuery menuQuery);

JsonResult edit(Menus entity, LoginUser loginUser);
JsonResult edit(Menu entity, LoginUser loginUser);
}

+ 2
- 2
tuoheng_oidc_admin/src/main/java/com/tuoheng/third/vo/RoleMenuVo.java View File

@@ -1,6 +1,6 @@
package com.tuoheng.third.vo;

import com.tuoheng.model.entity.Menus;
import com.tuoheng.model.entity.Menu;
import lombok.Data;

import java.util.List;
@@ -18,5 +18,5 @@ public class RoleMenuVo {
/**
*对应的菜单集合->及子菜单(按钮)
*/
private List<Menus> opMenusList;
private List<Menu> opMenusList;
}

+ 3
- 3
tuoheng_oidc_admin/src/main/resources/mapper/MenusMapper.xml View File

@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.mapper.op.MenusMapper">

<resultMap id="BaseResultMap" type="com.tuoheng.model.entity.Menus">
<resultMap id="BaseResultMap" type="com.tuoheng.model.entity.Menu">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
@@ -32,7 +32,7 @@
</sql>

<!--根据角色id获取对应的菜单集合 无父级-->
<select id="getOpMenusByRoleId" resultType="com.tuoheng.model.entity.Menus">
<select id="getOpMenusByRoleId" resultType="com.tuoheng.model.entity.Menu">
select
<include refid="Base_Column_List"/>
from op_menus
@@ -43,7 +43,7 @@
</select>

<!--根据父级id查询所属对应的菜单列表-->
<select id="getChildrenMenuByPid" resultType="com.tuoheng.model.entity.Menus">
<select id="getChildrenMenuByPid" resultType="com.tuoheng.model.entity.Menu">
select
<include refid="Base_Column_List"/>
from op_menus

Loading…
Cancel
Save