Merge pull request #1 from chillzhuang/master

更新数据
This commit is contained in:
yoyo3287258 2020-07-02 16:42:43 +08:00 committed by GitHub
commit e025f21557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 5630 additions and 389 deletions

View File

@ -176,7 +176,7 @@ recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within the same "printed page" as the copyright notice for easier identification within
third-party archives. third-party archives.
Copyright 2019 ZhuangQian (smallchill@163.com) Copyright 2020 BladeX (https://bladex.vip)
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,9 +1,9 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/Release-V2.6.1-green.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Release-V2.7.1-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status"> <img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status"> <img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR1-blue.svg" alt="Coverage Status"> <img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR5-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.2.4.RELEASE-blue.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Spring%20Boot-2.2.7.RELEASE-blue.svg" alt="Downloads">
<a target="_blank" href="https://bladex.vip"> <a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
</a> </a>
@ -22,7 +22,7 @@
* 极简封装了多租户底层用更少的代码换来拓展性更强的SaaS多租户系统。 * 极简封装了多租户底层用更少的代码换来拓展性更强的SaaS多租户系统。
* 借鉴OAuth2实现了多终端认证系统可控制子系统的token权限互相隔离。 * 借鉴OAuth2实现了多终端认证系统可控制子系统的token权限互相隔离。
* 借鉴Security封装了Secure模块采用JWT做Token认证可拓展集成Redis等细颗粒度控制方案。 * 借鉴Security封装了Secure模块采用JWT做Token认证可拓展集成Redis等细颗粒度控制方案。
* 稳定生产了一年经历了从Camden -> Greenwich的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构 * 稳定生产了两年经历了从Camden -> Hoxton的技术架构也经历了从fat jar -> docker -> k8s + jenkins的部署架构
* 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。 * 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。
## 架构图 ## 架构图
@ -58,12 +58,14 @@ SpringBlade
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) * 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
* 交流一群:`477853168`(满) * 交流一群:`477853168`(满)
* 交流二群:`751253339`(满) * 交流二群:`751253339`(满)
* 交流三群:`784729540` * 交流三群:`784729540`(满)
* 交流四群:`1034621754`
## 在线演示 ## 在线演示
* Saber-基于Vue[https://saber.bladex.vip](https://saber.bladex.vip) * Saber-基于Vue[https://saber.bladex.vip](https://saber.bladex.vip)
* Sword-基于React[https://sword.bladex.vip](https://sword.bladex.vip) * Sword-基于React[https://sword.bladex.vip](https://sword.bladex.vip)
* Archer-全能代码生成系统:[https://archer.bladex.vip](https://archer.bladex.vip) * Archer-全能代码生成系统:[https://archer.bladex.vip](https://archer.bladex.vip)
* Caster-数据大屏展示系统:[https://data.avuejs.com](https://data.avuejs.com)
## 技术文档 ## 技术文档
* [SpringBlade开发手册一览](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册) * [SpringBlade开发手册一览](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册)

View File

@ -8,7 +8,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>blade-auth</artifactId> <artifactId>blade-auth</artifactId>

View File

@ -81,6 +81,7 @@ public class AuthController {
} }
@GetMapping("/captcha") @GetMapping("/captcha")
@ApiOperation(value = "获取验证码")
public R<Kv> captcha() { public R<Kv> captcha() {
SpecCaptcha specCaptcha = new SpecCaptcha(130, 48, 5); SpecCaptcha specCaptcha = new SpecCaptcha(130, 48, 5);
String verCode = specCaptcha.text().toLowerCase(); String verCode = specCaptcha.text().toLowerCase();

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -20,7 +20,7 @@ public interface CommonConstant {
/** /**
* 顶级父节点id * 顶级父节点id
*/ */
Integer TOP_PARENT_ID = 0; Long TOP_PARENT_ID = 0L;
/** /**
* 顶级父节点名称 * 顶级父节点名称

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -46,8 +46,8 @@ public class JwtUtil {
String headStr = auth.substring(0, 6).toLowerCase(); String headStr = auth.substring(0, 6).toLowerCase();
if (headStr.compareTo(BEARER) == 0) { if (headStr.compareTo(BEARER) == 0) {
auth = auth.substring(7); auth = auth.substring(7);
return auth;
} }
return auth;
} }
return null; return null;
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -99,7 +99,7 @@ public class CodeController extends BladeController {
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(codeService.removeByIds(Func.toIntList(ids))); return R.status(codeService.removeByIds(Func.toLongList(ids)));
} }
/** /**
@ -108,7 +108,7 @@ public class CodeController extends BladeController {
@PostMapping("/copy") @PostMapping("/copy")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ApiOperation(value = "复制", notes = "传入id") @ApiOperation(value = "复制", notes = "传入id")
public R copy(@ApiParam(value = "主键", required = true) @RequestParam Integer id) { public R copy(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
Code code = codeService.getById(id); Code code = codeService.getById(id);
code.setId(null); code.setId(null);
code.setCodeName(code.getCodeName() + "-copy"); code.setCodeName(code.getCodeName() + "-copy");
@ -122,7 +122,7 @@ public class CodeController extends BladeController {
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "代码生成", notes = "传入ids") @ApiOperation(value = "代码生成", notes = "传入ids")
public R genCode(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) { public R genCode(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) {
Collection<Code> codes = codeService.listByIds(Func.toIntList(ids)); Collection<Code> codes = codeService.listByIds(Func.toLongList(ids));
codes.forEach(code -> { codes.forEach(code -> {
BladeCodeGenerator generator = new BladeCodeGenerator(); BladeCodeGenerator generator = new BladeCodeGenerator();
// 设置数据源 // 设置数据源

View File

@ -107,7 +107,7 @@ public class DatasourceController extends BladeController {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(datasourceService.deleteLogic(Func.toIntList(ids))); return R.status(datasourceService.deleteLogic(Func.toLongList(ids)));
} }
/** /**

View File

@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -41,14 +43,16 @@ public class Code implements Serializable {
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 数据源主键 * 数据源主键
*/ */
@ApiModelProperty(value = "数据源主键") @ApiModelProperty(value = "数据源主键")
private Integer datasourceId; @JsonSerialize(using = ToStringSerializer.class)
private Long datasourceId;
/** /**
* 模块名称 * 模块名称

View File

@ -18,6 +18,8 @@ package org.springblade.develop.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -41,8 +43,9 @@ public class Datasource extends BaseEntity {
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 名称 * 名称

View File

@ -134,7 +134,7 @@ public class $!{table.controllerName} {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.deleteLogic(Func.toIntList(ids))); return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids)));
} }
#else #else
@ -146,7 +146,7 @@ public class $!{table.controllerName} {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.removeByIds(Func.toIntList(ids))); return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));
} }
#end #end

View File

@ -134,7 +134,7 @@ public class $!{table.controllerName} {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.deleteLogic(Func.toIntList(ids))); return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids)));
} }
#else #else
@ -146,7 +146,7 @@ public class $!{table.controllerName} {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status($!{table.entityPath}Service.removeByIds(Func.toIntList(ids))); return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids)));
} }
#end #end

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -11,7 +11,6 @@ spring:
# seata配置 # seata配置
seata: seata:
tx-service-group: blade-seata-order-group
#registry: #registry:
# type: nacos # type: nacos
# nacos: # nacos:
@ -20,12 +19,13 @@ seata:
# type: nacos # type: nacos
# nacos: # nacos:
# server-addr: localhost # server-addr: localhost
tx-service-group: blade-seata-order-group
service: service:
grouplist: 127.0.0.1:8091 grouplist:
vgroup-mapping: default default: 127.0.0.1:8091
vgroup-mapping:
blade-seata-order-group: default
disable-global-transaction: false disable-global-transaction: false
client: client:
support: rm:
spring: report-success-enable: false
datasource-autoproxy: false
rm-report-success-enable: false

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-ops</artifactId> <artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -11,7 +11,6 @@ spring:
# seata配置 # seata配置
seata: seata:
tx-service-group: blade-seata-storage-group
#registry: #registry:
# type: nacos # type: nacos
# nacos: # nacos:
@ -20,12 +19,13 @@ seata:
# type: nacos # type: nacos
# nacos: # nacos:
# server-addr: localhost # server-addr: localhost
tx-service-group: blade-seata-storage-group
service: service:
grouplist: 127.0.0.1:8091 grouplist:
vgroup-mapping: default default: 127.0.0.1:8091
vgroup-mapping:
blade-seata-storage-group: default
disable-global-transaction: false disable-global-transaction: false
client: client:
support: rm:
spring: report-success-enable: false
datasource-autoproxy: false
rm-report-success-enable: false

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -19,6 +19,8 @@ package com.example.demo.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -41,9 +43,10 @@ public class Notice extends BaseEntity {
/** /**
* 主键id * 主键id
*/ */
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "主键")
@ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 标题 * 标题

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -18,6 +18,8 @@ package org.springblade.desk.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -40,9 +42,10 @@ public class Notice extends BaseEntity {
/** /**
* 主键id * 主键id
*/ */
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "主键")
@ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 标题 * 标题

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -42,14 +44,16 @@ public class Dict implements Serializable {
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 父主键 * 父主键
*/ */
@ApiModelProperty(value = "父主键") @ApiModelProperty(value = "父主键")
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 字典码 * 字典码

View File

@ -16,6 +16,8 @@
package org.springblade.system.vo; package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -39,12 +41,14 @@ public class DictVO extends Dict implements INode {
/** /**
* 主键ID * 主键ID
*/ */
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 父节点ID * 父节点ID
*/ */
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 子孙节点 * 子孙节点

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -18,6 +18,8 @@ package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -41,9 +43,10 @@ public class AuthClient extends BaseEntity {
/** /**
* 主键id * 主键id
*/ */
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "主键")
@ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 客户端id * 客户端id

View File

@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -41,8 +43,9 @@ public class Dept implements Serializable {
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 租户ID * 租户ID
@ -54,7 +57,8 @@ public class Dept implements Serializable {
* 父主键 * 父主键
*/ */
@ApiModelProperty(value = "父主键") @ApiModelProperty(value = "父主键")
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 部门名 * 部门名

View File

@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -42,14 +44,16 @@ public class Menu implements Serializable {
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 菜单父主键 * 菜单父主键
*/ */
@ApiModelProperty(value = "菜单父主键") @ApiModelProperty(value = "父主键")
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 菜单编号 * 菜单编号

View File

@ -18,6 +18,8 @@ package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -40,9 +42,10 @@ public class Param extends BaseEntity {
/** /**
* 主键id * 主键id
*/ */
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "主键")
@ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 参数名 * 参数名

View File

@ -0,0 +1,77 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.TenantEntity;
/**
* 岗位表实体类
*
* @author Chill
*/
@Data
@TableName("blade_post")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Post对象", description = "岗位表")
public class Post extends TenantEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 类型
*/
@ApiModelProperty(value = "类型")
private Integer category;
/**
* 岗位编号
*/
@ApiModelProperty(value = "岗位编号")
private String postCode;
/**
* 岗位名称
*/
@ApiModelProperty(value = "岗位名称")
private String postName;
/**
* 岗位排序
*/
@ApiModelProperty(value = "岗位排序")
private Integer sort;
/**
* 岗位描述
*/
@ApiModelProperty(value = "岗位描述")
private String remark;
}

View File

@ -0,0 +1,128 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 行政区划表实体类
*
* @author Chill
*/
@Data
@TableName("blade_region")
@ApiModel(value = "Region对象", description = "行政区划表")
public class Region implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 区划编号
*/
@TableId(value = "code", type = IdType.INPUT)
@ApiModelProperty(value = "区划编号")
private String code;
/**
* 父区划编号
*/
@ApiModelProperty(value = "父区划编号")
private String parentCode;
/**
* 祖区划编号
*/
@ApiModelProperty(value = "祖区划编号")
private String ancestors;
/**
* 区划名称
*/
@ApiModelProperty(value = "区划名称")
private String name;
/**
* 省级区划编号
*/
@ApiModelProperty(value = "省级区划编号")
private String provinceCode;
/**
* 省级名称
*/
@ApiModelProperty(value = "省级名称")
private String provinceName;
/**
* 市级区划编号
*/
@ApiModelProperty(value = "市级区划编号")
private String cityCode;
/**
* 市级名称
*/
@ApiModelProperty(value = "市级名称")
private String cityName;
/**
* 区级区划编号
*/
@ApiModelProperty(value = "区级区划编号")
private String districtCode;
/**
* 区级名称
*/
@ApiModelProperty(value = "区级名称")
private String districtName;
/**
* 镇级区划编号
*/
@ApiModelProperty(value = "镇级区划编号")
private String townCode;
/**
* 镇级名称
*/
@ApiModelProperty(value = "镇级名称")
private String townName;
/**
* 村级区划编号
*/
@ApiModelProperty(value = "村级区划编号")
private String villageCode;
/**
* 村级名称
*/
@ApiModelProperty(value = "村级名称")
private String villageName;
/**
* 层级
*/
@ApiModelProperty(value = "层级")
private Integer level;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
private Integer sort;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -41,8 +43,9 @@ public class Role implements Serializable {
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 租户ID * 租户ID
@ -54,7 +57,8 @@ public class Role implements Serializable {
* 父主键 * 父主键
*/ */
@ApiModelProperty(value = "父主键") @ApiModelProperty(value = "父主键")
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 角色名 * 角色名

View File

@ -18,6 +18,8 @@ package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -40,20 +42,23 @@ public class RoleMenu implements Serializable {
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 菜单id * 菜单id
*/ */
@ApiModelProperty(value = "菜单id") @ApiModelProperty(value = "菜单id")
private Integer menuId; @JsonSerialize(using = ToStringSerializer.class)
private Long menuId;
/** /**
* 角色id * 角色id
*/ */
@ApiModelProperty(value = "角色id") @ApiModelProperty(value = "角色id")
private Integer roleId; @JsonSerialize(using = ToStringSerializer.class)
private Long roleId;
} }

View File

@ -18,6 +18,8 @@ package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -40,9 +42,10 @@ public class Tenant extends BaseEntity {
/** /**
* 主键id * 主键id
*/ */
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "主键")
@ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 租户ID * 租户ID

View File

@ -22,6 +22,8 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/** /**
* Feign接口类 * Feign接口类
* *
@ -35,14 +37,6 @@ public interface ISysClient {
String API_PREFIX = "/sys"; String API_PREFIX = "/sys";
/**
* 获取部门名
*
* @param id 主键
* @return 部门名
*/
@GetMapping(API_PREFIX + "/getDeptName")
String getDeptName(@RequestParam("id") Integer id);
/** /**
* 获取部门 * 获取部门
@ -51,25 +45,55 @@ public interface ISysClient {
* @return Dept * @return Dept
*/ */
@GetMapping(API_PREFIX + "/getDept") @GetMapping(API_PREFIX + "/getDept")
Dept getDept(@RequestParam("id") Integer id); Dept getDept(@RequestParam("id") Long id);
/** /**
* 获取角色 * 获取部门
* *
* @param id 主键 * @param id 主键
* @return 角色 * @return 部门
*/ */
@GetMapping(API_PREFIX + "/getRoleName") @GetMapping(API_PREFIX + "/getDeptName")
String getRoleName(@RequestParam("id") Integer id); String getDeptName(@RequestParam("id") Long id);
/** /**
* 获取角色别名 * 获取部门id
* *
* @param id 主键 * @param tenantId 租户id
* @return 角色别名 * @param deptNames 部门名
* @return 部门id
*/ */
@GetMapping(API_PREFIX + "/getRoleAlias") @GetMapping(API_PREFIX + "/getDeptIds")
String getRoleAlias(@RequestParam("id") Integer id); String getDeptIds(@RequestParam("tenantId") String tenantId, @RequestParam("deptNames") String deptNames);
/**
* 获取部门名
*
* @param deptIds 主键
* @return
*/
@GetMapping(API_PREFIX + "/getDeptNames")
List<String> getDeptNames(@RequestParam("deptIds") String deptIds);
/**
* 获取岗位id
*
* @param tenantId 租户id
* @param postNames 岗位名
* @return 岗位id
*/
@GetMapping(API_PREFIX + "/getPostIds")
String getPostIds(@RequestParam("tenantId") String tenantId, @RequestParam("postNames") String postNames);
/**
* 获取岗位名
*
* @param postIds 主键
* @return
*/
@GetMapping(API_PREFIX + "/getPostNames")
List<String> getPostNames(@RequestParam("postIds") String postIds);
/** /**
* 获取角色 * 获取角色
@ -78,6 +102,43 @@ public interface ISysClient {
* @return Role * @return Role
*/ */
@GetMapping(API_PREFIX + "/getRole") @GetMapping(API_PREFIX + "/getRole")
Role getRole(@RequestParam("id") Integer id); Role getRole(@RequestParam("id") Long id);
/**
* 获取角色id
*
* @param tenantId 租户id
* @param roleNames 角色名
* @return 角色id
*/
@GetMapping(API_PREFIX + "/getRoleIds")
String getRoleIds(@RequestParam("tenantId") String tenantId, @RequestParam("roleNames") String roleNames);
/**
* 获取角色名
*
* @param id 主键
* @return 角色名
*/
@GetMapping(API_PREFIX + "/getRoleName")
String getRoleName(@RequestParam("id") Long id);
/**
* 获取角色名
*
* @param roleIds 主键
* @return
*/
@GetMapping(API_PREFIX + "/getRoleNames")
List<String> getRoleNames(@RequestParam("roleIds") String roleIds);
/**
* 获取角色别名
*
* @param id 主键
* @return 角色别名
*/
@GetMapping(API_PREFIX + "/getRoleAlias")
String getRoleAlias(@RequestParam("id") Long id);
} }

View File

@ -19,6 +19,8 @@ import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Role; import org.springblade.system.entity.Role;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
/** /**
* Feign失败配置 * Feign失败配置
* *
@ -26,28 +28,59 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
public class ISysClientFallback implements ISysClient { public class ISysClientFallback implements ISysClient {
@Override @Override
public String getDeptName(Integer id) { public Dept getDept(Long id) {
return null; return null;
} }
@Override @Override
public Dept getDept(Integer id) { public String getDeptName(Long id) {
return null; return null;
} }
@Override @Override
public String getRoleName(Integer id) { public String getDeptIds(String tenantId, String deptNames) {
return null; return null;
} }
@Override @Override
public String getRoleAlias(Integer id) { public List<String> getDeptNames(String deptIds) {
return null; return null;
} }
@Override @Override
public Role getRole(Integer id) { public String getPostIds(String tenantId, String postNames) {
return null;
}
@Override
public List<String> getPostNames(String postIds) {
return null;
}
@Override
public Role getRole(Long id) {
return null;
}
@Override
public String getRoleIds(String tenantId, String roleNames) {
return null;
}
@Override
public String getRoleName(Long id) {
return null;
}
@Override
public List<String> getRoleNames(String roleIds) {
return null;
}
@Override
public String getRoleAlias(Long id) {
return null; return null;
} }
} }

View File

@ -16,6 +16,8 @@
package org.springblade.system.vo; package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -39,12 +41,14 @@ public class DeptVO extends Dept implements INode {
/** /**
* 主键ID * 主键ID
*/ */
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 父节点ID * 父节点ID
*/ */
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 子孙节点 * 子孙节点

View File

@ -16,6 +16,8 @@
package org.springblade.system.vo; package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -39,12 +41,14 @@ public class MenuVO extends Menu implements INode {
/** /**
* 主键ID * 主键ID
*/ */
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 父节点ID * 父节点ID
*/ */
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 子孙节点 * 子孙节点

View File

@ -0,0 +1,39 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.entity.Post;
/**
* 岗位表视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PostVO对象", description = "岗位表")
public class PostVO extends Post {
private static final long serialVersionUID = 1L;
/**
* 岗位分类名
*/
private String categoryName;
}

View File

@ -0,0 +1,88 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Region;
import java.util.ArrayList;
import java.util.List;
/**
* 行政区划表视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RegionVO对象", description = "行政区划表")
public class RegionVO extends Region implements INode {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 父节点ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 父节点名称
*/
private String parentName;
/**
* 是否有子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Boolean hasChildren;
/**
* 子孙节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<INode> children;
@Override
public Long getId() {
return Func.toLong(this.getCode());
}
@Override
public Long getParentId() {
return Func.toLong(this.getParentCode());
}
@Override
public List<INode> getChildren() {
if (this.children == null) {
this.children = new ArrayList<>();
}
return this.children;
}
}

View File

@ -16,6 +16,8 @@
package org.springblade.system.vo; package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -39,12 +41,14 @@ public class RoleVO extends Role implements INode {
/** /**
* 主键ID * 主键ID
*/ */
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 父节点ID * 父节点ID
*/ */
private Integer parentId; @JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/** /**
* 子孙节点 * 子孙节点

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -18,6 +18,8 @@ package org.springblade.system.user.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -40,10 +42,16 @@ public class User extends TenantEntity {
/** /**
* 主键id * 主键id
*/ */
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "主键")
@ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.ASSIGN_ID)
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 编号
*/
private String code;
/** /**
* 账号 * 账号
*/ */
@ -88,6 +96,10 @@ public class User extends TenantEntity {
* 部门id * 部门id
*/ */
private String deptId; private String deptId;
/**
* 部门id
*/
private String postId;
} }

View File

@ -15,6 +15,8 @@
*/ */
package org.springblade.system.user.vo; package org.springblade.system.user.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -34,7 +36,8 @@ public class UserVO extends User {
/** /**
* 主键ID * 主键ID
*/ */
private Integer id; @JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** /**
* 角色名 * 角色名
@ -46,6 +49,11 @@ public class UserVO extends User {
*/ */
private String deptName; private String deptName;
/**
* 岗位名
*/
private String postName;
/** /**
* 性别 * 性别
*/ */

View File

@ -5,13 +5,13 @@
<parent> <parent>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId> <artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<version>2.6.1</version> <version>2.7.1</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description> <description>SpringBlade 微服务API集合</description>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -109,7 +109,7 @@ public class NoticeController extends BladeController implements CacheNames {
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入notice") @ApiOperation(value = "逻辑删除", notes = "传入notice")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = noticeService.deleteLogic(Func.toIntList(ids)); boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
return R.status(temp); return R.status(temp);
} }

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -114,7 +114,7 @@ public class NoticeController extends BladeController implements CacheNames {
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入notice") @ApiOperation(value = "逻辑删除", notes = "传入notice")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = noticeService.deleteLogic(Func.toIntList(ids)); boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
return R.status(temp); return R.status(temp);
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -110,7 +110,7 @@ public class AuthClientController extends BladeController {
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(clientService.deleteLogic(Func.toIntList(ids))); return R.status(clientService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -110,7 +110,7 @@ public class DeptController extends BladeController {
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(deptService.removeByIds(Func.toIntList(ids))); return R.status(deptService.removeByIds(Func.toLongList(ids)));
} }

View File

@ -110,7 +110,7 @@ public class DictController extends BladeController {
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(dictService.removeByIds(Func.toIntList(ids))); return R.status(dictService.removeByIds(Func.toLongList(ids)));
} }
/** /**

View File

@ -99,7 +99,7 @@ public class MenuController extends BladeController {
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(menuService.removeByIds(Func.toIntList(ids))); return R.status(menuService.removeByIds(Func.toLongList(ids)));
} }
/** /**

View File

@ -90,7 +90,7 @@ public class ParamController extends BladeController {
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(paramService.deleteLogic(Func.toIntList(ids))); return R.status(paramService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -0,0 +1,139 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Post;
import org.springblade.system.service.IPostService;
import org.springblade.system.vo.PostVO;
import org.springblade.system.wrapper.PostWrapper;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* 岗位表 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping("/post")
@Api(value = "岗位表", tags = "岗位表接口")
public class PostController extends BladeController {
private IPostService postService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入post")
public R<PostVO> detail(Post post) {
Post detail = postService.getOne(Condition.getQueryWrapper(post));
return R.data(PostWrapper.build().entityVO(detail));
}
/**
* 分页 岗位表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入post")
public R<IPage<PostVO>> list(Post post, Query query) {
IPage<Post> pages = postService.page(Condition.getPage(query), Condition.getQueryWrapper(post));
return R.data(PostWrapper.build().pageVO(pages));
}
/**
* 自定义分页 岗位表
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "分页", notes = "传入post")
public R<IPage<PostVO>> page(PostVO post, Query query) {
IPage<PostVO> pages = postService.selectPostPage(Condition.getPage(query), post);
return R.data(pages);
}
/**
* 新增 岗位表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入post")
public R save(@Valid @RequestBody Post post) {
return R.status(postService.save(post));
}
/**
* 修改 岗位表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入post")
public R update(@Valid @RequestBody Post post) {
return R.status(postService.updateById(post));
}
/**
* 新增或修改 岗位表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入post")
public R submit(@Valid @RequestBody Post post) {
return R.status(postService.saveOrUpdate(post));
}
/**
* 删除 岗位表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(postService.deleteLogic(Func.toLongList(ids)));
}
/**
* 下拉数据源
*/
@GetMapping("/select")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "下拉数据源", notes = "传入post")
public R<List<Post>> select(String tenantId, BladeUser bladeUser) {
List<Post> list = postService.list(Wrappers.<Post>query().lambda().eq(Post::getTenantId, Func.toStr(tenantId, bladeUser.getTenantId())));
return R.data(list);
}
}

View File

@ -0,0 +1,157 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Region;
import org.springblade.system.service.IRegionService;
import org.springblade.system.vo.RegionVO;
import org.springblade.system.wrapper.RegionWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping("/region")
@Api(value = "行政区划表", tags = "行政区划表接口")
public class RegionController extends BladeController {
private final IRegionService regionService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入region")
public R<RegionVO> detail(Region region) {
Region detail = regionService.getOne(Condition.getQueryWrapper(region));
return R.data(RegionWrapper.build().entityVO(detail));
}
/**
* 分页 行政区划表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入region")
public R<IPage<Region>> list(Region region, Query query) {
IPage<Region> pages = regionService.page(Condition.getPage(query), Condition.getQueryWrapper(region));
return R.data(pages);
}
/**
* 懒加载列表
*/
@GetMapping("/lazy-list")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "区划编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "区划名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 3)
@ApiOperation(value = "懒加载列表", notes = "传入menu")
public R<List<INode>> lazyList(String parentCode, @ApiIgnore @RequestParam Map<String, Object> menu) {
List<INode> list = regionService.lazyList(parentCode, menu);
return R.data(RegionWrapper.build().listNodeLazyVO(list));
}
/**
* 懒加载列表
*/
@GetMapping("/lazy-tree")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "区划编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "区划名称", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 4)
@ApiOperation(value = "懒加载列表", notes = "传入menu")
public R<List<INode>> lazyTree(String parentCode, @ApiIgnore @RequestParam Map<String, Object> menu) {
List<INode> list = regionService.lazyTree(parentCode, menu);
return R.data(RegionWrapper.build().listNodeLazyVO(list));
}
/**
* 新增 行政区划表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "新增", notes = "传入region")
public R save(@Valid @RequestBody Region region) {
return R.status(regionService.save(region));
}
/**
* 修改 行政区划表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "修改", notes = "传入region")
public R update(@Valid @RequestBody Region region) {
return R.status(regionService.updateById(region));
}
/**
* 新增或修改 行政区划表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "新增或修改", notes = "传入region")
public R submit(@Valid @RequestBody Region region) {
return R.status(regionService.submit(region));
}
/**
* 删除 行政区划表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "删除", notes = "传入主键")
public R remove(@ApiParam(value = "主键", required = true) @RequestParam String id) {
return R.status(regionService.removeRegion(id));
}
/**
* 行政区划下拉数据源
*/
@GetMapping("/select")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "下拉数据源", notes = "传入tenant")
public R<List<Region>> select(@RequestParam(required = false, defaultValue = "00") String code) {
List<Region> list = regionService.list(Wrappers.<Region>query().lambda().eq(Region::getParentCode, code));
return R.data(list);
}
}

View File

@ -109,7 +109,7 @@ public class RoleController extends BladeController {
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ApiOperation(value = "删除", notes = "传入ids") @ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(roleService.removeByIds(Func.toIntList(ids))); return R.status(roleService.removeByIds(Func.toLongList(ids)));
} }
/** /**
@ -124,7 +124,7 @@ public class RoleController extends BladeController {
@ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合") @ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合")
public R grant(@ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds, public R grant(@ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds,
@ApiParam(value = "menuId集合", required = true) @RequestParam String menuIds) { @ApiParam(value = "menuId集合", required = true) @RequestParam String menuIds) {
boolean temp = roleService.grant(Func.toIntList(roleIds), Func.toIntList(menuIds)); boolean temp = roleService.grant(Func.toLongList(roleIds), Func.toLongList(menuIds));
return R.status(temp); return R.status(temp);
} }

View File

@ -112,7 +112,7 @@ public class TenantController extends BladeController {
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(tenantService.deleteLogic(Func.toIntList(ids))); return R.status(tenantService.deleteLogic(Func.toLongList(ids)));
} }

View File

@ -19,11 +19,14 @@ import lombok.AllArgsConstructor;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Role; import org.springblade.system.entity.Role;
import org.springblade.system.service.IDeptService; import org.springblade.system.service.IDeptService;
import org.springblade.system.service.IPostService;
import org.springblade.system.service.IRoleService; import org.springblade.system.service.IRoleService;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/** /**
* 系统服务Feign实现类 * 系统服务Feign实现类
* *
@ -34,37 +37,69 @@ import springfox.documentation.annotations.ApiIgnore;
@AllArgsConstructor @AllArgsConstructor
public class SysClient implements ISysClient { public class SysClient implements ISysClient {
IDeptService deptService; private IDeptService deptService;
IRoleService roleService; private IPostService postService;
@Override private IRoleService roleService;
@GetMapping(API_PREFIX + "/getDeptName")
public String getDeptName(Integer id) {
return deptService.getById(id).getDeptName();
}
@Override @Override
@GetMapping(API_PREFIX + "/getDept") @GetMapping(API_PREFIX + "/getDept")
public Dept getDept(Integer id) { public Dept getDept(Long id) {
return deptService.getById(id); return deptService.getById(id);
} }
@Override @Override
@GetMapping(API_PREFIX + "/getRoleName") @GetMapping(API_PREFIX + "/getDeptName")
public String getRoleName(Integer id) { public String getDeptName(Long id) {
return roleService.getById(id).getRoleName(); return deptService.getById(id).getDeptName();
} }
@Override @Override
@GetMapping(API_PREFIX + "/getRoleAlias") public String getDeptIds(String tenantId, String deptNames) {
public String getRoleAlias(Integer id) { return deptService.getDeptIds(tenantId, deptNames);
return roleService.getById(id).getRoleAlias(); }
@Override
public List<String> getDeptNames(String deptIds) {
return deptService.getDeptNames(deptIds);
}
@Override
public String getPostIds(String tenantId, String postNames) {
return postService.getPostIds(tenantId, postNames);
}
@Override
public List<String> getPostNames(String postIds) {
return postService.getPostNames(postIds);
} }
@Override @Override
@GetMapping(API_PREFIX + "/getRole") @GetMapping(API_PREFIX + "/getRole")
public Role getRole(Integer id) { public Role getRole(Long id) {
return roleService.getById(id); return roleService.getById(id);
} }
@Override
public String getRoleIds(String tenantId, String roleNames) {
return roleService.getRoleIds(tenantId, roleNames);
}
@Override
@GetMapping(API_PREFIX + "/getRoleName")
public String getRoleName(Long id) {
return roleService.getById(id).getRoleName();
}
@Override
public List<String> getRoleNames(String roleIds) {
return roleService.getRoleNames(roleIds);
}
@Override
@GetMapping(API_PREFIX + "/getRoleAlias")
public String getRoleAlias(Long id) {
return roleService.getById(id).getRoleAlias();
}
} }

View File

@ -46,4 +46,12 @@ public interface DeptMapper extends BaseMapper<Dept> {
*/ */
List<DeptVO> tree(String tenantId); List<DeptVO> tree(String tenantId);
/**
* 获取部门名
*
* @param ids
* @return
*/
List<String> getDeptNames(Long[] ids);
} }

