Skip to content

Commit

Permalink
遵循阿里代码规范优化,分页优化,修复角色权限bug
Browse files Browse the repository at this point in the history
  • Loading branch information
springboot-plus committed Feb 21, 2020
1 parent 8151cb8 commit 3e6ad8e
Show file tree
Hide file tree
Showing 117 changed files with 1,174 additions and 684 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
- 统一响应结果处理:ApiResult
- 公共常量
- 常用validator注解约束:EmailValidator、EnumTypeValidator、IdCardValidator、PhoneValidator
- 提取公共类:BaseEntity、BaseService、BaseServiceImpl、BaseTypeStateEnum、BaseController、QueryParam等
- 提取公共类:BaseEntity、BaseService、BaseServiceImpl、BaseTypeStateEnum、BaseController、PageParam等
- 全局异常处理:BusinessException、GlobalErrorController、GlobalExceptionHandler
- 跨域处理Filter:CrossDomainFilter
- 请求路径处理Filter:RequestPathFilter
Expand Down
19 changes: 13 additions & 6 deletions CHANGELOG_TODO.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# CHANGELOG TODO

## [V1.4]
- 部门树形列表
- :white_check_mark: 部门树形列表

## [V1.5]
- 代码生成起优化,是否生成自定义update方法,生成version,deleted注解
- 黑白名单,配置文件和数据库可配置,并缓存到Redis
- 代码生成器优化,是否生成自定义update方法,生成version,deleted注解
- :white_check_mark: 黑白名单,配置文件和数据库可配置,并缓存到Redis
- Redis Cache注解使用
- ok http工具类
- Excel解析,导入导出
- 项目代码遵循阿里代码规范优化
- :white_check_mark: 项目代码遵循阿里代码规范优化
- 字典表
- 配置参数表
- 上传文件附件表
- Redis分布式锁
- 接口限流,ip限流,频率限流
- Shiro Redis缓存
- ApplicationRunner

- HikariCP

## [V1.6]
- Spring security集成
- HikariCP


