Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
fangxinjiang
yifu-mvp
Commits
9fbf1bf2
Commit
9fbf1bf2
authored
Sep 04, 2023
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.5.8-hgw-权限-角色-账号
parent
e4785ef0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
15 deletions
+22
-15
SysUserInfo.java
...ifu/cloud/plus/v1/yifu/permission/entity/SysUserInfo.java
+2
-4
SysRoleInfoController.java
.../plus/v1/permission/controller/SysRoleInfoController.java
+9
-2
SysRoleInfoServiceImpl.java
...us/v1/permission/service/impl/SysRoleInfoServiceImpl.java
+5
-7
SysUserInfoMapper.xml
...ssion-biz/src/main/resources/mapper/SysUserInfoMapper.xml
+6
-2
No files found.
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/SysUserInfo.java
View file @
9fbf1bf2
...
@@ -17,6 +17,7 @@ package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
...
@@ -17,6 +17,7 @@ package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
...
@@ -106,10 +107,7 @@ public class SysUserInfo extends BaseEntity {
...
@@ -106,10 +107,7 @@ public class SysUserInfo extends BaseEntity {
/**
/**
* 角色名称合集
* 角色名称合集
*/
*/
@ExcelAttribute
(
name
=
"角色名称合集"
,
maxLength
=
200
)
@TableField
(
exist
=
false
)
@Length
(
max
=
200
,
message
=
"角色名称合集不能超过200个字符"
)
@ExcelProperty
(
"角色名称合集"
)
@Schema
(
description
=
"角色名称合集"
)
private
String
roleNames
;
private
String
roleNames
;
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/controller/SysRoleInfoController.java
View file @
9fbf1bf2
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yifu.cloud.plus.v1.permission.service.SysRoleInfoService
;
import
com.yifu.cloud.plus.v1.permission.service.SysRoleInfoService
;
import
com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService
;
import
com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo
;
...
@@ -113,10 +114,13 @@ public class SysRoleInfoController {
...
@@ -113,10 +114,13 @@ public class SysRoleInfoController {
@DeleteMapping
(
"/{fdId}"
)
@DeleteMapping
(
"/{fdId}"
)
@PreAuthorize
(
"@pms.hasPermission('ekp_sysroleinfo_del')"
)
@PreAuthorize
(
"@pms.hasPermission('ekp_sysroleinfo_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
fdId
)
{
public
R
<
Boolean
>
removeById
(
@PathVariable
String
fdId
)
{
SysRoleInfo
roleInfo
=
sysRoleInfoService
.
getById
(
fdId
);
if
(
roleInfo
==
null
||
Common
.
isEmpty
(
roleInfo
.
getFdId
())
||
Common
.
isEmpty
(
roleInfo
.
getRoleName
()))
{
return
R
.
failed
(
"未找到角色"
);
}
// 删除关联表
// 删除关联表
sysUserRoleResService
.
deleteByRoleId
(
fdId
);
sysUserRoleResService
.
deleteByRoleId
(
fdId
);
// 假删除角色表
// 假删除角色表
SysRoleInfo
roleInfo
=
sysRoleInfoService
.
getById
(
fdId
);
roleInfo
.
setDeleteFlag
(
CommonConstants
.
ONE_INT
);
roleInfo
.
setDeleteFlag
(
CommonConstants
.
ONE_INT
);
sysRoleInfoService
.
updateById
(
roleInfo
);
sysRoleInfoService
.
updateById
(
roleInfo
);
return
R
.
ok
();
return
R
.
ok
();
...
@@ -133,10 +137,13 @@ public class SysRoleInfoController {
...
@@ -133,10 +137,13 @@ public class SysRoleInfoController {
@PostMapping
(
"/freezeById"
)
@PostMapping
(
"/freezeById"
)
@PreAuthorize
(
"@pms.hasPermission('ekp_sysroleinfo_freeze')"
)
@PreAuthorize
(
"@pms.hasPermission('ekp_sysroleinfo_freeze')"
)
public
R
<
Boolean
>
freezeById
(
@RequestParam
String
fdId
)
{
public
R
<
Boolean
>
freezeById
(
@RequestParam
String
fdId
)
{
SysRoleInfo
roleInfo
=
sysRoleInfoService
.
getById
(
fdId
);
if
(
roleInfo
==
null
||
Common
.
isEmpty
(
roleInfo
.
getFdId
())
||
Common
.
isEmpty
(
roleInfo
.
getRoleName
()))
{
return
R
.
failed
(
"未找到角色"
);
}
// 删除关联表
// 删除关联表
sysUserRoleResService
.
deleteByRoleId
(
fdId
);
sysUserRoleResService
.
deleteByRoleId
(
fdId
);
// 冻结角色表
// 冻结角色表
SysRoleInfo
roleInfo
=
sysRoleInfoService
.
getById
(
fdId
);
roleInfo
.
setStatus
(
CommonConstants
.
ONE_INT
);
roleInfo
.
setStatus
(
CommonConstants
.
ONE_INT
);
sysRoleInfoService
.
updateById
(
roleInfo
);
sysRoleInfoService
.
updateById
(
roleInfo
);
return
R
.
ok
();
return
R
.
ok
();
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/SysRoleInfoServiceImpl.java
View file @
9fbf1bf2
...
@@ -134,27 +134,25 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo
...
@@ -134,27 +134,25 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo
@Override
@Override
public
String
getAllRoleDataAuthByUserId
(
String
userId
)
{
public
String
getAllRoleDataAuthByUserId
(
String
userId
)
{
List
<
String
>
authList
=
baseMapper
.
getAllRoleDataAuthByUserId
(
userId
);
List
<
String
>
authList
=
baseMapper
.
getAllRoleDataAuthByUserId
(
userId
);
String
auths
=
""
;
String
Builder
auths
=
new
StringBuilder
()
;
if
(
authList
!=
null
&&
!
authList
.
isEmpty
())
{
if
(
authList
!=
null
&&
!
authList
.
isEmpty
())
{
String
[]
authArr
;
String
[]
authArr
;
Set
<
String
>
authSet
=
new
HashSet
<>();
Set
<
String
>
authSet
=
new
HashSet
<>();
for
(
String
auth
:
authList
)
{
for
(
String
auth
:
authList
)
{
authArr
=
auth
.
split
(
","
);
authArr
=
auth
.
split
(
","
);
for
(
String
subAuth
:
authArr
)
{
Collections
.
addAll
(
authSet
,
authArr
);
authSet
.
add
(
subAuth
);
}
}
}
boolean
flag
=
false
;
boolean
flag
=
false
;
for
(
String
subAuth
:
authSet
)
{
for
(
String
subAuth
:
authSet
)
{
if
(
flag
)
{
if
(
flag
)
{
auths
=
auths
+
","
+
subAuth
;
auths
.
append
(
","
).
append
(
subAuth
)
;
}
else
{
}
else
{
auths
=
subAuth
;
auths
.
append
(
subAuth
)
;
flag
=
true
;
flag
=
true
;
}
}
}
}
}
}
return
auths
;
return
auths
.
toString
()
;
}
}
private
LambdaQueryWrapper
buildQueryWrapper
(
SysRoleInfoSearchVo
entity
)
{
private
LambdaQueryWrapper
buildQueryWrapper
(
SysRoleInfoSearchVo
entity
)
{
...
...
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysUserInfoMapper.xml
View file @
9fbf1bf2
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
a.fd_mobile_no,
a.fd_mobile_no,
a.fd_email,
a.fd_email,
a.status,
a.status,
a.
role_names,
GROUP_CONCAT(r.role_name ORDER BY r.create_time asc) as
role_names,
a.CREATE_BY,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_NAME,
a.CREATE_TIME,
a.CREATE_TIME,
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
AND a.status = #{sysUserInfo.status}
AND a.status = #{sysUserInfo.status}
</if>
</if>
<if
test=
"sysUserInfo.roleNames != null and sysUserInfo.roleNames.trim() != ''"
>
<if
test=
"sysUserInfo.roleNames != null and sysUserInfo.roleNames.trim() != ''"
>
AND
a.role_names
like concat('%',#{sysUserInfo.roleNames},'%')
AND
r.role_name
like concat('%',#{sysUserInfo.roleNames},'%')
</if>
</if>
<if
test=
"sysUserInfo.createBy != null and sysUserInfo.createBy.trim() != ''"
>
<if
test=
"sysUserInfo.createBy != null and sysUserInfo.createBy.trim() != ''"
>
AND a.CREATE_BY = #{sysUserInfo.createBy}
AND a.CREATE_BY = #{sysUserInfo.createBy}
...
@@ -106,10 +106,14 @@
...
@@ -106,10 +106,14 @@
SELECT
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
FROM sys_user_info a
FROM sys_user_info a
LEFT JOIN sys_user_role_res res on a.fd_id=res.user_id
LEFT JOIN sys_role_info r on res.role_id=r.fd_id and r.delete_flag = 0 and r.status = 0
<where>
<where>
1=1
1=1
<include
refid=
"sysUserInfo_where"
/>
<include
refid=
"sysUserInfo_where"
/>
</where>
</where>
GROUP BY a.fd_id
order by a.CREATE_TIME desc
order by a.CREATE_TIME desc
</select>
</select>
</mapper>
</mapper>
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