View File

@ -38,4 +38,17 @@
</if> </if>
</select> </select>
<select id="getDeptNames" resultType="java.lang.String">
SELECT
dept_name
FROM
blade_dept
WHERE
id IN
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
#{ids}
</foreach>
and is_deleted = 0
</select>
</mapper> </mapper>

View File

@ -59,7 +59,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId * @param roleId
* @return * @return
*/ */
List<MenuVO> grantTreeByRole(List<Integer> roleId); List<MenuVO> grantTreeByRole(List<Long> roleId);
/** /**
* 所有菜单 * 所有菜单
@ -74,7 +74,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId * @param roleId
* @return * @return
*/ */
List<Menu> roleMenu(List<Integer> roleId); List<Menu> roleMenu(List<Long> roleId);
/** /**
* 菜单树形结构 * 菜单树形结构
@ -82,7 +82,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId * @param roleId
* @return * @return
*/ */
List<Menu> routes(List<Integer> roleId); List<Menu> routes(List<Long> roleId);
/** /**
* 按钮树形结构 * 按钮树形结构
@ -90,7 +90,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId * @param roleId
* @return * @return
*/ */
List<Menu> buttons(List<Integer> roleId); List<Menu> buttons(List<Long> roleId);
/** /**
* 获取配置的角色权限 * 获取配置的角色权限
@ -98,5 +98,5 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleIds * @param roleIds
* @return * @return
*/ */
List<MenuDTO> authRoutes(List<Integer> roleIds); List<MenuDTO> authRoutes(List<Long> roleIds);
} }

