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
98efd041
Commit
98efd041
authored
Sep 15, 2023
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单权限修改
parent
17e5badc
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
108 additions
and
9 deletions
+108
-9
SysMenu.java
...om/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
+5
-0
SysUserPermission.java
...oud/plus/v1/yifu/permission/entity/SysUserPermission.java
+5
-0
SysUserDeptVo.java
.../yifu/cloud/plus/v1/yifu/permission/vo/SysUserDeptVo.java
+6
-0
SysUserPermissionVo.java
...cloud/plus/v1/yifu/permission/vo/SysUserPermissionVo.java
+2
-2
SysMenuMapper.java
...m/yifu/cloud/plus/v1/permission/mapper/SysMenuMapper.java
+10
-0
SysUserPermissionMapper.java
...ud/plus/v1/permission/mapper/SysUserPermissionMapper.java
+8
-0
SysMenuServiceImpl.java
...d/plus/v1/permission/service/impl/SysMenuServiceImpl.java
+38
-2
SysUserPermissionServiceImpl.java
...permission/service/impl/SysUserPermissionServiceImpl.java
+14
-3
SysMenuMapper.xml
...ermission-biz/src/main/resources/mapper/SysMenuMapper.xml
+10
-0
SysUserPermissionMapper.xml
...biz/src/main/resources/mapper/SysUserPermissionMapper.xml
+10
-2
No files found.
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
View file @
98efd041
...
@@ -140,4 +140,9 @@ public class SysMenu extends BaseEntity {
...
@@ -140,4 +140,9 @@ public class SysMenu extends BaseEntity {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
List
<
String
>
columnIdList
;
private
List
<
String
>
columnIdList
;
/**
* 是否开关(0开、1关)
*/
@Schema
(
description
=
"是否开关(0开、1关)"
)
private
String
isOpen
;
}
}
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/SysUserPermission.java
View file @
98efd041
...
@@ -88,4 +88,9 @@ public class SysUserPermission extends BaseEntity {
...
@@ -88,4 +88,9 @@ public class SysUserPermission extends BaseEntity {
@Schema
(
description
=
"删除状态(0是、1否)"
)
@Schema
(
description
=
"删除状态(0是、1否)"
)
private
String
deleteFlag
;
private
String
deleteFlag
;
/**
* 项目id
*/
@Schema
(
description
=
"项目id"
)
private
String
domainId
;
}
}
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/vo/SysUserDeptVo.java
View file @
98efd041
...
@@ -53,4 +53,10 @@ public class SysUserDeptVo implements Serializable {
...
@@ -53,4 +53,10 @@ public class SysUserDeptVo implements Serializable {
@Schema
(
description
=
"登录名"
)
@Schema
(
description
=
"登录名"
)
private
String
loginName
;
private
String
loginName
;
/**
* 项目id
*/
@Schema
(
description
=
"项目id"
)
private
String
domainId
;
}
}
\ No newline at end of file
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/vo/SysUserPermissionVo.java
View file @
98efd041
...
@@ -63,8 +63,8 @@ public class SysUserPermissionVo extends RowIndex implements Serializable {
...
@@ -63,8 +63,8 @@ public class SysUserPermissionVo extends RowIndex implements Serializable {
/**
/**
* 名称
* 名称
*/
*/
@Length
(
max
=
20
,
message
=
"名称 不能超过2
0 个字符"
)
@Length
(
max
=
20
0
,
message
=
"名称 不能超过20
0 个字符"
)
@ExcelAttribute
(
name
=
"名称"
,
maxLength
=
20
)
@ExcelAttribute
(
name
=
"名称"
,
maxLength
=
20
0
)
@Schema
(
description
=
"名称"
)
@Schema
(
description
=
"名称"
)
@ExcelProperty
(
"名称"
)
@ExcelProperty
(
"名称"
)
private
String
name
;
private
String
name
;
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/mapper/SysMenuMapper.java
View file @
98efd041
...
@@ -32,6 +32,16 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
...
@@ -32,6 +32,16 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
*/
*/
long
selectMenuId
(
@Param
(
"modelId"
)
String
modelId
);
long
selectMenuId
(
@Param
(
"modelId"
)
String
modelId
);
/**
* 判断是否存在此菜单视图
*
* @param modelId 表单id
* @Author: huyc
* @Date: 2023/8/30 14:20
* @return
*/
long
selectViewId
(
@Param
(
"viewId"
)
String
viewId
,
@Param
(
"modelId"
)
String
modelId
);
/**
/**
* 判断是否存在此字段
* 判断是否存在此字段
*
*
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/mapper/SysUserPermissionMapper.java
View file @
98efd041
...
@@ -77,6 +77,14 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
...
@@ -77,6 +77,14 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
*/
*/
IPage
<
SysUserDeptVo
>
selectSettleVO
(
Page
<
SysUserDeptVo
>
page
,
@Param
(
"name"
)
String
name
);
IPage
<
SysUserDeptVo
>
selectSettleVO
(
Page
<
SysUserDeptVo
>
page
,
@Param
(
"name"
)
String
name
);
/**
* 根据名项目编码查询id
* 项目权限
* @param code 编码
* @return
*/
String
selectSettleByCode
(
@Param
(
"code"
)
String
code
);
/**
/**
* 根据名称或者编码查询数据
* 根据名称或者编码查询数据
* 商机权限
* 商机权限
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/SysMenuServiceImpl.java
View file @
98efd041
...
@@ -55,13 +55,23 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
...
@@ -55,13 +55,23 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if
(
menuIdCount
<
1
)
{
if
(
menuIdCount
<
1
)
{
return
R
.
failed
(
"表单ID填写错误,请确认"
);
return
R
.
failed
(
"表单ID填写错误,请确认"
);
}
}
//唯一性校验--表单ID唯一
//判断view id是否填写正确并且要属于modeleID
long
viewIdCount
=
baseMapper
.
selectViewId
(
menu
.
getViewId
(),
menu
.
getModelId
());
if
(
viewIdCount
<
1
)
{
return
R
.
failed
(
"视图ID不存在或者不属于填写的表单id,请确认"
);
}
//唯一性校验--视图ID唯一
long
modelCount
=
baseMapper
.
selectCount
(
Wrappers
.<
SysMenu
>
query
().
lambda
()
long
modelCount
=
baseMapper
.
selectCount
(
Wrappers
.<
SysMenu
>
query
().
lambda
()
.
eq
(
SysMenu:
:
get
ModelId
,
menu
.
getModel
Id
())
.
eq
(
SysMenu:
:
get
ViewId
,
menu
.
getView
Id
())
.
eq
(
SysMenu:
:
getDeleteStatus
,
CommonConstants
.
ONE_STRING
));
.
eq
(
SysMenu:
:
getDeleteStatus
,
CommonConstants
.
ONE_STRING
));
if
(
modelCount
>
0
)
{
if
(
modelCount
>
0
)
{
return
R
.
failed
(
"已存在对应菜单的权限维度"
);
return
R
.
failed
(
"已存在对应菜单的权限维度"
);
}
}
//是否开关为是的话,modelId只能有一个
boolean
errorFlag
=
isOpenCheck
(
menu
);
if
(
errorFlag
)
{
return
R
.
failed
(
"只能存在一个开关状态为开的表单ID"
);
}
//判断菜单是否为一级菜单
//判断菜单是否为一级菜单
if
(
Common
.
isNotNull
(
menu
.
getMenuName
())
&&
Common
.
isEmpty
(
menu
.
getMenuNameParent
()))
{
if
(
Common
.
isNotNull
(
menu
.
getMenuName
())
&&
Common
.
isEmpty
(
menu
.
getMenuNameParent
()))
{
//一级菜单的上级菜单id为0
//一级菜单的上级菜单id为0
...
@@ -86,6 +96,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
...
@@ -86,6 +96,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
@Override
public
R
<
Boolean
>
updateMenu
(
SysMenu
menu
)
{
public
R
<
Boolean
>
updateMenu
(
SysMenu
menu
)
{
//是否开关为是的话,modelId只能有一个
boolean
errorFlag
=
isOpenCheck
(
menu
);
if
(
errorFlag
)
{
return
R
.
failed
(
"只能存在一个开关状态为开的表单ID"
);
}
//错误信息
//错误信息
StringBuilder
errorStr
=
new
StringBuilder
();
StringBuilder
errorStr
=
new
StringBuilder
();
//权限维度
//权限维度
...
@@ -118,4 +133,25 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
...
@@ -118,4 +133,25 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
}
}
}
public
boolean
isOpenCheck
(
SysMenu
menu
)
{
if
(
Common
.
isNotNull
(
menu
.
getIsOpen
())
&&
CommonConstants
.
ZERO_STRING
.
equals
(
menu
.
getIsOpen
()))
{
if
(
Common
.
isNotNull
(
menu
.
getId
()))
{
long
modelCount
=
baseMapper
.
selectCount
(
Wrappers
.<
SysMenu
>
query
().
lambda
()
.
eq
(
SysMenu:
:
getModelId
,
menu
.
getModelId
())
.
eq
(
SysMenu:
:
getDeleteStatus
,
CommonConstants
.
ONE_STRING
)
.
eq
(
SysMenu:
:
getIsOpen
,
CommonConstants
.
ZERO_STRING
)
.
ne
(
SysMenu:
:
getId
,
menu
.
getId
()));
return
modelCount
>
0
;
}
else
{
long
modelCount
=
baseMapper
.
selectCount
(
Wrappers
.<
SysMenu
>
query
().
lambda
()
.
eq
(
SysMenu:
:
getModelId
,
menu
.
getModelId
())
.
eq
(
SysMenu:
:
getDeleteStatus
,
CommonConstants
.
ONE_STRING
)
.
eq
(
SysMenu:
:
getIsOpen
,
CommonConstants
.
ZERO_STRING
));
return
modelCount
>
0
;
}
}
else
{
return
false
;
}
}
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/SysUserPermissionServiceImpl.java
View file @
98efd041
...
@@ -158,7 +158,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
...
@@ -158,7 +158,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
if
(
CommonConstants
.
ONE_STRING
.
equals
(
user
.
getId
()))
{
if
(
CommonConstants
.
ONE_STRING
.
equals
(
user
.
getId
()))
{
iPage
=
baseMapper
.
selectContractVO
(
page
,
searchVo
.
getName
());
iPage
=
baseMapper
.
selectContractVO
(
page
,
searchVo
.
getName
());
}
else
{
}
else
{
iPage
=
baseMapper
.
selectContractSimpleVO
(
page
,
searchVo
.
getN
ame
(),
searchVo
.
getName
(),
searchVo
.
getType
());
iPage
=
baseMapper
.
selectContractSimpleVO
(
page
,
user
.
getUsern
ame
(),
searchVo
.
getName
(),
searchVo
.
getType
());
}
}
}
else
if
(
CommonConstants
.
EIGHT_STRING
.
equals
(
searchVo
.
getType
())
||
CommonConstants
.
NINE_STRING
.
equals
(
searchVo
.
getType
()))
{
}
else
if
(
CommonConstants
.
EIGHT_STRING
.
equals
(
searchVo
.
getType
())
||
CommonConstants
.
NINE_STRING
.
equals
(
searchVo
.
getType
()))
{
//部门&&收入归属权限
//部门&&收入归属权限
...
@@ -168,7 +168,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
...
@@ -168,7 +168,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
if
(
CommonConstants
.
ONE_STRING
.
equals
(
user
.
getId
()))
{
if
(
CommonConstants
.
ONE_STRING
.
equals
(
user
.
getId
()))
{
iPage
=
baseMapper
.
selectSettleVO
(
page
,
searchVo
.
getName
());
iPage
=
baseMapper
.
selectSettleVO
(
page
,
searchVo
.
getName
());
}
else
{
}
else
{
iPage
=
baseMapper
.
selectContractSimpleVO
(
page
,
searchVo
.
getN
ame
(),
searchVo
.
getName
(),
searchVo
.
getType
());
iPage
=
baseMapper
.
selectContractSimpleVO
(
page
,
user
.
getUsern
ame
(),
searchVo
.
getName
(),
searchVo
.
getType
());
}
}
}
}
return
iPage
;
return
iPage
;
...
@@ -259,6 +259,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
...
@@ -259,6 +259,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
YifuUser
user
=
SecurityUtils
.
getUser
();
YifuUser
user
=
SecurityUtils
.
getUser
();
SysUserPermission
permission
;
SysUserPermission
permission
;
List
<
SysUserInfo
>
userInfo
;
List
<
SysUserInfo
>
userInfo
;
String
domainId
;
try
{
try
{
// 执行数据插入操作 组装
// 执行数据插入操作 组装
...
@@ -328,6 +329,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
...
@@ -328,6 +329,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"系统中已经存在该用户对应的名称权限维度"
,
excel
));
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"系统中已经存在该用户对应的名称权限维度"
,
excel
));
continue
;
continue
;
}
}
insert
.
setCode
(
null
);
}
else
{
}
else
{
//判断对应维度的编码是否存在
//判断对应维度的编码是否存在
Integer
count
=
this
.
checkExit
(
insert
.
getPermissionType
(),
excel
.
getCode
());
Integer
count
=
this
.
checkExit
(
insert
.
getPermissionType
(),
excel
.
getCode
());
...
@@ -358,6 +360,15 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
...
@@ -358,6 +360,15 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
continue
;
continue
;
}
}
}
}
//项目权限的时候赋值项目id
if
(
CommonConstants
.
FIVE_STRING
.
equals
(
insert
.
getPermissionType
()))
{
domainId
=
baseMapper
.
selectSettleByCode
(
insert
.
getCode
());
insert
.
setDomainId
(
domainId
);
}
if
(!
CommonConstants
.
EIGHT_STRING
.
equals
(
insert
.
getPermissionType
())
&&
!
CommonConstants
.
NINE_STRING
.
equals
(
insert
.
getPermissionType
()))
{
insert
.
setIsContains
(
null
);
}
// 插入数据
// 插入数据
insertExcel
(
insert
);
insertExcel
(
insert
);
}
}
...
@@ -369,7 +380,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
...
@@ -369,7 +380,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
/**
/**
* 插入excel bad record
* 插入excel bad record
*/
*/
private
void
insertExcel
(
SysUserPermission
insert
)
{
private
void
insertExcel
(
SysUserPermission
insert
)
{
//转化是否含下级
//转化是否含下级
if
(
Common
.
isNotNull
(
insert
.
getIsContains
()))
{
if
(
Common
.
isNotNull
(
insert
.
getIsContains
()))
{
if
(
CommonConstants
.
IS_TRUE
.
equals
(
insert
.
getIsContains
()))
{
if
(
CommonConstants
.
IS_TRUE
.
equals
(
insert
.
getIsContains
()))
{
...
...
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysMenuMapper.xml
View file @
98efd041
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
<result
property=
"createName"
column=
"CREATE_NAME"
/>
<result
property=
"createName"
column=
"CREATE_NAME"
/>
<result
property=
"createTime"
column=
"CREATE_TIME"
/>
<result
property=
"createTime"
column=
"CREATE_TIME"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
/>
<result
property=
"isOpen"
column=
"IS_OPEN"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
a.ID,
a.ID,
...
@@ -46,6 +47,8 @@
...
@@ -46,6 +47,8 @@
a.BU_ID,
a.BU_ID,
a.LINE_ID,
a.LINE_ID,
a.DEPT_ID,
a.DEPT_ID,
a.IS_OPEN,
a.VIEW_ID,
a.CREATE_TIME
a.CREATE_TIME
</sql>
</sql>
<sql
id=
"sysMenu_where"
>
<sql
id=
"sysMenu_where"
>
...
@@ -83,6 +86,13 @@
...
@@ -83,6 +86,13 @@
WHERE a.fd_id = #{modelId}
WHERE a.fd_id = #{modelId}
</select>
</select>
<select
id=
"selectViewId"
resultType=
"java.lang.Long"
>
SELECT
count(1)
FROM modeling_app_collection_view a
WHERE a.fd_model_id = #{modelId} and a.fd_id = #{viewId}
</select>
<select
id=
"selectColumnList"
resultType=
"java.lang.String"
>
<select
id=
"selectColumnList"
resultType=
"java.lang.String"
>
SELECT
SELECT
a.fd_column
a.fd_column
...
...
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysUserPermissionMapper.xml
View file @
98efd041
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
<resultMap
id=
"nameAndCodeMap"
type=
"com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo"
>
<resultMap
id=
"nameAndCodeMap"
type=
"com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo"
>
<result
property=
"name"
column=
"name"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"code"
column=
"code"
/>
<result
property=
"code"
column=
"code"
/>
<result
property=
"domainId"
column=
"domainId"
/>
</resultMap>
</resultMap>
<resultMap
id=
"dictMap"
type=
"com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo"
>
<resultMap
id=
"dictMap"
type=
"com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo"
>
...
@@ -156,7 +157,7 @@
...
@@ -156,7 +157,7 @@
<select
id=
"selectSettleVO"
resultMap=
"nameAndCodeMap"
>
<select
id=
"selectSettleVO"
resultMap=
"nameAndCodeMap"
>
SELECT
SELECT
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name
,a.fd_id domainId
from ekp_24a8e6a7fc143bb8c48a a
from ekp_24a8e6a7fc143bb8c48a a
where 1=1
where 1=1
<if
test=
"name != null and name.trim() != ''"
>
<if
test=
"name != null and name.trim() != ''"
>
...
@@ -164,12 +165,19 @@
...
@@ -164,12 +165,19 @@
</if>
</if>
</select>
</select>
<!--根据项目编码查询id-->
<select
id=
"selectSettleByCode"
resultType=
"java.lang.String"
>
SELECT
a.fd_id
from ekp_24a8e6a7fc143bb8c48a a where a.fd_3a37fe508071fe = #{code} limit 1
</select>
<select
id=
"selectContractSimpleVO"
resultMap=
"nameAndCodeMap"
>
<select
id=
"selectContractSimpleVO"
resultMap=
"nameAndCodeMap"
>
SELECT
SELECT
a.NAME,
a.NAME,
a.CODE
a.CODE
from sys_user_permission a
from sys_user_permission a
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type}
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type}
and a.PERMISSION_STATUS = '0'
<if
test=
"name != null and name.trim() != ''"
>
<if
test=
"name != null and name.trim() != ''"
>
AND (a.NAME like concat('%',#{name},'%') or a.CODE like concat('%',#{name},'%'))
AND (a.NAME like concat('%',#{name},'%') or a.CODE like concat('%',#{name},'%'))
</if>
</if>
...
...
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