Commit f2163871 authored by huyuchen's avatar huyuchen

Merge branch 'develop' of http://git.yifucenter.com/fangxinjiang/yifu into develop

parents da8d55d4 45a33fbb
...@@ -11,12 +11,6 @@ ...@@ -11,12 +11,6 @@
- 提供对常见容器化支持 Docker、Kubernetes、Rancher2 支持 - 提供对常见容器化支持 Docker、Kubernetes、Rancher2 支持
- 提供 lambda 、stream api 、webflux 的生产实践 - 提供 lambda 、stream api 、webflux 的生产实践
## 文档视频
## 微信群 [禁广告]
## 快速开始 ## 快速开始
### 核心依赖 ### 核心依赖
...@@ -24,12 +18,10 @@ ...@@ -24,12 +18,10 @@
| 依赖 | 版本 | | 依赖 | 版本 |
| ---------------------- |------------| | ---------------------- |------------|
| Spring Boot | 2.6.7 | | Spring Boot | 2.6.7 |
| Spring Cloud | 2021.0.1 |
| Spring Cloud Alibaba | 2021.0.1.0 | | Spring Cloud Alibaba | 2021.0.1.0 |
| Spring Security OAuth2 | 2.3.6 | | Spring Security OAuth2 | 2.3.6 |
| Mybatis Plus | 3.5.1 | | Mybatis Plus | 3.5.1 |
| hutool | 5.7.22 | | hutool | 5.7.22 |
| Avue | 2.6.18 |
### 模块说明 ### 模块说明
...@@ -48,10 +40,7 @@ yifu ...@@ -48,10 +40,7 @@ yifu
├── yifu-common-seata -- 分布式事务 ├── yifu-common-seata -- 分布式事务
├── yifu-common-security -- 安全工具类 ├── yifu-common-security -- 安全工具类
├── yifu-common-swagger -- 接口文档 ├── yifu-common-swagger -- 接口文档
├── yifu-common-feign -- feign 扩展封装
└── yifu-common-test -- oauth2.0 单元测试扩展封装 └── yifu-common-test -- oauth2.0 单元测试扩展封装
├── yifu-register -- Nacos Server[8848]
├── yifu-gateway -- Spring Cloud Gateway网关[9999]
└── yifu-upms -- 通用用户权限管理模块 └── yifu-upms -- 通用用户权限管理模块
└── yifu-upms-api -- 通用用户权限管理系统公共api模块 └── yifu-upms-api -- 通用用户权限管理系统公共api模块
└── yifu-upms-biz -- 通用用户权限管理系统业务处理模块[4000] └── yifu-upms-biz -- 通用用户权限管理系统业务处理模块[4000]
...@@ -67,10 +56,6 @@ yifu ...@@ -67,10 +56,6 @@ yifu
请务必**完全按照**文档部署运行章节 进行操作,减少踩坑弯路!! 请务必**完全按照**文档部署运行章节 进行操作,减少踩坑弯路!!
### 定制自己微服务
### Docker 运行 ### Docker 运行
``` ```
......
...@@ -63,7 +63,8 @@ spring: ...@@ -63,7 +63,8 @@ spring:
pathmatch: pathmatch:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
redis: redis:
host: 127.0.0.1 host: 192.168.1.65
port: 22379
password: '@yf_2017' password: '@yf_2017'
cloud: cloud:
sentinel: sentinel:
...@@ -104,8 +105,7 @@ spring: ...@@ -104,8 +105,7 @@ spring:
pathmatch: pathmatch:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
redis: redis:
host: 192.168.1.65 host: 127.0.0.1
port: 22379
password: '@yf_2017' password: '@yf_2017'
cloud: cloud:
sentinel: sentinel:
......
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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 javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @Description: 数据权限主表
* @Author: hgw
* @Date: 2022/6/7 11:29
* @return:
**/
@Schema(description = "数据权限主表")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysDataAuth extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 关联对象类型:0分组;1用户
*/
@NotNull(message = "关联对象类型不能为空")
@Schema(description = "关联对象类型:0分组;1用户", required = true)
private Integer linkType;
/**
* 关联对象id
*/
@NotBlank(message = "关联对象id不能为空")
@Schema(description = "关联对象id", required = true)
private String linkId;
/**
* 关联对象名称
*/
@NotBlank(message = "关联对象名称不能为空")
@Schema(description = "关联对象名称", required = true)
private String linkName;
/**
* 创建人权限:0否;1是
*/
@NotNull(message = "创建人权限:0否;1是不能为空")
@Schema(description = "创建人权限:0否;1是", required = true)
private Integer isCreateAuth;
/**
* 部门权限:0无;1本部门;2自定义部门
*/
@NotNull(message = "部门权限:0无;1本部门;2自定义部门不能为空")
@Schema(description = "部门权限:0无;1本部门;2自定义部门", required = true)
private Integer isDeptAuth;
/**
* 结算主体权限:0否;1是
*/
@NotNull(message = "结算主体权限:0否;1是不能为空")
@Schema(description = "结算主体权限:0否;1是", required = true)
private Integer isSettleAuth;
/**
* 自定义sql:0否;1是
*/
@NotNull(message = "自定义sql:0否;1是不能为空")
@Schema(description = "自定义sql:0否;1是", required = true)
private Integer isDiySql;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description: 数据权限与组织部门的关联表
* @Author: hgw
* @Date: 2022-6-8 17:07:44
* @return:
**/
@Schema(description = "数据权限与组织部门的关联表")
@Data
public class SysDataAuthDeptRel implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 数据权限表id
*/
@NotBlank(message = "数据权限表id不能为空")
@Schema(description = "数据权限表id", required = true)
private String sysDataAuthId;
/**
* 组织部门id
*/
@NotBlank(message = "组织部门id不能为空")
@Schema(description = "组织部门id", required = true)
private String deptId;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 自定义sql表
* @Author: hgw
* @Date: 2022-6-8 17:07:44
* @return:
**/
@Schema(description = "自定义sql表")
@Data
public class SysDataAuthDiySql implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 数据权限表id
*/
@NotBlank(message = "数据权限表id不能为空")
@Schema(description = "数据权限表id", required = true)
private String sysDataAuthId;
/**
* 自定义sql
*/
@NotBlank(message = "自定义sql不能为空")
@Schema(description = "自定义sql", required = true)
private String diySql;
/**
* 自定义sql对应的菜单list
*/
@TableField(exist = false)
private List<SysDiySqlMenuRel> sqlMenuList;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Description: 数据权限与菜单的关联表
* @Author: hgw
* @Date: 2022-6-8 17:07:44
* @return:
**/
@Schema(description = "数据权限与菜单的关联表")
@Data
public class SysDataAuthMenuRel implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 数据权限表id
*/
@NotBlank(message = "数据权限表id不能为空")
@Schema(description = "数据权限表id", required = true)
private String sysDataAuthId;
/**
* 菜单id
*/
@NotBlank(message = "菜单id不能为空")
@Schema(description = "菜单id", required = true)
private String menuId;
/**
* 类型:1:创建人;2:结算主体;3部门
*/
@NotNull(message = "类型:1:创建人;2:结算主体;3部门不能为空")
@Schema(description = "类型:1:创建人;2:结算主体;3部门", required = true)
private Integer type;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description: 自定义sql与菜单的关联表
* @Author: hgw
* @Date: 2022-6-8 17:07:44
* @return:
**/
@Schema(description = "自定义sql与菜单的关联表")
@Data
public class SysDiySqlMenuRel implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 数据权限表id
*/
@NotBlank(message = "数据权限表id不能为空")
@Schema(description = "数据权限表id", required = true)
private String sysDataAuthId;
/**
* SysDataAuthDiySql表的id
*/
@NotBlank(message = "自定义sql表id不能为空")
@Schema(description = "自定义sql表id", required = true)
private String sysDiySqlId;
/**
* 菜单id
*/
@NotBlank(message = "菜单id不能为空")
@Schema(description = "菜单id", required = true)
private String menuId;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDeptRel;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDiySql;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthMenuRel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 数据权限Vo
* @Author: hgw
* @Date: 2022/6/8 17:37
**/
@Schema(description = "数据权限-新增、修改、详情vo")
@Data
public class SysDataAuthVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "权限主表信息")
SysDataAuth sysDataAuth;
@Schema(description = "权限-部门列表")
List<SysDataAuthDeptRel> authDeptList;
@Schema(description = "权限-sql列表")
List<SysDataAuthDiySql> authSqlList;
// 1:创建人;2:结算主体;3部门
@Schema(description = "菜单-创建人列表")
List<SysDataAuthMenuRel> menuCreateList;
@Schema(description = "菜单-结算主体(项目)列表")
List<SysDataAuthMenuRel> menuSettleList;
@Schema(description = "菜单-组织部门列表")
List<SysDataAuthMenuRel> menuDeptList;
}
...@@ -9,10 +9,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes; ...@@ -9,10 +9,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils; import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
......
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDataAuthVO;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDataAuthService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
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.*;
import java.util.List;
/**
* @Description: 数据权限控制器
* @Author: hgw
* @Date: 2022/6/7 10:44
* @return:
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/dataAuth")
@Tag(name = "数据权限控制器")
public class DataAuthController {
private final SysDataAuthService sysDataAuthService;
/**
* @Description: 分页查询
* @Author: hgw
* @Date: 2022/6/7 14:59
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.baomidou.mybatisplus.core.metadata.IPage < com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>>
**/
@Operation(summary = "分页查询")
@GetMapping("/getSysDataAuthPage")
public R<IPage<SysDataAuth>> getSysDataAuthPage(Page<SysDataAuth> page, SysDataAuth sysDataAuth) {
return R.ok(sysDataAuthService.getSysDataAuthPage(page, sysDataAuth));
}
/**
* @Description: 分页查询
* @Author: hgw
* @Date: 2022/6/7 14:59
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.baomidou.mybatisplus.core.metadata.IPage < com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>>
**/
@Operation(summary = "获取list")
@GetMapping("/getSysDataAuthList")
public R<List<SysDataAuth>> getSysDataAuthList(SysDataAuth sysDataAuth) {
return R.ok(sysDataAuthService.getSysDataAuthList(sysDataAuth));
}
/**
* @Description: 详情/编辑获取原数据
* @Author: hgw
* @Date: 2022/6/7 14:59
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>
**/
@Operation(summary = "详情/编辑获取原数据")
@GetMapping("/{id:\\d+}")
public R<SysDataAuthVO> getById(@PathVariable String id) {
return sysDataAuthService.getByMainId(id);
}
/**
* @Description: 添加数据权限配置
* @Author: hgw
* @Date: 2022/6/7 14:57
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Operation(summary = "新增/编辑数据权限配置")
@SysLog("系统管理-数据权限-新增/编辑数据权限配置")
@PostMapping("/saveOrUpdate")
@PreAuthorize("@pms.hasPermission('sys_data_auth_add')")
public R<String> saveOrUpdate(@RequestBody SysDataAuthVO sysDataAuthVO) {
return sysDataAuthService.saveDataAuth(sysDataAuthVO);
}
/**
* @Description: 删除数据权限配置
* @Author: hgw
* @Date: 2022/6/7 14:58
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Operation(summary = "删除数据权限配置")
@SysLog("系统管理-数据权限-删除数据权限配置")
@DeleteMapping("/{id:\\d+}")
@PreAuthorize("@pms.hasPermission('sys_data_auth_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(sysDataAuthService.removeDataAuthById(id));
}
}
...@@ -22,10 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService; ...@@ -22,10 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -27,12 +27,10 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictService; ...@@ -27,12 +27,10 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -27,12 +27,10 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -27,12 +27,10 @@ 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.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
......
...@@ -17,16 +17,14 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller; ...@@ -17,16 +17,14 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller;
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.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.yifu.cloud.plus.v1.yifu.admin.api.dto.SysLogDTO; import com.yifu.cloud.plus.v1.yifu.admin.api.dto.SysLogDTO;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysLog; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysLog;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysLogService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysLogService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -65,6 +63,7 @@ public class LogController { ...@@ -65,6 +63,7 @@ public class LogController {
* @param id ID * @param id ID
* @return success/false * @return success/false
*/ */
@com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog("日志删除")
@DeleteMapping("/{id:\\d+}") @DeleteMapping("/{id:\\d+}")
@PreAuthorize("@pms.hasPermission('sys_log_del')") @PreAuthorize("@pms.hasPermission('sys_log_del')")
public R<Boolean> removeById(@PathVariable Long id) { public R<Boolean> removeById(@PathVariable Long id) {
......
...@@ -19,17 +19,13 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller; ...@@ -19,17 +19,13 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller;
import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.Tree;
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.admin.api.dto.UserDTO;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysMenu; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysMenuService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysMenuService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -23,10 +23,8 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysOauthClientDetails; ...@@ -23,10 +23,8 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysOauthClientDetails;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysOauthClientDetailsService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysOauthClientDetailsService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -19,18 +19,16 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller; ...@@ -19,18 +19,16 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysPost; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysPost;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.PostExcelVO; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.PostExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysPostService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysPostService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.log.annotation.SysLog;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -25,10 +25,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -25,10 +25,8 @@ 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.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -6,7 +6,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -6,7 +6,6 @@ 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.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
......
...@@ -19,6 +19,8 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller; ...@@ -19,6 +19,8 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller;
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.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleVo;
...@@ -26,12 +28,8 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleMenuService; ...@@ -26,12 +28,8 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleMenuService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.log.annotation.SysLog;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -17,10 +17,8 @@ ...@@ -17,10 +17,8 @@
package com.yifu.cloud.plus.v1.yifu.admin.controller; package com.yifu.cloud.plus.v1.yifu.admin.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -36,10 +36,8 @@ import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; ...@@ -36,10 +36,8 @@ import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDeptRel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 数据权限配置相关mapper
* @Author: hgw
* @Date: 2022/6/7 14:40
* @return:
**/
@Mapper
public interface SysDataAuthDeptRelMapper extends BaseMapper<SysDataAuthDeptRel> {
// 清空
int deleteAuthDeptRelByAuthId(@Param("mainId") String mainId);
// 根据权限主表id,查询全部
List<SysDataAuthDeptRel> getByMainId(@Param("mainId") String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDiySql;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 数据权限配置相关mapper
* @Author: hgw
* @Date: 2022/6/7 14:40
* @return:
**/
@Mapper
public interface SysDataAuthDiySqlMapper extends BaseMapper<SysDataAuthDiySql> {
// 清空
int deleteDiySqlByAuthId(@Param("mainId") String mainId);
// 根据权限主表id,查询全部
List<SysDataAuthDiySql> getByMainId(@Param("mainId") String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.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.admin.api.entity.SysDataAuth;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 数据权限配置mapper
* @Author: hgw
* @Date: 2022/6/7 14:40
* @return:
**/
@Mapper
public interface SysDataAuthMapper extends BaseMapper<SysDataAuth> {
/**
* 关联dept——relation
*
* @return 数据列表
*/
IPage<SysDataAuth> getSysDataAuthPage(Page<SysDataAuth> page, @Param("sysDataAuth") SysDataAuth sysDataAuth);
/**
* @Description: 获取list
* @Author: hgw
* @Date: 2022/6/9 16:47
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>
**/
List<SysDataAuth> getSysDataAuthPage(@Param("sysDataAuth") SysDataAuth sysDataAuth);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthMenuRel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 数据权限配置相关mapper
* @Author: hgw
* @Date: 2022/6/7 14:40
* @return:
**/
@Mapper
public interface SysDataAuthMenuRelMapper extends BaseMapper<SysDataAuthMenuRel> {
// 清空
int deleteAuthMenuRelByAuthId(@Param("mainId") String mainId);
// 根据权限主表id,查询全部
List<SysDataAuthMenuRel> getByMainId(@Param("mainId") String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDiySqlMenuRel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 数据权限配置相关mapper
* @Author: hgw
* @Date: 2022/6/7 14:40
* @return:
**/
@Mapper
public interface SysDiySqlMenuRelMapper extends BaseMapper<SysDiySqlMenuRel> {
// 清空
int deleteSqlMenuRelByAuthId(@Param("mainId") String mainId);
// 根据权限主表id,查询全部
List<SysDiySqlMenuRel> getByMainId(@Param("mainId") String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDeptRel;
import java.util.List;
/**
* @Description: 数据权限与组织部门的关联接口
* @Author: hgw
* @Date: 2022/6/8 17:15
**/
public interface SysDataAuthDeptRelService extends IService<SysDataAuthDeptRel> {
/**
* @param mainId 权限主表id
* @Description: 删除
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: int
**/
int deleteAuthDeptRelByAuthId(String mainId);
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDeptRel>
**/
List<SysDataAuthDeptRel> getByMainId(String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDiySql;
import java.util.List;
/**
* @Description: 自定义sql接口
* @Author: hgw
* @Date: 2022/6/8 17:15
**/
public interface SysDataAuthDiySqlService extends IService<SysDataAuthDiySql> {
/**
* @param mainId 权限主表id
* @Description: 删除
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: int
**/
int deleteDiySqlByAuthId(String mainId);
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDiySql>
**/
List<SysDataAuthDiySql> getByMainId(String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthMenuRel;
import java.util.List;
/**
* @Description: 数据权限与菜单的关联接口
* @Author: hgw
* @Date: 2022/6/8 17:15
**/
public interface SysDataAuthMenuRelService extends IService<SysDataAuthMenuRel> {
/**
* @param mainId 权限主表id
* @Description: 删除
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: int
**/
int deleteAuthMenuRelByAuthId(String mainId);
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthMenuRel>
**/
List<SysDataAuthMenuRel> getByMainId(String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.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.admin.api.entity.SysDataAuth;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDataAuthVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
/**
* @Description: 数据权限配置接口
* @Author: hgw
* @Date: 2022/6/8 17:15
**/
public interface SysDataAuthService extends IService<SysDataAuth> {
/**
* @Description: 分页查询
* @Author: hgw
* @Date: 2022/6/7 14:45
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>
**/
IPage<SysDataAuth> getSysDataAuthPage(Page<SysDataAuth> page, SysDataAuth sysDataAuth);
/**
* @Description: 获取list
* @Author: hgw
* @Date: 2022/6/9 16:47
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>
**/
List<SysDataAuth> getSysDataAuthList(SysDataAuth sysDataAuth);
/**
* @Description: 新增
* @Author: hgw
* @Date: 2022/6/7 14:46
* @return: java.lang.Boolean
**/
R<String> saveDataAuth(SysDataAuthVO sysDataAuthVO);
/**
* @param id
* @Description: 删除
* @Author: hgw
* @Date: 2022/6/7 14:46
* @return: java.lang.Boolean
**/
Boolean removeDataAuthById(String id);
/**
* @param mainId
* @Description: 查看
* @Author: hgw
* @Date: 2022/6/9 14:52
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDataAuthVO>
**/
R<SysDataAuthVO> getByMainId(String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDiySqlMenuRel;
import java.util.List;
/**
* @Description: 自定义sql与菜单的关联表接口
* @Author: hgw
* @Date: 2022/6/8 17:15
**/
public interface SysDiySqlMenuRelService extends IService<SysDiySqlMenuRel> {
/**
* @param mainId 权限主表id
* @Description: 删除
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: int
**/
int deleteSqlMenuRelByAuthId(String mainId);
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:28
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDiySqlMenuRel>
**/
List<SysDiySqlMenuRel> getByMainId(String mainId);
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDeptRel;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDataAuthDeptRelMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDataAuthDeptRelService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 数据权限配置相关服务实现
* @Author: hgw
* @Date: 2022/6/8 17:20
**/
@Service
@RequiredArgsConstructor
public class SysDataAuthDeptRelServiceImpl extends ServiceImpl<SysDataAuthDeptRelMapper, SysDataAuthDeptRel> implements SysDataAuthDeptRelService {
// 清空
@Override
public int deleteAuthDeptRelByAuthId(String mainId) {
return baseMapper.deleteAuthDeptRelByAuthId(mainId);
}
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:31
**/
@Override
public List<SysDataAuthDeptRel> getByMainId(String mainId) {
return baseMapper.getByMainId(mainId);
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDiySql;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDataAuthDiySqlMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDataAuthDiySqlService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 数据权限配置相关服务实现
* @Author: hgw
* @Date: 2022/6/8 17:20
**/
@Service
@RequiredArgsConstructor
public class SysDataAuthDiySqlServiceImpl extends ServiceImpl<SysDataAuthDiySqlMapper, SysDataAuthDiySql> implements SysDataAuthDiySqlService {
// 清空
@Override
public int deleteDiySqlByAuthId(String mainId) {
return baseMapper.deleteDiySqlByAuthId(mainId);
}
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:31
**/
@Override
public List<SysDataAuthDiySql> getByMainId(String mainId) {
return baseMapper.getByMainId(mainId);
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthMenuRel;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDataAuthMenuRelMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDataAuthMenuRelService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 数据权限配置相关服务实现
* @Author: hgw
* @Date: 2022/6/8 17:20
**/
@Service
@RequiredArgsConstructor
public class SysDataAuthMenuRelServiceImpl extends ServiceImpl<SysDataAuthMenuRelMapper, SysDataAuthMenuRel> implements SysDataAuthMenuRelService {
// 清空
@Override
public int deleteAuthMenuRelByAuthId(String mainId) {
return baseMapper.deleteAuthMenuRelByAuthId(mainId);
}
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:31
**/
@Override
public List<SysDataAuthMenuRel> getByMainId(String mainId) {
return baseMapper.getByMainId(mainId);
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.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.yifu.admin.api.entity.*;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDataAuthVO;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDataAuthMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.service.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: 数据权限配置服务实现
* @Author: hgw
* @Date: 2022/6/8 17:20
**/
@Service
@RequiredArgsConstructor
public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDataAuth> implements SysDataAuthService {
// 权限-部门
private final SysDataAuthDeptRelService authDeptRelService;
// 权限-菜单(type:类型:1:创建人;2:结算主体;3部门)
private final SysDataAuthMenuRelService authMenuRelService;
// 权限-自定义sql
private final SysDataAuthDiySqlService diySqlService;
// 自定义sql-菜单
private final SysDiySqlMenuRelService diySqlMenuRelService;
/**
* @Description: 分页查询
* @Author: hgw
* @Date: 2022/6/7 14:49
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>
**/
@Override
public IPage<SysDataAuth> getSysDataAuthPage(Page<SysDataAuth> page, SysDataAuth sysDataAuth) {
return baseMapper.getSysDataAuthPage(page, sysDataAuth);
}
/**
* @Description: 获取list
* @Author: hgw
* @Date: 2022/6/9 16:47
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth>
**/
@Override
public List<SysDataAuth> getSysDataAuthList(SysDataAuth sysDataAuth) {
return baseMapper.getSysDataAuthPage(sysDataAuth);
}
/**
* @Description: 新增
* @Author: hgw
* @Date: 2022/6/7 14:48
* @return: java.lang.Boolean
**/
@Override
@Transactional(rollbackFor = Exception.class)
public R<String> saveDataAuth(SysDataAuthVO sysDataAuthVO) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!");
}
if (sysDataAuthVO != null) {
SysDataAuth sysDataAuth = sysDataAuthVO.getSysDataAuth();
// 校验参数
if (sysDataAuth == null || Common.isEmpty(sysDataAuth.getLinkType())
|| Common.isEmpty(sysDataAuth.getLinkId()) || Common.isEmpty(sysDataAuth.getLinkName())
|| Common.isEmpty(sysDataAuth.getIsDeptAuth())) {
return R.failed("请传参sysDataAuth以及参数!");
} else {
List<SysDataAuthMenuRel> saveMenuDeptList = new ArrayList<>();
// 编辑
String mainId = sysDataAuth.getId();
R<String> failed = null;
if (mainId == null) {
// 新增
this.save(sysDataAuth);
mainId = sysDataAuth.getId();
} else {
// 删除之前的关系
this.deleteSubInfoByMainId(mainId);
}
failed = doCore(sysDataAuth, saveMenuDeptList, sysDataAuthVO, mainId);
if (failed != null) {
return failed;
}
this.updateById(sysDataAuth);
if (!saveMenuDeptList.isEmpty()) {
authMenuRelService.saveOrUpdateBatch(saveMenuDeptList);
}
return R.ok("保存成功");
}
} else {
return R.failed("请传参sysDataAuthVO!");
}
}
/**
* @Description: 核心保存
* @Author: hgw
* @Date: 2022/6/8 18:41
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> doCore(SysDataAuth sysDataAuth, List<SysDataAuthMenuRel> saveMenuDeptList
, SysDataAuthVO sysDataAuthVO, String mainId) {
List<SysDataAuthDeptRel> authDeptList = sysDataAuthVO.getAuthDeptList();
List<SysDataAuthDiySql> authSqlList = sysDataAuthVO.getAuthSqlList();
// 类型:1:创建人;2:结算主体;3部门
List<SysDataAuthMenuRel> menuCreateList = sysDataAuthVO.getMenuCreateList();
List<SysDataAuthMenuRel> menuSettleList = sysDataAuthVO.getMenuSettleList();
List<SysDataAuthMenuRel> menuDeptList = sysDataAuthVO.getMenuDeptList();
// 处理权限部门
if (sysDataAuth.getIsDeptAuth() == 1 || sysDataAuth.getIsDeptAuth() == 2) {
if (menuDeptList == null || menuDeptList.isEmpty()) {
return R.failed("请选择部门关联的菜单!");
} else if (sysDataAuth.getIsDeptAuth() == 2) {
for (SysDataAuthDeptRel dept : authDeptList) {
dept.setSysDataAuthId(mainId);
}
authDeptRelService.saveOrUpdateBatch(authDeptList);
}
for (SysDataAuthMenuRel menu : menuDeptList) {
menu.setSysDataAuthId(mainId);
menu.setType(3);
}
saveMenuDeptList.addAll(menuSettleList);
}
// 处理创建人
if (menuCreateList != null && !menuCreateList.isEmpty()) {
sysDataAuth.setIsCreateAuth(1);
for (SysDataAuthMenuRel menu : menuCreateList) {
menu.setType(1);
menu.setSysDataAuthId(mainId);
}
saveMenuDeptList.addAll(menuSettleList);
}
// 处理结算主体
if (menuSettleList != null && !menuSettleList.isEmpty()) {
sysDataAuth.setIsSettleAuth(1);
for (SysDataAuthMenuRel menu : menuSettleList) {
menu.setType(2);
menu.setSysDataAuthId(mainId);
}
saveMenuDeptList.addAll(menuSettleList);
}
// 处理自定义sql
if (authSqlList != null && !authSqlList.isEmpty()) {
sysDataAuth.setIsDiySql(1);
List<SysDiySqlMenuRel> menuSqlList;
for (SysDataAuthDiySql sql : authSqlList) {
menuSqlList = sql.getSqlMenuList();
if (menuSqlList != null && !menuSqlList.isEmpty()) {
sql.setSysDataAuthId(mainId);
diySqlService.save(sql);
for (SysDiySqlMenuRel menuSql : menuSqlList) {
menuSql.setSysDataAuthId(mainId);
menuSql.setSysDiySqlId(sql.getId());
}
diySqlMenuRelService.saveBatch(menuSqlList);
} else {
return R.failed("自定义Sql有内容,要选择菜单!");
}
}
}
return null;
}
/**
* @param mainId 数据权限主表id
* @Description: 删除数据权限关联表
* @Author: hgw
* @Date: 2022/6/9 11:47
* @return: void
**/
public void deleteSubInfoByMainId(String mainId) {
authDeptRelService.deleteAuthDeptRelByAuthId(mainId);
authMenuRelService.deleteAuthMenuRelByAuthId(mainId);
diySqlService.deleteDiySqlByAuthId(mainId);
diySqlMenuRelService.deleteSqlMenuRelByAuthId(mainId);
}
/**
* 删除
*
* @param id 部门 ID
* @return 成功、失败
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean removeDataAuthById(String id) {
this.deleteSubInfoByMainId(id);
this.removeById(id);
return Boolean.TRUE;
}
/**
* @param mainId 权限主表id
* @Description: 查看
* @Author: hgw
* @Date: 2022/6/9 14:52
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDataAuthVO>
**/
@Override
public R<SysDataAuthVO> getByMainId(String mainId) {
SysDataAuthVO vo = new SysDataAuthVO();
SysDataAuth main = this.getById(mainId);
if (main != null) {
vo.setSysDataAuth(main);
// 部门树
vo.setAuthDeptList(authDeptRelService.getByMainId(mainId));
// 菜单
List<SysDataAuthMenuRel> menuList = authMenuRelService.getByMainId(mainId);
List<SysDataAuthMenuRel> menuCreateList = new ArrayList<>();
List<SysDataAuthMenuRel> menuSettleList = new ArrayList<>();
List<SysDataAuthMenuRel> menuDeptList = new ArrayList<>();
if (menuList != null && !menuList.isEmpty()) {
for (SysDataAuthMenuRel menu : menuList) {
switch (menu.getType()) {
case 1:
menuCreateList.add(menu);
break;
case 2:
menuSettleList.add(menu);
break;
case 3:
menuDeptList.add(menu);
break;
default:
break;
}
}
vo.setMenuCreateList(menuCreateList);
vo.setMenuSettleList(menuSettleList);
vo.setMenuDeptList(menuDeptList);
}
// 自定义sql
List<SysDataAuthDiySql> diyList = diySqlService.getByMainId(mainId);
if (diyList != null && !diyList.isEmpty()) {
List<SysDiySqlMenuRel> diyMenuList = diySqlMenuRelService.getByMainId(mainId);
if (diyMenuList != null && !diyMenuList.isEmpty()) {
Map<String, List<SysDiySqlMenuRel>> sqlMenuMap = new HashMap<>();
List<SysDiySqlMenuRel> baseList;
for (SysDiySqlMenuRel menu : diyMenuList) {
baseList = sqlMenuMap.get(menu.getSysDiySqlId());
if (baseList == null) {
baseList = new ArrayList<>();
}
baseList.add(menu);
sqlMenuMap.put(menu.getSysDiySqlId(), baseList);
}
for (SysDataAuthDiySql diy : diyList) {
if (sqlMenuMap.get(diy.getId()) != null) {
diy.setSqlMenuList(sqlMenuMap.get(diy.getId()));
}
}
}
vo.setAuthSqlList(diyList);
}
return new R<>(vo);
} else {
return R.failed("未找到!");
}
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDiySqlMenuRel;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDiySqlMenuRelMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDiySqlMenuRelService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 数据权限配置相关服务实现
* @Author: hgw
* @Date: 2022/6/8 17:20
**/
@Service
@RequiredArgsConstructor
public class SysDiySqlMenuRelServiceImpl extends ServiceImpl<SysDiySqlMenuRelMapper, SysDiySqlMenuRel> implements SysDiySqlMenuRelService {
// 清空
@Override
public int deleteSqlMenuRelByAuthId(String mainId) {
return baseMapper.deleteSqlMenuRelByAuthId(mainId);
}
/**
* @param mainId 权限主表id
* @Description: 根据权限主表id查询
* @Author: hgw
* @Date: 2022/6/9 14:31
**/
@Override
public List<SysDiySqlMenuRel> getByMainId(String mainId) {
return baseMapper.getByMainId(mainId);
}
}
...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.dto.SysLogDTO; ...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.dto.SysLogDTO;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysLog; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysLog;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysLogMapper; import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysLogMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysLogService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysLogService;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
...@@ -73,6 +74,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme ...@@ -73,6 +74,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
wrapper.ge(SysLog::getCreateTime, sysLog.getCreateTime()[0]).le(SysLog::getCreateTime, wrapper.ge(SysLog::getCreateTime, sysLog.getCreateTime()[0]).le(SysLog::getCreateTime,
sysLog.getCreateTime()[1]); sysLog.getCreateTime()[1]);
} }
wrapper.orderByDesc(BaseEntity::getCreateTime);
return wrapper; return wrapper;
} }
......
...@@ -63,6 +63,17 @@ spring: ...@@ -63,6 +63,17 @@ spring:
#mvc: #mvc:
# pathmatch: # pathmatch:
# matching-strategy: ANT_PATH_MATCHER # matching-strategy: ANT_PATH_MATCHER
#swagger 文档 https://springdoc.org/
### OpenAPI3 注解
# OpenAPI 3 注解位置
# @Tag(name = “接口类描述”) Controller 类上
# @Operation(summary =“接口方法描述”) Controller 方法上
# @Parameters Controller 方法上
# @Parameter(description=“参数描述”) Controller 方法上 @Parameters 里
# @Parameter(description=“参数描述”) Controller 方法的参数上
# @Parameter(hidden = true) 或 @Hidden --
# @Schema DTO类上
# @Schema DTO属性上
springdoc: springdoc:
api-docs: api-docs:
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!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.yifu.admin.mapper.SysDataAuthDeptRelMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDeptRel">
<id property="id" column="id"/>
<result property="sysDataAuthId" column="sys_data_auth_id"/>
<result property="deptId" column="dept_id"/>
</resultMap>
<!-- 通过权限ID,查询信息-->
<select id="getByMainId" resultMap="BaseResultMap">
SELECT id,
sys_data_auth_id,
dept_id
FROM sys_data_auth_dept_rel
WHERE sys_data_auth_id = #{mainId}
</select>
<delete id="deleteAuthDeptRelByAuthId">
delete from sys_data_auth_dept_rel where sys_data_auth_id = #{mainId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!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.yifu.admin.mapper.SysDataAuthDiySqlMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthDiySql">
<id property="id" column="id"/>
<result property="sysDataAuthId" column="sys_data_auth_id"/>
<result property="diySql" column="diy_sql"/>
</resultMap>
<!-- 通过权限ID,查询信息-->
<select id="getByMainId" resultMap="BaseResultMap">
SELECT id,
sys_data_auth_id,
diy_sql
FROM sys_data_auth_diy_sql
WHERE sys_data_auth_id = #{mainId}
</select>
<delete id="deleteDiySqlByAuthId">
delete from sys_data_auth_diy_sql where sys_data_auth_id = #{mainId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!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.yifu.admin.mapper.SysDataAuthMapper">
<!-- 通用查询映射结果 -->
<resultMap id="SysDataAuthMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth">
<id property="id" column="id"/>
<result property="linkType" column="link_type"/>
<result property="linkId" column="link_id"/>
<result property="linkName" column="link_name"/>
<result property="isCreateAuth" column="is_create_auth"/>
<result property="isDeptAuth" column="is_dept_auth"/>
<result property="isSettleAuth" column="is_settle_auth"/>
<result property="isDiySql" column="is_diy_sql"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.link_type,
a.link_id,
a.link_name,
a.is_create_auth,
a.is_dept_auth,
a.is_settle_auth,
a.is_diy_sql,
a.create_by,
a.create_time,
a.update_by,
a.update_time
</sql>
<sql id="sysDataAuthMap_where">
<if test="sysDataAuth != null">
<if test="sysDataAuth.id != null and sysDataAuth.id.trim() != ''">
AND a.id = #{sysDataAuth.id}
</if>
<if test="sysDataAuth.linkName != null and sysDataAuth.linkName.trim() != ''">
AND a.link_name like concat('%',#{sysDataAuth.linkName},'%')
</if>
</if>
</sql>
<!--简单分页查询-->
<select id="getSysDataAuthPage" resultMap="SysDataAuthMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_data_auth a
<where>
1=1
<include refid="sysDataAuthMap_where"/>
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!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.yifu.admin.mapper.SysDataAuthMenuRelMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuthMenuRel">
<id property="id" column="id"/>
<result property="sysDataAuthId" column="sys_data_auth_id"/>
<result property="type" column="type"/>
<result property="menuId" column="menu_id"/>
</resultMap>
<!-- 通过权限ID,查询信息-->
<select id="getByMainId" resultMap="BaseResultMap">
SELECT id,
sys_data_auth_id,
type,
menu_id
FROM sys_data_auth_menu_rel
WHERE sys_data_auth_id = #{mainId}
order by type asc
</select>
<delete id="deleteAuthMenuRelByAuthId">
delete from sys_data_auth_menu_rel where sys_data_auth_id = #{mainId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!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.yifu.admin.mapper.SysDiySqlMenuRelMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDiySqlMenuRel">
<id property="id" column="id"/>
<result property="sysDataAuthId" column="sys_data_auth_id"/>
<result property="sysDiySqlId" column="sys_diy_sql_id"/>
<result property="menuId" column="menu_id"/>
</resultMap>
<!-- 通过权限ID,查询信息-->
<select id="getByMainId" resultMap="BaseResultMap">
SELECT id,
sys_data_auth_id,
sys_diy_sql_id,
menu_id
FROM sys_diy_sql_menu_rel
WHERE sys_data_auth_id = #{mainId}
</select>
<delete id="deleteSqlMenuRelByAuthId">
delete
from sys_diy_sql_menu_rel
where sys_data_auth_id = #{mainId}
</delete>
</mapper>
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="create_by" property="createBy"/> <result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/> <result column="update_by" property="updateBy"/>
</resultMap> </resultMap>
......
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