View File

@ -0,0 +1,49 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.system.entity.Post;
import org.springblade.system.vo.PostVO;
import java.util.List;
/**
* 岗位表 Mapper 接口
*
* @author Chill
*/
public interface PostMapper extends BaseMapper<Post> {
/**
* 自定义分页
*
* @param page
* @param post
* @return
*/
List<PostVO> selectPostPage(IPage page, PostVO post);
/**
* 获取岗位名
*
* @param ids
* @return
*/
List<String> getPostNames(Long[] ids);
}

View File

@ -0,0 +1,40 @@
<?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="org.springblade.system.mapper.PostMapper">
<!-- 通用查询映射结果 -->
<resultMap id="postResultMap" type="org.springblade.system.entity.Post">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="category" property="category"/>
<result column="post_code" property="postCode"/>
<result column="post_name" property="postName"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
</resultMap>
<select id="selectPostPage" resultMap="postResultMap">
select * from blade_post where is_deleted = 0
</select>
<select id="getPostNames" resultType="java.lang.String">
SELECT
post_name
FROM
blade_post
WHERE
id IN
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
#{ids}
</foreach>
and is_deleted = 0
</select>
</mapper>

View File

@ -0,0 +1,50 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Region;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 Mapper 接口
*
* @author Chill
*/
public interface RegionMapper extends BaseMapper<Region> {
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyList(String parentCode, Map<String, Object> param);
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyTree(String parentCode, Map<String, Object> param);
}

