Compare commits
7 Commits
2.0.0.rc23
...
2.0.0.rc28
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60f996137f | ||
|
|
11c8d234ff | ||
|
|
125c681669 | ||
|
|
b9347013f0 | ||
|
|
3415f0836f | ||
|
|
22672c8a9e | ||
|
|
a405aa7057 |
22
pom.xml
22
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -58,61 +58,61 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-role</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -20,7 +20,7 @@ public @interface RoleAuthority {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String platform() default "web";
|
||||
String platform() default "";
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,4 +30,12 @@ public @interface RoleAuthority {
|
||||
*/
|
||||
String[] group() default {};
|
||||
|
||||
|
||||
/**
|
||||
* 依赖其他权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String[] deps() default {};
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-role</artifactId>
|
||||
|
||||
@@ -103,6 +103,7 @@ public class RoleGroupController {
|
||||
List<CoreRoleGroupRx> list = coreRoleService.getGroupRxMapper().selectList(new QueryWrapper<CoreRoleGroupRx>()
|
||||
.eq(CoreRoleGroupRx.IS_DELETED, 0)
|
||||
.eq("group_id", dto.getId())
|
||||
.eq("type", "bind")
|
||||
);
|
||||
return ApiResp.respOK(list);
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ public interface CoreRoleGroupRxMapper extends BaseMapper<CoreRoleGroupRx> {
|
||||
* @return
|
||||
*/
|
||||
int batchInsert(@Param("list") List<CoreRoleGroupRx> coreRoleGroupRxs);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.tiesheng.role.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.util.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 角色-权限
|
||||
@@ -81,6 +84,18 @@ public class CoreRoleAuthority extends DaoBase {
|
||||
@TableField(value = "version")
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 权限来源:auto-自动生成,input-添加
|
||||
*/
|
||||
@TableField(value = "`source`")
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 依赖权限
|
||||
*/
|
||||
@TableField(value = "deps")
|
||||
private String deps;
|
||||
|
||||
/**
|
||||
* 扩展1
|
||||
*/
|
||||
@@ -315,6 +330,42 @@ public class CoreRoleAuthority extends DaoBase {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限来源:auto-自动生成,input-添加
|
||||
*
|
||||
* @return source - 权限来源:auto-自动生成,input-添加
|
||||
*/
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置权限来源:auto-自动生成,input-添加
|
||||
*
|
||||
* @param source 权限来源:auto-自动生成,input-添加
|
||||
*/
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取依赖权限
|
||||
*
|
||||
* @return deps - 依赖权限
|
||||
*/
|
||||
public String getDeps() {
|
||||
return deps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置依赖权限
|
||||
*
|
||||
* @param deps 依赖权限
|
||||
*/
|
||||
public void setDeps(String deps) {
|
||||
this.deps = deps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取扩展1
|
||||
*
|
||||
@@ -368,4 +419,4 @@ public class CoreRoleAuthority extends DaoBase {
|
||||
public void setExt3(String ext3) {
|
||||
this.ext3 = ext3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,12 @@ public class CoreRoleGroupRx extends DaoBase {
|
||||
@TableField(value = "menu_id")
|
||||
private String menuId;
|
||||
|
||||
/**
|
||||
* 关联类型:dep-依赖,bind-绑定
|
||||
*/
|
||||
@TableField(value = "`type`")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 获取角色id
|
||||
*
|
||||
@@ -59,4 +65,22 @@ public class CoreRoleGroupRx extends DaoBase {
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联类型:dep-依赖,bind-绑定
|
||||
*
|
||||
* @return type - 关联类型:dep-依赖,bind-绑定
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置关联类型:dep-依赖,bind-绑定
|
||||
*
|
||||
* @param type 关联类型:dep-依赖,bind-绑定
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tiesheng.annotation.role.RoleAuthority;
|
||||
import com.tiesheng.role.mapper.*;
|
||||
@@ -79,10 +80,10 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
List<CoreRoleAuthority> distinctList = coreServiceMenuList.stream()
|
||||
.filter(it -> {
|
||||
if (keyMaps.containsKey(it.getId())) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
keyMaps.put(it.getId(), it.getId());
|
||||
return false;
|
||||
return true;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -130,7 +131,17 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
CoreRoleGroupRx coreRoleGroupRx = new CoreRoleGroupRx();
|
||||
coreRoleGroupRx.setGroupId(roleGroup.getId());
|
||||
coreRoleGroupRx.setMenuId(authority.getId());
|
||||
coreRoleGroupRx.setType("bind");
|
||||
list.add(coreRoleGroupRx);
|
||||
|
||||
List<String> deps = JSONUtil.toList(authority.getDeps(), String.class);
|
||||
for (String dep : deps) {
|
||||
CoreRoleGroupRx depRx = new CoreRoleGroupRx();
|
||||
depRx.setGroupId(roleGroup.getId());
|
||||
depRx.setMenuId(StrUtil.format("{}_{}", authority.getService(), dep));
|
||||
depRx.setType("dep");
|
||||
list.add(depRx);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
@@ -263,6 +274,7 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
|
||||
coreRoleAuthorityMapper.delete(new QueryWrapper<CoreRoleAuthority>()
|
||||
.ne("version", version)
|
||||
.ne("source", "auto")
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.tiesheng.role.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.annotation.role.RoleAuthority;
|
||||
import com.tiesheng.role.mapper.CoreRoleAuthorityMapper;
|
||||
import com.tiesheng.role.mapper.CoreRoleUserMapper;
|
||||
@@ -32,6 +33,8 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
String menuPlatform = StrUtil.emptyToDefault(menu.platform(), "web");
|
||||
|
||||
List<CoreRoleAuthority> list = new ArrayList<>();
|
||||
|
||||
// 分组
|
||||
@@ -52,9 +55,10 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
groupAuthority.setService(globalConfig.getService());
|
||||
groupAuthority.setType("group");
|
||||
groupAuthority.setLevel(level);
|
||||
groupAuthority.setPlatform(menu.platform());
|
||||
groupAuthority.setPlatform(menuPlatform);
|
||||
groupAuthority.setParent(parentId);
|
||||
groupAuthority.setVersion(version);
|
||||
groupAuthority.setSource("auto");
|
||||
groupAuthority.setId(StrUtil.join("_", groupAuthority.getService(), groupAuthority.getNo()));
|
||||
list.add(groupAuthority);
|
||||
}
|
||||
@@ -68,8 +72,10 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
menuAuthority.setType("menu");
|
||||
menuAuthority.setLevel(groupAuthority.getLevel() + 1);
|
||||
menuAuthority.setParent(groupAuthority.getId());
|
||||
menuAuthority.setPlatform(menu.platform());
|
||||
menuAuthority.setPlatform(menuPlatform);
|
||||
menuAuthority.setVersion(version);
|
||||
menuAuthority.setSource("auto");
|
||||
menuAuthority.setDeps(JSONUtil.toJsonStr(menu.deps()));
|
||||
menuAuthority.setId(StrUtil.join("_", menuAuthority.getService(), menuAuthority.getNo()));
|
||||
list.add(menuAuthority);
|
||||
|
||||
@@ -83,7 +89,9 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
point.setLevel(menuAuthority.getLevel() + 1);
|
||||
point.setParent(menuAuthority.getId());
|
||||
point.setVersion(version);
|
||||
point.setPlatform(StrUtil.emptyToDefault(authority.platform(), menu.platform()));
|
||||
point.setSource("auto");
|
||||
point.setDeps(JSONUtil.toJsonStr(authority.deps()));
|
||||
point.setPlatform(StrUtil.emptyToDefault(authority.platform(), menuPlatform));
|
||||
point.setId(StrUtil.join("_", point.getService(), point.getNo()));
|
||||
list.add(point);
|
||||
}
|
||||
|
||||
@@ -99,4 +99,13 @@ create table core_role_user
|
||||
alter table core_role_authority
|
||||
add version varchar(50) null comment '版本号' after platform;
|
||||
|
||||
alter table core_role_authority
|
||||
add source varchar(10) null comment '权限来源:auto-自动生成,input-添加' after version;
|
||||
|
||||
alter table core_role_authority
|
||||
add deps text null comment '依赖权限' after source;
|
||||
|
||||
alter table core_role_group_rx
|
||||
add type varchar(10) null comment '关联类型:dep-依赖,bind-绑定';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
<result column="link" jdbcType="LONGVARCHAR" property="link" />
|
||||
<result column="platform" jdbcType="VARCHAR" property="platform" />
|
||||
<result column="version" jdbcType="VARCHAR" property="version" />
|
||||
<result column="source" jdbcType="VARCHAR" property="source" />
|
||||
<result column="deps" jdbcType="LONGVARCHAR" property="deps" />
|
||||
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
|
||||
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
|
||||
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
|
||||
@@ -27,12 +29,12 @@
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, service, `no`, `name`, sort, `level`, parent,
|
||||
remark, is_open, `type`, link, platform, version, ext1, ext2, ext3
|
||||
remark, is_open, `type`, link, platform, version, `source`, deps, ext1, ext2, ext3
|
||||
</sql>
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into core_role_authority(id, create_time, update_time, is_deleted, service, no, name, level, parent,
|
||||
type, platform, is_open, version)
|
||||
type, platform, is_open, version, source, deps)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, now(), now(), 0,
|
||||
@@ -42,7 +44,7 @@
|
||||
#{item.level},
|
||||
#{item.parent},
|
||||
#{item.type},
|
||||
#{item.platform}, 1, #{item.version})
|
||||
#{item.platform}, 1, #{item.version}, #{item.source}, #{item.deps})
|
||||
</foreach>
|
||||
|
||||
on duplicate key update update_time=now(),
|
||||
@@ -51,6 +53,8 @@
|
||||
parent=values(parent),
|
||||
type=values(type),
|
||||
platform=values(platform),
|
||||
source=values(source),
|
||||
deps=values(deps),
|
||||
version=values(version)
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -10,19 +10,20 @@
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="group_id" jdbcType="VARCHAR" property="groupId" />
|
||||
<result column="menu_id" jdbcType="VARCHAR" property="menuId" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, group_id, menu_id
|
||||
id, create_time, update_time, is_deleted, group_id, menu_id, `type`
|
||||
</sql>
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into core_role_group_rx(id, create_time, update_time, is_deleted, group_id, menu_id)
|
||||
values
|
||||
<foreach collection="list" separator="," item="item">
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(uuid(), now(), now(), 0,
|
||||
#{item.groupId},
|
||||
#{item.menuId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
</mapper>
|
||||
@@ -50,8 +50,8 @@
|
||||
select crgr.menu_id
|
||||
from core_role_user cru
|
||||
left join core_role_group_rx crgr on crgr.group_id = cru.type_id
|
||||
where type = 'job'
|
||||
and user_id = #{userId}
|
||||
where cru.type = 'job'
|
||||
and cru.user_id = #{userId}
|
||||
and cru.is_deleted = 0
|
||||
and (cru.expire_time is null or cru.expire_time > now())
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc23</version>
|
||||
<version>2.0.0.rc28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user