Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
c1158932
提交
c1158932
authored
3月 05, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 修复角色分页
上级
09854fac
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
142 行增加
和
44 行删除
+142
-44
SysRole.java
backend/src/main/java/io/dataease/base/domain/SysRole.java
+2
-0
SysRoleExample.java
...src/main/java/io/dataease/base/domain/SysRoleExample.java
+70
-0
SysRoleMapper.xml
...d/src/main/java/io/dataease/base/mapper/SysRoleMapper.xml
+23
-8
ExtSysRoleMapper.java
...in/java/io/dataease/base/mapper/ext/ExtSysRoleMapper.java
+4
-2
ExtSysRoleMapper.xml
...ain/java/io/dataease/base/mapper/ext/ExtSysRoleMapper.xml
+8
-11
SysRoleController.java
...in/java/io/dataease/controller/sys/SysRoleController.java
+9
-3
RoleNodeResponse.java
...io/dataease/controller/sys/response/RoleNodeResponse.java
+0
-14
SysRoleService.java
...src/main/java/io/dataease/service/sys/SysRoleService.java
+7
-3
role.js
frontend/src/api/system/role.js
+8
-1
index.vue
frontend/src/views/system/role/index.vue
+11
-2
没有找到文件。
backend/src/main/java/io/dataease/base/domain/SysRole.java
浏览文件 @
c1158932
...
...
@@ -7,6 +7,8 @@ import lombok.Data;
public
class
SysRole
implements
Serializable
{
private
Long
roleId
;
private
String
code
;
private
String
name
;
private
String
description
;
...
...
backend/src/main/java/io/dataease/base/domain/SysRoleExample.java
浏览文件 @
c1158932
...
...
@@ -164,6 +164,76 @@ public class SysRoleExample {
return
(
Criteria
)
this
;
}
public
Criteria
andCodeIsNull
()
{
addCriterion
(
"code is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeIsNotNull
()
{
addCriterion
(
"code is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeEqualTo
(
String
value
)
{
addCriterion
(
"code ="
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeNotEqualTo
(
String
value
)
{
addCriterion
(
"code <>"
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeGreaterThan
(
String
value
)
{
addCriterion
(
"code >"
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"code >="
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeLessThan
(
String
value
)
{
addCriterion
(
"code <"
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"code <="
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeLike
(
String
value
)
{
addCriterion
(
"code like"
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeNotLike
(
String
value
)
{
addCriterion
(
"code not like"
,
value
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeIn
(
List
<
String
>
values
)
{
addCriterion
(
"code in"
,
values
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"code not in"
,
values
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"code between"
,
value1
,
value2
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCodeNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"code not between"
,
value1
,
value2
,
"code"
);
return
(
Criteria
)
this
;
}
public
Criteria
andNameIsNull
()
{
addCriterion
(
"`name` is null"
);
return
(
Criteria
)
this
;
...
...
backend/src/main/java/io/dataease/base/mapper/SysRoleMapper.xml
浏览文件 @
c1158932
...
...
@@ -3,6 +3,7 @@
<mapper
namespace=
"io.dataease.base.mapper.SysRoleMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.dataease.base.domain.SysRole"
>
<id
column=
"role_id"
jdbcType=
"BIGINT"
property=
"roleId"
/>
<result
column=
"code"
jdbcType=
"VARCHAR"
property=
"code"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"description"
jdbcType=
"VARCHAR"
property=
"description"
/>
<result
column=
"create_by"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
...
...
@@ -69,7 +70,7 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
role_id, `name`, description, create_by, update_by, create_time, update_time
role_id,
code,
`name`, description, create_by, update_by, create_time, update_time
</sql>
<select
id=
"selectByExample"
parameterType=
"io.dataease.base.domain.SysRoleExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -102,12 +103,12 @@
</if>
</delete>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.SysRole"
>
insert into sys_role (role_id,
`name`, description
,
create_by, update_by, create_time
,
update_time)
values (#{roleId,jdbcType=BIGINT}, #{
name,jdbcType=VARCHAR}, #{description
,jdbcType=VARCHAR},
#{
createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT
},
#{updateTime,jdbcType=BIGINT})
insert into sys_role (role_id,
code, `name`
,
description, create_by, update_by
,
create_time,
update_time)
values (#{roleId,jdbcType=BIGINT}, #{
code,jdbcType=VARCHAR}, #{name
,jdbcType=VARCHAR},
#{
description,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR
},
#{
createTime,jdbcType=BIGINT}, #{
updateTime,jdbcType=BIGINT})
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.SysRole"
>
insert into sys_role
...
...
@@ -115,6 +116,9 @@
<if
test=
"roleId != null"
>
role_id,
</if>
<if
test=
"code != null"
>
code,
</if>
<if
test=
"name != null"
>
`name`,
</if>
...
...
@@ -138,6 +142,9 @@
<if
test=
"roleId != null"
>
#{roleId,jdbcType=BIGINT},
</if>
<if
test=
"code != null"
>
#{code,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
...
...
@@ -170,6 +177,9 @@
<if
test=
"record.roleId != null"
>
role_id = #{record.roleId,jdbcType=BIGINT},
</if>
<if
test=
"record.code != null"
>
code = #{record.code,jdbcType=VARCHAR},
</if>
<if
test=
"record.name != null"
>
`name` = #{record.name,jdbcType=VARCHAR},
</if>
...
...
@@ -196,6 +206,7 @@
<update
id=
"updateByExample"
parameterType=
"map"
>
update sys_role
set role_id = #{record.roleId,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
...
...
@@ -209,6 +220,9 @@
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.dataease.base.domain.SysRole"
>
update sys_role
<set>
<if
test=
"code != null"
>
code = #{code,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
`name` = #{name,jdbcType=VARCHAR},
</if>
...
...
@@ -232,7 +246,8 @@
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.dataease.base.domain.SysRole"
>
update sys_role
set `name` = #{name,jdbcType=VARCHAR},
set code = #{code,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
...
...
backend/src/main/java/io/dataease/base/mapper/ext/ExtSysRoleMapper.java
浏览文件 @
c1158932
package
io
.
dataease
.
base
.
mapper
.
ext
;
import
io.dataease.base.domain.SysRole
;
import
io.dataease.controller.sys.request.RoleGridRequest
;
import
io.dataease.controller.sys.response.RoleNodeResponse
;
import
io.dataease.controller.sys.response.RoleUserItem
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -12,11 +12,13 @@ import java.util.Map;
public
interface
ExtSysRoleMapper
{
List
<
RoleNodeRespons
e
>
query
(
@Param
(
"request"
)
RoleGridRequest
request
);
List
<
SysRol
e
>
query
(
@Param
(
"request"
)
RoleGridRequest
request
);
int
deleteRoleMenu
(
@Param
(
"roleId"
)
Long
roleId
);
int
batchInsertRoleMenu
(
@Param
(
"maps"
)
List
<
Map
<
String
,
Long
>>
maps
);
List
<
RoleUserItem
>
queryAll
();
List
<
Long
>
menuIds
(
@Param
(
"roleId"
)
Long
roleId
);
}
backend/src/main/java/io/dataease/base/mapper/ext/ExtSysRoleMapper.xml
浏览文件 @
c1158932
...
...
@@ -2,23 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"io.dataease.base.mapper.ext.ExtSysRoleMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.dataease.controller.sys.response.RoleNodeResponse"
extends=
"io.dataease.base.mapper.SysRoleMapper.BaseResultMap"
>
<result
column=
"menuIds"
property=
"menu_ids"
/>
<collection
property=
"menuIds"
ofType=
"long"
>
<constructor>
<arg
column=
"menu_id"
/>
</constructor>
</collection>
</resultMap>
<resultMap
id=
"roleItemMap"
type=
"io.dataease.controller.sys.response.RoleUserItem"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"name"
column=
"name"
/>
</resultMap>
<select
id=
"query"
resultMap=
"BaseResultMap"
>
select r.*
, m.menu_id
from sys_role r
left join sys_roles_menus m on r.role_id = m.role_id
<select
id=
"query"
resultMap=
"
io.dataease.base.mapper.SysRoleMapper.
BaseResultMap"
>
select r.*
from sys_role r
<where>
<if
test=
"request.name != null"
>
AND r.name like CONCAT('%', #{request.name},'%')
...
...
@@ -43,6 +36,10 @@
select role_id as id, name from sys_role
</select>
<select
id=
"menuIds"
resultType=
"java.lang.Long"
>
select menu_id from sys_roles_menus where role_id = #{roleId}
</select>
</mapper>
backend/src/main/java/io/dataease/controller/sys/SysRoleController.java
浏览文件 @
c1158932
...
...
@@ -8,7 +8,6 @@ import io.dataease.commons.utils.PageUtils;
import
io.dataease.commons.utils.Pager
;
import
io.dataease.controller.sys.request.RoleGridRequest
;
import
io.dataease.controller.sys.request.RoleMenusRequest
;
import
io.dataease.controller.sys.response.RoleNodeResponse
;
import
io.dataease.controller.sys.response.RoleUserItem
;
import
io.dataease.service.sys.SysRoleService
;
import
io.swagger.annotations.Api
;
...
...
@@ -50,9 +49,16 @@ public class SysRoleController {
@ApiOperation
(
"查询角色"
)
@PostMapping
(
"/roleGrid/{goPage}/{pageSize}"
)
public
Pager
<
List
<
RoleNodeRespons
e
>>
roleGrid
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
RoleGridRequest
request
)
{
public
Pager
<
List
<
SysRol
e
>>
roleGrid
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
RoleGridRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
return
PageUtils
.
setPageInfo
(
page
,
sysRoleService
.
query
(
request
));
Pager
<
List
<
SysRole
>>
listPager
=
PageUtils
.
setPageInfo
(
page
,
sysRoleService
.
query
(
request
));
return
listPager
;
}
@ApiOperation
(
"查询角色对应的菜单ID"
)
@PostMapping
(
"/menuIds/{roleId}"
)
public
List
<
Long
>
menuIdsByRoleId
(
@PathVariable
(
"roleId"
)
Long
roleId
){
return
sysRoleService
.
menuIds
(
roleId
);
}
...
...
backend/src/main/java/io/dataease/controller/sys/response/RoleNodeResponse.java
deleted
100644 → 0
浏览文件 @
09854fac
package
io
.
dataease
.
controller
.
sys
.
response
;
import
io.dataease.base.domain.SysRole
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
RoleNodeResponse
extends
SysRole
{
private
List
<
Long
>
menuIds
;
private
List
<
Long
>
dataIds
;
}
backend/src/main/java/io/dataease/service/sys/SysRoleService.java
浏览文件 @
c1158932
...
...
@@ -8,7 +8,6 @@ import io.dataease.base.mapper.SysUsersRolesMapper;
import
io.dataease.base.mapper.ext.ExtSysRoleMapper
;
import
io.dataease.controller.sys.request.RoleGridRequest
;
import
io.dataease.controller.sys.request.RoleMenusRequest
;
import
io.dataease.controller.sys.response.RoleNodeResponse
;
import
io.dataease.controller.sys.response.RoleUserItem
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -32,6 +31,7 @@ public class SysRoleService {
private
SysUsersRolesMapper
sysUsersRolesMapper
;
public
int
add
(
SysRole
role
){
Long
now
=
System
.
currentTimeMillis
();
role
.
setCreateTime
(
now
);
...
...
@@ -56,12 +56,16 @@ public class SysRoleService {
}
public
List
<
RoleNodeRespons
e
>
query
(
RoleGridRequest
request
){
List
<
RoleNodeRespons
e
>
result
=
extSysRoleMapper
.
query
(
request
);
public
List
<
SysRol
e
>
query
(
RoleGridRequest
request
){
List
<
SysRol
e
>
result
=
extSysRoleMapper
.
query
(
request
);
return
result
;
}
public
List
<
Long
>
menuIds
(
Long
roleId
){
return
extSysRoleMapper
.
menuIds
(
roleId
);
}
@Transactional
public
int
batchSaveRolesMenus
(
RoleMenusRequest
request
){
...
...
frontend/src/api/system/role.js
浏览文件 @
c1158932
...
...
@@ -45,4 +45,11 @@ export function addRoleMenus(data) {
data
})
}
export
default
{
addRole
,
editRole
,
delRole
,
roleGrid
,
allRoles
,
addRoleMenus
}
export
function
menuIds
(
roleId
)
{
return
request
({
url
:
'/api/role/menuIds/'
+
roleId
,
method
:
'post'
})
}
export
default
{
addRole
,
editRole
,
delRole
,
roleGrid
,
allRoles
,
addRoleMenus
,
menuIds
}
frontend/src/views/system/role/index.vue
浏览文件 @
c1158932
...
...
@@ -9,6 +9,7 @@
<el-table
border
highlight-current-row
class=
"adjust-table"
:data=
"tableData"
style=
"width: 100%;"
@
row-click=
"rowClick"
>
<el-table-column
prop=
"name"
label=
"名称"
/>
<el-table-column
prop=
"code"
label=
"代码"
/>
<el-table-column
:show-overflow-tooltip=
"true"
prop=
"createTime"
label=
"创建日期"
>
<
template
v-slot:default=
"scope"
>
<span>
{{
scope
.
row
.
createTime
|
timestampFormatDate
}}
</span>
...
...
@@ -58,6 +59,10 @@
<el-input
v-model=
"form.name"
style=
"width: 380px;"
/>
</el-form-item>
<el-form-item
label=
"角色代码"
prop=
"code"
>
<el-input
v-model=
"form.code"
style=
"width: 380px;"
/>
</el-form-item>
<el-form-item
label=
"描述信息"
prop=
"description"
>
<el-input
v-model=
"form.description"
style=
"width: 380px;"
rows=
"5"
type=
"textarea"
/>
</el-form-item>
...
...
@@ -83,7 +88,7 @@ import {
listenGoBack
,
removeGoBackListener
}
from
'@/metersphere/common/js/utils'
import
{
addRole
,
editRole
,
delRole
,
roleGrid
,
addRoleMenus
}
from
'@/api/system/role'
import
{
addRole
,
editRole
,
delRole
,
roleGrid
,
addRoleMenus
,
menuIds
}
from
'@/api/system/role'
import
{
getMenusTree
,
getChild
}
from
'@/api/system/menu'
export
default
{
...
...
@@ -230,7 +235,11 @@ export default {
})
},
rowClick
(
row
,
column
,
event
)
{
this
.
currentRow
=
row
menuIds
(
row
.
roleId
).
then
(
res
=>
{
const
menuIds
=
res
.
data
row
.
menuIds
=
menuIds
this
.
currentRow
=
row
})
},
currentRowChange
(
newVal
,
oldVal
)
{
if
(
newVal
===
oldVal
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论