View File

@ -0,0 +1,100 @@
<?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="org.springblade.system.mapper.RegionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="regionResultMap" type="org.springblade.system.entity.Region">
<id column="code" property="code"/>
<result column="parent_code" property="parentCode"/>
<result column="ancestors" property="ancestors"/>
<result column="name" property="name"/>
<result column="province_code" property="provinceCode"/>
<result column="province_name" property="provinceName"/>
<result column="city_code" property="cityCode"/>
<result column="city_name" property="cityName"/>
<result column="district_code" property="districtCode"/>
<result column="district_name" property="districtName"/>
<result column="town_code" property="townCode"/>
<result column="town_name" property="townName"/>
<result column="village_code" property="villageCode"/>
<result column="village_name" property="villageName"/>
<result column="level" property="level"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
</resultMap>
<resultMap id="regionVOResultMap" type="org.springblade.system.vo.RegionVO">
<id column="code" property="code"/>
<result column="parent_code" property="parentCode"/>
<result column="ancestors" property="ancestors"/>
<result column="name" property="name"/>
<result column="province_code" property="provinceCode"/>
<result column="province_name" property="provinceName"/>
<result column="city_code" property="cityCode"/>
<result column="city_name" property="cityName"/>
<result column="district_code" property="districtCode"/>
<result column="district_name" property="districtName"/>
<result column="town_code" property="townCode"/>
<result column="town_name" property="townName"/>
<result column="village_code" property="villageCode"/>
<result column="village_name" property="villageName"/>
<result column="level" property="level"/>
<result column="sort" property="sort"/>
<result column="remark" property="remark"/>
<result column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="has_children" property="hasChildren"/>
</resultMap>
<resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="title" property="title"/>
<result column="value" property="value"/>
<result column="key" property="key"/>
<result column="has_children" property="hasChildren"/>
</resultMap>
<select id="lazyList" resultMap="regionVOResultMap">
SELECT
region.*,
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM blade_region WHERE parent_code = region.code ) AS "has_children"
FROM
blade_region region
<where>
<if test="param1!=null">
and region.parent_code = #{param1}
</if>
<if test="param2.code!=null and param2.code!=''">
and region.code like concat(concat('%', #{param2.code}),'%')
</if>
<if test="param2.name!=null and param2.name!=''">
and region.name like concat(concat('%', #{param2.name}),'%')
</if>
</where>
</select>
<select id="lazyTree" resultMap="treeNodeResultMap">
SELECT
region.code AS "id",
region.parent_code AS "parent_id",
region.name AS "title",
region.code AS "value",
region.code AS "key",
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM blade_region WHERE parent_code = region.code ) AS "has_children"
FROM
blade_region region
<where>
<if test="param1!=null">
and region.parent_code = #{param1}
</if>
<if test="param2.code!=null and param2.code!=''">
and region.code like concat(concat('%', #{param2.code}),'%')
</if>
<if test="param2.name!=null and param2.name!=''">
and region.name like concat(concat('%', #{param2.name}),'%')
</if>
</where>
</select>
</mapper>

View File

@ -47,4 +47,12 @@ public interface RoleMapper extends BaseMapper<Role> {
*/ */
List<RoleVO> tree(String tenantId, String excludeRole); List<RoleVO> tree(String tenantId, String excludeRole);
/**
* 获取角色名
*
* @param ids
* @return
*/
List<String> getRoleNames(Long[] ids);
} }

View File

@ -40,4 +40,17 @@
</if> </if>
</select> </select>
<select id="getRoleNames" resultType="java.lang.String">
SELECT
role_name
FROM
blade_role
WHERE
id IN
<foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
#{ids}
</foreach>
and is_deleted = 0
</select>
</mapper> </mapper>

View File

@ -46,4 +46,21 @@ public interface IDeptService extends IService<Dept> {
*/ */
List<DeptVO> tree(String tenantId); List<DeptVO> tree(String tenantId);
/**
* 获取部门ID
*
* @param tenantId
* @param deptNames
* @return
*/
String getDeptIds(String tenantId, String deptNames);
/**
* 获取部门名
*
* @param deptIds
* @return
*/
List<String> getDeptNames(String deptIds);
} }

View File

@ -0,0 +1,58 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.system.entity.Post;
import org.springblade.system.vo.PostVO;
import java.util.List;
/**
* 岗位表 服务类
*
* @author Chill
*/
public interface IPostService extends BaseService<Post> {
/**
* 自定义分页
*
* @param page
* @param post
* @return
*/
IPage<PostVO> selectPostPage(IPage<PostVO> page, PostVO post);
/**
* 获取岗位ID
*
* @param tenantId
* @param postNames
* @return
*/
String getPostIds(String tenantId, String postNames);
/**
* 获取岗位名
*
* @param postIds
* @return
*/
List<String> getPostNames(String postIds);
}

View File

@ -0,0 +1,66 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.core.tool.node.INode;
import org.springblade.system.entity.Region;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 服务类
*
* @author Chill
*/
public interface IRegionService extends IService<Region> {
/**
* 提交
*
* @param region
* @return
*/
boolean submit(Region region);
/**
* 删除
*
* @param id
* @return
*/
boolean removeRegion(String id);
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyList(String parentCode, Map<String, Object> param);
/**
* 懒加载列表
*
* @param parentCode
* @param param
* @return
*/
List<INode> lazyTree(String parentCode, Map<String, Object> param);
}

View File

@ -54,6 +54,23 @@ public interface IRoleService extends IService<Role> {
* @param menuIds 菜单id集合 * @param menuIds 菜单id集合
* @return 是否成功 * @return 是否成功
*/ */
boolean grant(@NotEmpty List<Integer> roleIds, @NotEmpty List<Integer> menuIds); boolean grant(@NotEmpty List<Long> roleIds, @NotEmpty List<Long> menuIds);
/**
* 获取角色ID
*
* @param tenantId
* @param roleNames
* @return
*/
String getRoleIds(String tenantId, String roleNames);
/**
* 获取角色名
*
* @param roleIds
* @return
*/
List<String> getRoleNames(String roleIds);
} }

View File

@ -16,8 +16,10 @@
package org.springblade.system.service.impl; package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.tool.node.ForestNodeMerger; import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.mapper.DeptMapper; import org.springblade.system.mapper.DeptMapper;
import org.springblade.system.service.IDeptService; import org.springblade.system.service.IDeptService;
@ -25,6 +27,7 @@ import org.springblade.system.vo.DeptVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
@ -44,4 +47,18 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
return ForestNodeMerger.merge(baseMapper.tree(tenantId)); return ForestNodeMerger.merge(baseMapper.tree(tenantId));
} }
@Override
public String getDeptIds(String tenantId, String deptNames) {
List<Dept> deptList = baseMapper.selectList(Wrappers.<Dept>query().lambda().eq(Dept::getTenantId, tenantId).in(Dept::getDeptName, Func.toStrList(deptNames)));
if (deptList != null && deptList.size() > 0) {
return deptList.stream().map(dept -> Func.toStr(dept.getId())).distinct().collect(Collectors.joining(","));
}
return null;
}
@Override
public List<String> getDeptNames(String deptIds) {
return baseMapper.getDeptNames(Func.toLongArray(deptIds));
}
} }

View File