## [V2.0]
- 当主键类型为自动生成时,ID生成了NotNull注解,应去掉
- 是否生成list方法
- 是否生成id,name方法,提供公共的id,name获取方法
- fix SysRoleServiceImpl.java if(deleteSet.size() > 0){ // 删除权限关联
- SysPermissionMapper.xml order by p.sort asc
6 changes: 3 additions & 3 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Spring Boot | 2.2.0.RELEASE | 最新发布稳定版 |
Spring Framework | 5.2.0.RELEASE | 最新发布稳定版 |
Mybatis | 3.5.2 | 持久层框架 |
Mybatis Plus | 3.2.0 | mybatis增强框架 |
Alibaba Druid | 1.1.20 | 数据源 |
HikariCP | 3.4.1 | 数据源 |
Fastjson | 1.2.62 | JSON处理工具集 |
swagger2 | 2.6.1 | api文档生成工具 |
commons-lang3 | 3.9 | 常用工具包 |
Expand Down Expand Up @@ -182,7 +182,7 @@ public class SpringBootPlusGenerator {
// 当数据库字段更新时,可自定义自动生成哪些那文件
codeGenerator
.setGeneratorEntity(true)
.setGeneratorQueryParam(true)
.setGeneratorPageParam(true)
.setGeneratorQueryVo(true);

// 生成业务相关代码
Expand Down Expand Up @@ -236,7 +236,7 @@ public class SpringBootPlusGenerator {
├── mapper
│   └── FooBarMapper.java
├── param
│   └── FooBarQueryParam.java
│   └── FooBarPageParam.java
├── service
│   ├── FooBarService.java
│   └── impl
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- Integrated JWT,Shiro/Spring security permission control
- Integrated Redis、spring cache、ehcache,etc
- Integrated Rabbit/Rocket/Kafka MQ
- Integration alibaba druid connection pool, JDBC performance and slow query detection
- Integration HikariCP connection pool, A solid, high-performance, JDBC connection pool at last.
- Integrated Spring Boot Admin, real-time detection of project operation
- Integrate maven-assembly-plugin for different environment package deployment, including startup and restart commands, and extract configuration files to external config directory

Expand Down Expand Up @@ -182,7 +182,7 @@ public class SpringBootPlusGenerator {
// Customize which files are generated automatically
codeGenerator
.setGeneratorEntity(true)
.setGeneratorQueryParam(true)
.setGeneratorPageParam(true)
.setGeneratorQueryVo(true);

// Generate business related codes
Expand Down Expand Up @@ -235,7 +235,7 @@ public class SpringBootPlusGenerator {
├── mapper
│   └── FooBarMapper.java
├── param
│   └── FooBarQueryParam.java
│   └── FooBarPageParam.java
├── service
│   ├── FooBarService.java
│   └── impl
Expand Down
8 changes: 0 additions & 8 deletions docs/bin/install/install-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
# date: 2019-8-29
#======================================================================


# 配置阿里云yum镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum clean all

yum makecache

# 下载mysql rpm
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm

Expand Down
47 changes: 30 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<groupId>io.geekidea</groupId>
<artifactId>spring-boot-plus</artifactId>
<version>1.4.0</version>
<version>2.0.SNAPSHOT</version>
<packaging>jar</packaging>

<name>spring-boot-plus</name>
Expand All @@ -46,30 +46,29 @@
<project.build.sourceEncoding>${utf8}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${utf8}</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.2.0.RELEASE</spring-boot.version>
<spring-boot-admin.version>2.2.0</spring-boot-admin.version>
<mybatis-plus-boot-starter.version>3.2.0</mybatis-plus-boot-starter.version>
<swagger2.version>2.6.1</swagger2.version>
<spring-boot.version>2.2.4.RELEASE</spring-boot.version>
<spring-boot-admin.version>2.2.2</spring-boot-admin.version>
<mybatis-plus-boot-starter.version>3.3.1</mybatis-plus-boot-starter.version>
<swagger2.version>2.9.2</swagger2.version>
<commons-lang3.version>3.9</commons-lang3.version>
<commons-collections4.version>4.4</commons-collections4.version>
<commons-io.version>2.6</commons-io.version>
<commons-codec.version>1.13</commons-codec.version>
<commons-codec.version>1.14</commons-codec.version>
<commons-net.version>3.6</commons-net.version>
<commons-pool2.version>2.7.0</commons-pool2.version>
<commons-pool2.version>2.8.0</commons-pool2.version>
<commons-text.version>1.8</commons-text.version>
<fastjson.version>1.2.62</fastjson.version>
<velocity.version>1.7</velocity.version>
<mysql.version>5.1.47</mysql.version>
<druid.version>1.1.20</druid.version>
<reflections.version>0.9.11</reflections.version>
<reflections.version>0.9.12</reflections.version>
<jansi.version>1.18</jansi.version>
<lombok.version>1.18.10</lombok.version>
<hutool.version>5.0.4</hutool.version>
<lombok.version>1.18.12</lombok.version>
<hutool.version>5.1.3</hutool.version>
<junit.version>4.12</junit.version>
<ini4j.version>0.5.4</ini4j.version>
<mapstruct.version>1.3.1.Final</mapstruct.version>
<shiro.version>1.4.1</shiro.version>
<jwt.version>3.8.3</jwt.version>
<jwt.version>3.10.0</jwt.version>
<guava.version>28.1-jre</guava.version>

<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
Expand Down Expand Up @@ -150,6 +149,12 @@
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
Expand All @@ -159,11 +164,6 @@
<!-- mybatis-plus end -->

<!-- alibaba start -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
Expand All @@ -176,11 +176,16 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
<!-- 排除版本冲突的jar -->
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -229,6 +234,12 @@
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>${reflections.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -433,6 +444,8 @@
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
<!-- 打包时跳过 -->
<skip>true</skip>
</configuration>
<executions>
<execution>
Expand Down
Empty file.
Empty file.
Empty file removed src/logs/spring-boot-plus.log
Empty file.
40 changes: 19 additions & 21 deletions src/main/java/io/geekidea/springbootplus/common/api/ApiCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,41 @@
*/
public enum ApiCode {

/** 操作成功 **/
SUCCESS(200, "操作成功"),

/** 非法访问 **/
UNAUTHORIZED(401, "非法访问"),

/** 没有权限 **/
NOT_PERMISSION(403, "没有权限"),

/** 你请求的资源不存在 **/
NOT_FOUND(404, "你请求的资源不存在"),

/** 操作失败 **/
FAIL(500, "操作失败"),


/** 登陆失败 **/
LOGIN_EXCEPTION(4000, "登陆失败"),


SYSTEM_EXCEPTION(5000, "系统异常!"),

/** 系统异常 **/
SYSTEM_EXCEPTION(5000, "系统异常"),
/** 请求参数校验异常 **/
PARAMETER_EXCEPTION(5001, "请求参数校验异常"),

/** 请求参数解析异常 **/
PARAMETER_PARSE_EXCEPTION(5002, "请求参数解析异常"),

HTTP_MEDIA_TYPE_EXCEPTION(5003, "HTTP Media 类型异常"),

/** HTTP内容类型异常 **/
HTTP_MEDIA_TYPE_EXCEPTION(5003, "HTTP内容类型异常"),
/** 系统处理异常 **/
SPRING_BOOT_PLUS_EXCEPTION(5100, "系统处理异常"),

/** 业务处理异常 **/
BUSINESS_EXCEPTION(5101, "业务处理异常"),

/** 数据库处理异常 **/
DAO_EXCEPTION(5102, "数据库处理异常"),

/** 验证码校验异常 **/
VERIFICATION_CODE_EXCEPTION(5103, "验证码校验异常"),

/** 登陆授权异常 **/
AUTHENTICATION_EXCEPTION(5104, "登陆授权异常"),

/** 没有访问权限 **/
UNAUTHENTICATED_EXCEPTION(5105, "没有访问权限"),

/** 没有访问权限 **/
UNAUTHORIZED_EXCEPTION(5106, "没有访问权限"),


;

private final int code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static ApiResult ok(Object data,String msg){
}

public static ApiResult okMap(String key,Object value){
Map<String,Object> map = new HashMap<>();
Map<String,Object> map = new HashMap<>(1);
map.put(key,value);
return ok(map);
}
Expand All @@ -142,7 +142,7 @@ public static ApiResult fail(ApiCode apiCode,Object data){
}

public static ApiResult fail(String key,Object value){
Map<String,Object> map = new HashMap<>();
Map<String,Object> map = new HashMap<>(1);
map.put(key,value);
return result(ApiCode.FAIL,map);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ApiDocController extends BaseController {
* swaggerUI
*/
@GetMapping("")
public String swaggerUI() {
public String swagger() {
return "redirect:/swagger-ui.html";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.geekidea.springbootplus.common.controller;

import io.geekidea.springbootplus.util.UUIDUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
* CSRF
*
* @author geekidea
* @date 2019/12/10
**/
@RestController
public class CsrfController {

@RequestMapping(value = "/csrf", method = {RequestMethod.GET, RequestMethod.POST})
public String csrf() {
return UUIDUtil.getUuid();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.geekidea.springbootplus.common.param;
package io.geekidea.springbootplus.common.pagination;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import io.swagger.annotations.ApiModel;
Expand All @@ -35,7 +35,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("可排序查询参数对象")
public abstract class OrderQueryParam extends QueryParam {
public abstract class BasePageOrderParam extends BasePageParam {
private static final long serialVersionUID = 57714391204790143L;

@ApiModelProperty(value = "排序")
Expand Down
Loading

0 comments on commit 3e6ad8e

Please sign in to comment.