Commit d8c94c14 authored by huyuchen's avatar huyuchen

菜单权限修改

parent 56d9c8b8
...@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.permission.entity; ...@@ -2,6 +2,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;
...@@ -11,6 +12,8 @@ import lombok.Data; ...@@ -11,6 +12,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import java.util.List;
/** /**
* 新权限-菜单表 * 新权限-菜单表
* *
...@@ -27,33 +30,27 @@ public class SysMenu extends BaseEntity { ...@@ -27,33 +30,27 @@ public class SysMenu extends BaseEntity {
* ID * ID
*/ */
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("ID")
@Schema(description = "ID") @Schema(description = "ID")
private String id; private String id;
/** /**
* 菜单名称 * 菜单名称
*/ */
@ExcelAttribute(name = "菜单名称", maxLength = 20)
@Length(max = 20, message = "菜单名称不能超过20个字符")
@ExcelProperty("菜单名称")
@Schema(description = "菜单名称") @Schema(description = "菜单名称")
private String menuName; private String menuName;
/** /**
* 上级菜单名称 * 上级菜单名称
*/ */
@ExcelAttribute(name = "上级菜单名称", maxLength = 20)
@Length(max = 20, message = "上级菜单名称不能超过20个字符")
@ExcelProperty("上级菜单名称")
@Schema(description = "上级菜单名称") @Schema(description = "上级菜单名称")
private String menuNameParent; private String menuNameParent;
/** /**
* 上级菜单id * 上级菜单id
*/ */
@ExcelAttribute(name = "上级菜单id", maxLength = 36)
@Length(max = 36, message = "上级菜单id不能超过36个字符")
@ExcelProperty("上级菜单id")
@Schema(description = "上级菜单id") @Schema(description = "上级菜单id")
private String menuParentId; private String menuParentId;
/** /**
* 表单ID * 表单ID
*/ */
...@@ -62,101 +59,84 @@ public class SysMenu extends BaseEntity { ...@@ -62,101 +59,84 @@ public class SysMenu extends BaseEntity {
@ExcelProperty("表单ID") @ExcelProperty("表单ID")
@Schema(description = "表单ID") @Schema(description = "表单ID")
private String modelId; private String modelId;
/** /**
* 视图ID * 视图ID
*/ */
@ExcelAttribute(name = "视图ID", maxLength = 36)
@Length(max = 36, message = "视图ID不能超过36个字符")
@ExcelProperty("视图ID")
@Schema(description = "视图ID") @Schema(description = "视图ID")
private String viewId; private String viewId;
/** /**
* 授权状态(0启用、1禁用) * 授权状态(0启用、1禁用)
*/ */
@ExcelAttribute(name = "授权状态(0启用、1禁用)", maxLength = 1)
@Length(max = 1, message = "授权状态(0启用、1禁用)不能超过1个字符")
@ExcelProperty("授权状态(0启用、1禁用)")
@Schema(description = "授权状态(0启用、1禁用)") @Schema(description = "授权状态(0启用、1禁用)")
private String permissionStatus; private String permissionStatus;
/** /**
* 删除状态(0是、1否) * 删除状态(0是、1否)
*/ */
@ExcelAttribute(name = "删除状态(0是、1否)", maxLength = 1)
@Length(max = 1, message = "删除状态(0是、1否)不能超过1个字符")
@ExcelProperty("删除状态(0是、1否)")
@Schema(description = "删除状态(0是、1否)") @Schema(description = "删除状态(0是、1否)")
private String deleteStatus; private String deleteStatus;
/** /**
* 收入权限id * 收入权限id
*/ */
@ExcelAttribute(name = "收入权限id", maxLength = 20)
@Length(max = 20, message = "收入权限id不能超过20个字符")
@ExcelProperty("收入权限id")
@Schema(description = "收入权限id") @Schema(description = "收入权限id")
private String incomeId; private String incomeId;
/** /**
* 客户权限id * 客户权限id
*/ */
@ExcelAttribute(name = "客户权限id", maxLength = 20)
@Length(max = 20, message = "客户权限id不能超过20个字符")
@ExcelProperty("客户权限id")
@Schema(description = "客户权限id") @Schema(description = "客户权限id")
private String customerId; private String customerId;
/** /**
* 合同权限id * 合同权限id
*/ */
@ExcelAttribute(name = "合同权限id", maxLength = 20)
@Length(max = 20, message = "合同权限id不能超过20个字符")
@ExcelProperty("合同权限id")
@Schema(description = "合同权限id") @Schema(description = "合同权限id")
private String contractId; private String contractId;
/** /**
* 商机权限id * 商机权限id
*/ */
@ExcelAttribute(name = "商机权限id", maxLength = 20)
@Length(max = 20, message = "商机权限id不能超过20个字符")
@ExcelProperty("商机权限id")
@Schema(description = "商机权限id") @Schema(description = "商机权限id")
private String bussinessId; private String bussinessId;
/** /**
* 报价单权限id * 报价单权限id
*/ */
@ExcelAttribute(name = "报价单权限id", maxLength = 20)
@Length(max = 20, message = "报价单权限id不能超过20个字符")
@ExcelProperty("报价单权限id")
@Schema(description = "报价单权限id") @Schema(description = "报价单权限id")
private String quotationId; private String quotationId;
/** /**
* 项目权限id * 项目权限id
*/ */
@ExcelAttribute(name = "项目权限id", maxLength = 20)
@Length(max = 20, message = "项目权限id不能超过20个字符")
@ExcelProperty("项目权限id")
@Schema(description = "项目权限id") @Schema(description = "项目权限id")
private String domainId; private String domainId;
/** /**
* BU归属权限id * BU归属权限id
*/ */
@ExcelAttribute(name = "BU归属权限id", maxLength = 20)
@Length(max = 20, message = "BU归属权限id不能超过20个字符")
@ExcelProperty("BU归属权限id")
@Schema(description = "BU归属权限id") @Schema(description = "BU归属权限id")
private String buId; private String buId;
/** /**
* 条线类型权限id * 条线类型权限id
*/ */
@ExcelAttribute(name = "条线类型权限id", maxLength = 20)
@Length(max = 20, message = "条线类型权限id不能超过20个字符")
@ExcelProperty("条线类型权限id")
@Schema(description = "条线类型权限id") @Schema(description = "条线类型权限id")
private String lineId; private String lineId;
/** /**
* 部门权限id * 部门权限id
*/ */
@ExcelAttribute(name = "部门权限id", maxLength = 20)
@Length(max = 20, message = "部门权限id不能超过20个字符")
@ExcelProperty("部门权限id")
@Schema(description = "部门权限id") @Schema(description = "部门权限id")
private String deptId; private String deptId;
/**
* 权限idList
*/
@Schema(description = "权限idList")
@TableField(exist = false)
private List<String> columnIdList;
} }
package com.yifu.cloud.plus.v1.yifu.permission.entity; 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.IdType;
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.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/** /**
* 新权限-用户权限表 * 新权限-用户权限表
...@@ -29,80 +24,60 @@ public class SysUserPermission extends BaseEntity { ...@@ -29,80 +24,60 @@ public class SysUserPermission extends BaseEntity {
* id * id
*/ */
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("id")
@Schema(description = "id") @Schema(description = "id")
private String id; private String id;
/** /**
* 员工姓名 * 员工姓名
*/ */
@ExcelAttribute(name = "员工姓名", maxLength = 20)
@Length(max = 20, message = "员工姓名不能超过20个字符")
@ExcelProperty("员工姓名")
@Schema(description = "员工姓名") @Schema(description = "员工姓名")
private String empName; private String empName;
/** /**
* 登录账号 * 登录账号
*/ */
@ExcelAttribute(name = "登录账号", isNotEmpty = true, errorInfo = "登录账号不能为空", maxLength = 10)
@NotBlank(message = "登录账号不能为空")
@Length(max = 10, message = "登录账号不能超过10个字符")
@ExcelProperty("登录账号")
@Schema(description = "登录账号") @Schema(description = "登录账号")
private String empLoginName; private String empLoginName;
/** /**
* 所在部门 * 所在部门
*/ */
@ExcelAttribute(name = "所在部门", maxLength = 20)
@Length(max = 20, message = "所在部门不能超过20个字符")
@ExcelProperty("所在部门")
@Schema(description = "所在部门") @Schema(description = "所在部门")
private String empDept; private String empDept;
/** /**
* 权限类型 * 权限类型
*/ */
@ExcelAttribute(name = "权限类型", maxLength = 8)
@Length(max = 8, message = "权限类型不能超过8个字符")
@ExcelProperty("权限类型")
@Schema(description = "权限类型") @Schema(description = "权限类型")
private String permissionType; private String permissionType;
/** /**
* 名称 * 名称
*/ */
@ExcelAttribute(name = "名称", maxLength = 20)
@Length(max = 20, message = "名称不能超过20个字符")
@ExcelProperty("名称")
@Schema(description = "名称") @Schema(description = "名称")
private String name; private String name;
/** /**
* 编码 * 编码
*/ */
@ExcelAttribute(name = "编码", maxLength = 10)
@Length(max = 10, message = "编码不能超过10个字符")
@ExcelProperty("编码")
@Schema(description = "编码") @Schema(description = "编码")
private String code; private String code;
/** /**
* 是否包含(0 是 1否) * 是否包含(0 是 1否)
*/ */
@ExcelAttribute(name = "是否包含(0 是 1否)", maxLength = 1)
@Length(max = 1, message = "是否包含(0 是 1否)不能超过1个字符")
@ExcelProperty("是否包含(0 是 1否)")
@Schema(description = "是否包含(0 是 1否)") @Schema(description = "是否包含(0 是 1否)")
private String isContains; private String isContains;
/** /**
* 授权状态(0启用、1禁用) * 授权状态(0启用、1禁用)
*/ */
@ExcelAttribute(name = "授权状态(0启用、1禁用)", maxLength = 1)
@Length(max = 1, message = "授权状态(0启用、1禁用)不能超过1个字符")
@ExcelProperty("授权状态(0启用、1禁用)")
@Schema(description = "授权状态(0启用、1禁用)") @Schema(description = "授权状态(0启用、1禁用)")
private String permissionStatus; private String permissionStatus;
/** /**
* 删除状态(0是、1否) * 删除状态(0是、1否)
*/ */
@ExcelAttribute(name = "删除状态(0是、1否)", maxLength = 1)
@Length(max = 1, message = "删除状态(0是、1否)不能超过1个字符")
@ExcelProperty("删除状态(0是、1否)")
@Schema(description = "删除状态(0是、1否)") @Schema(description = "删除状态(0是、1否)")
private String deleteFlag; private String deleteFlag;
......
...@@ -47,12 +47,12 @@ public class SysMenuController { ...@@ -47,12 +47,12 @@ public class SysMenuController {
* @param sysMenu 新权限-菜单表 * @param sysMenu 新权限-菜单表
* @return R * @return R
*/ */
@Operation(summary = "新增新权限-菜单表", description = "新增新权限-菜单表:hasPermission('demo_sysmenu_add')") @Operation(description = "新增新权限-菜单表:hasPermission('permission_sysmenu_add')")
@SysLog("新增新权限-菜单表") @SysLog("新增新权限-菜单表")
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('demo_sysmenu_add')") @PreAuthorize("@pms.hasPermission('permission_sysmenu_add')")
public R<Boolean> save(@RequestBody SysMenu sysMenu) { public R<Boolean> save(@RequestBody SysMenu sysMenu) {
return R.ok(sysMenuService.save(sysMenu)); return sysMenuService.saveMenu(sysMenu);
} }
/** /**
...@@ -61,26 +61,12 @@ public class SysMenuController { ...@@ -61,26 +61,12 @@ public class SysMenuController {
* @param sysMenu 新权限-菜单表 * @param sysMenu 新权限-菜单表
* @return R * @return R
*/ */
@Operation(summary = "修改新权限-菜单表", description = "修改新权限-菜单表:hasPermission('demo_sysmenu_edit')") @Operation(description = "修改新权限-菜单表:hasPermission('permission_sysmenu_edit')")
@SysLog("修改新权限-菜单表") @SysLog("修改新权限-菜单表")
@PutMapping @PostMapping("/updateMenu")
@PreAuthorize("@pms.hasPermission('demo_sysmenu_edit')") @PreAuthorize("@pms.hasPermission('permission_sysmenu_edit')")
public R<Boolean> updateById(@RequestBody SysMenu sysMenu) { public R<Boolean> updateById(@RequestBody SysMenu sysMenu) {
return R.ok(sysMenuService.updateById(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));
}
} }
...@@ -65,9 +65,8 @@ public class SysUserPermissionController { ...@@ -65,9 +65,8 @@ public class SysUserPermissionController {
* @param id id * @param id id
* @return R * @return R
*/ */
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('demo_sysuserpermission_get')") @Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}") @GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_get')")
public R<SysUserPermission> getById(@PathVariable("id") String id) { public R<SysUserPermission> getById(@PathVariable("id") String id) {
return R.ok(sysUserPermissionService.getById(id)); return R.ok(sysUserPermissionService.getById(id));
} }
...@@ -78,10 +77,10 @@ public class SysUserPermissionController { ...@@ -78,10 +77,10 @@ public class SysUserPermissionController {
* @param sysUserPermission 新权限-用户权限表 * @param sysUserPermission 新权限-用户权限表
* @return R * @return R
*/ */
@Operation(summary = "新增新权限-用户权限表", description = "新增新权限-用户权限表:hasPermission('demo_sysuserpermission_add')") @Operation(description = "新增新权限-用户权限表:hasPermission('permission_sysuserpermission_add')")
@SysLog("新增新权限-用户权限表") @SysLog("新增新权限-用户权限表")
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_add')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission_add')")
public R<Boolean> save(@RequestBody SysUserPermission sysUserPermission) { public R<Boolean> save(@RequestBody SysUserPermission sysUserPermission) {
return R.ok(sysUserPermissionService.save(sysUserPermission)); return R.ok(sysUserPermissionService.save(sysUserPermission));
} }
...@@ -92,10 +91,10 @@ public class SysUserPermissionController { ...@@ -92,10 +91,10 @@ public class SysUserPermissionController {
* @param sysUserPermission 新权限-用户权限表 * @param sysUserPermission 新权限-用户权限表
* @return R * @return R
*/ */
@Operation(summary = "修改新权限-用户权限表", description = "修改新权限-用户权限表:hasPermission('demo_sysuserpermission_edit')") @Operation(description = "修改新权限-用户权限表:hasPermission('permission_sysuserpermission_edit')")
@SysLog("修改新权限-用户权限表") @SysLog("修改新权限-用户权限表")
@PutMapping @PutMapping
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_edit')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission_edit')")
public R<Boolean> updateById(@RequestBody SysUserPermission sysUserPermission) { public R<Boolean> updateById(@RequestBody SysUserPermission sysUserPermission) {
return R.ok(sysUserPermissionService.updateById(sysUserPermission)); return R.ok(sysUserPermissionService.updateById(sysUserPermission));
} }
...@@ -106,10 +105,10 @@ public class SysUserPermissionController { ...@@ -106,10 +105,10 @@ public class SysUserPermissionController {
* @param id id * @param id id
* @return R * @return R
*/ */
@Operation(summary = "通过id删除新权限-用户权限表", description = "通过id删除新权限-用户权限表:hasPermission('demo_sysuserpermission_del')") @Operation(description = "通过id删除新权限-用户权限表:hasPermission('permission_sysuserpermission_del')")
@SysLog("通过id删除新权限-用户权限表") @SysLog("通过id删除新权限-用户权限表")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_del')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission_del')")
public R<Boolean> removeById(@PathVariable String id) { public R<Boolean> removeById(@PathVariable String id) {
return R.ok(sysUserPermissionService.removeById(id)); return R.ok(sysUserPermissionService.removeById(id));
} }
...@@ -121,10 +120,10 @@ public class SysUserPermissionController { ...@@ -121,10 +120,10 @@ public class SysUserPermissionController {
* @date 2023-08-29 14:49:40 * @date 2023-08-29 14:49:40
**/ **/
@SneakyThrows @SneakyThrows
@Operation(description = "批量新增新权限-用户权限表 hasPermission('demo_sysuserpermission-batch-import')") @Operation(description = "批量新增新权限-用户权限表 hasPermission('permission_sysuserpermission-batch-import')")
@SysLog("批量新增新权限-用户权限表") @SysLog("批量新增新权限-用户权限表")
@PostMapping("/importListAdd") @PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission-batch-import')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) { public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return sysUserPermissionService.importDiy(file.getInputStream()); return sysUserPermissionService.importDiy(file.getInputStream());
} }
...@@ -135,9 +134,8 @@ public class SysUserPermissionController { ...@@ -135,9 +134,8 @@ public class SysUserPermissionController {
* @author hyc * @author hyc
* @date 2023-08-29 14:49:40 * @date 2023-08-29 14:49:40
**/ **/
@Operation(description = "导出新权限-用户权限表 hasPermission('demo_sysuserpermission-export')") @Operation(description = "导出新权限-用户权限表")
@PostMapping("/export") @PostMapping("/export")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission-export')")
public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) { public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) {
sysUserPermissionService.listExport(response, searchVo); sysUserPermissionService.listExport(response, searchVo);
} }
......
...@@ -4,16 +4,41 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,16 +4,41 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> { public interface SysMenuMapper extends BaseMapper<SysMenu> {
/** /**
* 新权限-菜单表简单分页查询 * 新权限-菜单表简单分页查询
* *
* @param 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 * @return
*/ */
IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, @Param("sysMenu") SysMenu sysMenu); List<String> selectColumnList(@Param("modelId") String modelId);
} }
...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.permission.service; ...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.permission.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; 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.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
...@@ -13,10 +14,18 @@ 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 * @date 2023-08-29 14:49:40
*/ */
public interface SysMenuService extends IService<SysMenu> { public interface SysMenuService extends IService<SysMenu> {
/** /**
* 新权限-菜单表简单分页查询 * 新权限-菜单表简单分页查询
* @param sysMenu 新权限-菜单表 * @param sysMenu 新权限-菜单表
* @return * @return
*/ */
IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu); IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu);
/**
* 新增菜单表
* @param menu 新权限-菜单表
* @return
*/
R<Boolean> saveMenu(SysMenu menu);
} }
package com.yifu.cloud.plus.v1.permission.service.impl; package com.yifu.cloud.plus.v1.permission.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.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.SysMenuMapper;
import com.yifu.cloud.plus.v1.permission.service.SysMenuService; 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.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 新权限-菜单表 * 新权限-菜单表
* *
...@@ -19,14 +25,72 @@ import org.springframework.stereotype.Service; ...@@ -19,14 +25,72 @@ import org.springframework.stereotype.Service;
@Log4j2 @Log4j2
@Service @Service
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService { public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {
/**
* 新权限-菜单表简单分页查询 /**
* @param sysMenu 新权限-菜单表 * 新权限-菜单表简单分页查询
* @return *
*/ * @param sysMenu 新权限-菜单表
@Override * @return
public IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu){ */
return baseMapper.getSysMenuPage(page,sysMenu); @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();
}
} }
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<result property="createBy" column="CREATE_BY"/> <result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/> <result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/> <result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -31,89 +32,24 @@ ...@@ -31,89 +32,24 @@
a.MENU_NAME, a.MENU_NAME,
a.MENU_NAME_PARENT, a.MENU_NAME_PARENT,
a.MENU_PARENT_ID, a.MENU_PARENT_ID,
a.MODEL_ID,
a.VIEW_ID,
a.PERMISSION_STATUS, a.PERMISSION_STATUS,
a.DELETE_STATUS, a.DELETE_STATUS,
a.INCOME_ID, a.CREATE_TIME
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
</sql> </sql>
<sql id="sysMenu_where"> <sql id="sysMenu_where">
<if test="sysMenu != null"> <if test="sysMenu != null">
<if test="sysMenu.id != null and sysMenu.id.trim() != ''"> <if test="sysMenu.menuName != null and sysMenu.menuName.trim() != ''">
AND a.ID = #{sysMenu.id} AND a.MENU_NAME = #{sysMenu.menuName}
</if> </if>
<if test="sysMenu.menuName != null and sysMenu.menuName.trim() != ''"> <if test="sysMenu.menuNameParent != null and sysMenu.menuNameParent.trim() != ''">
AND a.MENU_NAME = #{sysMenu.menuName} AND a.MENU_NAME_PARENT = #{sysMenu.menuNameParent}
</if> </if>
<if test="sysMenu.menuNameParent != null and sysMenu.menuNameParent.trim() != ''"> <if test="sysMenu.menuParentId != null and sysMenu.menuParentId.trim() != ''">
AND a.MENU_NAME_PARENT = #{sysMenu.menuNameParent} AND a.MENU_PARENT_ID = #{sysMenu.menuParentId}
</if> </if>
<if test="sysMenu.menuParentId != null and sysMenu.menuParentId.trim() != ''"> <if test="sysMenu.permissionStatus != null and sysMenu.permissionStatus.trim() != ''">
AND a.MENU_PARENT_ID = #{sysMenu.menuParentId} AND a.PERMISSION_STATUS = #{sysMenu.permissionStatus}
</if> </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> </if>
</sql> </sql>
<!--sysMenu简单分页查询--> <!--sysMenu简单分页查询-->
...@@ -126,4 +62,18 @@ ...@@ -126,4 +62,18 @@
<include refid="sysMenu_where"/> <include refid="sysMenu_where"/>
</where> </where>
</select> </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> </mapper>
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<result property="createBy" column="CREATE_BY"/> <result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/> <result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/> <result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -30,16 +31,10 @@ ...@@ -30,16 +31,10 @@
a.IS_CONTAINS, a.IS_CONTAINS,
a.PERMISSION_STATUS, a.PERMISSION_STATUS,
a.DELETE_FLAG, a.DELETE_FLAG,
a.CREATE_BY, a.CREATE_TIME
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_TIME
</sql> </sql>
<sql id="sysUserPermission_where"> <sql id="sysUserPermission_where">
<if test="sysUserPermission != null"> <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() != ''"> <if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''">
AND a.EMP_NAME = #{sysUserPermission.empName} AND a.EMP_NAME = #{sysUserPermission.empName}
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment