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
9641f9f0
Commit
9641f9f0
authored
Sep 14, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据权限2
parent
577c1cb3
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
98 additions
and
100 deletions
+98
-100
TEmployeeInfoController.java
.../v1/yifu/archives/controller/TEmployeeInfoController.java
+11
-65
TEmployeeInfoMapper.java
...oud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
+2
-2
TEmployeeInfoService.java
...d/plus/v1/yifu/archives/service/TEmployeeInfoService.java
+2
-2
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+4
-4
TEmployeeInfoMapper.xml
...ves-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
+8
-1
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+2
-0
MenuUtil.java
...om/yifu/cloud/plus/v1/yifu/common/dapr/util/MenuUtil.java
+41
-10
BaseEntity.java
...fu.cloud.plus.v1/yifu/common/mybatis/base/BaseEntity.java
+0
-7
UserController.java
...u.cloud.plus.v1/yifu/admin/controller/UserController.java
+20
-1
SysDataAuthServiceImpl.java
...us.v1/yifu/admin/service/impl/SysDataAuthServiceImpl.java
+8
-8
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeInfoController.java
View file @
9641f9f0
...
@@ -70,12 +70,8 @@ public class TEmployeeInfoController {
...
@@ -70,12 +70,8 @@ public class TEmployeeInfoController {
private
final
TEmployeeInfoService
tEmployeeInfoService
;
private
final
TEmployeeInfoService
tEmployeeInfoService
;
// 缓存信息
private
final
CacheManager
cacheManager
;
private
final
MenuUtil
menuUtil
;
private
final
MenuUtil
menuUtil
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
/**
/**
* 分页查询
* 分页查询
*
*
...
@@ -94,7 +90,10 @@ public class TEmployeeInfoController {
...
@@ -94,7 +90,10 @@ public class TEmployeeInfoController {
tEmployeeInfo
.
setMId
(
"1536922631616278529"
);
tEmployeeInfo
.
setMId
(
"1536922631616278529"
);
}
}
menuUtil
.
setAuthSql
(
user
,
tEmployeeInfo
);
menuUtil
.
setAuthSql
(
user
,
tEmployeeInfo
);
return
R
.
ok
(
tEmployeeInfoService
.
getPage
(
page
,
tEmployeeInfo
,
null
));
if
(
Common
.
isNotNull
(
tEmployeeInfo
.
getAuthSql
())
&&
tEmployeeInfo
.
getAuthSql
().
contains
(
CommonConstants
.
A_DEPT_ID
))
{
tEmployeeInfo
.
setAuthSql
(
tEmployeeInfo
.
getAuthSql
().
replace
(
CommonConstants
.
A_DEPT_ID
,
"b.id"
));
}
return
R
.
ok
(
tEmployeeInfoService
.
getPage
(
page
,
tEmployeeInfo
));
}
}
/**
/**
...
@@ -111,67 +110,14 @@ public class TEmployeeInfoController {
...
@@ -111,67 +110,14 @@ public class TEmployeeInfoController {
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
return
R
.
failed
(
CommonConstants
.
PLEASE_LOG_IN
);
return
R
.
failed
(
CommonConstants
.
PLEASE_LOG_IN
);
}
}
// 普通用户:
if
(
Common
.
isEmpty
(
tEmployeeInfo
.
getMId
()))
{
if
(
CommonConstants
.
ONE_STRING
.
equals
(
user
.
getSystemFlag
()))
{
tEmployeeInfo
.
setMId
(
"1536952884128591873"
);
}
// 菜单id
menuUtil
.
setAuthSql
(
user
,
tEmployeeInfo
);
String
menuId
=
"1536952884128591873"
;
if
(
Common
.
isNotNull
(
tEmployeeInfo
.
getAuthSql
())
&&
tEmployeeInfo
.
getAuthSql
().
contains
(
CommonConstants
.
A_DEPT_ID
))
{
String
linkId
=
user
.
getId
();
tEmployeeInfo
.
setAuthSql
(
tEmployeeInfo
.
getAuthSql
().
replace
(
CommonConstants
.
A_DEPT_ID
,
"b.id"
));
int
linkType
=
1
;
// 用户
SysDataAuth
sysDataAuth
=
new
SysDataAuth
();
sysDataAuth
.
setLinkId
(
linkId
);
sysDataAuth
.
setLinkType
(
linkType
);
// 获取缓存菜单权限的步骤:
Cache
cache
=
cacheManager
.
getCache
(
CacheConstants
.
DATA_AUTH_DETAILS
+
linkType
);
Object
obj
=
null
;
if
(
cache
!=
null
)
{
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
if
(
Common
.
isEmpty
(
obj
))
{
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dataAuth/refreshAuth"
,
sysDataAuth
,
TEmployeeInfo
.
class
,
SecurityConstants
.
FROM_IN
);
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
if
(
Common
.
isEmpty
(
obj
))
{
linkId
=
user
.
getUserGroup
();
linkType
=
0
;
// 用户组
cache
=
cacheManager
.
getCache
(
CacheConstants
.
DATA_AUTH_DETAILS
+
linkType
);
if
(
cache
!=
null
)
{
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
if
(
Common
.
isEmpty
(
obj
))
{
sysDataAuth
.
setLinkId
(
linkId
);
sysDataAuth
.
setLinkType
(
linkType
);
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dataAuth/refreshAuth"
,
sysDataAuth
,
TEmployeeInfo
.
class
,
SecurityConstants
.
FROM_IN
);
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
}
}
}
}
}
if
(
Common
.
isNotNull
(
obj
))
{
SimpleValueWrapper
objs
=
(
SimpleValueWrapper
)
obj
;
if
(
objs
!=
null
)
{
String
sql
=
String
.
valueOf
(
objs
.
get
());
if
(
sql
.
contains
(
"#deptId"
))
{
// TODO - 需要关联部门表
}
if
(
sql
.
contains
(
"#create_by"
))
{
sql
=
sql
.
replace
(
"#create_by"
,
user
.
getId
());
}
if
(
sql
.
contains
(
"#settleDomainId"
))
{
// TODO - 获取人员项目权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql
=
sql
.
replace
(
"or a.settle_domain_id in ('0'#settleDomainId) "
,
""
);
}
if
(
sql
.
contains
(
"#deptId"
))
{
// TODO - 获取人员部门权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql
=
sql
.
replace
(
" or dept.dept_id = #deptId "
,
""
);
}
return
R
.
ok
(
tEmployeeInfoService
.
getLeavePage
(
page
,
tEmployeeInfo
,
sql
));
}
}
}
}
return
R
.
ok
(
tEmployeeInfoService
.
getLeavePage
(
page
,
tEmployeeInfo
,
null
));
return
R
.
ok
(
tEmployeeInfoService
.
getLeavePage
(
page
,
tEmployeeInfo
));
}
}
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
View file @
9641f9f0
...
@@ -39,9 +39,9 @@ import java.util.List;
...
@@ -39,9 +39,9 @@ import java.util.List;
@Mapper
@Mapper
public
interface
TEmployeeInfoMapper
extends
BaseMapper
<
TEmployeeInfo
>
{
public
interface
TEmployeeInfoMapper
extends
BaseMapper
<
TEmployeeInfo
>
{
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
@Param
(
"tEmployeeInfo"
)
TEmployeeInfo
tEmployeeInfo
,
@Param
(
"sql"
)
String
sql
);
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
@Param
(
"tEmployeeInfo"
)
TEmployeeInfo
tEmployeeInfo
);
IPage
<
TEmployeeInfo
>
getLeavePage
(
Page
<
TEmployeeInfo
>
page
,
@Param
(
"tEmployeeInfo"
)
TEmployeeInfo
tEmployeeInfo
,
@Param
(
"sql"
)
String
sql
);
IPage
<
TEmployeeInfo
>
getLeavePage
(
Page
<
TEmployeeInfo
>
page
,
@Param
(
"tEmployeeInfo"
)
TEmployeeInfo
tEmployeeInfo
);
List
<
TEmployeeInfo
>
getList
(
@Param
(
"tEmployeeInfo"
)
TEmployeeInfo
tEmployeeInfo
);
List
<
TEmployeeInfo
>
getList
(
@Param
(
"tEmployeeInfo"
)
TEmployeeInfo
tEmployeeInfo
);
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeInfoService.java
View file @
9641f9f0
...
@@ -46,7 +46,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
...
@@ -46,7 +46,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/6/20 20:46
* @Date: 2022/6/20 20:46
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/
**/
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
,
String
sql
);
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
);
/**
/**
* @Description: 离职库分页
* @Description: 离职库分页
...
@@ -54,7 +54,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
...
@@ -54,7 +54,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/7/4 17:38
* @Date: 2022/7/4 17:38
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/
**/
IPage
<
TEmployeeInfo
>
getLeavePage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
,
String
sql
);
IPage
<
TEmployeeInfo
>
getLeavePage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
);
/**
/**
* @param employeeInfo
* @param employeeInfo
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
9641f9f0
...
@@ -88,13 +88,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
...
@@ -88,13 +88,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
@Override
public
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
,
String
sql
)
{
public
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
)
{
return
baseMapper
.
getPage
(
page
,
employeeInfo
,
sql
);
return
baseMapper
.
getPage
(
page
,
employeeInfo
);
}
}
@Override
@Override
public
IPage
<
TEmployeeInfo
>
getLeavePage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
,
String
sql
)
{
public
IPage
<
TEmployeeInfo
>
getLeavePage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
)
{
return
baseMapper
.
getLeavePage
(
page
,
employeeInfo
,
sql
);
return
baseMapper
.
getLeavePage
(
page
,
employeeInfo
);
}
}
@Override
@Override
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
View file @
9641f9f0
...
@@ -491,11 +491,16 @@
...
@@ -491,11 +491,16 @@
select
select
<include
refid=
"baseParam"
/>
<include
refid=
"baseParam"
/>
from t_employee_info a
from t_employee_info a
<if
test=
"tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.contains('b.id') "
>
left join t_employee_project b on a.id=b.EMP_ID
</if>
where a.DELETE_FLAG = '0'
where a.DELETE_FLAG = '0'
<include
refid=
"employeeInfo_where"
/>
<include
refid=
"employeeInfo_where"
/>
<if
test=
"tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''"
>
<if
test=
"tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''"
>
and b.DELETE_FLAG = '0'
${tEmployeeInfo.authSql}
${tEmployeeInfo.authSql}
</if>
</if>
GROUP BY a.id
order by a.CREATE_TIME desc
order by a.CREATE_TIME desc
</select>
</select>
...
@@ -515,7 +520,9 @@
...
@@ -515,7 +520,9 @@
left join t_employee_project b on a.id = b.EMP_ID
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
where a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include
refid=
"employeeInfo_where"
/>
<include
refid=
"employeeInfo_where"
/>
${sql}
<if
test=
"tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''"
>
${tEmployeeInfo.authSql}
</if>
group by a.id order by a.CREATE_TIME desc
group by a.id order by a.CREATE_TIME desc
) b
) b
where 1=1
where 1=1
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
9641f9f0
...
@@ -492,4 +492,6 @@ public interface CommonConstants {
...
@@ -492,4 +492,6 @@ public interface CommonConstants {
public
static
final
String
XLSX
=
".xlsx"
;
public
static
final
String
XLSX
=
".xlsx"
;
public
static
final
String
ERROR_IMPORT
=
"执行异常"
;
public
static
final
String
ERROR_IMPORT
=
"执行异常"
;
// 权限使用的
public
static
final
String
A_DEPT_ID
=
"a.dept_id"
;
}
}
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/MenuUtil.java
View file @
9641f9f0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
dapr
.
util
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
dapr
.
util
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
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.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
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.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.CacheManager
;
...
@@ -20,7 +24,7 @@ import org.springframework.cache.support.SimpleValueWrapper;
...
@@ -20,7 +24,7 @@ import org.springframework.cache.support.SimpleValueWrapper;
* 2022-9-13 16:14:34
* 2022-9-13 16:14:34
* @Description 公共获取菜单权限的工具
* @Description 公共获取菜单权限的工具
*/
*/
@EnableConfigurationProperties
({
DaprUpmsProperties
.
class
})
@EnableConfigurationProperties
({
DaprUpmsProperties
.
class
,
DaprArchivesProperties
.
class
})
@RequiredArgsConstructor
@RequiredArgsConstructor
@Slf4j
@Slf4j
public
class
MenuUtil
{
public
class
MenuUtil
{
...
@@ -28,7 +32,8 @@ public class MenuUtil {
...
@@ -28,7 +32,8 @@ public class MenuUtil {
private
final
CacheManager
cacheManager
;
private
final
CacheManager
cacheManager
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
private
final
String
DEPT
=
"#deptId"
;
private
final
DaprArchivesProperties
daprArchivesProperties
;
private
static
final
String
START_STR
=
"start"
;
public
void
setAuthSql
(
YifuUser
user
,
BaseEntity
entity
)
{
public
void
setAuthSql
(
YifuUser
user
,
BaseEntity
entity
)
{
// 普通用户:
// 普通用户:
...
@@ -72,19 +77,45 @@ public class MenuUtil {
...
@@ -72,19 +77,45 @@ public class MenuUtil {
SimpleValueWrapper
objs
=
(
SimpleValueWrapper
)
obj
;
SimpleValueWrapper
objs
=
(
SimpleValueWrapper
)
obj
;
if
(
objs
!=
null
)
{
if
(
objs
!=
null
)
{
String
sql
=
String
.
valueOf
(
objs
.
get
());
String
sql
=
String
.
valueOf
(
objs
.
get
());
if
(
sql
.
contains
(
DEPT
))
{
entity
.
setIsDept
(
CommonConstants
.
ONE_INT
);
}
if
(
sql
.
contains
(
"#create_by"
))
{
if
(
sql
.
contains
(
"#create_by"
))
{
sql
=
sql
.
replace
(
"#create_by"
,
user
.
getId
());
sql
=
sql
.
replace
(
"#create_by"
,
user
.
getId
());
}
}
if
(
sql
.
contains
(
"#settleDomainId"
))
{
if
(
sql
.
contains
(
"#settleDomainId"
))
{
// TODO - 获取人员项目权限
// 获取人员项目权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
R
<
TSettleDomainListVo
>
res
=
HttpDaprUtil
.
invokeMethodPost
(
daprArchivesProperties
.
getAppUrl
()
sql
=
sql
.
replace
(
"or a.settle_domain_id in ('0'#settleDomainId) "
,
""
);
,
daprArchivesProperties
.
getAppId
(),
"/tsettledomain/getSettleDomainIdsByUserId"
,
user
.
getId
(),
TSettleDomainListVo
.
class
,
SecurityConstants
.
FROM_IN
);
StringBuilder
deptStr
=
new
StringBuilder
();
if
(
res
!=
null
&&
CommonConstants
.
SUCCESS
!=
res
.
getCode
()
&&
res
.
getData
()
!=
null
&&
res
.
getData
().
getDeptIds
()
!=
null
&&
!
res
.
getData
().
getDeptIds
().
isEmpty
())
{
for
(
String
deptId
:
res
.
getData
().
getDeptIds
())
{
deptStr
.
append
(
",'"
).
append
(
deptId
).
append
(
"'"
);
}
}
//sql = sql.replace("or a.settle_domain_id in ('0'#settleDomainId) ", "")
sql
=
sql
.
replace
(
"#settleDomainId"
,
deptStr
.
toString
());
}
}
if
(
sql
.
contains
(
DEPT
))
{
String
userIds
=
"0"
;
sql
=
sql
.
replace
(
DEPT
,
String
.
valueOf
(
user
.
getDeptId
()));
if
(
sql
.
contains
(
START_STR
))
{
String
deptIds
=
StringUtils
.
substringBetween
(
sql
,
START_STR
,
"end"
);
R
<
String
>
userIdR
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
()
,
daprUpmsProperties
.
getAppId
(),
"/user/inner/getUserIdByDeptIds"
,
deptIds
,
String
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
userIdR
!=
null
&&
CommonConstants
.
SUCCESS
==
userIdR
.
getCode
())
{
userIds
=
userIdR
.
getData
();
}
sql
=
sql
.
replace
(
START_STR
,
""
).
replace
(
"end"
,
""
)
.
replace
(
deptIds
,
userIds
);
}
if
(
sql
.
contains
(
"#deptId"
))
{
R
<
String
>
userIdR
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
()
,
daprUpmsProperties
.
getAppId
(),
"/user/inner/getUserIdByDeptIds"
,
String
.
valueOf
(
user
.
getDeptId
()),
String
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
userIdR
!=
null
&&
CommonConstants
.
SUCCESS
==
userIdR
.
getCode
())
{
userIds
=
userIdR
.
getData
();
}
sql
=
sql
.
replace
(
"#deptId"
,
userIds
);
//sql = sql.replace(" or dept.dept_id = #deptId ", "")
//sql = sql.replace(" or dept.dept_id = #deptId ", "")
}
}
entity
.
setAuthSql
(
sql
);
entity
.
setAuthSql
(
sql
);
...
...
yifu-common/yifu-common-mybatis/src/main/java/com/yifu.cloud.plus.v1/yifu/common/mybatis/base/BaseEntity.java
View file @
9641f9f0
...
@@ -70,13 +70,6 @@ public class BaseEntity implements Serializable {
...
@@ -70,13 +70,6 @@ public class BaseEntity implements Serializable {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
mId
;
private
String
mId
;
/**
* 是否关联部门表;0否;1是
*/
@TableField
(
exist
=
false
)
@ExcelIgnore
private
Integer
isDept
;
/**
/**
* 权限sql
* 权限sql
*/
*/
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/UserController.java
View file @
9641f9f0
...
@@ -30,7 +30,6 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO;
...
@@ -30,7 +30,6 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserInfoVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserInfoVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
...
@@ -295,4 +294,24 @@ public class UserController {
...
@@ -295,4 +294,24 @@ public class UserController {
}
}
return
naVo
;
return
naVo
;
}
}
/**
* @Author hgw
* @Description 获取部门下的用户id
* @Date 2022-9-14 11:29:59
**/
@Inner
@PostMapping
(
value
=
{
"/inner/getUserIdByDeptIds"
})
public
String
getUserIdByDeptIds
(
@RequestBody
String
deptIds
)
{
StringBuilder
userIds
=
new
StringBuilder
(
"0"
);
if
(
Common
.
isNotNull
(
deptIds
))
{
List
<
SysUser
>
sysUsers
=
userService
.
list
(
Wrappers
.<
SysUser
>
query
().
lambda
().
in
(
SysUser:
:
getDeptId
,
deptIds
));
if
(
Common
.
isNotEmpty
(
sysUsers
)){
for
(
SysUser
u:
sysUsers
){
userIds
.
append
(
",'"
).
append
(
u
.
getUserId
()).
append
(
"'"
);
}
}
}
return
userIds
.
toString
();
}
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysDataAuthServiceImpl.java
View file @
9641f9f0
...
@@ -108,13 +108,13 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
...
@@ -108,13 +108,13 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 处理权限部门
// 处理权限部门
if
(
sysDataAuth
.
getIsDeptAuth
()
==
1
||
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
if
(
sysDataAuth
.
getIsDeptAuth
()
==
1
||
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
if
(
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
if
(
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
sql
.
append
(
" or
dept.dept_id in (
'0' "
);
sql
.
append
(
" or
a.create_user in (start
'0' "
);
for
(
SysDataAuthDeptRel
dept
:
authDeptList
)
{
for
(
SysDataAuthDeptRel
dept
:
authDeptList
)
{
sql
.
append
(
", '"
).
append
(
dept
.
getDeptId
()).
append
(
"'"
);
sql
.
append
(
", '"
).
append
(
dept
.
getDeptId
()).
append
(
"'"
);
}
}
sql
.
append
(
")"
);
sql
.
append
(
"
end
)"
);
}
else
{
}
else
{
sql
.
append
(
" or
dept.dept_id = #deptId
"
);
sql
.
append
(
" or
a.create_user in (#deptId)
"
);
}
}
for
(
SysDataAuthMenuRel
menu
:
menuDeptList
)
{
for
(
SysDataAuthMenuRel
menu
:
menuDeptList
)
{
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
(),
sql
.
toString
());
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
(),
sql
.
toString
());
...
@@ -137,7 +137,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
...
@@ -137,7 +137,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 处理项目
// 处理项目
if
(
menuSettleList
!=
null
&&
!
menuSettleList
.
isEmpty
())
{
if
(
menuSettleList
!=
null
&&
!
menuSettleList
.
isEmpty
())
{
nowSql
=
" or a.
settle_domain
_id in ('0'#settleDomainId) "
;
nowSql
=
" or a.
dept
_id in ('0'#settleDomainId) "
;
sysDataAuth
.
setIsSettleAuth
(
1
);
sysDataAuth
.
setIsSettleAuth
(
1
);
for
(
SysDataAuthMenuRel
menu
:
menuSettleList
)
{
for
(
SysDataAuthMenuRel
menu
:
menuSettleList
)
{
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
...
@@ -314,15 +314,15 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
...
@@ -314,15 +314,15 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
if
(
menuDeptList
==
null
||
menuDeptList
.
isEmpty
())
{
if
(
menuDeptList
==
null
||
menuDeptList
.
isEmpty
())
{
return
R
.
failed
(
"请选择部门关联的菜单!"
);
return
R
.
failed
(
"请选择部门关联的菜单!"
);
}
else
if
(
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
}
else
if
(
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
sql
.
append
(
" or
dept.dept_id in (
'0' "
);
sql
.
append
(
" or
a.create_user in (start
'0' "
);
for
(
SysDataAuthDeptRel
dept
:
authDeptList
)
{
for
(
SysDataAuthDeptRel
dept
:
authDeptList
)
{
sql
.
append
(
", '"
).
append
(
dept
.
getDeptId
()).
append
(
"'"
);
sql
.
append
(
", '"
).
append
(
dept
.
getDeptId
()).
append
(
"'"
);
dept
.
setSysDataAuthId
(
mainId
);
dept
.
setSysDataAuthId
(
mainId
);
}
}
sql
.
append
(
")"
);
sql
.
append
(
"
end
)"
);
authDeptRelService
.
saveOrUpdateBatch
(
authDeptList
);
authDeptRelService
.
saveOrUpdateBatch
(
authDeptList
);
}
else
{
}
else
{
sql
.
append
(
" or
dept.dept_id = #deptId
"
);
sql
.
append
(
" or
a.create_user in (#deptId)
"
);
}
}
for
(
SysDataAuthMenuRel
menu
:
menuDeptList
)
{
for
(
SysDataAuthMenuRel
menu
:
menuDeptList
)
{
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
(),
sql
.
toString
());
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
(),
sql
.
toString
());
...
@@ -352,7 +352,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
...
@@ -352,7 +352,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 处理项目
// 处理项目
if
(
menuSettleList
!=
null
&&
!
menuSettleList
.
isEmpty
())
{
if
(
menuSettleList
!=
null
&&
!
menuSettleList
.
isEmpty
())
{
nowSql
=
" or a.
settle_domain
_id in ('0'#settleDomainId) "
;
nowSql
=
" or a.
dept
_id in ('0'#settleDomainId) "
;
sysDataAuth
.
setIsSettleAuth
(
1
);
sysDataAuth
.
setIsSettleAuth
(
1
);
for
(
SysDataAuthMenuRel
menu
:
menuSettleList
)
{
for
(
SysDataAuthMenuRel
menu
:
menuSettleList
)
{
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
...
...
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