@ -56,7 +56,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override @Override
public List<MenuVO> routes(String roleId) { public List<MenuVO> routes(String roleId) {
List<Menu> allMenus = baseMapper.allMenu(); List<Menu> allMenus = baseMapper.allMenu();
List<Menu> roleMenus = baseMapper.roleMenu(Func.toIntList(roleId)); List<Menu> roleMenus = baseMapper.roleMenu(Func.toLongList(roleId));
List<Menu> routes = new LinkedList<>(roleMenus); List<Menu> routes = new LinkedList<>(roleMenus);
roleMenus.forEach(roleMenu -> recursion(allMenus, routes, roleMenu)); roleMenus.forEach(roleMenu -> recursion(allMenus, routes, roleMenu));
routes.sort(Comparator.comparing(Menu::getSort)); routes.sort(Comparator.comparing(Menu::getSort));
@ -75,7 +75,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override @Override
public List<MenuVO> buttons(String roleId) { public List<MenuVO> buttons(String roleId) {
List<Menu> buttons = baseMapper.buttons(Func.toIntList(roleId)); List<Menu> buttons = baseMapper.buttons(Func.toLongList(roleId));
MenuWrapper menuWrapper = new MenuWrapper(); MenuWrapper menuWrapper = new MenuWrapper();
return menuWrapper.listNodeVO(buttons); return menuWrapper.listNodeVO(buttons);
} }
@ -87,12 +87,12 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override @Override
public List<MenuVO> grantTree(BladeUser user) { public List<MenuVO> grantTree(BladeUser user) {
return ForestNodeMerger.merge(user.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? baseMapper.grantTree() : baseMapper.grantTreeByRole(Func.toIntList(user.getRoleId()))); return ForestNodeMerger.merge(user.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? baseMapper.grantTree() : baseMapper.grantTreeByRole(Func.toLongList(user.getRoleId())));
} }
@Override @Override
public List<String> roleTreeKeys(String roleIds) { public List<String> roleTreeKeys(String roleIds) {
List<RoleMenu> roleMenus = roleMenuService.list(Wrappers.<RoleMenu>query().lambda().in(RoleMenu::getRoleId, Func.toIntList(roleIds))); List<RoleMenu> roleMenus = roleMenuService.list(Wrappers.<RoleMenu>query().lambda().in(RoleMenu::getRoleId, Func.toLongList(roleIds)));
return roleMenus.stream().map(roleMenu -> Func.toStr(roleMenu.getMenuId())).collect(Collectors.toList()); return roleMenus.stream().map(roleMenu -> Func.toStr(roleMenu.getMenuId())).collect(Collectors.toList());
} }
@ -101,7 +101,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
if (Func.isEmpty(user)) { if (Func.isEmpty(user)) {
return null; return null;
} }
List<MenuDTO> routes = baseMapper.authRoutes(Func.toIntList(user.getRoleId())); List<MenuDTO> routes = baseMapper.authRoutes(Func.toLongList(user.getRoleId()));
List<Kv> list = new ArrayList<>(); List<Kv> list = new ArrayList<>();
routes.forEach(route -> list.add(Kv.init().set(route.getPath(), Kv.init().set("authority", Func.toStrArray(route.getAlias()))))); routes.forEach(route -> list.add(Kv.init().set(route.getPath(), Kv.init().set("authority", Func.toStrArray(route.getAlias())))));
return list; return list;

View File

@ -0,0 +1,58 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Post;
import org.springblade.system.mapper.PostMapper;
import org.springblade.system.service.IPostService;
import org.springblade.system.vo.PostVO;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 岗位表 服务实现类
*
* @author Chill
*/
@Service
public class PostServiceImpl extends BaseServiceImpl<PostMapper, Post> implements IPostService {
@Override
public IPage<PostVO> selectPostPage(IPage<PostVO> page, PostVO post) {
return page.setRecords(baseMapper.selectPostPage(page, post));
}
@Override
public String getPostIds(String tenantId, String postNames) {
List<Post> postList = baseMapper.selectList(Wrappers.<Post>query().lambda().eq(Post::getTenantId, tenantId).in(Post::getPostName, Func.toStrList(postNames)));
if (postList != null && postList.size() > 0) {
return postList.stream().map(post -> Func.toStr(post.getId())).distinct().collect(Collectors.joining(","));
}
return null;
}
@Override
public List<String> getPostNames(String postIds) {
return baseMapper.getPostNames(Func.toLongArray(postIds));
}
}

View File

@ -0,0 +1,98 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.system.entity.Region;
import org.springblade.system.mapper.RegionMapper;
import org.springblade.system.service.IRegionService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 行政区划表 服务实现类
*
* @author Chill
*/
@Service
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements IRegionService {
public static final int PROVINCE_LEVEL = 1;
public static final int CITY_LEVEL = 2;
public static final int DISTRICT_LEVEL = 3;
public static final int TOWN_LEVEL = 4;
public static final int VILLAGE_LEVEL = 5;
@Override
public boolean submit(Region region) {
Integer cnt = baseMapper.selectCount(Wrappers.<Region>query().lambda().eq(Region::getCode, region.getCode()));
if (cnt > 0) {
return this.updateById(region);
}
// 设置祖区划编号
Region parent = baseMapper.selectById(region.getParentCode());
if (Func.isNotEmpty(parent) || Func.isNotEmpty(parent.getCode())) {
String ancestors = parent.getAncestors() + StringPool.COMMA + parent.getCode();
region.setAncestors(ancestors);
}
// 设置省
Integer level = region.getLevel();
String code = region.getCode();
String name = region.getName();
if (level == PROVINCE_LEVEL) {
region.setProvinceCode(code);
region.setProvinceName(name);
} else if (level == CITY_LEVEL) {
region.setCityCode(code);
region.setCityName(name);
} else if (level == DISTRICT_LEVEL) {
region.setDistrictCode(code);
region.setDistrictName(name);
} else if (level == TOWN_LEVEL) {
region.setTownCode(code);
region.setTownName(name);
} else if (level == VILLAGE_LEVEL) {
region.setVillageCode(code);
region.setVillageName(name);
}
return this.save(region);
}
@Override
public boolean removeRegion(String id) {
Integer cnt = baseMapper.selectCount(Wrappers.<Region>query().lambda().eq(Region::getParentCode, id));
if (cnt > 0) {
throw new ServiceException("请先删除子节点!");
}
return removeById(id);
}
@Override
public List<INode> lazyList(String parentCode, Map<String, Object> param) {
return baseMapper.lazyList(parentCode, param);
}
@Override
public List<INode> lazyTree(String parentCode, Map<String, Object> param) {
return baseMapper.lazyTree(parentCode, param);
}
}

View File

@ -36,6 +36,7 @@ import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
@ -65,7 +66,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
} }
@Override @Override
public boolean grant(@NotEmpty List<Integer> roleIds, @NotEmpty List<Integer> menuIds) { public boolean grant(@NotEmpty List<Long> roleIds, @NotEmpty List<Long> menuIds) {
// 删除角色配置的菜单集合 // 删除角色配置的菜单集合
roleMenuService.remove(Wrappers.<RoleMenu>update().lambda().in(RoleMenu::getRoleId, roleIds)); roleMenuService.remove(Wrappers.<RoleMenu>update().lambda().in(RoleMenu::getRoleId, roleIds));
// 组装配置 // 组装配置
@ -80,4 +81,18 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
return roleMenuService.saveBatch(roleMenus); return roleMenuService.saveBatch(roleMenus);
} }
@Override
public String getRoleIds(String tenantId, String roleNames) {
List<Role> roleList = baseMapper.selectList(Wrappers.<Role>query().lambda().eq(Role::getTenantId, tenantId).in(Role::getRoleName, Func.toStrList(roleNames)));
if (roleList != null && roleList.size() > 0) {
return roleList.stream().map(role -> Func.toStr(role.getId())).distinct().collect(Collectors.joining(","));
}
return null;
}
@Override
public List<String> getRoleNames(String roleIds) {
return baseMapper.getRoleNames(Func.toLongArray(roleIds));
}
} }

View File

@ -64,7 +64,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
// 新建租户对应的默认角色 // 新建租户对应的默认角色
Role role = new Role(); Role role = new Role();
role.setTenantId(tenantId); role.setTenantId(tenantId);
role.setParentId(0); role.setParentId(0L);
role.setRoleName("管理员"); role.setRoleName("管理员");
role.setRoleAlias("admin"); role.setRoleAlias("admin");
role.setSort(2); role.setSort(2);
@ -73,7 +73,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
// 新建租户对应的默认部门 // 新建租户对应的默认部门
Dept dept = new Dept(); Dept dept = new Dept();
dept.setTenantId(tenantId); dept.setTenantId(tenantId);
dept.setParentId(0); dept.setParentId(0L);
dept.setDeptName(tenant.getTenantName()); dept.setDeptName(tenant.getTenantName());
dept.setFullName(tenant.getTenantName()); dept.setFullName(tenant.getTenantName());
dept.setSort(2); dept.setSort(2);

View File

@ -0,0 +1,52 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.entity.Post;
import org.springblade.system.service.IDictService;
import org.springblade.system.vo.PostVO;
import java.util.Objects;
/**
* 岗位表包装类,返回视图层所需的字段
*
* @author Chill
*/
public class PostWrapper extends BaseEntityWrapper<Post, PostVO> {
private static IDictService dictService;
static {
dictService = SpringUtil.getBean(IDictService.class);
}
public static PostWrapper build() {
return new PostWrapper();
}
@Override
public PostVO entityVO(Post post) {
PostVO postVO = Objects.requireNonNull(BeanUtil.copy(post, PostVO.class));
String categoryName = dictService.getValue("post_category", post.getCategory());
postVO.setCategoryName(categoryName);
return postVO;
}
}

View File

