Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-shiro
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
xzxt-shiro
Commits
dbde765f
Commit
dbde765f
authored
Sep 19, 2018
by
liuyongshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改批量授权的bug;完善角色子父级关系;
parent
8dbcf869
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
16 deletions
+31
-16
src/main/java/com/xzxtshiro/controller/admin/SysUserController.java
+2
-3
src/main/java/com/xzxtshiro/mapper/SysRoleMapper.xml
+8
-3
src/main/java/com/xzxtshiro/pojo/SysRole.java
+3
-0
src/main/java/com/xzxtshiro/service/imp/SysUserServiceImpl.java
+4
-0
src/main/webapp/WEB-INF/jsp/admin/role/add.jsp
+4
-2
src/main/webapp/WEB-INF/jsp/admin/role/update.jsp
+6
-5
src/main/webapp/WEB-INF/jsp/admin/user/batchUpdate.jsp
+4
-3
No files found.
src/main/java/com/xzxtshiro/controller/admin/SysUserController.java
View file @
dbde765f
...
...
@@ -126,9 +126,6 @@ public class SysUserController {
//添加限制条件根据用户权限筛选用户能够看到的列表
//grade:X=县级,D=地市级,S=省级,T=特级
//1.举个栗子,陕西省渭南市用户只能看到渭南市以下的用户
System
.
out
.
println
(
"usergrade===================="
+
usergrade
);
if
(
usergrade
!=
null
&&!
""
.
equals
(
usergrade
)){
dw
=
subUnitCode
(
usergrade
,
dlUser
.
getUnitcode
(),
dw
);
}
...
...
@@ -340,6 +337,8 @@ public class SysUserController {
String
ids
=
user
.
getIds
();
ids
=
ids
.
replace
(
" "
,
""
);
String
[]
idList
=
ids
.
split
(
","
);
System
.
out
.
println
(
idList
);
System
.
out
.
println
(
user
.
getRoleId
());
for
(
int
i
=
0
;
i
<
idList
.
length
;
i
++){
SysUser
thisUser
=
new
SysUser
();
thisUser
.
setId
(
idList
[
i
]);
...
...
src/main/java/com/xzxtshiro/mapper/SysRoleMapper.xml
View file @
dbde765f
...
...
@@ -16,10 +16,11 @@
<result
column=
"SFFB"
property=
"sffb"
jdbcType=
"VARCHAR"
/>
<result
column=
"PID"
property=
"pid"
jdbcType=
"VARCHAR"
/>
<result
column=
"TYPE"
property=
"type"
jdbcType=
"VARCHAR"
/>
<result
column=
"ISPARENT"
property=
"isParent"
jdbcType=
"VARCHAR"
/>
<result
column=
"rn"
property=
"rn"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
ID, ROLENAME, DESCRIPTION, LRR, LRSJ, GXR, GXSJ, LRDWDM, LRDWMC, SCBZ, IP, SFFB , PID , TYPE
ID, ROLENAME, DESCRIPTION, LRR, LRSJ, GXR, GXSJ, LRDWDM, LRDWMC, SCBZ, IP, SFFB , PID ,
ISPARENT ,
TYPE
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
...
...
@@ -107,6 +108,9 @@
<if
test=
"pid != null"
>
AND pid = #{pid,jdbcType=VARCHAR}
</if>
<if
test=
"isParent != null"
>
AND ISPARENT = #{isParent,jdbcType=VARCHAR}
</if>
<if
test=
"type != null"
>
AND type = #{type,jdbcType=VARCHAR}
</if>
...
...
@@ -119,11 +123,11 @@
insert into SYS_ROLE (ID, ROLENAME, DESCRIPTION,
LRR, LRSJ, GXR, GXSJ,
LRDWDM, LRDWMC, SCBZ,
IP, SFFB, PID, TYPE)
IP, SFFB, PID,
ISPARENT,
TYPE)
values (#{id,jdbcType=VARCHAR}, #{rolename,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{lrr,jdbcType=VARCHAR}, #{lrsj,jdbcType=DATE}, #{gxr,jdbcType=VARCHAR}, #{gxsj,jdbcType=DATE},
#{lrdwdm,jdbcType=VARCHAR}, #{lrdwmc,jdbcType=VARCHAR}, #{scbz,jdbcType=DECIMAL},
#{ip,jdbcType=VARCHAR}, #{sffb,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR})
#{ip,jdbcType=VARCHAR}, #{sffb,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{
isParent,jdbcType=VARCHAR}, #{
type,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.xzxtshiro.pojo.SysRole"
>
insert into SYS_ROLE
...
...
@@ -208,6 +212,7 @@
update SYS_ROLE
set ROLENAME = #{rolename,jdbcType=VARCHAR},
TYPE = #{type,jdbcType=VARCHAR},
ISPARENT = #{isParent,jdbcType=VARCHAR},
PID = #{pid,jdbcType=VARCHAR},
DESCRIPTION = #{description,jdbcType=VARCHAR},
GXR = #{gxr,jdbcType=VARCHAR},
...
...
src/main/java/com/xzxtshiro/pojo/SysRole.java
View file @
dbde765f
...
...
@@ -35,5 +35,7 @@ public class SysRole extends BaseModel implements Serializable {
/**权限组的name合集*/
protected
String
permissionName
;
protected
String
isParent
;
}
\ No newline at end of file
src/main/java/com/xzxtshiro/service/imp/SysUserServiceImpl.java
View file @
dbde765f
...
...
@@ -279,9 +279,13 @@ public class SysUserServiceImpl implements SysUserService {
sysUserRole
.
setScbz
(
0
);
userRoles
.
add
(
sysUserRole
);
}
System
.
out
.
println
(
"角色信息"
);
System
.
out
.
println
(
userRoles
);
if
(
userRoles
.
size
()>
0
){
int
c
=
userDao
.
batchAddSysUserRole
(
userRoles
);
}
}
}
/**
* 批量授权功能,两步操作,删除原有的权限,增加新的权限
...
...
src/main/webapp/WEB-INF/jsp/admin/role/add.jsp
View file @
dbde765f
...
...
@@ -64,8 +64,8 @@
<div
class=
"layui-input-block"
>
<select
id=
"isParent"
name=
"isParent"
lay-verify=
"required"
lay-filter=
"isParent"
>
<option
value=
""
>
请选择
</option>
<option
value=
"0
1
"
>
父级
</option>
<option
value=
"
02
"
>
子级
</option>
<option
value=
"0"
>
父级
</option>
<option
value=
"
1
"
>
子级
</option>
</select>
</div>
</div>
...
...
@@ -141,6 +141,8 @@
$
(
"#pidName"
).
removeAttr
(
'lay-verify'
);
//$("#hasPermission").hide();
$
(
"#isParentRole"
).
hide
();
$
(
"#pidName"
).
val
(
""
);
$
(
"#pid"
).
val
(
""
);
}
if
(
data
.
value
==
"02"
){
//如果是子级角色,权限选择为必填,父级角色为必填
...
...
src/main/webapp/WEB-INF/jsp/admin/role/update.jsp
View file @
dbde765f
...
...
@@ -68,8 +68,8 @@
<div
class=
"layui-input-block"
>
<select
id=
"isParent"
name=
"isParent"
lay-verify=
"required"
lay-filter=
"isParent"
>
<option
value=
""
>
请选择
</option>
<option
value=
"0
1
"
>
父级
</option>
<option
value=
"
02
"
>
子级
</option>
<option
value=
"0"
>
父级
</option>
<option
value=
"
1
"
>
子级
</option>
</select>
</div>
</div>
...
...
@@ -145,8 +145,6 @@
$
(
"#pidName"
).
removeAttr
(
'lay-verify'
);
//$("#hasPermission").hide();
$
(
"#isParentRole"
).
hide
();
$
(
"#permissionName"
).
val
(
""
);
$
(
"#permissionId"
).
val
(
""
);
$
(
"#pidName"
).
val
(
""
);
$
(
"#pid"
).
val
(
""
);
}
...
...
@@ -171,10 +169,13 @@
if
(
msg
.
length
!=
""
)
{
layer
.
msg
(
msg
,
{
icon
:
5
});
}
//设置角色类型
//设置角色类型
和层级
var
type
=
"${oldRole.type}"
;
var
isParent
=
"${oldRole.isParent}"
;
$
(
"#isParent"
).
val
(
isParent
);
$
(
"#type"
).
val
(
type
);
form
.
render
(
'select'
);
//权限树
var
data
=
$
{
permission
};
var
checkData
=
$
{
oldPermission
};
...
...
src/main/webapp/WEB-INF/jsp/admin/user/batchUpdate.jsp
View file @
dbde765f
...
...
@@ -127,8 +127,8 @@
<div
class=
"layui-form-item"
style=
"display: inline-block;width:100%;text-align: center;"
>
<div
class=
"layui-form-item demoTable"
>
<button
class=
"layui-btn queryUserList"
data-type=
"reload"
style=
"margin-left: 20px;"
>
查询
</button>
<button
class=
"layui-btn layui-btn-
danger
"
style=
"margin-left: 20px;"
onclick=
"reset();"
>
清空
</button>
<button
class=
"layui-btn queryUserList
layui-btn-normal
"
data-type=
"reload"
style=
"margin-left: 20px;"
>
查询
</button>
<button
class=
"layui-btn layui-btn-
primary
"
style=
"margin-left: 20px;"
onclick=
"reset();"
>
清空
</button>
</div>
</div>
...
...
@@ -235,6 +235,7 @@
})
});
function
removeUser
(
obj
)
{
console
.
log
(
obj
);
var
checkboxs
,
origin
,
target
,
num
=
0
;
if
(
$
(
obj
).
hasClass
(
'right'
))
{
origin
=
$
(
'.layui-table-main'
);
...
...
@@ -255,7 +256,7 @@
idStr
=
$
(
this
).
find
(
"div"
).
text
();
}
});
$
(
"#selectUserTable td"
)
.
each
(
function
()
{
target
.
each
(
function
()
{
if
(
$
(
this
).
attr
(
"data-field"
)
==
"id"
){
if
(
idStr
==
$
(
this
).
find
(
"div"
).
text
()){
//如果已经有该用户,则不再允许移动
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment