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
212985ff
Commit
212985ff
authored
Sep 11, 2023
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.5.8-hgw-权限-角色-账号
parent
c462d75e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
104 additions
and
19 deletions
+104
-19
SysMenu.java
...om/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
+1
-0
SysUserInfoController.java
.../plus/v1/permission/controller/SysUserInfoController.java
+3
-3
SysMenuMapper.java
...m/yifu/cloud/plus/v1/permission/mapper/SysMenuMapper.java
+9
-0
SysUserInfoMapper.java
...fu/cloud/plus/v1/permission/mapper/SysUserInfoMapper.java
+1
-1
SysUserPermissionMapper.java
...ud/plus/v1/permission/mapper/SysUserPermissionMapper.java
+10
-0
SysUserInfoService.java
.../cloud/plus/v1/permission/service/SysUserInfoService.java
+1
-1
SysUserInfoServiceImpl.java
...us/v1/permission/service/impl/SysUserInfoServiceImpl.java
+56
-12
SysMenuMapper.xml
...ermission-biz/src/main/resources/mapper/SysMenuMapper.xml
+10
-0
SysUserInfoMapper.xml
...ssion-biz/src/main/resources/mapper/SysUserInfoMapper.xml
+2
-2
SysUserPermissionMapper.xml
...biz/src/main/resources/mapper/SysUserPermissionMapper.xml
+11
-0
No files found.
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
View file @
212985ff
...
@@ -86,6 +86,7 @@ public class SysMenu extends BaseEntity {
...
@@ -86,6 +86,7 @@ public class SysMenu extends BaseEntity {
/**
/**
* 客户权限id
* 客户权限id
* 1客户权限;2商机;3报价单;4合同;5项目;6BU;7条线;8部门;9收入归属
*/
*/
@Schema
(
description
=
"客户权限id"
)
@Schema
(
description
=
"客户权限id"
)
private
String
customerId
;
private
String
customerId
;
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/controller/SysUserInfoController.java
View file @
212985ff
...
@@ -150,13 +150,13 @@ public class SysUserInfoController {
...
@@ -150,13 +150,13 @@ public class SysUserInfoController {
@Operation
(
summary
=
"测试权限sql"
,
description
=
"测试权限sql"
)
@Operation
(
summary
=
"测试权限sql"
,
description
=
"测试权限sql"
)
@SysLog
(
"测试权限sql"
)
@SysLog
(
"测试权限sql"
)
@PostMapping
(
"/testPermission"
)
@PostMapping
(
"/testPermission"
)
public
R
<
String
>
testPermission
(
@RequestParam
String
m
enu
Id
,
@RequestParam
(
required
=
false
)
String
userId
)
{
public
R
<
String
>
testPermission
(
@RequestParam
String
m
odel
Id
,
@RequestParam
(
required
=
false
)
String
userId
)
{
return
R
.
ok
(
sysUserInfoService
.
testPermission
(
m
enu
Id
,
userId
));
return
R
.
ok
(
sysUserInfoService
.
testPermission
(
m
odel
Id
,
userId
));
}
}
/**
/**
* 简单分页查询
* 简单分页查询
*
*
hyc 2023-9-11 15:25:50
* @param page 分页对象
* @param page 分页对象
* @param code 新权限-账号管理表
* @param code 新权限-账号管理表
* @return
* @return
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/mapper/SysMenuMapper.java
View file @
212985ff
...
@@ -41,4 +41,13 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
...
@@ -41,4 +41,13 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
* @return
* @return
*/
*/
List
<
String
>
selectColumnList
(
@Param
(
"modelId"
)
String
modelId
);
List
<
String
>
selectColumnList
(
@Param
(
"modelId"
)
String
modelId
);
/**
* @param modelId
* @Description: 根据modelId获取菜单
* @Author: hgw
* @Date: 2023/9/11 11:48
* @return: com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu
**/
SysMenu
getSysMenuByModelId
(
@Param
(
"modelId"
)
String
modelId
);
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/mapper/SysUserInfoMapper.java
View file @
212985ff
...
@@ -60,7 +60,7 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
...
@@ -60,7 +60,7 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
* @Date: 2023/9/8 17:00
* @Date: 2023/9/8 17:00
* @return: java.lang.int
* @return: java.lang.int
**/
**/
int
getAuthByUserIdAndM
enuId
(
@Param
(
"menuId"
)
String
menu
Id
,
@Param
(
"userId"
)
String
userId
);
int
getAuthByUserIdAndM
odelId
(
@Param
(
"modelId"
)
String
model
Id
,
@Param
(
"userId"
)
String
userId
);
/**
/**
* @Description: 根据编码或者登录名简单分页查询
* @Description: 根据编码或者登录名简单分页查询
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/mapper/SysUserPermissionMapper.java
View file @
212985ff
...
@@ -172,5 +172,15 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
...
@@ -172,5 +172,15 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
* @return
* @return
*/
*/
Integer
selectDeptCount
(
@Param
(
"name"
)
String
name
);
Integer
selectDeptCount
(
@Param
(
"name"
)
String
name
);
/**
* @param userId
* @Description: 查找当前用户的所有权限
* @Author: hgw
* @Date: 2023/9/11 11:44
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission>
**/
List
<
SysUserPermission
>
getUserPermissionByUserId
(
@Param
(
"userId"
)
String
userId
);
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/SysUserInfoService.java
View file @
212985ff
...
@@ -75,7 +75,7 @@ public interface SysUserInfoService extends IService<SysUserInfo> {
...
@@ -75,7 +75,7 @@ public interface SysUserInfoService extends IService<SysUserInfo> {
* @Date: 2023/9/8 16:35
* @Date: 2023/9/8 16:35
* @return: java.lang.String
* @return: java.lang.String
**/
**/
String
testPermission
(
String
m
enu
Id
,
String
userId
);
String
testPermission
(
String
m
odel
Id
,
String
userId
);
IPage
<
SysUserInfo
>
getUserByCodeOrLoginName
(
Page
<
SysUserInfo
>
page
,
String
code
);
IPage
<
SysUserInfo
>
getUserByCodeOrLoginName
(
Page
<
SysUserInfo
>
page
,
String
code
);
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/SysUserInfoServiceImpl.java
View file @
212985ff
...
@@ -21,7 +21,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
...
@@ -21,7 +21,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper
;
import
com.yifu.cloud.plus.v1.permission.mapper.SysUserInfoMapper
;
import
com.yifu.cloud.plus.v1.permission.mapper.SysUserInfoMapper
;
import
com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper
;
import
com.yifu.cloud.plus.v1.permission.service.SysMenuService
;
import
com.yifu.cloud.plus.v1.permission.service.SysMenuService
;
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.SysUserInfoService
;
import
com.yifu.cloud.plus.v1.permission.service.SysUserInfoService
;
...
@@ -31,6 +33,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...
@@ -31,6 +33,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo
;
...
@@ -53,6 +56,8 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
...
@@ -53,6 +56,8 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
private
final
SysUserRoleResService
sysUserRoleResService
;
private
final
SysUserRoleResService
sysUserRoleResService
;
private
final
SysRoleInfoService
sysRoleInfoService
;
private
final
SysRoleInfoService
sysRoleInfoService
;
private
final
SysMenuMapper
sysMenuMapper
;
private
final
SysUserPermissionMapper
sysUserPermissionMapper
;
/**
/**
* 新权限-账号管理表简单分页查询
* 新权限-账号管理表简单分页查询
...
@@ -173,7 +178,7 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
...
@@ -173,7 +178,7 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
private
final
SysMenuService
sysMenuService
;
private
final
SysMenuService
sysMenuService
;
/**
/**
* @param m
enu
Id
* @param m
odel
Id
* @param userId
* @param userId
* @Description: 给EKP用的,获取权限
* @Description: 给EKP用的,获取权限
* @Author: hgw
* @Author: hgw
...
@@ -181,7 +186,7 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
...
@@ -181,7 +186,7 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
* @return: void
* @return: void
**/
**/
@Override
@Override
public
String
testPermission
(
String
m
enu
Id
,
String
userId
)
{
public
String
testPermission
(
String
m
odel
Id
,
String
userId
)
{
//1:获取菜单是否已配置,是:第2步;否:结束,用EKP本身权限;
//1:获取菜单是否已配置,是:第2步;否:结束,用EKP本身权限;
//2:获取账号,有:第3步;无:结束,用EKP;
//2:获取账号,有:第3步;无:结束,用EKP;
//3:检测账号的角色 是否有 对应的菜单,有,第4不,无:结束,用ekp;
//3:检测账号的角色 是否有 对应的菜单,有,第4不,无:结束,用ekp;
...
@@ -197,30 +202,69 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
...
@@ -197,30 +202,69 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
//第6步的sql要改为:
//第6步的sql要改为:
//or (docCreateUser in (账号id,其他账号id))
//or (docCreateUser in (账号id,其他账号id))
String
sql
=
""
;
String
Builder
sql
=
new
StringBuilder
()
;
// 测试权限
// 测试权限
SysMenu
menu
=
sysMenu
Service
.
getById
(
menu
Id
);
SysMenu
menu
=
sysMenu
Mapper
.
getSysMenuByModelId
(
model
Id
);
if
(
menu
!=
null
)
{
if
(
menu
!=
null
)
{
// 返回0:无配置;1:全量;2:继续下一步,找数据权限配置
// 返回0:无配置;1:全量;2:继续下一步,找数据权限配置
int
allAuth
=
baseMapper
.
getAuthByUserIdAndM
enuId
(
menu
Id
,
userId
);
int
allAuth
=
baseMapper
.
getAuthByUserIdAndM
odelId
(
model
Id
,
userId
);
if
(
allAuth
==
0
)
{
if
(
allAuth
==
0
)
{
sql
=
" 1=2 "
;
sql
.
append
(
" 1=2 "
)
;
}
else
if
(
allAuth
==
1
)
{
}
else
if
(
allAuth
==
1
)
{
sql
=
" 1=1 "
;
sql
.
append
(
" 1=1 "
)
;
}
else
{
}
else
{
// TODO-继续下一步,找数据权限配置
sql
.
append
(
" 1=2 "
);
// 继续下一步,找数据权限配置
List
<
SysUserPermission
>
permissionList
=
sysUserPermissionMapper
.
getUserPermissionByUserId
(
userId
);
if
(
permissionList
!=
null
&&
!
permissionList
.
isEmpty
()
&&
Common
.
isNotNull
(
menu
.
getCustomerId
()))
{
setAuthSql
(
sql
,
"1"
,
menu
.
getCustomerId
(),
permissionList
);
setAuthSql
(
sql
,
"2"
,
menu
.
getBussinessId
(),
permissionList
);
setAuthSql
(
sql
,
"3"
,
menu
.
getQuotationId
(),
permissionList
);
setAuthSql
(
sql
,
"4"
,
menu
.
getContractId
(),
permissionList
);
setAuthSql
(
sql
,
"5"
,
menu
.
getDomainId
(),
permissionList
);
setAuthSql
(
sql
,
"6"
,
menu
.
getBuId
(),
permissionList
);
setAuthSql
(
sql
,
"7"
,
menu
.
getLineId
(),
permissionList
);
setAuthSql
(
sql
,
"9"
,
menu
.
getIncomeId
(),
permissionList
);
// TODO-部门
setAuthSqlByDept
(
sql
,
menu
.
getDeptId
(),
permissionList
);
}
}
}
}
}
if
(
Common
.
isNotNull
(
sql
))
{
if
(
Common
.
isNotNull
(
sql
))
{
return
" or ("
+
sql
+
" ) "
;
return
" or (
"
+
sql
+
" ) "
;
}
}
return
""
;
return
""
;
}
}
private
void
setAuthSql
(
StringBuilder
sql
,
String
type
,
String
shuXing
,
List
<
SysUserPermission
>
permissionList
)
{
StringBuilder
tempValue
=
new
StringBuilder
();
for
(
SysUserPermission
permission
:
permissionList
)
{
if
((
"6"
.
equals
(
type
)
||
"7"
.
equals
(
type
))
&&
type
.
equals
(
permission
.
getPermissionType
()))
{
tempValue
.
append
(
"'"
).
append
(
permission
.
getName
()).
append
(
"',"
);
}
else
if
(
type
.
equals
(
permission
.
getPermissionType
()))
{
tempValue
.
append
(
"'"
).
append
(
permission
.
getCode
()).
append
(
"',"
);
}
}
if
(
tempValue
.
length
()
>
0
)
{
tempValue
.
deleteCharAt
(
tempValue
.
length
()
-
1
);
}
sql
.
append
(
" or ("
).
append
(
shuXing
).
append
(
" in ("
).
append
(
tempValue
).
append
(
"))"
);
}
private
void
setAuthSqlByDept
(
StringBuilder
sql
,
String
shuXing
,
List
<
SysUserPermission
>
permissionList
)
{
StringBuilder
tempValue
=
new
StringBuilder
();
for
(
SysUserPermission
permission
:
permissionList
)
{
if
(
"8"
.
equals
(
permission
.
getPermissionType
()))
{
tempValue
.
append
(
"'"
).
append
(
permission
.
getCode
()).
append
(
"',"
);
}
}
if
(
tempValue
.
length
()
>
0
)
{
tempValue
.
deleteCharAt
(
tempValue
.
length
()
-
1
);
}
sql
.
append
(
" or ("
).
append
(
shuXing
).
append
(
" in ("
).
append
(
tempValue
).
append
(
"))"
);
}
/**
/**
* 新权限-账号管理表简单分页查询
* 新权限-账号管理表简单分页查询
...
...
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysMenuMapper.xml
View file @
212985ff
...
@@ -90,4 +90,14 @@
...
@@ -90,4 +90,14 @@
LEFT JOIN sys_xform_db_table b on a.fd_main_id = b.fd_id
LEFT JOIN sys_xform_db_table b on a.fd_main_id = b.fd_id
WHERE b.fd_model_id = #{modelId}
WHERE b.fd_model_id = #{modelId}
</select>
</select>
<!--根据modelId获取菜单-->
<select
id=
"getSysMenuByModelId"
resultMap=
"sysMenuMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM sys_menu a
where a.DELETE_STATUS = '1' and a.PERMISSION_STATUS='0' and a.MODEL_ID = {modelId}
limit 1
</select>
</mapper>
</mapper>
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysUserInfoMapper.xml
View file @
212985ff
...
@@ -158,7 +158,7 @@
...
@@ -158,7 +158,7 @@
<!--给EKP用的,获取列表是否全量的权限-->
<!--给EKP用的,获取列表是否全量的权限-->
<!--#全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)-->
<!--#全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)-->
<select
id=
"getAuthByUserIdAndM
enu
Id"
resultType=
"java.lang.Integer"
>
<select
id=
"getAuthByUserIdAndM
odel
Id"
resultType=
"java.lang.Integer"
>
select
select
case
case
when a.data_auth is null then 0
when a.data_auth is null then 0
...
@@ -189,7 +189,7 @@
...
@@ -189,7 +189,7 @@
join sys_role_info a on m.role_id = a.fd_id
join sys_role_info a on m.role_id = a.fd_id
join sys_user_role_res r on r.role_id = a.fd_id
join sys_user_role_res r on r.role_id = a.fd_id
where a.delete_flag = 0 and a.status = 0 and b.DELETE_STATUS='1' and b.PERMISSION_STATUS='0'
where a.delete_flag = 0 and a.status = 0 and b.DELETE_STATUS='1' and b.PERMISSION_STATUS='0'
and r.user_id = #{userId} and b.MODEL_ID=#{m
enu
Id}
and r.user_id = #{userId} and b.MODEL_ID=#{m
odel
Id}
) a
) a
</select>
</select>
...
...
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysUserPermissionMapper.xml
View file @
212985ff
...
@@ -270,4 +270,15 @@
...
@@ -270,4 +270,15 @@
where a.fd_is_available = '1' and fd_org_type = 2 and a.fd_no = #{name}
where a.fd_is_available = '1' and fd_org_type = 2 and a.fd_no = #{name}
</select>
</select>
<!-- 查找当前用户的所有权限 -->
<select
id=
"getUserPermissionByUserId"
resultMap=
"sysUserPermissionMap"
>
select
p.PERMISSION_TYPE,p.NAME,p.CODE,ifnull(p.IS_CONTAINS,'1') IS_CONTAINS
from
sys_user_permission p
where p.DELETE_FLAG='1' and p.PERMISSION_STATUS='0'
and p.USER_ID = #{userId}
ORDER BY p.PERMISSION_TYPE
</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