@ -0,0 +1,59 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 org.springblade.system.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.entity.Region;
import org.springblade.system.service.IRegionService;
import org.springblade.system.vo.RegionVO;
import java.util.List;
import java.util.Objects;
/**
* 包装类,返回视图层所需的字段
*
* @author Chill
*/
public class RegionWrapper extends BaseEntityWrapper<Region, RegionVO> {
private static IRegionService regionService;
static {
regionService = SpringUtil.getBean(IRegionService.class);
}
public static RegionWrapper build() {
return new RegionWrapper();
}
@Override
public RegionVO entityVO(Region region) {
RegionVO regionVO = Objects.requireNonNull(BeanUtil.copy(region, RegionVO.class));
Region parentRegion = regionService.getById(region.getParentCode());
regionVO.setParentName(parentRegion.getName());
return regionVO;
}
public List<INode> listNodeLazyVO(List<INode> list) {
return ForestNodeMerger.merge(list);
}
}

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -31,6 +31,16 @@
<artifactId>blade-dict-api</artifactId> <artifactId>blade-dict-api</artifactId>
<version>${blade.project.version}</version> <version>${blade.project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>${blade.project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
</dependency>
<!--Zipkin--> <!--Zipkin-->
<!--<dependency> <!--<dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>

View File

@ -16,6 +16,8 @@
package org.springblade.system.user.controller; package org.springblade.system.user.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@ -24,20 +26,33 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.apache.commons.codec.Charsets;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.excel.UserExcel;
import org.springblade.system.user.excel.UserImportListener;
import org.springblade.system.user.service.IUserService; import org.springblade.system.user.service.IUserService;
import org.springblade.system.user.vo.UserVO; import org.springblade.system.user.vo.UserVO;
import org.springblade.system.user.wrapper.UserWrapper; import org.springblade.system.user.wrapper.UserWrapper;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -118,7 +133,7 @@ public class UserController {
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "删除", notes = "传入地基和") @ApiOperation(value = "删除", notes = "传入地基和")
public R remove(@RequestParam String ids) { public R remove(@RequestParam String ids) {
return R.status(userService.deleteLogic(Func.toIntList(ids))); return R.status(userService.deleteLogic(Func.toLongList(ids)));
} }
@ -178,4 +193,69 @@ public class UserController {
return R.data(list); return R.data(list);
} }
/**
* 导入用户
*/
@PostMapping("import-user")
@ApiOperationSupport(order = 12)
@ApiOperation(value = "导入用户", notes = "传入excel")
public R importUser(MultipartFile file, Integer isCovered) {
String filename = file.getOriginalFilename();
if (StringUtils.isEmpty(filename)) {
throw new RuntimeException("请上传文件!");
}
if ((!StringUtils.endsWithIgnoreCase(filename, ".xls") && !StringUtils.endsWithIgnoreCase(filename, ".xlsx"))) {
throw new RuntimeException("请上传正确的excel文件!");
}
InputStream inputStream;
try {
UserImportListener importListener = new UserImportListener(userService);
inputStream = new BufferedInputStream(file.getInputStream());
ExcelReaderBuilder builder = EasyExcel.read(inputStream, UserExcel.class, importListener);
builder.doReadAll();
} catch (IOException e) {
e.printStackTrace();
}
return R.success("操作成功");
}
/**
* 导出用户
*/
@SneakyThrows
@GetMapping("export-user")
@ApiOperationSupport(order = 13)
@ApiOperation(value = "导出用户", notes = "传入user")
public void exportUser(@ApiIgnore @RequestParam Map<String, Object> user, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
if (!SecureUtil.isAdministrator()){
queryWrapper.lambda().eq(User::getTenantId, bladeUser.getTenantId());
}
queryWrapper.lambda().eq(User::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<UserExcel> list = userService.exportUser(queryWrapper);
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
String fileName = URLEncoder.encode("用户数据导出", Charsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream(), UserExcel.class).sheet("用户数据表").doWrite(list);
}
/**
* 导出模板
*/
@SneakyThrows
@GetMapping("export-template")
@ApiOperationSupport(order = 14)
@ApiOperation(value = "导出模板")
public void exportUser(HttpServletResponse response) {
List<UserExcel> list = new ArrayList<>();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
String fileName = URLEncoder.encode("用户数据模板", Charsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream(), UserExcel.class).sheet("用户数据表").doWrite(list);
}
} }

View File

@ -0,0 +1,89 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.user.excel;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* UserDTO
*
* @author Chill
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class UserExcel implements Serializable {
private static final long serialVersionUID = 1L;
@ColumnWidth(15)
@ExcelProperty("租户编号")
private String tenantId;
@ColumnWidth(15)
@ExcelProperty("账户")
private String account;
@ColumnWidth(10)
@ExcelProperty("昵称")
private String name;
@ColumnWidth(10)
@ExcelProperty("姓名")
private String realName;
@ExcelProperty("邮箱")
private String email;
@ColumnWidth(15)
@ExcelProperty("手机")
private String phone;
@ExcelIgnore
@ExcelProperty("角色ID")
private String roleId;
@ExcelIgnore
@ExcelProperty("部门ID")
private String deptId;
@ExcelIgnore
@ExcelProperty("岗位ID")
private String postId;
@ExcelProperty("角色名称")
private String roleName;
@ExcelProperty("部门名称")
private String deptName;
@ExcelProperty("岗位名称")
private String postName;
@ColumnWidth(20)
@ExcelProperty("生日")
private Date birthday;
}

View File

@ -0,0 +1,56 @@
package org.springblade.system.user.excel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import org.springblade.system.user.service.IUserService;
import java.util.ArrayList;
import java.util.List;
/**
* UserImportListener
*
* @author Chill
*/
@Data
@RequiredArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class UserImportListener extends AnalysisEventListener<UserExcel> {
/**
* 默认每隔3000条存储数据库
*/
private int batchCount = 3000;
/**
* 缓存的数据列表
*/
private List<UserExcel> list = new ArrayList<>();
/**
* 用户service
*/
private final IUserService userService;
@Override
public void invoke(UserExcel data, AnalysisContext context) {
list.add(data);
// 达到BATCH_COUNT则调用importer方法入库防止数据几万条数据在内存容易OOM
if (list.size() >= batchCount) {
// 调用importer方法
userService.importUser(list);
// 存储完成清理list
list.clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
// 调用importer方法
userService.importUser(list);
// 存储完成清理list
list.clear();
}
}

View File

@ -15,9 +15,12 @@
*/ */
package org.springblade.system.user.mapper; package org.springblade.system.user.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.excel.UserExcel;
import java.util.List; import java.util.List;
@ -71,4 +74,12 @@ public interface UserMapper extends BaseMapper<User> {
*/ */
List<String> getDeptName(String[] ids); List<String> getDeptName(String[] ids);
/**
* 获取导出用户数据
*
* @param queryWrapper
* @return
*/
List<UserExcel> exportUser(@Param("ew") Wrapper<User> queryWrapper);
} }

View File

@ -12,6 +12,7 @@
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/> <result column="is_deleted" property="isDeleted"/>
<result column="code" property="code"/>
<result column="account" property="account"/> <result column="account" property="account"/>
<result column="password" property="password"/> <result column="password" property="password"/>
<result column="name" property="name"/> <result column="name" property="name"/>
@ -88,4 +89,8 @@
and is_deleted = 0 and is_deleted = 0
</select> </select>
<select id="exportUser" resultType="org.springblade.system.user.excel.UserExcel">
SELECT id, tenant_id, account, name, real_name, email, phone, birthday, role_id, dept_id, post_id FROM blade_user ${ew.customSqlSegment}
</select>
</mapper> </mapper>

View File

@ -16,10 +16,12 @@
package org.springblade.system.user.service; package org.springblade.system.user.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo; import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.excel.UserExcel;
import java.util.List; import java.util.List;
@ -91,7 +93,7 @@ public interface IUserService extends BaseService<User> {
* @param newPassword1 * @param newPassword1
* @return * @return
*/ */
boolean updatePassword(Integer userId, String oldPassword, String newPassword, String newPassword1); boolean updatePassword(Long userId, String oldPassword, String newPassword, String newPassword1);
/** /**
* 获取角色名 * 获取角色名
@ -108,4 +110,20 @@ public interface IUserService extends BaseService<User> {
* @return * @return
*/ */
List<String> getDeptName(String deptIds); List<String> getDeptName(String deptIds);
/**
* 导入用户数据
*
* @param data
* @return
*/
void importUser(List<UserExcel> data);
/**
* 获取导出用户数据
*
* @param queryWrapper
* @return
*/
List<UserExcel> exportUser(Wrapper<User> queryWrapper);
} }

View File

@ -16,22 +16,25 @@
package org.springblade.system.user.service.impl; package org.springblade.system.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
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.exceptions.ApiException; import com.baomidou.mybatisplus.extension.exceptions.ApiException;
import lombok.AllArgsConstructor;
import org.springblade.common.constant.CommonConstant; import org.springblade.common.constant.CommonConstant;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.*;
import org.springblade.core.tool.utils.DigestUtil; import org.springblade.system.feign.ISysClient;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo; import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.excel.UserExcel;
import org.springblade.system.user.mapper.UserMapper; import org.springblade.system.user.mapper.UserMapper;
import org.springblade.system.user.service.IUserService; import org.springblade.system.user.service.IUserService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 服务实现类 * 服务实现类
@ -39,8 +42,11 @@ import java.util.List;
* @author Chill * @author Chill
*/ */
@Service @Service
@AllArgsConstructor
public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implements IUserService { public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implements IUserService {
private ISysClient sysClient;
@Override @Override
public boolean submit(User user) { public boolean submit(User user) {
if (Func.isNotEmpty(user.getPassword())) { if (Func.isNotEmpty(user.getPassword())) {
@ -86,7 +92,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
public boolean grant(String userIds, String roleIds) { public boolean grant(String userIds, String roleIds) {
User user = new User(); User user = new User();
user.setRoleId(roleIds); user.setRoleId(roleIds);
return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toIntList(userIds))); return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toLongList(userIds)));
} }
@Override @Override
@ -94,11 +100,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
User user = new User(); User user = new User();
user.setPassword(DigestUtil.encrypt(CommonConstant.DEFAULT_PASSWORD)); user.setPassword(DigestUtil.encrypt(CommonConstant.DEFAULT_PASSWORD));
user.setUpdateTime(DateUtil.now()); user.setUpdateTime(DateUtil.now());
return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toIntList(userIds))); return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toLongList(userIds)));
} }
@Override @Override
public boolean updatePassword(Integer userId, String oldPassword, String newPassword, String newPassword1) { public boolean updatePassword(Long userId, String oldPassword, String newPassword, String newPassword1) {
User user = getById(userId); User user = getById(userId);
if (!newPassword.equals(newPassword1)) { if (!newPassword.equals(newPassword1)) {
throw new ServiceException("请输入正确的确认密码!"); throw new ServiceException("请输入正确的确认密码!");
@ -119,4 +125,31 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
return baseMapper.getDeptName(Func.toStrArray(deptIds)); return baseMapper.getDeptName(Func.toStrArray(deptIds));
} }
@Override
public void importUser(List<UserExcel> data) {
data.forEach(userExcel -> {
User user = Objects.requireNonNull(BeanUtil.copy(userExcel, User.class));
// 设置部门ID
user.setDeptId(sysClient.getDeptIds(userExcel.getTenantId(), userExcel.getDeptName()));
// 设置岗位ID
user.setPostId(sysClient.getPostIds(userExcel.getTenantId(), userExcel.getPostName()));
// 设置角色ID
user.setRoleId(sysClient.getRoleIds(userExcel.getTenantId(), userExcel.getRoleName()));
// 设置默认密码
user.setPassword(CommonConstant.DEFAULT_PASSWORD);
this.submit(user);
});
}
@Override
public List<UserExcel> exportUser(Wrapper<User> queryWrapper) {
List<UserExcel> userList = baseMapper.exportUser(queryWrapper);
userList.forEach(user -> {
user.setRoleName(StringUtil.join(sysClient.getRoleNames(user.getRoleId())));
user.setDeptName(StringUtil.join(sysClient.getDeptNames(user.getDeptId())));
user.setPostName(StringUtil.join(sysClient.getPostNames(user.getPostId())));
});
return userList;
}
} }

View File

@ -7,12 +7,12 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId> <artifactId>SpringBlade</artifactId>
<version>2.6.1</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>blade-service</artifactId> <artifactId>blade-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<version>2.6.1</version> <version>2.7.1</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>SpringBlade 微服务集合</description> <description>SpringBlade 微服务集合</description>

