Commit 06304408 authored by huyuchen's avatar huyuchen

菜单权限修改

parent e50ed5c9
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;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_menu")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-菜单表")
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
*/
@ExcelAttribute(name = "表单ID", maxLength = 36)
@Length(max = 36, message = "表单ID不能超过36个字符")
@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;
}
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;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
@TableName("sys_user_permission")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "新权限-用户权限表")
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;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysMenuSearchVo extends SysMenu {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysMenuVo extends RowIndex implements Serializable {
/**
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "ID 不能为空")
@Length(max = 36, message = "ID 不能超过36 个字符")
@ExcelAttribute(name = "ID", isNotEmpty = true, errorInfo = "ID 不能为空", maxLength = 36)
@Schema(description = "ID")
@ExcelProperty("ID")
private String id;
/**
* 菜单名称
*/
@Length(max = 20, message = "菜单名称 不能超过20 个字符")
@ExcelAttribute(name = "菜单名称", maxLength = 20)
@Schema(description = "菜单名称")
@ExcelProperty("菜单名称")
private String menuName;
/**
* 上级菜单名称
*/
@Length(max = 20, message = "上级菜单名称 不能超过20 个字符")
@ExcelAttribute(name = "上级菜单名称", maxLength = 20)
@Schema(description = "上级菜单名称")
@ExcelProperty("上级菜单名称")
private String menuNameParent;
/**
* 上级菜单id
*/
@Length(max = 36, message = "上级菜单id 不能超过36 个字符")
@ExcelAttribute(name = "上级菜单id", maxLength = 36)
@Schema(description = "上级菜单id")
@ExcelProperty("上级菜单id")
private String menuParentId;
/**
* 表单ID
*/
@Length(max = 36, message = "表单ID 不能超过36 个字符")
@ExcelAttribute(name = "表单ID", maxLength = 36)
@Schema(description = "表单ID")
@ExcelProperty("表单ID")
private String modelId;
/**
* 视图ID
*/
@Length(max = 36, message = "视图ID 不能超过36 个字符")
@ExcelAttribute(name = "视图ID", maxLength = 36)
@Schema(description = "视图ID")
@ExcelProperty("视图ID")
private String viewId;
/**
* 授权状态(0启用、1禁用)
*/
@Length(max = 1, message = "授权状态(0启用、1禁用) 不能超过1 个字符")
@ExcelAttribute(name = "授权状态(0启用、1禁用)", maxLength = 1)
@Schema(description = "授权状态(0启用、1禁用)")
@ExcelProperty("授权状态(0启用、1禁用)")
private String permissionStatus;
/**
* 删除状态(0是、1否)
*/
@Length(max = 1, message = "删除状态(0是、1否) 不能超过1 个字符")
@ExcelAttribute(name = "删除状态(0是、1否)", maxLength = 1)
@Schema(description = "删除状态(0是、1否)")
@ExcelProperty("删除状态(0是、1否)")
private String deleteStatus;
/**
* 收入权限id
*/
@Length(max = 20, message = "收入权限id 不能超过20 个字符")
@ExcelAttribute(name = "收入权限id", maxLength = 20)
@Schema(description = "收入权限id")
@ExcelProperty("收入权限id")
private String incomeId;
/**
* 客户权限id
*/
@Length(max = 20, message = "客户权限id 不能超过20 个字符")
@ExcelAttribute(name = "客户权限id", maxLength = 20)
@Schema(description = "客户权限id")
@ExcelProperty("客户权限id")
private String customerId;
/**
* 合同权限id
*/
@Length(max = 20, message = "合同权限id 不能超过20 个字符")
@ExcelAttribute(name = "合同权限id", maxLength = 20)
@Schema(description = "合同权限id")
@ExcelProperty("合同权限id")
private String contractId;
/**
* 商机权限id
*/
@Length(max = 20, message = "商机权限id 不能超过20 个字符")
@ExcelAttribute(name = "商机权限id", maxLength = 20)
@Schema(description = "商机权限id")
@ExcelProperty("商机权限id")
private String bussinessId;
/**
* 报价单权限id
*/
@Length(max = 20, message = "报价单权限id 不能超过20 个字符")
@ExcelAttribute(name = "报价单权限id", maxLength = 20)
@Schema(description = "报价单权限id")
@ExcelProperty("报价单权限id")
private String quotationId;
/**
* 项目权限id
*/
@Length(max = 20, message = "项目权限id 不能超过20 个字符")
@ExcelAttribute(name = "项目权限id", maxLength = 20)
@Schema(description = "项目权限id")
@ExcelProperty("项目权限id")
private String domainId;
/**
* BU归属权限id
*/
@Length(max = 20, message = "BU归属权限id 不能超过20 个字符")
@ExcelAttribute(name = "BU归属权限id", maxLength = 20)
@Schema(description = "BU归属权限id")
@ExcelProperty("BU归属权限id")
private String buId;
/**
* 条线类型权限id
*/
@Length(max = 20, message = "条线类型权限id 不能超过20 个字符")
@ExcelAttribute(name = "条线类型权限id", maxLength = 20)
@Schema(description = "条线类型权限id")
@ExcelProperty("条线类型权限id")
private String lineId;
/**
* 部门权限id
*/
@Length(max = 20, message = "部门权限id 不能超过20 个字符")
@ExcelAttribute(name = "部门权限id", maxLength = 20)
@Schema(description = "部门权限id")
@ExcelProperty("部门权限id")
private String deptId;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserPermissionSearchVo extends SysUserPermission {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Data
public class SysUserPermissionVo extends RowIndex implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "id 不能为空")
@Length(max = 36, message = "id 不能超过36 个字符")
@ExcelAttribute(name = "id", isNotEmpty = true, errorInfo = "id 不能为空", maxLength = 36)
@Schema(description = "id")
@ExcelProperty("id")
private String id;
/**
* 员工姓名
*/
@Length(max = 20, message = "员工姓名 不能超过20 个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 20)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 登录账号
*/
@NotBlank(message = "登录账号 不能为空")
@Length(max = 10, message = "登录账号 不能超过10 个字符")
@ExcelAttribute(name = "登录账号", isNotEmpty = true, errorInfo = "登录账号 不能为空", maxLength = 10)
@Schema(description = "登录账号")
@ExcelProperty("登录账号")
private String empLoginName;
/**
* 所在部门
*/
@Length(max = 20, message = "所在部门 不能超过20 个字符")
@ExcelAttribute(name = "所在部门", maxLength = 20)
@Schema(description = "所在部门")
@ExcelProperty("所在部门")
private String empDept;
/**
* 权限类型
*/
@Length(max = 8, message = "权限类型 不能超过8 个字符")
@ExcelAttribute(name = "权限类型", maxLength = 8)
@Schema(description = "权限类型")
@ExcelProperty("权限类型")
private String permissionType;
/**
* 名称
*/
@Length(max = 20, message = "名称 不能超过20 个字符")
@ExcelAttribute(name = "名称", maxLength = 20)
@Schema(description = "名称")
@ExcelProperty("名称")
private String name;
/**
* 编码
*/
@Length(max = 10, message = "编码 不能超过10 个字符")
@ExcelAttribute(name = "编码", maxLength = 10)
@Schema(description = "编码")
@ExcelProperty("编码")
private String code;
/**
* 是否包含(0 是 1否)
*/
@Length(max = 1, message = "是否包含(0 是 1否) 不能超过1 个字符")
@ExcelAttribute(name = "是否包含(0 是 1否)", maxLength = 1)
@Schema(description = "是否包含(0 是 1否)")
@ExcelProperty("是否包含(0 是 1否)")
private String isContains;
/**
* 授权状态(0启用、1禁用)
*/
@Length(max = 1, message = "授权状态(0启用、1禁用) 不能超过1 个字符")
@ExcelAttribute(name = "授权状态(0启用、1禁用)", maxLength = 1)
@Schema(description = "授权状态(0启用、1禁用)")
@ExcelProperty("授权状态(0启用、1禁用)")
private String permissionStatus;
/**
* 删除状态(0是、1否)
*/
@Length(max = 1, message = "删除状态(0是、1否) 不能超过1 个字符")
@ExcelAttribute(name = "删除状态(0是、1否)", maxLength = 1)
@Schema(description = "删除状态(0是、1否)")
@ExcelProperty("删除状态(0是、1否)")
private String deleteFlag;
}
......@@ -57,6 +57,12 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-permission-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......
package com.yifu.cloud.plus.v1.permission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysMenuService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysmenu")
@Tag(name = "新权限-菜单表管理")
public class SysMenuController {
private final SysMenuService sysMenuService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysMenu 新权限-菜单表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysMenu>> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu) {
return new R<>(sysMenuService.getSysMenuPage(page, sysMenu));
}
/**
* 新增新权限-菜单表
*
* @param sysMenu 新权限-菜单表
* @return R
*/
@Operation(summary = "新增新权限-菜单表", description = "新增新权限-菜单表:hasPermission('demo_sysmenu_add')")
@SysLog("新增新权限-菜单表")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_sysmenu_add')")
public R<Boolean> save(@RequestBody SysMenu sysMenu) {
return R.ok(sysMenuService.save(sysMenu));
}
/**
* 修改新权限-菜单表
*
* @param sysMenu 新权限-菜单表
* @return R
*/
@Operation(summary = "修改新权限-菜单表", description = "修改新权限-菜单表:hasPermission('demo_sysmenu_edit')")
@SysLog("修改新权限-菜单表")
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_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));
}
}
package com.yifu.cloud.plus.v1.permission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysUserPermissionService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysuserpermission")
@Tag(name = "新权限-用户权限表管理")
public class SysUserPermissionController {
private final SysUserPermissionService sysUserPermissionService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<SysUserPermission>> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission) {
return new R<>(sysUserPermissionService.getSysUserPermissionPage(page, sysUserPermission));
}
/**
* 不分页查询
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
public R<List<SysUserPermission>> getSysUserPermissionNoPage(@RequestBody SysUserPermissionSearchVo sysUserPermission) {
return R.ok(sysUserPermissionService.noPageDiy(sysUserPermission));
}
/**
* 通过id查询新权限-用户权限表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('demo_sysuserpermission_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_get')")
public R<SysUserPermission> getById(@PathVariable("id") String id) {
return R.ok(sysUserPermissionService.getById(id));
}
/**
* 新增新权限-用户权限表
*
* @param sysUserPermission 新权限-用户权限表
* @return R
*/
@Operation(summary = "新增新权限-用户权限表", description = "新增新权限-用户权限表:hasPermission('demo_sysuserpermission_add')")
@SysLog("新增新权限-用户权限表")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_add')")
public R<Boolean> save(@RequestBody SysUserPermission sysUserPermission) {
return R.ok(sysUserPermissionService.save(sysUserPermission));
}
/**
* 修改新权限-用户权限表
*
* @param sysUserPermission 新权限-用户权限表
* @return R
*/
@Operation(summary = "修改新权限-用户权限表", description = "修改新权限-用户权限表:hasPermission('demo_sysuserpermission_edit')")
@SysLog("修改新权限-用户权限表")
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_edit')")
public R<Boolean> updateById(@RequestBody SysUserPermission sysUserPermission) {
return R.ok(sysUserPermissionService.updateById(sysUserPermission));
}
/**
* 通过id删除新权限-用户权限表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id删除新权限-用户权限表", description = "通过id删除新权限-用户权限表:hasPermission('demo_sysuserpermission_del')")
@SysLog("通过id删除新权限-用户权限表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(sysUserPermissionService.removeById(id));
}
/**
* 新权限-用户权限表 批量导入
*
* @author hyc
* @date 2023-08-29 14:49:40
**/
@SneakyThrows
@Operation(description = "批量新增新权限-用户权限表 hasPermission('demo_sysuserpermission-batch-import')")
@SysLog("批量新增新权限-用户权限表")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return sysUserPermissionService.importDiy(file.getInputStream());
}
/**
* 新权限-用户权限表 批量导出
*
* @author hyc
* @date 2023-08-29 14:49:40
**/
@Operation(description = "导出新权限-用户权限表 hasPermission('demo_sysuserpermission-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('demo_sysuserpermission-export')")
public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) {
sysUserPermissionService.listExport(response, searchVo);
}
}
package com.yifu.cloud.plus.v1.permission.mapper;
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 org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {
/**
* 新权限-菜单表简单分页查询
*
* @param sysMenu 新权限-菜单表
* @return
*/
IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, @Param("sysMenu") SysMenu sysMenu);
}
package com.yifu.cloud.plus.v1.permission.mapper;
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.SysUserPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Mapper
public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
/**
* 新权限-用户权限表简单分页查询
* @param sysUserPermission 新权限-用户权限表
* @return
*/
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, @Param("sysUserPermission") SysUserPermission sysUserPermission);
}
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.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
public interface SysMenuService extends IService<SysMenu> {
/**
* 新权限-菜单表简单分页查询
* @param sysMenu 新权限-菜单表
* @return
*/
IPage<SysMenu> getSysMenuPage(Page<SysMenu> page, SysMenuSearchVo sysMenu);
}
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
public interface SysUserPermissionService extends IService<SysUserPermission> {
/**
* 新权限-用户权限表简单分页查询
* @param sysUserPermission 新权限-用户权限表
* @return
*/
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission);
R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo);
List<SysUserPermission> noPageDiy(SysUserPermissionSearchVo searchVo);
}
package com.yifu.cloud.plus.v1.permission.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysMenuSearchVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
/**
* 新权限-菜单表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@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);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper">
<resultMap id="sysMenuMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu">
<id property="id" column="ID"/>
<result property="menuName" column="MENU_NAME"/>
<result property="menuNameParent" column="MENU_NAME_PARENT"/>
<result property="menuParentId" column="MENU_PARENT_ID"/>
<result property="modelId" column="MODEL_ID"/>
<result property="viewId" column="VIEW_ID"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteStatus" column="DELETE_STATUS"/>
<result property="incomeId" column="INCOME_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="contractId" column="CONTRACT_ID"/>
<result property="bussinessId" column="BUSSINESS_ID"/>
<result property="quotationId" column="QUOTATION_ID"/>
<result property="domainId" column="DOMAIN_ID"/>
<result property="buId" column="BU_ID"/>
<result property="lineId" column="LINE_ID"/>
<result property="deptId" column="DEPT_ID"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
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
</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>
</sql>
<!--sysMenu简单分页查询-->
<select id="getSysMenuPage" resultMap="sysMenuMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_menu a
<where>
1=1
<include refid="sysMenu_where"/>
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper">
<resultMap id="sysUserPermissionMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission">
<id property="id" column="ID"/>
<result property="empName" column="EMP_NAME"/>
<result property="empLoginName" column="EMP_LOGIN_NAME"/>
<result property="empDept" column="EMP_DEPT"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="name" column="NAME"/>
<result property="code" column="CODE"/>
<result property="isContains" column="IS_CONTAINS"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.EMP_NAME,
a.EMP_LOGIN_NAME,
a.EMP_DEPT,
a.PERMISSION_TYPE,
a.NAME,
a.CODE,
a.IS_CONTAINS,
a.PERMISSION_STATUS,
a.DELETE_FLAG,
a.CREATE_BY,
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_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>
<if test="sysUserPermission.empLoginName != null and sysUserPermission.empLoginName.trim() != ''">
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''">
AND a.EMP_DEPT = #{sysUserPermission.empDept}
</if>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
</if>
<if test="sysUserPermission.name != null and sysUserPermission.name.trim() != ''">
AND a.NAME = #{sysUserPermission.name}
</if>
<if test="sysUserPermission.code != null and sysUserPermission.code.trim() != ''">
AND a.CODE = #{sysUserPermission.code}
</if>
<if test="sysUserPermission.isContains != null and sysUserPermission.isContains.trim() != ''">
AND a.IS_CONTAINS = #{sysUserPermission.isContains}
</if>
<if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if>
<if test="sysUserPermission.deleteFlag != null and sysUserPermission.deleteFlag.trim() != ''">
AND a.DELETE_FLAG = #{sysUserPermission.deleteFlag}
</if>
<if test="sysUserPermission.createBy != null and sysUserPermission.createBy.trim() != ''">
AND a.CREATE_BY = #{sysUserPermission.createBy}
</if>
<if test="sysUserPermission.updateBy != null and sysUserPermission.updateBy.trim() != ''">
AND a.UPDATE_BY = #{sysUserPermission.updateBy}
</if>
<if test="sysUserPermission.createName != null and sysUserPermission.createName.trim() != ''">
AND a.CREATE_NAME = #{sysUserPermission.createName}
</if>
<if test="sysUserPermission.updateTime != null">
AND a.UPDATE_TIME = #{sysUserPermission.updateTime}
</if>
</if>
</sql>
<!--sysUserPermission简单分页查询-->
<select id="getSysUserPermissionPage" resultMap="sysUserPermissionMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_permission a
<where>
1=1
<include refid="sysUserPermission_where"/>
</where>
</select>
</mapper>
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