瀏覽代碼

修改统计时间最新的五条

tags/v1.0.0^2
chengwang 1 年之前
父節點
當前提交
41ee7970d5
共有 8 個文件被更改,包括 139 次插入0 次删除
  1. +14
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/RoleMenuController.java
  2. +27
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/OpRolePermission.java
  3. +37
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/RoleMenu.java
  4. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/RoleMenuMapper.java
  5. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IRoleMenuService.java
  6. +15
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/RoleMenuServiceImpl.java
  7. +18
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/role/RoleServiceImpl.java
  8. +6
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/RoleMenuMapper.xml

+ 14
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/RoleMenuController.java 查看文件

@@ -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("/role-menu")
public class RoleMenuController extends BaseController {
}

+ 27
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/OpRolePermission.java 查看文件

@@ -0,0 +1,27 @@
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;

/**
* 角色可操作的permission
* @TableName op_role_permission
*/
@TableName(value ="op_role_permission")
@Data
public class OpRolePermission extends BaseEntity {

/**
* 角色id
*/
private String roleId;
/**
* 权限id
*/
private String permissionId;

@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

+ 37
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/RoleMenu.java 查看文件

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

import com.baomidou.mybatisplus.annotation.TableName;

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

/**
* <p>
* 角色菜单关联表
* </p>
*
* @author 拓恒
* @since 2020-10-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("op_role_menu")
public class RoleMenu extends BaseEntity {

private static final long serialVersionUID = 1L;

/**
* 角色ID
*/
private String roleId;

/**
* 菜单ID
*/
private String menuId;


}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/RoleMenuMapper.java 查看文件

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

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

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

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IRoleMenuService.java 查看文件

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

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

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

+ 15
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/RoleMenuServiceImpl.java 查看文件

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

import com.tuoheng.admin.entity.RoleMenu;
import com.tuoheng.admin.mapper.RoleMenuMapper;
import com.tuoheng.admin.service.IRoleMenuService;
import com.tuoheng.common.core.common.BaseServiceImpl;
import org.springframework.stereotype.Service;

/**
* @Author ChengWang
* @Date 2022/12/16
*/
@Service
public class RoleMenuServiceImpl extends BaseServiceImpl<RoleMenuMapper, RoleMenu> implements IRoleMenuService {
}

+ 18
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/role/RoleServiceImpl.java 查看文件

@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.Role;
import com.tuoheng.admin.mapper.RoleMapper;
@@ -118,6 +119,23 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, Role> implement
if (collect.contains(roleIds)) {
return JsonResult.error("初始化配置角色不能删除");
}
// for (Integer roleId : roleIds) {
// List<RoleMenu> roleMenus = roleMenuMapper.selectList(Wrappers.<RoleMenu>lambdaQuery().eq(RoleMenu::getRoleId, roleId).eq(BaseEntity::getMark, 1));
// if (roleMenus.size() > 0 && StringUtils.isNotEmpty(roleMenus)) {
// return JsonResult.error("该角色已配置菜单不能删除!");
// }
// List<OpRolePermission> opRolePermissionList = opRolePermissionMapper.selectList(Wrappers.<OpRolePermission>lambdaQuery().eq(OpRolePermission::getRoleId,roleId).eq(BaseEntity::getMark, 1));
// if (opRolePermissionList.size() > 0 && StringUtils.isNotEmpty(opRolePermissionList)) {
// return JsonResult.error("该角色已配置权限不能删除!");
// }
// List<UserRoleDto> userRoles = userRoleMapper.getListByRoleId(roleId, ShiroUtils.getTenantId());
// if (userRoles.size() > 0 && StringUtils.isNotEmpty(userRoles)) {
// return JsonResult.error("该角色已经分配用户不能删除!");
// }
// Role role = roleMapper.selectById(roleId);
// role.setMark(0);
// roleMapper.updateById(role);
// }


return null;

+ 6
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/RoleMenuMapper.xml 查看文件

@@ -0,0 +1,6 @@
<?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.RoleMenuMapper">


</mapper>

Loading…
取消
儲存