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
d8c94c14
Commit
d8c94c14
authored
Aug 30, 2023
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单权限修改
parent
56d9c8b8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
189 additions
and
207 deletions
+189
-207
SysMenu.java
...om/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
+26
-46
SysUserPermission.java
...oud/plus/v1/yifu/permission/entity/SysUserPermission.java
+9
-34
SysMenuController.java
...loud/plus/v1/permission/controller/SysMenuController.java
+6
-20
SysUserPermissionController.java
...v1/permission/controller/SysUserPermissionController.java
+10
-12
SysMenuMapper.java
...m/yifu/cloud/plus/v1/permission/mapper/SysMenuMapper.java
+26
-1
SysMenuService.java
...yifu/cloud/plus/v1/permission/service/SysMenuService.java
+9
-0
SysMenuServiceImpl.java
...d/plus/v1/permission/service/impl/SysMenuServiceImpl.java
+73
-9
SysMenuMapper.xml
...ermission-biz/src/main/resources/mapper/SysMenuMapper.xml
+28
-78
SysUserPermissionMapper.xml
...biz/src/main/resources/mapper/SysUserPermissionMapper.xml
+2
-7
No files found.
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
View file @
d8c94c14
...
...
@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.permission.entity;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
...
...
@@ -11,6 +12,8 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.List
;
/**
* 新权限-菜单表
*
...
...
@@ -27,33 +30,27 @@ public class SysMenu extends BaseEntity {
* ID
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@ExcelProperty
(
"ID"
)
@Schema
(
description
=
"ID"
)
private
String
id
;
/**
* 菜单名称
*/
@ExcelAttribute
(
name
=
"菜单名称"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"菜单名称不能超过20个字符"
)
@ExcelProperty
(
"菜单名称"
)
@Schema
(
description
=
"菜单名称"
)
private
String
menuName
;
/**
* 上级菜单名称
*/
@ExcelAttribute
(
name
=
"上级菜单名称"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"上级菜单名称不能超过20个字符"
)
@ExcelProperty
(
"上级菜单名称"
)
@Schema
(
description
=
"上级菜单名称"
)
private
String
menuNameParent
;
/**
* 上级菜单id
*/
@ExcelAttribute
(
name
=
"上级菜单id"
,
maxLength
=
36
)
@Length
(
max
=
36
,
message
=
"上级菜单id不能超过36个字符"
)
@ExcelProperty
(
"上级菜单id"
)
@Schema
(
description
=
"上级菜单id"
)
private
String
menuParentId
;
/**
* 表单ID
*/
...
...
@@ -62,101 +59,84 @@ public class SysMenu extends BaseEntity {
@ExcelProperty
(
"表单ID"
)
@Schema
(
description
=
"表单ID"
)
private
String
modelId
;
/**
* 视图ID
*/
@ExcelAttribute
(
name
=
"视图ID"
,
maxLength
=
36
)
@Length
(
max
=
36
,
message
=
"视图ID不能超过36个字符"
)
@ExcelProperty
(
"视图ID"
)
@Schema
(
description
=
"视图ID"
)
private
String
viewId
;
/**
* 授权状态(0启用、1禁用)
*/
@ExcelAttribute
(
name
=
"授权状态(0启用、1禁用)"
,
maxLength
=
1
)
@Length
(
max
=
1
,
message
=
"授权状态(0启用、1禁用)不能超过1个字符"
)
@ExcelProperty
(
"授权状态(0启用、1禁用)"
)
@Schema
(
description
=
"授权状态(0启用、1禁用)"
)
private
String
permissionStatus
;
/**
* 删除状态(0是、1否)
*/
@ExcelAttribute
(
name
=
"删除状态(0是、1否)"
,
maxLength
=
1
)
@Length
(
max
=
1
,
message
=
"删除状态(0是、1否)不能超过1个字符"
)
@ExcelProperty
(
"删除状态(0是、1否)"
)
@Schema
(
description
=
"删除状态(0是、1否)"
)
private
String
deleteStatus
;
/**
* 收入权限id
*/
@ExcelAttribute
(
name
=
"收入权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"收入权限id不能超过20个字符"
)
@ExcelProperty
(
"收入权限id"
)
@Schema
(
description
=
"收入权限id"
)
private
String
incomeId
;
/**
* 客户权限id
*/
@ExcelAttribute
(
name
=
"客户权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"客户权限id不能超过20个字符"
)
@ExcelProperty
(
"客户权限id"
)
@Schema
(
description
=
"客户权限id"
)
private
String
customerId
;
/**
* 合同权限id
*/
@ExcelAttribute
(
name
=
"合同权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"合同权限id不能超过20个字符"
)
@ExcelProperty
(
"合同权限id"
)
@Schema
(
description
=
"合同权限id"
)
private
String
contractId
;
/**
* 商机权限id
*/
@ExcelAttribute
(
name
=
"商机权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"商机权限id不能超过20个字符"
)
@ExcelProperty
(
"商机权限id"
)
@Schema
(
description
=
"商机权限id"
)
private
String
bussinessId
;
/**
* 报价单权限id
*/
@ExcelAttribute
(
name
=
"报价单权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"报价单权限id不能超过20个字符"
)
@ExcelProperty
(
"报价单权限id"
)
@Schema
(
description
=
"报价单权限id"
)
private
String
quotationId
;
/**
* 项目权限id
*/
@ExcelAttribute
(
name
=
"项目权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"项目权限id不能超过20个字符"
)
@ExcelProperty
(
"项目权限id"
)
@Schema
(
description
=
"项目权限id"
)
private
String
domainId
;
/**
* BU归属权限id
*/
@ExcelAttribute
(
name
=
"BU归属权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"BU归属权限id不能超过20个字符"
)
@ExcelProperty
(
"BU归属权限id"
)
@Schema
(
description
=
"BU归属权限id"
)
private
String
buId
;
/**
* 条线类型权限id
*/
@ExcelAttribute
(
name
=
"条线类型权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"条线类型权限id不能超过20个字符"
)
@ExcelProperty
(
"条线类型权限id"
)
@Schema
(
description
=
"条线类型权限id"
)
private
String
lineId
;
/**
* 部门权限id
*/
@ExcelAttribute
(
name
=
"部门权限id"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"部门权限id不能超过20个字符"
)
@ExcelProperty
(
"部门权限id"
)
@Schema
(
description
=
"部门权限id"
)
private
String
deptId
;
/**
* 权限idList
*/
@Schema
(
description
=
"权限idList"
)
@TableField
(
exist
=
false
)
private
List
<
String
>
columnIdList
;
}
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/SysUserPermission.java
View file @
d8c94c14
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
permission
.
entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
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.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
/**
* 新权限-用户权限表
...
...
@@ -29,80 +24,60 @@ public class SysUserPermission extends BaseEntity {
* id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@ExcelProperty
(
"id"
)
@Schema
(
description
=
"id"
)
private
String
id
;
/**
* 员工姓名
*/
@ExcelAttribute
(
name
=
"员工姓名"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"员工姓名不能超过20个字符"
)
@ExcelProperty
(
"员工姓名"
)
@Schema
(
description
=
"员工姓名"
)
private
String
empName
;
/**
* 登录账号
*/
@ExcelAttribute
(
name
=
"登录账号"
,
isNotEmpty
=
true
,
errorInfo
=
"登录账号不能为空"
,
maxLength
=
10
)
@NotBlank
(
message
=
"登录账号不能为空"
)
@Length
(
max
=
10
,
message
=
"登录账号不能超过10个字符"
)
@ExcelProperty
(
"登录账号"
)
@Schema
(
description
=
"登录账号"
)
private
String
empLoginName
;
/**
* 所在部门
*/
@ExcelAttribute
(
name
=
"所在部门"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"所在部门不能超过20个字符"
)
@ExcelProperty
(
"所在部门"
)
@Schema
(
description
=
"所在部门"
)
private
String
empDept
;
/**
* 权限类型
*/
@ExcelAttribute
(
name
=
"权限类型"
,
maxLength
=
8
)
@Length
(
max
=
8
,
message
=
"权限类型不能超过8个字符"
)
@ExcelProperty
(
"权限类型"
)
@Schema
(
description
=
"权限类型"
)
private
String
permissionType
;
/**
* 名称
*/
@ExcelAttribute
(
name
=
"名称"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"名称不能超过20个字符"
)
@ExcelProperty
(
"名称"
)
@Schema
(
description
=
"名称"
)
private
String
name
;
/**
* 编码
*/
@ExcelAttribute
(
name
=
"编码"
,
maxLength
=
10
)
@Length
(
max
=
10
,
message
=
"编码不能超过10个字符"
)
@ExcelProperty
(
"编码"
)
@Schema
(
description
=
"编码"
)
private
String
code
;
/**
* 是否包含(0 是 1否)
*/
@ExcelAttribute
(
name
=
"是否包含(0 是 1否)"
,
maxLength
=
1
)
@Length
(
max
=
1
,
message
=
"是否包含(0 是 1否)不能超过1个字符"
)
@ExcelProperty
(
"是否包含(0 是 1否)"
)
@Schema
(
description
=
"是否包含(0 是 1否)"
)
private
String
isContains
;
/**
* 授权状态(0启用、1禁用)
*/
@ExcelAttribute
(
name
=
"授权状态(0启用、1禁用)"
,
maxLength
=
1
)
@Length
(
max
=
1
,
message
=
"授权状态(0启用、1禁用)不能超过1个字符"
)
@ExcelProperty
(
"授权状态(0启用、1禁用)"
)
@Schema
(
description
=
"授权状态(0启用、1禁用)"
)
private
String
permissionStatus
;
/**
* 删除状态(0是、1否)
*/
@ExcelAttribute
(
name
=
"删除状态(0是、1否)"
,
maxLength
=
1
)
@Length
(
max
=
1
,
message
=
"删除状态(0是、1否)不能超过1个字符"
)
@ExcelProperty
(
"删除状态(0是、1否)"
)
@Schema
(
description
=
"删除状态(0是、1否)"
)
private
String
deleteFlag
;
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/controller/SysMenuController.java
View file @
d8c94c14
...
...
@@ -47,12 +47,12 @@ public class SysMenuController {
* @param sysMenu 新权限-菜单表
* @return R
*/
@Operation
(
summary
=
"新增新权限-菜单表"
,
description
=
"新增新权限-菜单表:hasPermission('demo
_sysmenu_add')"
)
@Operation
(
description
=
"新增新权限-菜单表:hasPermission('permission
_sysmenu_add')"
)
@SysLog
(
"新增新权限-菜单表"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('
demo
_sysmenu_add')"
)
@PreAuthorize
(
"@pms.hasPermission('
permission
_sysmenu_add')"
)
public
R
<
Boolean
>
save
(
@RequestBody
SysMenu
sysMenu
)
{
return
R
.
ok
(
sysMenuService
.
save
(
sysMenu
)
);
return
sysMenuService
.
saveMenu
(
sysMenu
);
}
/**
...
...
@@ -61,26 +61,12 @@ public class SysMenuController {
* @param sysMenu 新权限-菜单表
* @return R
*/
@Operation
(
summary
=
"修改新权限-菜单表"
,
description
=
"修改新权限-菜单表:hasPermission('demo
_sysmenu_edit')"
)
@Operation
(
description
=
"修改新权限-菜单表:hasPermission('permission
_sysmenu_edit')"
)
@SysLog
(
"修改新权限-菜单表"
)
@P
utMapping
@PreAuthorize
(
"@pms.hasPermission('
demo
_sysmenu_edit')"
)
@P
ostMapping
(
"/updateMenu"
)
@PreAuthorize
(
"@pms.hasPermission('
permission
_sysmenu_edit')"
)
public
R
<
Boolean
>
updateById
(
@RequestBody
SysMenu
sysMenu
)
{
return
R
.
ok
(
sysMenuService
.
updateById
(
sysMenu
));
}
/**
* 通过id删除新权限-菜单表
*
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id删除新权限-菜单表"
,
description
=
"通过id删除新权限-菜单表:hasPermission('demo_sysmenu_del')"
)
@SysLog
(
"通过id删除新权限-菜单表"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_sysmenu_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
)
{
return
R
.
ok
(
sysMenuService
.
removeById
(
id
));
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/controller/SysUserPermissionController.java
View file @
d8c94c14
...
...
@@ -65,9 +65,8 @@ public class SysUserPermissionController {
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询
:hasPermission('demo_sysuserpermission_get')
"
)
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_sysuserpermission_get')"
)
public
R
<
SysUserPermission
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
sysUserPermissionService
.
getById
(
id
));
}
...
...
@@ -78,10 +77,10 @@ public class SysUserPermissionController {
* @param sysUserPermission 新权限-用户权限表
* @return R
*/
@Operation
(
summary
=
"新增新权限-用户权限表"
,
description
=
"新增新权限-用户权限表:hasPermission('demo
_sysuserpermission_add')"
)
@Operation
(
description
=
"新增新权限-用户权限表:hasPermission('permission
_sysuserpermission_add')"
)
@SysLog
(
"新增新权限-用户权限表"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('
demo
_sysuserpermission_add')"
)
@PreAuthorize
(
"@pms.hasPermission('
permission
_sysuserpermission_add')"
)
public
R
<
Boolean
>
save
(
@RequestBody
SysUserPermission
sysUserPermission
)
{
return
R
.
ok
(
sysUserPermissionService
.
save
(
sysUserPermission
));
}
...
...
@@ -92,10 +91,10 @@ public class SysUserPermissionController {
* @param sysUserPermission 新权限-用户权限表
* @return R
*/
@Operation
(
summary
=
"修改新权限-用户权限表"
,
description
=
"修改新权限-用户权限表:hasPermission('demo
_sysuserpermission_edit')"
)
@Operation
(
description
=
"修改新权限-用户权限表:hasPermission('permission
_sysuserpermission_edit')"
)
@SysLog
(
"修改新权限-用户权限表"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('
demo
_sysuserpermission_edit')"
)
@PreAuthorize
(
"@pms.hasPermission('
permission
_sysuserpermission_edit')"
)
public
R
<
Boolean
>
updateById
(
@RequestBody
SysUserPermission
sysUserPermission
)
{
return
R
.
ok
(
sysUserPermissionService
.
updateById
(
sysUserPermission
));
}
...
...
@@ -106,10 +105,10 @@ public class SysUserPermissionController {
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id删除新权限-用户权限表"
,
description
=
"通过id删除新权限-用户权限表:hasPermission('demo
_sysuserpermission_del')"
)
@Operation
(
description
=
"通过id删除新权限-用户权限表:hasPermission('permission
_sysuserpermission_del')"
)
@SysLog
(
"通过id删除新权限-用户权限表"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('
demo
_sysuserpermission_del')"
)
@PreAuthorize
(
"@pms.hasPermission('
permission
_sysuserpermission_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
)
{
return
R
.
ok
(
sysUserPermissionService
.
removeById
(
id
));
}
...
...
@@ -121,10 +120,10 @@ public class SysUserPermissionController {
* @date 2023-08-29 14:49:40
**/
@SneakyThrows
@Operation
(
description
=
"批量新增新权限-用户权限表 hasPermission('
demo
_sysuserpermission-batch-import')"
)
@Operation
(
description
=
"批量新增新权限-用户权限表 hasPermission('
permission
_sysuserpermission-batch-import')"
)
@SysLog
(
"批量新增新权限-用户权限表"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('
demo
_sysuserpermission-batch-import')"
)
@PreAuthorize
(
"@pms.hasPermission('
permission
_sysuserpermission-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
)
{
return
sysUserPermissionService
.
importDiy
(
file
.
getInputStream
());
}
...
...
@@ -135,9 +134,8 @@ public class SysUserPermissionController {
* @author hyc
* @date 2023-08-29 14:49:40
**/
@Operation
(
description
=
"导出新权限-用户权限表
hasPermission('demo_sysuserpermission-export')
"
)
@Operation
(
description
=
"导出新权限-用户权限表"
)
@PostMapping
(
"/export"
)
@PreAuthorize
(
"@pms.hasPermission('demo_sysuserpermission-export')"
)
public
void
export
(
HttpServletResponse
response
,
@RequestBody
SysUserPermissionSearchVo
searchVo
)
{
sysUserPermissionService
.
listExport
(
response
,
searchVo
);
}
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/mapper/SysMenuMapper.java
View file @
d8c94c14
...
...
@@ -4,16 +4,41 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
public
interface
SysMenuMapper
extends
BaseMapper
<
SysMenu
>
{
/**
* 新权限-菜单表简单分页查询
*
* @param sysMenu 新权限-菜单表
* @Author: huyc
* @Date: 2023/8/29 14:19
* @return
*/
IPage
<
SysMenu
>
getSysMenuPage
(
Page
<
SysMenu
>
page
,
@Param
(
"sysMenu"
)
SysMenuSearchVo
sysMenu
);
/**
* 判断是否存在此菜单
*
* @param modelId 表单id
* @Author: huyc
* @Date: 2023/8/30 14:20
* @return
*/
long
selectMenuId
(
@Param
(
"modelId"
)
String
modelId
);
/**
* 判断是否存在此字段
*
* @param modelId 表单id
* @Author: huyc
* @Date: 2023/8/30 14:41
* @return
*/
IPage
<
SysMenu
>
getSysMenuPage
(
Page
<
SysMenu
>
page
,
@Param
(
"sysMenu"
)
SysMenu
sysMenu
);
List
<
String
>
selectColumnList
(
@Param
(
"modelId"
)
String
modelId
);
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/SysMenuService.java
View file @
d8c94c14
...
...
@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.permission.service;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo
;
...
...
@@ -13,10 +14,18 @@ import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
* @date 2023-08-29 14:49:40
*/
public
interface
SysMenuService
extends
IService
<
SysMenu
>
{
/**
* 新权限-菜单表简单分页查询
* @param sysMenu 新权限-菜单表
* @return
*/
IPage
<
SysMenu
>
getSysMenuPage
(
Page
<
SysMenu
>
page
,
SysMenuSearchVo
sysMenu
);
/**
* 新增菜单表
* @param menu 新权限-菜单表
* @return
*/
R
<
Boolean
>
saveMenu
(
SysMenu
menu
);
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/SysMenuServiceImpl.java
View file @
d8c94c14
package
com
.
yifu
.
cloud
.
plus
.
v1
.
permission
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper
;
import
com.yifu.cloud.plus.v1.permission.service.SysMenuService
;
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.permission.entity.SysMenu
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 新权限-菜单表
*
...
...
@@ -19,14 +25,72 @@ import org.springframework.stereotype.Service;
@Log4j2
@Service
public
class
SysMenuServiceImpl
extends
ServiceImpl
<
SysMenuMapper
,
SysMenu
>
implements
SysMenuService
{
/**
* 新权限-菜单表简单分页查询
* @param sysMenu 新权限-菜单表
* @return
*/
@Override
public
IPage
<
SysMenu
>
getSysMenuPage
(
Page
<
SysMenu
>
page
,
SysMenuSearchVo
sysMenu
){
return
baseMapper
.
getSysMenuPage
(
page
,
sysMenu
);
}
/**
* 新权限-菜单表简单分页查询
*
* @param sysMenu 新权限-菜单表
* @return
*/
@Override
public
IPage
<
SysMenu
>
getSysMenuPage
(
Page
<
SysMenu
>
page
,
SysMenuSearchVo
sysMenu
)
{
return
baseMapper
.
getSysMenuPage
(
page
,
sysMenu
);
}
/**
* 新增菜单表
*
* @param menu 新权限-菜单表
* @return
*/
@Override
public
R
<
Boolean
>
saveMenu
(
SysMenu
menu
)
{
if
(
Common
.
isEmpty
(
menu
.
getModelId
()))
{
return
R
.
failed
(
"表单ID不可为空"
);
}
//判断表单id是否填写正确
long
menuIdCount
=
baseMapper
.
selectMenuId
(
menu
.
getModelId
());
if
(
menuIdCount
<
1
)
{
return
R
.
failed
(
"表单ID填写错误,请确认"
);
}
//唯一性校验--表单ID唯一
long
modelCount
=
baseMapper
.
selectCount
(
Wrappers
.<
SysMenu
>
query
().
lambda
()
.
eq
(
SysMenu:
:
getModelId
,
menu
.
getModelId
())
.
eq
(
SysMenu:
:
getDeleteStatus
,
CommonConstants
.
ONE_STRING
));
if
(
modelCount
>
0
)
{
return
R
.
failed
(
"已存在对应菜单的权限维度"
);
}
//判断菜单是否为一级菜单
if
(
Common
.
isNotNull
(
menu
.
getMenuName
())
&&
Common
.
isEmpty
(
menu
.
getMenuNameParent
()))
{
//一级菜单的上级菜单id为0
menu
.
setMenuParentId
(
CommonConstants
.
ZERO_STRING
);
}
//错误信息
StringBuilder
errorStr
=
new
StringBuilder
();
//权限类型
String
name
;
//判断填写的控件id 是否属于表单的字段
List
<
String
>
list
=
baseMapper
.
selectColumnList
(
menu
.
getModelId
());
if
(!
menu
.
getColumnIdList
().
isEmpty
())
{
for
(
String
columnId
:
menu
.
getColumnIdList
())
{
name
=
columnId
.
substring
(
0
,
columnId
.
indexOf
(
";"
));
//label为控件id;columnId格式为【客户权限_fd_3ae495ff53c560】
String
label
=
columnId
.
substring
(
columnId
.
indexOf
(
";"
)
+
1
);
if
(
list
.
stream
().
noneMatch
(
e
->
e
.
equals
(
label
)))
{
errorStr
.
append
(
name
).
append
(
"的控件id填写有误;"
);
}
}
}
//权限维度的控件id填写错误的话统一返回
if
(
errorStr
.
length
()
>
0
)
{
return
R
.
failed
(
errorStr
.
substring
(
0
,
errorStr
.
lastIndexOf
(
";"
)));
}
int
res
=
baseMapper
.
insert
(
menu
);
if
(
res
<=
CommonConstants
.
ZERO_INT
)
{
return
R
.
failed
();
}
return
R
.
ok
();
}
}
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysMenuMapper.xml
View file @
d8c94c14
...
...
@@ -24,6 +24,7 @@
<result
property=
"createBy"
column=
"CREATE_BY"
/>
<result
property=
"updateBy"
column=
"UPDATE_BY"
/>
<result
property=
"createName"
column=
"CREATE_NAME"
/>
<result
property=
"createTime"
column=
"CREATE_TIME"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -31,89 +32,24 @@
a.MENU_NAME,
a.MENU_NAME_PARENT,
a.MENU_PARENT_ID,
a.MODEL_ID,
a.VIEW_ID,
a.PERMISSION_STATUS,
a.DELETE_STATUS,
a.INCOME_ID,
a.CUSTOMER_ID,
a.CONTRACT_ID,
a.BUSSINESS_ID,
a.QUOTATION_ID,
a.DOMAIN_ID,
a.BU_ID,
a.LINE_ID,
a.DEPT_ID,
a.CREATE_BY,
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_TIME
a.CREATE_TIME
</sql>
<sql
id=
"sysMenu_where"
>
<if
test=
"sysMenu != null"
>
<if
test=
"sysMenu.id != null and sysMenu.id.trim() != ''"
>
AND a.ID = #{sysMenu.id}
</if>
<if
test=
"sysMenu.menuName != null and sysMenu.menuName.trim() != ''"
>
AND a.MENU_NAME = #{sysMenu.menuName}
</if>
<if
test=
"sysMenu.menuNameParent != null and sysMenu.menuNameParent.trim() != ''"
>
AND a.MENU_NAME_PARENT = #{sysMenu.menuNameParent}
</if>
<if
test=
"sysMenu.menuParentId != null and sysMenu.menuParentId.trim() != ''"
>
AND a.MENU_PARENT_ID = #{sysMenu.menuParentId}
</if>
<if
test=
"sysMenu.modelId != null and sysMenu.modelId.trim() != ''"
>
AND a.MODEL_ID = #{sysMenu.modelId}
</if>
<if
test=
"sysMenu.viewId != null and sysMenu.viewId.trim() != ''"
>
AND a.VIEW_ID = #{sysMenu.viewId}
</if>
<if
test=
"sysMenu.permissionStatus != null and sysMenu.permissionStatus.trim() != ''"
>
AND a.PERMISSION_STATUS = #{sysMenu.permissionStatus}
</if>
<if
test=
"sysMenu.deleteStatus != null and sysMenu.deleteStatus.trim() != ''"
>
AND a.DELETE_STATUS = #{sysMenu.deleteStatus}
</if>
<if
test=
"sysMenu.incomeId != null and sysMenu.incomeId.trim() != ''"
>
AND a.INCOME_ID = #{sysMenu.incomeId}
</if>
<if
test=
"sysMenu.customerId != null and sysMenu.customerId.trim() != ''"
>
AND a.CUSTOMER_ID = #{sysMenu.customerId}
</if>
<if
test=
"sysMenu.contractId != null and sysMenu.contractId.trim() != ''"
>
AND a.CONTRACT_ID = #{sysMenu.contractId}
</if>
<if
test=
"sysMenu.bussinessId != null and sysMenu.bussinessId.trim() != ''"
>
AND a.BUSSINESS_ID = #{sysMenu.bussinessId}
</if>
<if
test=
"sysMenu.quotationId != null and sysMenu.quotationId.trim() != ''"
>
AND a.QUOTATION_ID = #{sysMenu.quotationId}
</if>
<if
test=
"sysMenu.domainId != null and sysMenu.domainId.trim() != ''"
>
AND a.DOMAIN_ID = #{sysMenu.domainId}
</if>
<if
test=
"sysMenu.buId != null and sysMenu.buId.trim() != ''"
>
AND a.BU_ID = #{sysMenu.buId}
</if>
<if
test=
"sysMenu.lineId != null and sysMenu.lineId.trim() != ''"
>
AND a.LINE_ID = #{sysMenu.lineId}
</if>
<if
test=
"sysMenu.deptId != null and sysMenu.deptId.trim() != ''"
>
AND a.DEPT_ID = #{sysMenu.deptId}
</if>
<if
test=
"sysMenu.createBy != null and sysMenu.createBy.trim() != ''"
>
AND a.CREATE_BY = #{sysMenu.createBy}
</if>
<if
test=
"sysMenu.updateBy != null and sysMenu.updateBy.trim() != ''"
>
AND a.UPDATE_BY = #{sysMenu.updateBy}
</if>
<if
test=
"sysMenu.createName != null and sysMenu.createName.trim() != ''"
>
AND a.CREATE_NAME = #{sysMenu.createName}
</if>
<if
test=
"sysMenu.updateTime != null"
>
AND a.UPDATE_TIME = #{sysMenu.updateTime}
</if>
<if
test=
"sysMenu.menuName != null and sysMenu.menuName.trim() != ''"
>
AND a.MENU_NAME = #{sysMenu.menuName}
</if>
<if
test=
"sysMenu.menuNameParent != null and sysMenu.menuNameParent.trim() != ''"
>
AND a.MENU_NAME_PARENT = #{sysMenu.menuNameParent}
</if>
<if
test=
"sysMenu.menuParentId != null and sysMenu.menuParentId.trim() != ''"
>
AND a.MENU_PARENT_ID = #{sysMenu.menuParentId}
</if>
<if
test=
"sysMenu.permissionStatus != null and sysMenu.permissionStatus.trim() != ''"
>
AND a.PERMISSION_STATUS = #{sysMenu.permissionStatus}
</if>
</if>
</sql>
<!--sysMenu简单分页查询-->
...
...
@@ -126,4 +62,18 @@
<include
refid=
"sysMenu_where"
/>
</where>
</select>
<select
id=
"selectMenuId"
resultType=
"java.lang.Long"
>
SELECT
count(1)
FROM modeling_app_model a
where a.fd_id = #{modelId}
</select>
<select
id=
"selectColumnList"
resultType=
"java.lang.String"
>
SELECT
a.fd_column
FROM sys_xform_db_column a
where a.fd_main_id = #{modelId}
</select>
</mapper>
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysUserPermissionMapper.xml
View file @
d8c94c14
...
...
@@ -17,6 +17,7 @@
<result
property=
"createBy"
column=
"CREATE_BY"
/>
<result
property=
"updateBy"
column=
"UPDATE_BY"
/>
<result
property=
"createName"
column=
"CREATE_NAME"
/>
<result
property=
"createTime"
column=
"CREATE_TIME"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -30,16 +31,10 @@
a.IS_CONTAINS,
a.PERMISSION_STATUS,
a.DELETE_FLAG,
a.CREATE_BY,
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_TIME
a.CREATE_TIME
</sql>
<sql
id=
"sysUserPermission_where"
>
<if
test=
"sysUserPermission != null"
>
<if
test=
"sysUserPermission.id != null and sysUserPermission.id.trim() != ''"
>
AND a.ID = #{sysUserPermission.id}
</if>
<if
test=
"sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''"
>
AND a.EMP_NAME = #{sysUserPermission.empName}
</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