From f0b6014e77cc2f76baaa0f8e027c9cb02122174e Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Wed, 8 Mar 2023 17:42:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plusone-basic/plusone-basic-domain/pom.xml | 4 +--- .../java/xyz/zhouxy/plusone/jdbc/PlusoneJdbcDaoSupport.java | 3 ++- .../main/java/xyz/zhouxy/plusone/oss/FastDFSException.java | 1 + plusone-basic/pom.xml | 2 -- plusone-start/pom.xml | 3 --- .../common/exception/UnsupportedPrincipalTypeException.java | 5 ++++- .../zhouxy/plusone/system/domain/model/menu/ActionDAO.java | 4 ++-- .../plusone/system/domain/model/menu/MenuRepositoryImpl.java | 4 ++-- plusone-system/pom.xml | 2 -- 9 files changed, 12 insertions(+), 16 deletions(-) diff --git a/plusone-basic/plusone-basic-domain/pom.xml b/plusone-basic/plusone-basic-domain/pom.xml index ca01461..1a38772 100644 --- a/plusone-basic/plusone-basic-domain/pom.xml +++ b/plusone-basic/plusone-basic-domain/pom.xml @@ -28,12 +28,10 @@ com.fasterxml.jackson.core jackson-core - 2.13.4 com.fasterxml.jackson.core jackson-annotations - 2.13.4 - + diff --git a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/jdbc/PlusoneJdbcDaoSupport.java b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/jdbc/PlusoneJdbcDaoSupport.java index 33e39e2..b8f0cd6 100644 --- a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/jdbc/PlusoneJdbcDaoSupport.java +++ b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/jdbc/PlusoneJdbcDaoSupport.java @@ -14,6 +14,7 @@ import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import org.springframework.util.CollectionUtils; import xyz.zhouxy.plusone.commons.util.NumberUtil; import xyz.zhouxy.plusone.exception.DataOperationResultException; @@ -156,7 +157,7 @@ public abstract class PlusoneJdbcDaoSupport { protected static final SqlParameterSource[] buildSqlParameterSourceArray( Collection c, @Nonnull Function paramSourceBuilder) { - if (c == null || c.isEmpty()) { + if (CollectionUtils.isEmpty(c)) { return new SqlParameterSource[] {}; } return buildSqlParameterSourceArray(c.stream(), paramSourceBuilder); diff --git a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/oss/FastDFSException.java b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/oss/FastDFSException.java index a34cd35..88f4c13 100644 --- a/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/oss/FastDFSException.java +++ b/plusone-basic/plusone-basic-infrastructure/src/main/java/xyz/zhouxy/plusone/oss/FastDFSException.java @@ -6,6 +6,7 @@ package xyz.zhouxy.plusone.oss; * @author ZhouXY */ public class FastDFSException extends Exception { + private static final long serialVersionUID = 7871031982887742468L; public FastDFSException() { } diff --git a/plusone-basic/pom.xml b/plusone-basic/pom.xml index 6072631..26d7e80 100644 --- a/plusone-basic/pom.xml +++ b/plusone-basic/pom.xml @@ -7,9 +7,7 @@ 1.0.0-SNAPSHOT - xyz.zhouxy plusone-basic - 1.0.0-SNAPSHOT pom diff --git a/plusone-start/pom.xml b/plusone-start/pom.xml index 56478b1..99950e8 100644 --- a/plusone-start/pom.xml +++ b/plusone-start/pom.xml @@ -7,10 +7,7 @@ 1.0.0-SNAPSHOT - xyz.zhouxy plusone-start - 1.0.0-SNAPSHOT - plusone-start 参考 DDD 落地的脚手架 diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/common/exception/UnsupportedPrincipalTypeException.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/common/exception/UnsupportedPrincipalTypeException.java index de90bae..a71d443 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/common/exception/UnsupportedPrincipalTypeException.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/common/exception/UnsupportedPrincipalTypeException.java @@ -9,10 +9,13 @@ import xyz.zhouxy.plusone.exception.BizException; */ public class UnsupportedPrincipalTypeException extends BizException { + private static final long serialVersionUID = 5207757290868470762L; + public static final int ERR_CODE = 4040201; + private static final String DEFAULT_ERROR_MSG = "不支持的 PrincipalType"; public UnsupportedPrincipalTypeException() { - super(ERR_CODE, "不支持的 PrincipalType"); + super(ERR_CODE, DEFAULT_ERROR_MSG); } public UnsupportedPrincipalTypeException(String msg) { diff --git a/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/ActionDAO.java b/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/ActionDAO.java index 34a8e89..07bb570 100644 --- a/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/ActionDAO.java +++ b/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/ActionDAO.java @@ -8,7 +8,6 @@ import java.time.LocalDateTime; import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; import javax.annotation.Nonnull; @@ -16,6 +15,7 @@ import javax.annotation.Nonnull; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import org.springframework.util.CollectionUtils; import cn.hutool.core.util.IdUtil; import xyz.zhouxy.plusone.jdbc.JdbcEntityDaoSupport; @@ -80,7 +80,7 @@ class ActionDAO extends JdbcEntityDaoSupport { } Collection selectActionsByIdIn(Collection actionIds) { - if (Objects.isNull(actionIds) || actionIds.isEmpty()) { + if (CollectionUtils.isEmpty(actionIds)) { return Collections.emptyList(); } return queryForList(""" diff --git a/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/MenuRepositoryImpl.java b/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/MenuRepositoryImpl.java index d09428c..93b9e97 100644 --- a/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/MenuRepositoryImpl.java +++ b/plusone-system/plusone-system-infrastructure/src/main/java/xyz/zhouxy/plusone/system/domain/model/menu/MenuRepositoryImpl.java @@ -7,7 +7,6 @@ import java.sql.SQLException; import java.time.LocalDateTime; import java.util.Collection; import java.util.Collections; -import java.util.Objects; import java.util.Optional; import javax.annotation.Nonnull; @@ -15,6 +14,7 @@ import javax.annotation.Nonnull; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Repository; +import org.springframework.util.CollectionUtils; import cn.hutool.core.util.IdUtil; import xyz.zhouxy.plusone.commons.util.EnumUtil; @@ -121,7 +121,7 @@ public class MenuRepositoryImpl extends JdbcRepositorySupport implem @Override public Collection findByIdIn(Collection ids) { - if (Objects.isNull(ids) || ids.isEmpty()) { + if (CollectionUtils.isEmpty(ids)) { return Collections.emptyList(); } return queryForList(""" diff --git a/plusone-system/pom.xml b/plusone-system/pom.xml index ff51ce4..e118c51 100644 --- a/plusone-system/pom.xml +++ b/plusone-system/pom.xml @@ -7,9 +7,7 @@ 1.0.0-SNAPSHOT - xyz.zhouxy plusone-system - 1.0.0-SNAPSHOT pom plusone-system