Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Skyeye云
Skyeye
提交
7da5dead
S
Skyeye
项目概览
Skyeye云
/
Skyeye
通知
1431
Star
162
Fork
130
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Skyeye
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7da5dead
编写于
9月 18, 2018
作者:
Skyeye云
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
编辑角色,删除角色完成
上级
e425ce08
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
189 addition
and
23 deletion
+189
-23
skyeye-dao/src/main/java/com/skyeye/authority/dao/SysEveRoleDao.java
...src/main/java/com/skyeye/authority/dao/SysEveRoleDao.java
+10
-0
skyeye-service/src/main/java/com/skyeye/authority/service/SysEveRoleService.java
.../java/com/skyeye/authority/service/SysEveRoleService.java
+4
-0
skyeye-service/src/main/java/com/skyeye/authority/service/impl/SysEveRoleServiceImpl.java
.../skyeye/authority/service/impl/SysEveRoleServiceImpl.java
+62
-0
skyeye-web/src/main/java/com/skyeye/authority/controller/SysEveRoleController.java
...com/skyeye/authority/controller/SysEveRoleController.java
+32
-0
skyeye-web/src/main/resources/dbmapper/SysEveRoleMapper.xml
skyeye-web/src/main/resources/dbmapper/SysEveRoleMapper.xml
+46
-0
skyeye-web/src/main/resources/mapping/reqmapping.xml
skyeye-web/src/main/resources/mapping/reqmapping.xml
+9
-0
skyeye-web/src/main/resources/mybatis/SqlMapConfig.xml
skyeye-web/src/main/resources/mybatis/SqlMapConfig.xml
+4
-1
skyeye-web/src/main/webapp/js/syseverole/syseveroleedit.js
skyeye-web/src/main/webapp/js/syseverole/syseveroleedit.js
+21
-21
skyeye-web/src/main/webapp/js/syseverole/syseverolelist.js
skyeye-web/src/main/webapp/js/syseverole/syseverolelist.js
+1
-1
未找到文件。
skyeye-dao/src/main/java/com/skyeye/authority/dao/SysEveRoleDao.java
浏览文件 @
7da5dead
...
@@ -21,5 +21,15 @@ public interface SysEveRoleDao {
...
@@ -21,5 +21,15 @@ public interface SysEveRoleDao {
public
List
<
Map
<
String
,
Object
>>
querySysRoleMenuIdByRoleId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
List
<
Map
<
String
,
Object
>>
querySysRoleMenuIdByRoleId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
Map
<
String
,
Object
>
queryRoleNameByIdAndName
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
editSysRoleMationById
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
deleteRoleMenuByRoleId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
Map
<
String
,
Object
>
queryUserRoleByRoleId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
deleteRoleByRoleId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
}
}
skyeye-service/src/main/java/com/skyeye/authority/service/SysEveRoleService.java
浏览文件 @
7da5dead
...
@@ -13,4 +13,8 @@ public interface SysEveRoleService {
...
@@ -13,4 +13,8 @@ public interface SysEveRoleService {
public
void
querySysRoleMationToEditById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
public
void
querySysRoleMationToEditById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
public
void
editSysRoleMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
public
void
deleteSysRoleMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
}
}
skyeye-service/src/main/java/com/skyeye/authority/service/impl/SysEveRoleServiceImpl.java
浏览文件 @
7da5dead
...
@@ -125,5 +125,67 @@ public class SysEveRoleServiceImpl implements SysEveRoleService{
...
@@ -125,5 +125,67 @@ public class SysEveRoleServiceImpl implements SysEveRoleService{
outputObject
.
setBeans
(
roleMenuId
);
outputObject
.
setBeans
(
roleMenuId
);
outputObject
.
settotal
(
roleMenuId
.
size
());
outputObject
.
settotal
(
roleMenuId
.
size
());
}
}
/**
*
* @Title: editSysRoleMationById
* @Description: 编辑角色
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public
void
editSysRoleMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
Map
<
String
,
Object
>
user
=
inputObject
.
getLogParams
();
Map
<
String
,
Object
>
roleName
=
sysEveRoleDao
.
queryRoleNameByIdAndName
(
map
);
if
(
roleName
==
null
){
List
<
Map
<
String
,
Object
>>
beans
=
new
ArrayList
<>();
String
[]
menuIds
=
map
.
get
(
"menuIds"
).
toString
().
split
(
","
);
if
(
menuIds
.
length
>
0
){
for
(
String
str
:
menuIds
){
Map
<
String
,
Object
>
item
=
new
HashMap
<>();
item
.
put
(
"id"
,
ToolUtil
.
getSurFaceId
());
item
.
put
(
"roleId"
,
map
.
get
(
"id"
).
toString
());
item
.
put
(
"menuId"
,
str
);
item
.
put
(
"createId"
,
user
.
get
(
"id"
));
item
.
put
(
"createTime"
,
ToolUtil
.
getTimeAndToString
());
beans
.
add
(
item
);
}
sysEveRoleDao
.
deleteRoleMenuByRoleId
(
map
);
//删除角色菜单关联表信息
sysEveRoleDao
.
editSysRoleMationById
(
map
);
sysEveRoleDao
.
insertSysRoleMenuMation
(
beans
);
}
else
{
outputObject
.
setreturnMessage
(
"请选择该角色即将拥有的权限!"
);
}
}
else
{
outputObject
.
setreturnMessage
(
"该角色名称已存在,请更换!"
);
}
}
/**
*
* @Title: deleteSysRoleMationById
* @Description: 删除角色
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public
void
deleteSysRoleMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
//判断当前是否有用户在使用该角色
Map
<
String
,
Object
>
bean
=
sysEveRoleDao
.
queryUserRoleByRoleId
(
map
);
if
(
Integer
.
parseInt
(
bean
.
get
(
"num"
).
toString
())
==
0
){
sysEveRoleDao
.
deleteRoleMenuByRoleId
(
map
);
//删除角色菜单关联表信息
sysEveRoleDao
.
deleteRoleByRoleId
(
map
);
//删除角色信息
}
else
{
outputObject
.
setreturnMessage
(
"该角色下有用户正在使用,只能对角色进行维护。"
);
}
}
}
}
skyeye-web/src/main/java/com/skyeye/authority/controller/SysEveRoleController.java
浏览文件 @
7da5dead
...
@@ -79,4 +79,36 @@ public class SysEveRoleController {
...
@@ -79,4 +79,36 @@ public class SysEveRoleController {
sysEveRoleService
.
querySysRoleMationToEditById
(
inputObject
,
outputObject
);
sysEveRoleService
.
querySysRoleMationToEditById
(
inputObject
,
outputObject
);
}
}
/**
*
* @Title: editSysRoleMationById
* @Description: 编辑角色
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping
(
"/post/SysEveRoleController/editSysRoleMationById"
)
@ResponseBody
public
void
editSysRoleMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
sysEveRoleService
.
editSysRoleMationById
(
inputObject
,
outputObject
);
}
/**
*
* @Title: deleteSysRoleMationById
* @Description: 删除角色
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping
(
"/post/SysEveRoleController/deleteSysRoleMationById"
)
@ResponseBody
public
void
deleteSysRoleMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
sysEveRoleService
.
deleteSysRoleMationById
(
inputObject
,
outputObject
);
}
}
}
skyeye-web/src/main/resources/dbmapper/SysEveRoleMapper.xml
浏览文件 @
7da5dead
...
@@ -79,4 +79,50 @@
...
@@ -79,4 +79,50 @@
a.role_id = #{id}
a.role_id = #{id}
</select>
</select>
<select
id=
"queryRoleNameByIdAndName"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id,
a.role_name roleName,
a.role_desc roleDesc
FROM
sys_eve_role a
WHERE
a.id != #{id}
AND a.role_name = #{roleName}
</select>
<update
id=
"editSysRoleMationById"
parameterType=
"java.util.Map"
>
UPDATE sys_eve_role
<set>
role_name = #{roleName},
role_desc = #{roleDesc},
</set>
WHERE id = #{id}
</update>
<delete
id=
"deleteRoleMenuByRoleId"
parameterType=
"java.util.Map"
>
DELETE
FROM
sys_eve_role_menu
WHERE
role_id = #{id}
</delete>
<delete
id=
"deleteRoleByRoleId"
parameterType=
"java.util.Map"
>
DELETE
FROM
sys_eve_role
WHERE
id = #{id}
</delete>
<select
id=
"queryUserRoleByRoleId"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
IFNULL(COUNT(*), 0) num
FROM
sys_eve_user a
WHERE
INSTR(CONCAT(',', #{id}, ','), CONCAT(',', a.role_id, ','))
</select>
</mapper>
</mapper>
\ No newline at end of file
skyeye-web/src/main/resources/mapping/reqmapping.xml
浏览文件 @
7da5dead
...
@@ -85,5 +85,14 @@
...
@@ -85,5 +85,14 @@
<url
id=
"sys016"
path=
"/post/SysEveRoleController/querySysRoleMationToEditById"
val=
"编辑角色时的信息回显"
>
<url
id=
"sys016"
path=
"/post/SysEveRoleController/querySysRoleMationToEditById"
val=
"编辑角色时的信息回显"
>
<property
id=
"rowId"
name=
"id"
ref=
"required"
var=
"角色ID"
/>
<property
id=
"rowId"
name=
"id"
ref=
"required"
var=
"角色ID"
/>
</url>
</url>
<url
id=
"sys017"
path=
"/post/SysEveRoleController/editSysRoleMationById"
val=
"编辑角色"
>
<property
id=
"roleName"
name=
"roleName"
ref=
"required"
var=
"角色名称"
/>
<property
id=
"roleDesc"
name=
"roleDesc"
ref=
""
var=
"角色描述"
/>
<property
id=
"menuIds"
name=
"menuIds"
ref=
"required"
var=
"菜单权限"
/>
<property
id=
"rowId"
name=
"id"
ref=
"required"
var=
"角色ID"
/>
</url>
<url
id=
"sys018"
path=
"/post/SysEveRoleController/deleteSysRoleMationById"
val=
"删除角色"
>
<property
id=
"rowId"
name=
"id"
ref=
"required"
var=
"角色ID"
/>
</url>
</controller>
</controller>
\ No newline at end of file
skyeye-web/src/main/resources/mybatis/SqlMapConfig.xml
浏览文件 @
7da5dead
...
@@ -3,5 +3,8 @@
...
@@ -3,5 +3,8 @@
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<configuration>
<!-- 打印sql日志 -->
<settings>
<setting
name=
"logImpl"
value=
"STDOUT_LOGGING"
/>
</settings>
</configuration>
</configuration>
\ No newline at end of file
skyeye-web/src/main/webapp/js/syseverole/syseveroleedit.js
浏览文件 @
7da5dead
...
@@ -35,10 +35,11 @@ layui.config({
...
@@ -35,10 +35,11 @@ layui.config({
var
params
=
{
var
params
=
{
roleName
:
$
(
"
#roleName
"
).
val
(),
roleName
:
$
(
"
#roleName
"
).
val
(),
roleDesc
:
$
(
"
#roleDesc
"
).
val
(),
roleDesc
:
$
(
"
#roleDesc
"
).
val
(),
menuIds
:
menuIds
menuIds
:
menuIds
,
rowId
:
parent
.
rowId
};
};
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys01
5
"
,
params
:
params
,
type
:
'
json
'
,
callback
:
function
(
json
){
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys01
7
"
,
params
:
params
,
type
:
'
json
'
,
callback
:
function
(
json
){
if
(
json
.
returnCode
==
0
){
if
(
json
.
returnCode
==
0
){
parent
.
layer
.
close
(
index
);
parent
.
layer
.
close
(
index
);
parent
.
refreshCode
=
'
0
'
;
parent
.
refreshCode
=
'
0
'
;
...
@@ -78,27 +79,26 @@ layui.config({
...
@@ -78,27 +79,26 @@ layui.config({
});
});
//绑定按钮事件
//绑定按钮事件
fsCommon
.
buttonEvent
(
"
tree
"
,
getTree
);
fsCommon
.
buttonEvent
(
"
tree
"
,
getTree
);
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys016
"
,
params
:{
rowId
:
parent
.
rowId
},
type
:
'
json
'
,
callback
:
function
(
json
){
if
(
json
.
returnCode
==
0
){
$
(
"
#roleName
"
).
val
(
json
.
bean
.
roleName
);
$
(
"
#roleDesc
"
).
val
(
json
.
bean
.
roleDesc
);
var
zTreeObj
=
$
.
fn
.
zTree
.
getZTreeObj
(
"
treeDemo
"
);
var
zTree
=
zTreeObj
.
getCheckedNodes
(
false
);
for
(
var
i
=
0
;
i
<
zTree
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
json
.
rows
.
length
;
j
++
){
if
(
zTree
[
i
].
id
==
json
.
rows
[
j
].
menuId
){
zTreeObj
.
checkNode
(
zTree
[
i
],
true
);
json
.
rows
.
splice
(
j
,
1
);
}
}
}
}
else
{
top
.
winui
.
window
.
msg
(
json
.
returnMessage
,
{
icon
:
2
,
time
:
2000
});
}
}});
}
}
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys016
"
,
params
:{
rowId
:
parent
.
rowId
},
type
:
'
json
'
,
callback
:
function
(
json
){
if
(
json
.
returnCode
==
0
){
$
(
"
#roleName
"
).
val
(
json
.
bean
.
roleName
);
$
(
"
#roleDesc
"
).
val
(
json
.
bean
.
roleDesc
);
var
zTreeObj
=
$
.
fn
.
zTree
.
getZTreeObj
(
"
treeDemo
"
);
var
zTree
=
zTreeObj
.
getCheckedNodes
(
false
);
for
(
var
i
=
0
;
i
<
zTree
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
json
.
rows
.
length
;
j
++
){
if
(
zTree
[
i
].
id
==
json
.
rows
[
j
].
menuId
){
zTreeObj
.
checkNode
(
zTree
[
i
],
true
);
json
.
rows
.
splice
(
j
,
1
);
}
}
}
}
else
{
top
.
winui
.
window
.
msg
(
json
.
returnMessage
,
{
icon
:
2
,
time
:
2000
});
}
}});
function
getTree
(
treeId
)
{
function
getTree
(
treeId
)
{
if
(
$
.
isEmpty
(
trees
))
{
if
(
$
.
isEmpty
(
trees
))
{
fsCommon
.
warnMsg
(
"
未配置tree!
"
);
fsCommon
.
warnMsg
(
"
未配置tree!
"
);
...
...
skyeye-web/src/main/webapp/js/syseverole/syseverolelist.js
浏览文件 @
7da5dead
...
@@ -57,7 +57,7 @@ layui.config({
...
@@ -57,7 +57,7 @@ layui.config({
layer
.
confirm
(
msg
,
{
icon
:
3
,
title
:
'
删除角色
'
},
function
(
index
)
{
layer
.
confirm
(
msg
,
{
icon
:
3
,
title
:
'
删除角色
'
},
function
(
index
)
{
layer
.
close
(
index
);
layer
.
close
(
index
);
//向服务端发送删除指令
//向服务端发送删除指令
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys01
1
"
,
params
:{
rowId
:
data
.
id
},
type
:
'
json
'
,
callback
:
function
(
json
){
AjaxPostUtil
.
request
({
url
:
reqBasePath
+
"
sys01
8
"
,
params
:{
rowId
:
data
.
id
},
type
:
'
json
'
,
callback
:
function
(
json
){
if
(
json
.
returnCode
==
0
){
if
(
json
.
returnCode
==
0
){
top
.
winui
.
window
.
msg
(
"
删除成功
"
,
{
icon
:
1
,
time
:
2000
});
top
.
winui
.
window
.
msg
(
"
删除成功
"
,
{
icon
:
1
,
time
:
2000
});
loadTable
();
loadTable
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录