Skip to content

Commit

Permalink
2.1.0 发布
Browse files Browse the repository at this point in the history
  • Loading branch information
yl-yue committed Aug 6, 2020
1 parent 4063357 commit d457a19
Show file tree
Hide file tree
Showing 51 changed files with 604 additions and 429 deletions.
9 changes: 7 additions & 2 deletions docs/base/介绍.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
- AsyncConfig-异步线程池(共用父线程上下文环境,异步执行任务时不丢失token) `yue.thread-pool.async.*`
- CorsConfig-跨域配置 `yue.cors.allow`

  在 `application.yml``bootstrap.yml` 文件中添加如下示例配置,导入 **yue-library** 提供的默认配置支持。如:时间格式化、可执行SQL打印、接口定义打印等
```yml
spring:
profiles:
include:
- yue-library-web
include:
- yue-library-base
- yue-library-web
- yue-library-webflux
- yue-library-data-jdbc
- yue-library-data-redis
...
```

## 特性介绍
Expand Down
20 changes: 20 additions & 0 deletions docs/base/参数解析器.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ ParamUtils.getParam()
ParamUtils.getParam(Class<T>)
```

## 基本参数解析器
- 不再区分Query传参与Body传参
- 时间类型反序列化:进行增强解析以处理更多时间格式
- 时间类型序列化:进行统一格式化(yyyy-MM-dd HH:mm:ss

目前已测试通过如下几种时间格式:
```java
java.util.Date
java.time.LocalDate
java.time.LocalTime
java.time.LocalDateTime
cn.hutool.core.date.DateTime
```

基本参数解析:
```java
@PostMapping
public Result<?> post(String v1, int v2, boolean v3, v4 v5 ...) {
```

## JSONObject参数解析器
优先级最高的参数解析器,常用于 `Controller JSON传参 → Service校验 → DAO智能解析` 的快速开发模式

Expand Down
36 changes: 25 additions & 11 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
---
## TODO LIST
### base
- 前后端统一表单验证

### jdbc
- **内置全局拦截插件**:提供全表 delete 、 update 操作智能分析阻断,预防误操作
- 【jdbc】多租户支持
- 【jdbc】tidb特性支持
- JDBC审计支持
- JDBC框架遵循Java开发手册实现MySQL 数据库规约与框架层面的优化,如:SQL分页优化、表必备三字段、数据修订前先确认数据等规范

![数据修订前先确认数据](changelog_files/3.jpg)
![表必备三字段](changelog_files/1.jpg)
![SQL分页优化](changelog_files/2.jpg)
Expand All @@ -17,7 +18,6 @@
- 增强第三方登录封装

### 其他
- 基于spring-cloud-alibaba体系封装改造
- 添加短信、OSS等封装
- 加入996icu license 协议、木兰协议

Expand All @@ -29,17 +29,31 @@ yue-library的版本命名方式,采用SpringCloud版本名作为前缀,然
|JDK8 |LTS(Oracle长期支持版本),目前大部分互联网公司采用版本|Finchley |JDK8兼容版本,每次新特性发布都会进行一次全面的兼容适配与测试,以供JDK8用户稳定使用 |
|JDK11 |LTS(Oracle长期支持版本),作者采用版本 |Greenwich |JDK11推荐版本,提供更快速的迭代与反馈 |

## 2.1.0【规划中】
## 2.2.0【规划中】
## 2.1.0【2020-08-08】
### 新特性
- 独立的OAuth认证体系
- 实用的参数解析器
- 分离的web、webflux
- 升级系列依赖版本
- 删除失效方法
- redis client 包名标准,规范登录?
基于全新的spring-cloud-alibaba体系封装改造,拆分独立的OAuth认证体系,对webmvc、webflux分开支持。依赖定义如下:

|依赖 |版本 |
|-- |-- |
|spring-boot |2.1.10.RELEASE |
|spring-cloud-alibaba |2.1.2.RELEASE |
|spring-cloud |Greenwich.SR5 |

[点击查看更多依赖版本定义](https://gitee.com/yl-yue/yue-library/blob/master/pom.xml)

- 【base】提供`yml`默认配置支持,一键解决常规坑点困扰,更适合国内标准
- 【web】实用的参数解析器(解决参数获取困扰,不再区分Query传参与Body传参,Request请求参数智能解析)
- 【web】HTTP消息转换器增强,fastjson与jackson一键切换
- 【redis】规范redis包名标准,分离OAuth认证体系
- 【jdbc】遵守Java开发手册命名规约,Service/DAO 层方法命名规约,优化如获取单个对象采用 get 做前缀
- 【jdbc】提供友好的方言支持,为适配国产化数据库打下基础
- 【jdbc】提供业务主键支持
- 【jdbc】提供逻辑删除支持
- 【jdbc】提供获得表元数据支持

### Bug修复
- 批量插入优化,容易报错
- 【jdbc】批量插入容易报错问题

## Finchley.SR4.1【2019-10-18】
### 新特性
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<hutool.version>5.2.5</hutool.version>
<fastjson.version>1.2.68</fastjson.version>
<fastjson.version>1.2.73</fastjson.version>
<pay.version>2.12.8</pay.version>
<easypoi.version>4.1.3</easypoi.version>
<easyexcel.version>2.1.6</easyexcel.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package ai.yue.library.base.constant;

import com.alibaba.fastjson.PropertyNamingStrategy;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* 字段命名策略
*
* @author ylyue
* @since 2020年2月20日
*/
@Getter
@AllArgsConstructor
public enum FieldNamingStrategyEnum {

/**
* 驼峰命名法,即:小驼峰命名法
* <p>CAMEL_CASE策略,Java对象属性:personId,序列化后属性:persionId
*/
CAMEL_CASE(PropertyNamingStrategy.CamelCase),

/**
* 小驼峰命名法
* <p>{@link #CAMEL_CASE}
*/
LOWER_CAMEL_CASE(PropertyNamingStrategy.CamelCase),

/**
* 大驼峰命名法
* <p>{@link #PASCAL_CASE}
*/
UPPER_CAMEL_CASE(PropertyNamingStrategy.PascalCase),

/**
* 帕斯卡命名法,即:大驼峰命名法
* <p>PASCAL_CASE策略,Java对象属性:personId,序列化后属性:PersonId
*/
PASCAL_CASE(PropertyNamingStrategy.PascalCase),

/**
* 下划线命名法
* <p>SNAKE_CASE策略,Java对象属性:personId,序列化后属性:person_id
*/
SNAKE_CASE(PropertyNamingStrategy.SnakeCase),

/**
* 中划线命名法
* <p>KEBAB_CASE策略,Java对象属性:personId,序列化后属性:person-id
*/
KEBAB_CASE(PropertyNamingStrategy.KebabCase);

private PropertyNamingStrategy propertyNamingStrategy;

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ public static boolean isNotEmpty(List<?> list) {
return !isEmpty(list);
}

/**
* 获得List数组中对应类型的第一个值
*
* @param <T> 想要的类型
* @param list List数组
* @param clazz 想要的类型Class
* @return 找到的第一个值或null
*/
@SuppressWarnings("unchecked")
public static <T> T get(List<?> list, Class<T> clazz) {
for (Object value : list) {
if (value != null && value.getClass() == clazz) {
return (T) value;
}
}

return null;
}

/**
* 数据分组
* <p>将拥有相同的 key 值的JSON数据归为一组</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
@Slf4j
public class MapUtils extends MapUtil {

/**
* 不可变的空JSON常量
*/
/** 不可变的空Json常量 */
public final static JSONObject FINAL_EMPTY_JSON = new JSONObject();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import com.alibaba.fastjson.JSONObject;

import ai.yue.library.base.constant.FieldNamingStrategyEnum;
import ai.yue.library.base.exception.DbException;
import ai.yue.library.base.util.MapUtils;
import ai.yue.library.base.util.StringUtils;
import ai.yue.library.base.view.ResultPrompt;
import ai.yue.library.data.jdbc.client.dialect.Dialect;
import ai.yue.library.data.jdbc.constant.DbConstant;
import ai.yue.library.data.jdbc.constant.FieldNamingStrategyEnum;
import cn.hutool.core.util.ArrayUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.boot.context.properties.ConfigurationProperties;

import ai.yue.library.data.jdbc.constant.FieldNamingStrategyEnum;
import ai.yue.library.base.constant.FieldNamingStrategyEnum;
import lombok.Data;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
/**
* 数据库字段命名策略
*
* @deprecated {@linkplain ai.yue.library.base.constant.FieldNamingStrategyEnum}
* @author ylyue
* @since 2020年2月20日
*/
@Getter
@AllArgsConstructor
@Deprecated
public enum FieldNamingStrategyEnum {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.serializer.SerializeConfig;

import ai.yue.library.base.constant.FieldNamingStrategyEnum;
import ai.yue.library.base.convert.Convert;
import ai.yue.library.data.jdbc.client.Db;
import ai.yue.library.data.jdbc.config.properties.JdbcProperties;
import ai.yue.library.data.jdbc.constant.DbSortEnum;
import ai.yue.library.data.jdbc.constant.FieldNamingStrategyEnum;
import ai.yue.library.data.jdbc.ipo.PageIPO;
import ai.yue.library.data.jdbc.vo.PageTVO;
import cn.hutool.core.util.ClassUtil;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.constant.example.data.jdbc;
package ai.yue.library.test.constant;

/**
* 角色类型
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.constant.test;
package ai.yue.library.test.constant;

/**
* @author ylyue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.constant.example.data.jdbc;
package ai.yue.library.test.constant;

/**
* @author ylyue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.base.api.version;
package ai.yue.library.test.controller.base.api.version;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.base.api.version;
package ai.yue.library.test.controller.base.api.version;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.base.api.version;
package ai.yue.library.test.controller.base.api.version;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.base.datetime.format;
package ai.yue.library.test.controller.base.datetime.format;

import javax.validation.Valid;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.base.request.param;
package ai.yue.library.test.controller.base.request.param;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -12,7 +12,7 @@

import ai.yue.library.base.view.Result;
import ai.yue.library.base.view.ResultInfo;
import ai.yue.library.test.constant.test.TestEnum;
import ai.yue.library.test.constant.TestEnum;
import ai.yue.library.test.ipo.ValidationIPO;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.base.validation;
package ai.yue.library.test.controller.base.validation;

import java.time.LocalDate;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.data.jdbc;
package ai.yue.library.test.controller.data.jdbc;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -17,10 +17,10 @@
import ai.yue.library.base.view.Result;
import ai.yue.library.base.view.ResultInfo;
import ai.yue.library.data.jdbc.client.Db;
import ai.yue.library.test.constant.example.data.jdbc.RoleEnum;
import ai.yue.library.test.constant.example.data.jdbc.UserStatusEnum;
import ai.yue.library.test.dao.test.data.jdbc.JdbcDAO;
import ai.yue.library.test.dataobject.example.data.jdbc.UserDO;
import ai.yue.library.test.constant.RoleEnum;
import ai.yue.library.test.constant.UserStatusEnum;
import ai.yue.library.test.dataobject.UserDO;
import ai.yue.library.test.doc.example.data.jdbc.JdbcDAO;

/**
* @author ylyue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ai.yue.library.test.controller.test.data.redis;
package ai.yue.library.test.controller.data.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
Expand All @@ -12,7 +12,7 @@
import ai.yue.library.base.view.Result;
import ai.yue.library.base.view.ResultInfo;
import ai.yue.library.data.redis.client.Redis;
import ai.yue.library.test.dataobject.example.data.jdbc.UserDO;
import ai.yue.library.test.dataobject.UserDO;

/**
* @author ylyue
Expand Down
Loading

0 comments on commit d457a19

Please sign in to comment.