View File

@ -1 +0,0 @@
mvn install:install-file -Dfile=blade-core-1.0.jar -DgroupId=org.springblade -DartifactId=blade-core -Dversion=1.0 -Dpackaging=jar

View File

@ -12,6 +12,9 @@ server:
#spring配置 #spring配置
spring: spring:
cloud:
sentinel:
eager: true
devtools: devtools:
restart: restart:
log-condition-evaluation-delta: false log-condition-evaluation-delta: false
@ -22,8 +25,6 @@ spring:
feign: feign:
hystrix: hystrix:
enabled: true enabled: true
#sentinel:
#enabled: true
okhttp: okhttp:
enabled: true enabled: true
httpclient: httpclient:
@ -69,7 +70,7 @@ management:
#blade配置 #blade配置
blade: blade:
xss: xss:
enable: true enabled: true
skip-url: skip-url:
- /weixin - /weixin
secure: secure:

View File

@ -1,29 +0,0 @@
## 环境变量
#### 环境划分
> dev开发、test测试、prod正式默认dev
#### 添加环境变量
##### java命令行
```
java -jar gateWay.jar --spring.profiles.active=dev
```
##### JAVA_OPS
```
set JAVA_OPTS="-Dspring.profiles.active=test"
```
##### 标注方式代码层面junit单元测试非常实用
```
@ActiveProfiles({"junittest","productprofile"})
```
##### ENV方式
```
系统环境变量SPRING_PROFILES_ACTIVE注意是大写
```

View File

