Merge branch 'master' into deploy

pull/875/head
Zheng Jie 2023-07-05 17:55:43 +08:00
commit 92d38e51df
12 changed files with 49 additions and 68 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>eladmin</artifactId> <artifactId>eladmin</artifactId>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<version>2.6</version> <version>2.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<properties> <properties>

View File

@ -15,9 +15,7 @@
*/ */
package me.zhengjie.exception.handler; package me.zhengjie.exception.handler;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
/** /**
* @author Zheng Jie * @author Zheng Jie
@ -27,12 +25,11 @@ import java.time.LocalDateTime;
class ApiError { class ApiError {
private Integer status = 400; private Integer status = 400;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Long timestamp;
private LocalDateTime timestamp;
private String message; private String message;
private ApiError() { private ApiError() {
timestamp = LocalDateTime.now(); timestamp = System.currentTimeMillis();
} }
public static ApiError error(String message){ public static ApiError error(String message){

View File

@ -53,6 +53,7 @@ public class QueryHelp {
} }
} }
try { try {
Map<String, Join> joinKey = new HashMap<>();
List<Field> fields = getAllFields(query.getClass(), new ArrayList<>()); List<Field> fields = getAllFields(query.getClass(), new ArrayList<>());
for (Field field : fields) { for (Field field : fields) {
boolean accessible = field.isAccessible(); boolean accessible = field.isAccessible();
@ -75,40 +76,43 @@ public class QueryHelp {
String[] blurrys = blurry.split(","); String[] blurrys = blurry.split(",");
List<Predicate> orPredicate = new ArrayList<>(); List<Predicate> orPredicate = new ArrayList<>();
for (String s : blurrys) { for (String s : blurrys) {
orPredicate.add(cb.like(root.get(s) orPredicate.add(cb.like(root.get(s).as(String.class), "%" + val.toString() + "%"));
.as(String.class), "%" + val.toString() + "%"));
} }
Predicate[] p = new Predicate[orPredicate.size()]; Predicate[] p = new Predicate[orPredicate.size()];
list.add(cb.or(orPredicate.toArray(p))); list.add(cb.or(orPredicate.toArray(p)));
continue; continue;
} }
if (ObjectUtil.isNotEmpty(joinName)) { if (ObjectUtil.isNotEmpty(joinName)) {
String[] joinNames = joinName.split(">"); join = joinKey.get(joinName);
for (String name : joinNames) { if(join == null){
switch (q.join()) { String[] joinNames = joinName.split(">");
case LEFT: for (String name : joinNames) {
if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){ switch (q.join()) {
join = join.join(name, JoinType.LEFT); case LEFT:
} else { if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){
join = root.join(name, JoinType.LEFT); join = join.join(name, JoinType.LEFT);
} } else {
break; join = root.join(name, JoinType.LEFT);
case RIGHT: }
if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){ break;
join = join.join(name, JoinType.RIGHT); case RIGHT:
} else { if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){
join = root.join(name, JoinType.RIGHT); join = join.join(name, JoinType.RIGHT);
} } else {
break; join = root.join(name, JoinType.RIGHT);
case INNER: }
if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){ break;
join = join.join(name, JoinType.INNER); case INNER:
} else { if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){
join = root.join(name, JoinType.INNER); join = join.join(name, JoinType.INNER);
} } else {
break; join = root.join(name, JoinType.INNER);
default: break; }
break;
default: break;
}
} }
joinKey.put(joinName, join);
} }
} }
switch (q.type()) { switch (q.type()) {

View File

@ -15,11 +15,11 @@
*/ */
package me.zhengjie.utils; package me.zhengjie.utils;
import cn.hutool.http.useragent.UserAgent;
import cn.hutool.http.useragent.UserAgentUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher; import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
import net.dreamlu.mica.ip2region.core.IpInfo; import net.dreamlu.mica.ip2region.core.IpInfo;
import nl.basjes.parse.useragent.UserAgent;
import nl.basjes.parse.useragent.UserAgentAnalyzer;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.NetworkInterface; import java.net.NetworkInterface;
@ -43,14 +43,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*/ */
private final static Ip2regionSearcher IP_SEARCHER = SpringContextHolder.getBean(Ip2regionSearcher.class); private final static Ip2regionSearcher IP_SEARCHER = SpringContextHolder.getBean(Ip2regionSearcher.class);
private static final UserAgentAnalyzer USER_AGENT_ANALYZER = UserAgentAnalyzer
.newBuilder()
.hideMatcherLoadStats()
.withCache(10000)
.withField(UserAgent.AGENT_NAME_VERSION)
.build();
/** /**
* *
* *
@ -178,8 +170,8 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
} }
public static String getBrowser(HttpServletRequest request) { public static String getBrowser(HttpServletRequest request) {
UserAgent.ImmutableUserAgent userAgent = USER_AGENT_ANALYZER.parse(request.getHeader("User-Agent")); UserAgent ua = UserAgentUtil.parse(request.getHeader("User-Agent"));
return userAgent.get(UserAgent.AGENT_NAME_VERSION).getValue(); return ua.getBrowser().toString() + " " + ua.getVersion();
} }
/** /**

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>eladmin</artifactId> <artifactId>eladmin</artifactId>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<version>2.6</version> <version>2.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<artifactId>eladmin-common</artifactId> <artifactId>eladmin-common</artifactId>
<version>2.6</version> <version>2.7</version>
</dependency> </dependency>
<!--模板引擎--> <!--模板引擎-->

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>eladmin</artifactId> <artifactId>eladmin</artifactId>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<version>2.6</version> <version>2.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -16,7 +16,7 @@
<dependency> <dependency>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<artifactId>eladmin-common</artifactId> <artifactId>eladmin-common</artifactId>
<version>2.6</version> <version>2.7</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>eladmin</artifactId> <artifactId>eladmin</artifactId>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<version>2.6</version> <version>2.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<artifactId>eladmin-generator</artifactId> <artifactId>eladmin-generator</artifactId>
<version>2.6</version> <version>2.7</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
@ -36,7 +36,7 @@
<dependency> <dependency>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<artifactId>eladmin-tools</artifactId> <artifactId>eladmin-tools</artifactId>
<version>2.6</version> <version>2.7</version>
</dependency> </dependency>
<!-- Spring boot websocket --> <!-- Spring boot websocket -->

View File

@ -15,7 +15,6 @@
*/ */
package me.zhengjie.modules.system.domain.vo; package me.zhengjie.modules.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -26,7 +25,6 @@ import java.util.List;
* @date 2018-12-20 * @date 2018-12-20
*/ */
@Data @Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class MenuVo implements Serializable { public class MenuVo implements Serializable {
private String name; private String name;

View File

@ -15,7 +15,6 @@
*/ */
package me.zhengjie.modules.system.service.dto; package me.zhengjie.modules.system.service.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import me.zhengjie.base.BaseDTO; import me.zhengjie.base.BaseDTO;
@ -39,7 +38,6 @@ public class DeptDto extends BaseDTO implements Serializable {
private Integer deptSort; private Integer deptSort;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<DeptDto> children; private List<DeptDto> children;
private Long pid; private Long pid;

View File

@ -2,14 +2,13 @@ server:
port: 8000 port: 8000
compression: compression:
enabled: true enabled: true
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
spring: spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: dev active: dev
jackson:
time-zone: GMT+8
data: data:
redis: redis:
repositories: repositories:

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>eladmin</artifactId> <artifactId>eladmin</artifactId>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<version>2.6</version> <version>2.7</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<artifactId>eladmin-logging</artifactId> <artifactId>eladmin-logging</artifactId>
<version>2.6</version> <version>2.7</version>
</dependency> </dependency>
<!--邮件依赖--> <!--邮件依赖-->

View File

@ -7,7 +7,7 @@
<groupId>me.zhengjie</groupId> <groupId>me.zhengjie</groupId>
<artifactId>eladmin</artifactId> <artifactId>eladmin</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>2.6</version> <version>2.7</version>
<modules> <modules>
<module>eladmin-common</module> <module>eladmin-common</module>
@ -188,13 +188,6 @@
<artifactId>commons-text</artifactId> <artifactId>commons-text</artifactId>
<version>1.10.0</version> <version>1.10.0</version>
</dependency> </dependency>
<!-- 解析客户端操作系统、浏览器信息 -->
<dependency>
<groupId>nl.basjes.parse.useragent</groupId>
<artifactId>yauaa</artifactId>
<version>6.11</version>
</dependency>
</dependencies> </dependencies>
<build> <build>