Browse Source

用户权限及菜单

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
2b2492c28a
12 changed files with 278 additions and 0 deletions
  1. +14
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/MenuController.java
  2. +15
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/PermissionController.java
  3. +97
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Menu.java
  4. +63
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/OpPermissions.java
  5. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/MenuMapper.java
  6. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/OpPermissionsMapper.java
  7. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/menu/IMenuService.java
  8. +14
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/menu/MenuServiceImpl.java
  9. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/permissions/OpPermissionsService.java
  10. +17
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/permissions/OpPermissionsServiceImpl.java
  11. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/MenuMapper.xml
  12. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/OpPermissionsMapper.xml

+ 14
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/MenuController.java View File

@@ -0,0 +1,14 @@
package com.tuoheng.admin.controller;

import com.tuoheng.common.core.common.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Author ChengWang
* @Date 2022/12/16
*/
@RestController
@RequestMapping("/menu")
public class MenuController extends BaseController {
}

+ 15
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/PermissionController.java View File

@@ -0,0 +1,15 @@
package com.tuoheng.admin.controller;

import com.tuoheng.common.core.common.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Author ChengWang
* @Date 2022/12/16
*/

@RestController
@RequestMapping("/permission")
public class PermissionController extends BaseController {
}

+ 97
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Menu.java View File

@@ -0,0 +1,97 @@
package com.tuoheng.admin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

/**
* <p>
* 系统菜单表
* </p>
*
* @author 拓恒
* @since 2020-10-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("op_menus")
public class Menu extends BaseEntity {

private static final long serialVersionUID = 1L;
/**
* 父级ID
*/
private Integer parentId;

/**
* 菜单名称
*/
private String name;
/**
* 菜单所属client
*/
private String clientId;
/**
* 页面跳转方式
*/
private String target;
/**
* 图标
*/
private String menuIcon;
/**
* 菜单路径
*/
private String path;

/**
* 菜单组件
*/
private String component;
/**
* 1正常 2禁用
*/
private Integer status;

/**
* 0:显示;1:隐藏
*/
private Integer isHidden;

/**
* 显示顺序
*/
private Integer sort;

/**
* 子级菜单
*/
@TableField(exist = false)
private List<Menu> children;

/**
* 是否选中
*/
@TableField(exist = false)
private boolean checked;

/**
* 是否打开
*/
@TableField(exist = false)
private boolean open;

/**
* 权限节点参数
*/
@TableField(exist = false)
private Integer[] checkedList;

}

+ 63
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/OpPermissions.java View File

@@ -0,0 +1,63 @@
package com.tuoheng.admin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;

/**
* 权限配置表
* @TableName op_permissions
*/
@TableName(value ="op_permissions")
@Data
public class OpPermissions extends BaseEntity {

/**
* 所属client
*/
private String clientId;

/**
* code标识
*/
private String code;

/**
* 展示name
*/
private String name;

/**
* 备注信息
*/
private String remark;

/**
* 0:菜单项action-permissions;
*/
private Integer type;

/**
* 关联菜单id
*/
private Integer menuId;

/**
* 接口路径
*/
private String apiUrl;

/**
* 是否选中
*/
@TableField(exist = false)
private boolean checked;

/**
* 是否打开
*/
@TableField(exist = false)
private boolean open;
}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/MenuMapper.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.Menu;

/**
* @Author ChengWang
* @Date 2022/12/16
*/
public interface MenuMapper extends BaseMapper<Menu> {
}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/OpPermissionsMapper.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.OpPermissions;

/**
* @Author ChengWang
* @Date 2022/12/16
*/
public interface OpPermissionsMapper extends BaseMapper<OpPermissions> {
}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/menu/IMenuService.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.admin.service.menu;

import com.tuoheng.admin.entity.Menu;
import com.tuoheng.common.core.common.IBaseService;

/**
* @Author ChengWang
* @Date 2022/12/16
*/
public interface IMenuService extends IBaseService<Menu> {
}

+ 14
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/menu/MenuServiceImpl.java View File

@@ -0,0 +1,14 @@
package com.tuoheng.admin.service.menu;

import com.tuoheng.admin.entity.Menu;
import com.tuoheng.admin.mapper.MenuMapper;
import com.tuoheng.common.core.common.BaseServiceImpl;
import org.springframework.stereotype.Service;

/**
* @Author ChengWang
* @Date 2022/12/16
*/
@Service
public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, Menu> implements IMenuService{
}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/permissions/OpPermissionsService.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.admin.service.permissions;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tuoheng.admin.entity.OpPermissions;

/**
* @Author ChengWang
* @Date 2022/12/16
*/
public interface OpPermissionsService extends IService<OpPermissions> {
}

+ 17
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/permissions/OpPermissionsServiceImpl.java View File

@@ -0,0 +1,17 @@
package com.tuoheng.admin.service.permissions;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tuoheng.admin.entity.OpPermissions;
import com.tuoheng.admin.mapper.OpPermissionsMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
* @Author ChengWang
* @Date 2022/12/16
*/

@Service
@Slf4j
public class OpPermissionsServiceImpl extends ServiceImpl<OpPermissionsMapper, OpPermissions> {
}

+ 7
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/MenuMapper.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.MenuMapper">

</mapper>

+ 7
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/OpPermissionsMapper.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.OpPermissionsMapper">

</mapper>

Loading…
Cancel
Save