@ -1,57 +0,0 @@
## HTTP 状态码
| 状态码 | 含义 |
| ------ | ------------------------------------------------------------ |
| 100 | 客户端应当继续发送请求。这个临时响应是用来通知客户端它的部分请求已经被服务器接收,且仍未被拒绝。客户端应当继续发送请求的剩余部分,或者如果请求已经完成,忽略这个响应。服务器必须在请求完成后向客户端发送一个最终响应。 |
| 101 | 服务器已经理解了客户端的请求并将通过Upgrade 消息头通知客户端采用不同的协议来完成这个请求。在发送完这个响应最后的空行后服务器将会切换到在Upgrade 消息头中定义的那些协议。 只有在切换新的协议更有好处的时候才应该采取类似措施。例如切换到新的HTTP 版本比旧版本更有优势,或者切换到一个实时且同步的协议以传送利用此类特性的资源。 |
| 102 | 由WebDAVRFC 2518扩展的状态码代表处理将被继续执行。 |
| 200 | 请求已成功,请求所希望的响应头或数据体将随此响应返回。 |
| 201 | 请求已经被实现,而且有一个新的资源已经依据请求的需要而建立,且其 URI 已经随Location 头信息返回。假如需要的资源无法及时建立的话,应当返回 '202 Accepted'。 |
| 202 | 服务器已接受请求,但尚未处理。正如它可能被拒绝一样,最终该请求可能会也可能不会被执行。在异步操作的场合下,没有比发送这个状态码更方便的做法了。 返回202状态码的响应的目的是允许服务器接受其他过程的请求例如某个每天只执行一次的基于批处理的操作而不必让客户端一直保持与服务器的连接直到批处理操作全部完成。在接受请求处理并返回202状态码的响应应当在返回的实体中包含一些指示处理当前状态的信息以及指向处理状态监视器或状态预测的指针以便用户能够估计操作是否已经完成。 |
| 203 | 服务器已成功处理了请求但返回的实体头部元信息不是在原始服务器上有效的确定集合而是来自本地或者第三方的拷贝。当前的信息可能是原始版本的子集或者超集。例如包含资源的元数据可能导致原始服务器知道元信息的超级。使用此状态码不是必须的而且只有在响应不使用此状态码便会返回200 OK的情况下才是合适的。 |
| 204 | 服务器成功处理了请求,但不需要返回任何实体内容,并且希望返回更新了的元信息。响应可能通过实体头部的形式,返回新的或更新后的元信息。如果存在这些头部信息,则应当与所请求的变量相呼应。 如果客户端是浏览器的话,那么用户浏览器应保留发送了该请求的页面,而不产生任何文档视图上的变化,即使按照规范新的或更新后的元信息应当被应用到用户浏览器活动视图中的文档。 由于204响应被禁止包含任何消息体因此它始终以消息头后的第一个空行结尾。 |
| 205 | 服务器成功处理了请求且没有返回任何内容。但是与204响应不同返回此状态码的响应要求请求者重置文档视图。该响应主要是被用于接受用户输入后立即重置表单以便用户能够轻松地开始另一次输入。 与204响应一样该响应也被禁止包含任何消息体且以消息头后的第一个空行结束。 |
| 206 | 服务器已经成功处理了部分 GET 请求。类似于 FlashGet 或者迅雷这类的 HTTP 下载工具都是使用此类响应实现断点续传或者将一个大文档分解为多个下载段同时下载。 该请求必须包含 Range 头信息来指示客户端希望得到的内容范围,并且可能包含 If-Range 来作为请求条件。 响应必须包含如下的头部域: Content-Range 用以指示本次响应中返回的内容的范围;如果是 Content-Type 为 multipart/byteranges 的多段下载,则每一 multipart 段中都应包含 Content-Range 域用以指示本段的内容范围。假如响应中包含 Content-Length那么它的数值必须匹配它返回的内容范围的真实字节数。 Date ETag 和/或 Content-Location假如同样的请求本应该返回200响应。 Expires, Cache-Control和/或 Vary假如其值可能与之前相同变量的其他响应对应的值不同的话。 假如本响应请求使用了 If-Range 强缓存验证,那么本次响应不应该包含其他实体头;假如本响应的请求使用了 If-Range 弱缓存验证那么本次响应禁止包含其他实体头这避免了缓存的实体内容和更新了的实体头信息之间的不一致。否则本响应就应当包含所有本应该返回200响应中应当返回的所有实体头部域。 假如 ETag 或 Last-Modified 头部不能精确匹配的话则客户端缓存应禁止将206响应返回的内容与之前任何缓存过的内容组合在一起。 任何不支持 Range 以及 Content-Range 头的缓存都禁止缓存206响应返回的内容。 |
| 207 | 由WebDAV(RFC 2518)扩展的状态码代表之后的消息体将是一个XML消息并且可能依照之前子请求数量的不同包含一系列独立的响应代码。 |
| 300 | 被请求的资源有一系列可供选择的回馈信息,每个都有自己特定的地址和浏览器驱动的商议信息。用户或浏览器能够自行选择一个首选的地址进行重定向。 除非这是一个 HEAD 请求,否则该响应应当包括一个资源特性及地址的列表的实体,以便用户或浏览器从中选择最合适的重定向地址。这个实体的格式由 Content-Type 定义的格式所决定。浏览器可能根据响应的格式以及浏览器自身能力自动作出最合适的选择。当然RFC 2616规范并没有规定这样的自动选择该如何进行。 如果服务器本身已经有了首选的回馈选择,那么在 Location 中应当指明这个回馈的 URI浏览器可能会将这个 Location 值作为自动重定向的地址。此外,除非额外指定,否则这个响应也是可缓存的。 |
| 301 | 被请求的资源已永久移动到新位置,并且将来任何对此资源的引用都应该使用本响应返回的若干个 URI 之一。如果可能,拥有链接编辑功能的客户端应当自动把请求的地址修改为从服务器反馈回来的地址。除非额外指定,否则这个响应也是可缓存的。 新的永久性的 URI 应当在响应的 Location 域中返回。除非这是一个 HEAD 请求,否则响应的实体中应当包含指向新的 URI 的超链接及简短说明。 如果这不是一个 GET 或者 HEAD 请求,因此浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。 注意:对于某些使用 HTTP/1.0 协议的浏览器,当它们发送的 POST 请求得到了一个301响应的话接下来的重定向请求将会变成 GET 方式。 |
| 302 | 请求的资源现在临时从不同的 URI 响应请求。由于这样的重定向是临时的客户端应当继续向原有地址发送以后的请求。只有在Cache-Control或Expires中进行了指定的情况下这个响应才是可缓存的。 新的临时性的 URI 应当在响应的 Location 域中返回。除非这是一个 HEAD 请求,否则响应的实体中应当包含指向新的 URI 的超链接及简短说明。 如果这不是一个 GET 或者 HEAD 请求,那么浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。 注意虽然RFC 1945和RFC 2068规范不允许客户端在重定向时改变请求的方法但是很多现存的浏览器将302响应视作为303响应并且使用 GET 方式访问在 Location 中规定的 URI而无视原先请求的方法。状态码303和307被添加了进来用以明确服务器期待客户端进行何种反应。 |
| 303 | 对应当前请求的响应可以在另一个 URI 上被找到,而且客户端应当采用 GET 的方式访问那个资源。这个方法的存在主要是为了允许由脚本激活的POST请求输出重定向到一个新的资源。这个新的 URI 不是原始资源的替代引用。同时303响应禁止被缓存。当然第二个请求重定向可能被缓存。 新的 URI 应当在响应的 Location 域中返回。除非这是一个 HEAD 请求,否则响应的实体中应当包含指向新的 URI 的超链接及简短说明。 注意:许多 HTTP/1.1 版以前的 浏览器不能正确理解303状态。如果需要考虑与这些浏览器之间的互动302状态码应该可以胜任因为大多数的浏览器处理302响应时的方式恰恰就是上述规范要求客户端处理303响应时应当做的。 |
| 304 | 如果客户端发送了一个带条件的 GET 请求且该请求已被允许而文档的内容自上次访问以来或者根据请求的条件并没有改变则服务器应当返回这个状态码。304响应禁止包含消息体因此始终以消息头后的第一个空行结尾。 该响应必须包含以下的头信息: Date除非这个服务器没有时钟。假如没有时钟的服务器也遵守这些规则那么代理服务器以及客户端可以自行将 Date 字段添加到接收到的响应头中去正如RFC 2068中规定的一样缓存机制将会正常工作。 ETag 和/或 Content-Location假如同样的请求本应返回200响应。 Expires, Cache-Control和/或Vary假如其值可能与之前相同变量的其他响应对应的值不同的话。 假如本响应请求使用了强缓存验证,那么本次响应不应该包含其他实体头;否则(例如,某个带条件的 GET 请求使用了弱缓存验证),本次响应禁止包含其他实体头;这避免了缓存了的实体内容和更新了的实体头信息之间的不一致。 假如某个304响应指明了当前某个实体没有缓存那么缓存系统必须忽视这个响应并且重复发送不包含限制条件的请求。 假如接收到一个要求更新某个缓存条目的304响应那么缓存系统必须更新整个条目以反映所有在响应中被更新的字段的值。 |
| 305 | 被请求的资源必须通过指定的代理才能被访问。Location 域中将给出指定的代理所在的 URI 信息接收者需要重复发送一个单独的请求通过这个代理才能访问相应资源。只有原始服务器才能建立305响应。 注意RFC 2068中没有明确305响应是为了重定向一个单独的请求而且只能被原始服务器建立。忽视这些限制可能导致严重的安全后果。 |
| 306 | 在最新版的规范中306状态码已经不再被使用。 |
| 307 | 请求的资源现在临时从不同的URI 响应请求。由于这样的重定向是临时的客户端应当继续向原有地址发送以后的请求。只有在Cache-Control或Expires中进行了指定的情况下这个响应才是可缓存的。 新的临时性的URI 应当在响应的 Location 域中返回。除非这是一个HEAD 请求否则响应的实体中应当包含指向新的URI 的超链接及简短说明。因为部分浏览器不能识别307响应因此需要添加上述必要信息以便用户能够理解并向新的 URI 发出访问请求。 如果这不是一个GET 或者 HEAD 请求,那么浏览器禁止自动进行重定向,除非得到用户的确认,因为请求的条件可能因此发生变化。 |
| 400 | 1、语义有误当前请求无法被服务器理解。除非进行修改否则客户端不应该重复提交这个请求。 2、请求参数有误。 |
| 401 | 当前请求需要用户验证。该响应必须包含一个适用于被请求资源的 WWW-Authenticate 信息头用以询问用户信息。客户端可以重复提交一个包含恰当的 Authorization 头信息的请求。如果当前请求已经包含了 Authorization 证书那么401响应代表着服务器验证已经拒绝了那些证书。如果401响应包含了与前一个响应相同的身份验证询问且浏览器已经至少尝试了一次验证那么浏览器应当向用户展示响应中包含的实体信息因为这个实体信息中可能包含了相关诊断信息。参见RFC 2617。 |
| 402 | 该状态码是为了将来可能的需求而预留的。 |
| 403 | 服务器已经理解请求但是拒绝执行它。与401响应不同的是身份验证并不能提供任何帮助而且这个请求也不应该被重复提交。如果这不是一个 HEAD 请求而且服务器希望能够讲清楚为何请求不能被执行那么就应该在实体内描述拒绝的原因。当然服务器也可以返回一个404响应假如它不希望让客户端获得任何信息。 |
| 404 | 请求失败请求所希望得到的资源未被在服务器上发现。没有信息能够告诉用户这个状况到底是暂时的还是永久的。假如服务器知道情况的话应当使用410状态码来告知旧资源因为某些内部的配置机制问题已经永久的不可用而且没有任何可以跳转的地址。404这个状态码被广泛应用于当服务器不想揭示到底为何请求被拒绝或者没有其他适合的响应可用的情况下。 |
| 405 | 请求行中指定的请求方法不能被用于请求相应的资源。该响应必须返回一个Allow 头信息用以表示出当前资源能够接受的请求方法的列表。 鉴于 PUTDELETE 方法会对服务器上的资源进行写操作因而绝大部分的网页服务器都不支持或者在默认配置下不允许上述请求方法对于此类请求均会返回405错误。 |
| 406 | 请求的资源的内容特性无法满足请求头中的条件,因而无法生成响应实体。 除非这是一个 HEAD 请求,否则该响应就应当返回一个包含可以让用户或者浏览器从中选择最合适的实体特性以及地址列表的实体。实体的格式由 Content-Type 头中定义的媒体类型决定。浏览器可以根据格式及自身能力自行作出最佳选择。但是,规范中并没有定义任何作出此类自动选择的标准。 |
| 407 | 与401响应类似只不过客户端必须在代理服务器上进行身份验证。代理服务器必须返回一个 Proxy-Authenticate 用以进行身份询问。客户端可以返回一个 Proxy-Authorization 信息头用以验证。参见RFC 2617。 |
| 408 | 请求超时。客户端没有在服务器预备等待的时间内完成一个请求的发送。客户端可以随时再次提交这一请求而无需进行任何更改。 |
| 409 | 由于和被请求的资源的当前状态之间存在冲突,请求无法完成。这个代码只允许用在这样的情况下才能被使用:用户被认为能够解决冲突,并且会重新提交新的请求。该响应应当包含足够的信息以便用户发现冲突的源头。 冲突通常发生于对 PUT 请求的处理中。例如,在采用版本检查的环境下,某次 PUT 提交的对特定资源的修改请求所附带的版本信息与之前的某个第三方请求向冲突那么此时服务器就应该返回一个409错误告知用户请求无法完成。此时响应实体中很可能会包含两个冲突版本之间的差异比较以便用户重新提交归并以后的新版本。 |
| 410 | 被请求的资源在服务器上已经不再可用而且没有任何已知的转发地址。这样的状况应当被认为是永久性的。如果可能拥有链接编辑功能的客户端应当在获得用户许可后删除所有指向这个地址的引用。如果服务器不知道或者无法确定这个状况是否是永久的那么就应该使用404状态码。除非额外说明否则这个响应是可缓存的。 410响应的目的主要是帮助网站管理员维护网站通知用户该资源已经不再可用并且服务器拥有者希望所有指向这个资源的远端连接也被删除。这类事件在限时、增值服务中很普遍。同样410响应也被用于通知客户端在当前服务器站点上原本属于某个个人的资源已经不再可用。当然是否需要把所有永久不可用的资源标记为'410 Gone',以及是否需要保持此标记多长时间,完全取决于服务器拥有者。 |
| 411 | 服务器拒绝在没有定义 Content-Length 头的情况下接受请求。在添加了表明请求消息体长度的有效 Content-Length 头之后,客户端可以再次提交该请求。 |
| 412 | 服务器在验证在请求的头字段中给出先决条件时,没能满足其中的一个或多个。这个状态码允许客户端在获取资源时在请求的元信息(请求头字段数据)中设置先决条件,以此避免该请求方法被应用到其希望的内容以外的资源上。 |
| 413 | 服务器拒绝处理当前请求,因为该请求提交的实体数据大小超过了服务器愿意或者能够处理的范围。此种情况下,服务器可以关闭连接以免客户端继续发送此请求。 如果这个状况是临时的,服务器应当返回一个 Retry-After 的响应头,以告知客户端可以在多少时间以后重新尝试。 |
| 414 | 请求的URI 长度超过了服务器能够解释的长度,因此服务器拒绝对该请求提供服务。这比较少见,通常的情况包括: 本应使用POST方法的表单提交变成了GET方法导致查询字符串Query String过长。 重定向URI “黑洞”,例如每次重定向把旧的 URI 作为新的 URI 的一部分,导致在若干次重定向后 URI 超长。 客户端正在尝试利用某些服务器中存在的安全漏洞攻击服务器。这类服务器使用固定长度的缓冲读取或操作请求的 URI当 GET 后的参数超过某个数值后,可能会产生缓冲区溢出,导致任意代码被执行[1]。没有此类漏洞的服务器应当返回414状态码。 |
| 415 | 对于当前请求的方法和所请求的资源,请求中提交的实体并不是服务器中所支持的格式,因此请求被拒绝。 |
| 416 | 如果请求中包含了 Range 请求头,并且 Range 中指定的任何数据范围都与当前资源的可用范围不重合,同时请求中又没有定义 If-Range 请求头那么服务器就应当返回416状态码。 假如 Range 使用的是字节范围那么这种情况就是指请求指定的所有数据范围的首字节位置都超过了当前资源的长度。服务器也应当在返回416状态码的同时包含一个 Content-Range 实体头,用以指明当前资源的长度。这个响应也被禁止使用 multipart/byteranges 作为其 Content-Type。 |
| 417 | 在请求头 Expect 中指定的预期内容无法被服务器满足或者这个服务器是一个代理服务器它有明显的证据证明在当前路由的下一个节点上Expect 的内容无法被满足。 |
| 421 | 从当前客户端所在的IP地址到服务器的连接数超过了服务器许可的最大范围。通常这里的IP地址指的是从服务器上看到的客户端地址比如用户的网关或者代理服务器地址。在这种情况下连接数的计算可能涉及到不止一个终端用户。 |
| 422 | 从当前客户端所在的IP地址到服务器的连接数超过了服务器许可的最大范围。通常这里的IP地址指的是从服务器上看到的客户端地址比如用户的网关或者代理服务器地址。在这种情况下连接数的计算可能涉及到不止一个终端用户。 |
| 422 | 请求格式正确但是由于含有语义错误无法响应。RFC 4918 WebDAV423 Locked 当前资源被锁定。RFC 4918 WebDAV |
| 424 | 由于之前的某个请求发生的错误,导致当前请求失败,例如 PROPPATCH。RFC 4918 WebDAV |
| 425 | 在WebDav Advanced Collections 草案中定义但是未出现在《WebDAV 顺序集协议》RFC 3658中。 |
| 426 | 客户端应当切换到TLS/1.0。RFC 2817 |
| 449 | 由微软扩展,代表请求应当在执行完适当的操作后进行重试。 |
| 500 | 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。一般来说,这个问题都会在服务器的程序码出错时出现。 |
| 501 | 服务器不支持当前请求所需要的某个功能。当服务器无法识别请求的方法,并且无法支持其对任何资源的请求。 |
| 502 | 作为网关或者代理工作的服务器尝试执行请求时,从上游服务器接收到无效的响应。 |
| 503 | 由于临时的服务器维护或者过载,服务器当前无法处理请求。这个状况是临时的,并且将在一段时间以后恢复。如果能够预计延迟时间,那么响应中可以包含一个 Retry-After 头用以标明这个延迟时间。如果没有给出这个 Retry-After 信息那么客户端应当以处理500响应的方式处理它。 注意503状态码的存在并不意味着服务器在过载的时候必须使用它。某些服务器只不过是希望拒绝客户端的连接。 |
| 504 | 作为网关或者代理工作的服务器尝试执行请求时未能及时从上游服务器URI标识出的服务器例如HTTP、FTP、LDAP或者辅助服务器例如DNS收到响应。 注意某些代理服务器在DNS查询超时时会返回400或者500错误 |
| 505 | 服务器不支持,或者拒绝支持在请求中使用的 HTTP 版本。这暗示着服务器不能或不愿使用与客户端相同的版本。响应中应当包含一个描述了为何版本不被支持以及服务器支持哪些协议的实体。 |
| 506 | 由《透明内容协商协议》RFC 2295扩展代表服务器存在内部配置错误被请求的协商变元资源被配置为在透明内容协商中使用自己因此在一个协商处理中不是一个合适的重点。 |
| 507 | 服务器无法存储完成请求所必须的内容。这个状况被认为是临时的。WebDAV (RFC 4918) |
| 509 | 服务器达到带宽限制。这不是一个官方的状态码,但是仍被广泛使用。 |
| 510 | 获取资源所需要的策略并没有没满足。RFC 2774 |

Some files were not shown because too many files have changed in this diff Show More