20 Commits

Author SHA1 Message Date
e8274b1beb 添加 TODO,不放行全部域名,通过配置文件配置允许访问的域名。 2023-12-06 18:14:29 +08:00
3b1c15335b 升级 Spring Boot 版本。 2023-12-06 18:13:58 +08:00
81cefdca83 修改排序的 bug。 2023-12-06 18:13:34 +08:00
86fcd7a255 plusone-commons 中新增 BaseRuntimeException 作为基础运行时异常,原 BaseException 作为基础检查型异常。 2023-10-18 11:09:55 +08:00
15ed0e2ec6 升级 Spring Boot 版本。 2023-10-18 11:09:26 +08:00
3bb5397c49 修改 UnsupportedMenuTypeException 的错误码 2023-09-10 16:47:53 +08:00
b69983077a plusone-validator 修改了方法名 2023-09-10 16:47:30 +08:00
7f8a37803a 修改菜单树的构建 2023-09-09 18:41:00 +08:00
8414fcb010 删除 MenuUtil 2023-09-09 18:40:25 +08:00
b91ab22354 plusone-commons 修改了 IWithIntCode 的包名 2023-09-09 18:39:13 +08:00
00c5ed651e 修改异常 2023-09-09 18:38:44 +08:00
b25d7589c2 使用 UnifiedResponse 替代 RestfulResult 2023-09-09 18:38:09 +08:00
208d7c93c9 plusone-commons 修改了 BaseException 2023-09-09 18:19:58 +08:00
b870684fea 静态方法不需要 final 2023-09-09 18:18:01 +08:00
9582cc7187 plusone-commons 修改了 IWithCode 和 IWithIntCode 的包名 2023-09-09 18:17:17 +08:00
a30e5bcd12 升级依赖 2023-09-09 18:14:41 +08:00
1c02b37442 优化代码。 2023-07-16 03:28:17 +08:00
68f6ce5b8f Merge branch 'dev' of http://zhouxy.xyz:3000/ZhouXY108/plusone-admin into dev 2023-07-07 15:34:45 +08:00
bd42da6777 优化 MenuViewObject。 2023-07-07 15:33:49 +08:00
f83a05e429 改用 ValueSet 的静态工厂方法。 2023-05-16 17:41:29 +08:00
50 changed files with 282 additions and 278 deletions

View File

@@ -222,6 +222,10 @@
{ {
"code": 4040201, "code": 4040201,
"description": "不支持的 PrincipalType" "description": "不支持的 PrincipalType"
},
{
"code": 4040209,
"description": "不支持的菜单类型"
} }
] ]
}, },

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone-basic</artifactId> <artifactId>plusone-basic</artifactId>

View File

@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
/** /**
* 默认异常的处理器 * 默认异常的处理器
@@ -62,7 +62,7 @@ public class DefaultExceptionHandler extends BaseExceptionHandler {
DataAccessException.class, DataAccessException.class,
MethodArgumentNotValidException.class MethodArgumentNotValidException.class
}) })
public ResponseEntity<RestfulResult> handleException(Exception e) { public ResponseEntity<UnifiedResponse> handleException(Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return buildExceptionResponse(e); return buildExceptionResponse(e);
} }

View File

@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
import xyz.zhouxy.plusone.exception.SysException; import xyz.zhouxy.plusone.exception.SysException;
@RestControllerAdvice @RestControllerAdvice
@@ -21,9 +21,9 @@ public class SysExceptionHandler extends BaseExceptionHandler {
} }
@ExceptionHandler({ SysException.class }) @ExceptionHandler({ SysException.class })
public ResponseEntity<RestfulResult> handleException(@Nonnull Exception e) { public ResponseEntity<UnifiedResponse> handleException(@Nonnull Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
HttpStatus httpStatus = getHttpStatus(e); HttpStatus httpStatus = getHttpStatus(e);
return new ResponseEntity<>(RestfulResult.error(getErrorCode(e), "系统错误"), httpStatus); return new ResponseEntity<>(UnifiedResponse.error(getErrorCode(e), "系统错误"), httpStatus);
} }
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone-basic</artifactId> <artifactId>plusone-basic</artifactId>

View File

@@ -1,39 +1,39 @@
package xyz.zhouxy.plusone.exception; package xyz.zhouxy.plusone.exception;
import xyz.zhouxy.plusone.commons.exception.BaseException; import xyz.zhouxy.plusone.commons.exception.BaseRuntimeException;
/** /**
* 业务异常 * 业务异常
* *
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a> * @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
*/ */
public class BizException extends BaseException { public class BizException extends BaseRuntimeException {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = -5524759033245815405L; private static final long serialVersionUID = -5524759033245815405L;
public static final int DEFAULT_ERROR_CODE = 4000000; public static final String DEFAULT_ERROR_CODE = "4000000";
public BizException(int code, String msg) { public BizException(String code, String msg) {
super(code, msg); super(code, msg);
} }
public BizException(int code, Throwable cause) { public BizException(String code, Throwable cause) {
super(code, cause); super(code, cause);
} }
public BizException(int code, String msg, Throwable cause) { public BizException(String code, String msg, Throwable cause) {
super(code, msg, cause); super(code, msg, cause);
} }
public BizException(String msg) { public static BizException of(String msg) {
super(DEFAULT_ERROR_CODE, msg); return new BizException(DEFAULT_ERROR_CODE, msg);
} }
public BizException(Throwable cause) { public static BizException of(Throwable cause) {
super(DEFAULT_ERROR_CODE, cause); return new BizException(DEFAULT_ERROR_CODE, cause);
} }
public BizException(String msg, Throwable cause) { public static BizException of(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause); return new BizException(DEFAULT_ERROR_CODE, msg, cause);
} }
} }

View File

@@ -14,7 +14,7 @@ public class DataNotExistException extends BizException {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = 6536955800679703111L; private static final long serialVersionUID = 6536955800679703111L;
public static final int ERROR_CODE = 4110100; public static final String ERROR_CODE = "4110100";
public DataNotExistException() { public DataNotExistException() {
super(ERROR_CODE, "数据不存在"); super(ERROR_CODE, "数据不存在");

View File

@@ -18,7 +18,7 @@ public class DataOperationResultException extends SysException {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = -9220765735990318186L; private static final long serialVersionUID = -9220765735990318186L;
public static final int ERROR_CODE = 4110200; public static final String ERROR_CODE = "4110200";
public DataOperationResultException() { public DataOperationResultException() {
super(ERROR_CODE, "数据操作结果不符合预期"); super(ERROR_CODE, "数据操作结果不符合预期");

View File

@@ -1,34 +1,34 @@
package xyz.zhouxy.plusone.exception; package xyz.zhouxy.plusone.exception;
import xyz.zhouxy.plusone.commons.exception.BaseException; import xyz.zhouxy.plusone.commons.exception.BaseRuntimeException;
public class SysException extends BaseException { public class SysException extends BaseRuntimeException {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = 8821240827443168118L; private static final long serialVersionUID = 8821240827443168118L;
public static final int DEFAULT_ERROR_CODE = 5000000; public static final String DEFAULT_ERROR_CODE = "5000000";
public SysException(int code, String msg) { public SysException(String code, String msg) {
super(code, msg); super(code, msg);
} }
public SysException(int code, Throwable cause) { public SysException(String code, Throwable cause) {
super(code, cause); super(code, cause);
} }
public SysException(int code, String msg, Throwable cause) { public SysException(String code, String msg, Throwable cause) {
super(code, msg, cause); super(code, msg, cause);
} }
public SysException(String msg) { public static SysException of(String msg) {
super(DEFAULT_ERROR_CODE, msg); return new SysException(DEFAULT_ERROR_CODE, msg);
} }
public SysException(Throwable cause) { public static SysException of(Throwable cause) {
super(DEFAULT_ERROR_CODE, cause); return new SysException(DEFAULT_ERROR_CODE, cause);
} }
public SysException(String msg, Throwable cause) { public static SysException of(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause); return new SysException(DEFAULT_ERROR_CODE, msg, cause);
} }
} }

View File

@@ -14,28 +14,28 @@ public class UserOperationException extends BizException {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = 4371055414421991940L; private static final long serialVersionUID = 4371055414421991940L;
public static final int DEFAULT_ERROR_CODE = 4040600; public static final String DEFAULT_ERROR_CODE = "4040600";
public UserOperationException(String msg) { public UserOperationException(String code, String msg) {
super(DEFAULT_ERROR_CODE, msg);
}
public UserOperationException(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause);
}
public UserOperationException(int code, String msg) {
super(code, msg); super(code, msg);
} }
public UserOperationException(int code, Throwable cause) { public UserOperationException(String code, Throwable cause) {
super(code, cause); super(code, cause);
} }
public UserOperationException(int code, String msg, Throwable cause) { public UserOperationException(String code, String msg, Throwable cause) {
super(code, msg, cause); super(code, msg, cause);
} }
public static UserOperationException of(String msg) {
return new UserOperationException(DEFAULT_ERROR_CODE, msg);
}
public static UserOperationException of(String msg, Throwable cause) {
return new UserOperationException(DEFAULT_ERROR_CODE, msg, cause);
}
/** /**
* 无效的操作 * 无效的操作
* *
@@ -52,7 +52,7 @@ public class UserOperationException extends BizException {
* @return 异常对象 * @return 异常对象
*/ */
public static UserOperationException invalidOperation(String msg) { public static UserOperationException invalidOperation(String msg) {
return new UserOperationException(4040604, msg); return new UserOperationException("4040604", msg);
} }
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>xyz.zhouxy</groupId> <groupId>xyz.zhouxy</groupId>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>xyz.zhouxy</groupId> <groupId>xyz.zhouxy</groupId>

View File

@@ -1,10 +1,11 @@
package xyz.zhouxy.plusone.jdbc; package xyz.zhouxy.plusone.jdbc;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource; import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import xyz.zhouxy.plusone.commons.exception.IWithCode; import xyz.zhouxy.plusone.commons.base.IWithCode;
import xyz.zhouxy.plusone.commons.exception.IWithIntCode; import xyz.zhouxy.plusone.commons.base.IWithIntCode;
/** /**
* 扩展了 {@link BeanPropertySqlParameterSource},在将 POJO 转换为 * 扩展了 {@link BeanPropertySqlParameterSource},在将 POJO 转换为

View File

@@ -16,17 +16,19 @@ import xyz.zhouxy.plusone.spring.SpringContextHolder;
*/ */
public final class JdbcFactory { public final class JdbcFactory {
private static final ApplicationContext CONTEXT = SpringContextHolder.getContext(); private static final ApplicationContext SPRING_APPLICATION_CONTEXT = SpringContextHolder.getContext();
private static final JdbcTemplate JDBC_TEMPLATE = SPRING_APPLICATION_CONTEXT.getBean(JdbcTemplate.class);
private static final NamedParameterJdbcTemplate NAMED_PARAMETER_JDBC_TEMPLATE = SPRING_APPLICATION_CONTEXT.getBean(NamedParameterJdbcTemplate.class);
private JdbcFactory() { private JdbcFactory() {
throw new IllegalStateException("Utility class"); throw new IllegalStateException("Utility class");
} }
public static JdbcTemplate getJdbcTemplate() { public static JdbcTemplate getJdbcTemplate() {
return CONTEXT.getBean(JdbcTemplate.class); return JDBC_TEMPLATE;
} }
public static NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() { public static NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
return CONTEXT.getBean(NamedParameterJdbcTemplate.class); return NAMED_PARAMETER_JDBC_TEMPLATE;
} }
} }

View File

@@ -103,49 +103,49 @@ public abstract class PlusoneJdbcDaoSupport {
return Numbers.sum(i); return Numbers.sum(i);
} }
protected static final <T> void assertResultEquals(T result, T expectedValue) { protected static <T> void assertResultEquals(T result, T expectedValue) {
if (!Objects.equals(result, expectedValue)) { if (!Objects.equals(result, expectedValue)) {
throw new DataOperationResultException(); throw new DataOperationResultException();
} }
} }
protected static final <T> void assertResultEquals(T result, T expectedValue, Function<T, String> errMsg) { protected static <T> void assertResultEquals(T result, T expectedValue, Function<T, String> errMsg) {
if (!Objects.equals(result, expectedValue)) { if (!Objects.equals(result, expectedValue)) {
throw new DataOperationResultException(errMsg.apply(result)); throw new DataOperationResultException(errMsg.apply(result));
} }
} }
protected static final <T> void assertResultEquals(T result, T expectedValue, String msgTemplate, Object... args) { protected static <T> void assertResultEquals(T result, T expectedValue, String msgTemplate, Object... args) {
if (!Objects.equals(result, expectedValue)) { if (!Objects.equals(result, expectedValue)) {
throw new DataOperationResultException(String.format(msgTemplate, args)); throw new DataOperationResultException(String.format(msgTemplate, args));
} }
} }
protected static final <T, E extends Throwable> void assertResultEqualsOrThrow(T result, T expectedValue, protected static <T, E extends Throwable> void assertResultEqualsOrThrow(T result, T expectedValue,
Function<T, E> e) throws E { Function<T, E> e) throws E {
if (!Objects.equals(result, expectedValue)) { if (!Objects.equals(result, expectedValue)) {
throw e.apply(result); throw e.apply(result);
} }
} }
protected static final void assertUpdateOneRow(int result) { protected static void assertUpdateOneRow(int result) {
assertResultEquals(result, 1); assertResultEquals(result, 1);
} }
protected static final void assertUpdateOneRow(int result, Function<Integer, String> errMsg) { protected static void assertUpdateOneRow(int result, Function<Integer, String> errMsg) {
assertResultEquals(result, 1, errMsg); assertResultEquals(result, 1, errMsg);
} }
protected static final void assertUpdateOneRow(int result, String msgTemplate, Object... args) { protected static void assertUpdateOneRow(int result, String msgTemplate, Object... args) {
assertResultEquals(result, 1, msgTemplate, args); assertResultEquals(result, 1, msgTemplate, args);
} }
protected static final <E extends Throwable> void assertUpdateOneRowOrThrow(int result, Function<Integer, E> e) protected static <E extends Throwable> void assertUpdateOneRowOrThrow(int result, Function<Integer, E> e)
throws E { throws E {
assertResultEqualsOrThrow(result, 1, e); assertResultEqualsOrThrow(result, 1, e);
} }
protected static final <T> SqlParameterSource[] buildSqlParameterSourceArray( protected static <T> SqlParameterSource[] buildSqlParameterSourceArray(
T[] c, T[] c,
@Nonnull Function<T, SqlParameterSource> paramSourceBuilder) { @Nonnull Function<T, SqlParameterSource> paramSourceBuilder) {
if (c == null || c.length == 0) { if (c == null || c.length == 0) {
@@ -154,7 +154,7 @@ public abstract class PlusoneJdbcDaoSupport {
return buildSqlParameterSourceArray(Arrays.stream(c), paramSourceBuilder); return buildSqlParameterSourceArray(Arrays.stream(c), paramSourceBuilder);
} }
protected static final <T> SqlParameterSource[] buildSqlParameterSourceArray( protected static <T> SqlParameterSource[] buildSqlParameterSourceArray(
Collection<T> c, Collection<T> c,
@Nonnull Function<T, SqlParameterSource> paramSourceBuilder) { @Nonnull Function<T, SqlParameterSource> paramSourceBuilder) {
if (CollectionUtils.isEmpty(c)) { if (CollectionUtils.isEmpty(c)) {
@@ -163,7 +163,7 @@ public abstract class PlusoneJdbcDaoSupport {
return buildSqlParameterSourceArray(c.stream(), paramSourceBuilder); return buildSqlParameterSourceArray(c.stream(), paramSourceBuilder);
} }
protected static final <T> SqlParameterSource[] buildSqlParameterSourceArray( protected static <T> SqlParameterSource[] buildSqlParameterSourceArray(
Stream<T> stream, Stream<T> stream,
@Nonnull Function<T, SqlParameterSource> paramSourceBuilder) { @Nonnull Function<T, SqlParameterSource> paramSourceBuilder) {
Objects.requireNonNull(stream); Objects.requireNonNull(stream);

View File

@@ -186,7 +186,7 @@ public class FastDFSUtil {
var sha512Hex = new BigInteger(1, result).toString(16); var sha512Hex = new BigInteger(1, result).toString(16);
return Objects.requireNonNull(sha512Hex); return Objects.requireNonNull(sha512Hex);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
throw new SysException(e); throw SysException.of(e);
} }
} }
} }

View File

@@ -1,5 +1,7 @@
package xyz.zhouxy.plusone.sms; package xyz.zhouxy.plusone.sms;
import org.springframework.stereotype.Service;
import com.tencentcloudapi.common.Credential; import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile; import com.tencentcloudapi.common.profile.ClientProfile;
@@ -8,11 +10,8 @@ import com.tencentcloudapi.sms.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest; import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse; import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import xyz.zhouxy.plusone.constant.ErrorCodeConsts; import xyz.zhouxy.plusone.exception.SysException;
import xyz.zhouxy.plusone.exception.BizException;
import xyz.zhouxy.plusone.sms.SmsProperties.SmsCredentialProperties; import xyz.zhouxy.plusone.sms.SmsProperties.SmsCredentialProperties;
import xyz.zhouxy.plusone.sms.SmsProperties.SmsHttpProperties; import xyz.zhouxy.plusone.sms.SmsProperties.SmsHttpProperties;
import xyz.zhouxy.plusone.sms.SmsProperties.SmsProxyProperties; import xyz.zhouxy.plusone.sms.SmsProperties.SmsProxyProperties;
@@ -69,7 +68,7 @@ public class TencentSmsServiceImpl implements SmsService {
} catch (TencentCloudSDKException e) { } catch (TencentCloudSDKException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BizException(ErrorCodeConsts.DEFAULT_ERROR_CODE, e); throw SysException.of(e);
} }
} }

View File

@@ -4,15 +4,13 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
public class SpringContextHolder { public enum SpringContextHolder {
INSTANCE
;
private ApplicationContext context; private ApplicationContext context;
private static final SpringContextHolder INSTANCE = new SpringContextHolder();
private SpringContextHolder() {
}
public static ApplicationContext getContext() { public static ApplicationContext getContext() {
return INSTANCE.context; return INSTANCE.context;
} }

View File

@@ -12,6 +12,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class WebCorsConfig implements WebMvcConfigurer { public class WebCorsConfig implements WebMvcConfigurer {
// TODO 不放行全部,通过配置文件配置允许访问的域名
@Override @Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") registry.addMapping("/**")

View File

@@ -36,7 +36,7 @@ class LoginCommandValidator extends BaseValidator<LoginCommand> {
private LoginCommandValidator() { private LoginCommandValidator() {
ruleForString(LoginCommand::getAccount) ruleForString(LoginCommand::getAccount)
.notNull("邮箱地址不能为空") .notNull("邮箱地址不能为空")
.matchesOr(new Pattern[] { PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE }, .matchesOne(new Pattern[] { PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE },
value -> new RuntimeException('"' + value + "\" 不是邮箱地址或手机号")); value -> new RuntimeException('"' + value + "\" 不是邮箱地址或手机号"));
ruleForString(LoginCommand::getPwd) ruleForString(LoginCommand::getPwd)
.notNull("密码不能为空") .notNull("密码不能为空")

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone</artifactId> <artifactId>plusone</artifactId>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone</artifactId> <artifactId>plusone</artifactId>

View File

@@ -0,0 +1,33 @@
package xyz.zhouxy.plusone;
import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import lombok.extern.slf4j.Slf4j;
import xyz.zhouxy.plusone.system.application.query.AccountQueries;
import xyz.zhouxy.plusone.system.application.query.params.AccountQueryParams;
import xyz.zhouxy.plusone.system.application.query.result.AccountOverview;
@Slf4j
@SpringBootTest(classes = PlusoneApplication.class)
class AccountQueriesTests {
@Resource
AccountQueries accountQueries;
@Test
void testQueryPage() {
AccountQueryParams queryParams = new AccountQueryParams();
// queryParams.setOrderBy(List.of("email", "mobile_phone", "id"));
queryParams.setSize(20);
queryParams.setPageNum(1L);
queryParams.setOrderBy(Collections.emptyList());
List<AccountOverview> l = accountQueries.queryAccountOverview(queryParams);
log.info("l: {}", l);
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone-system</artifactId> <artifactId>plusone-system</artifactId>

View File

@@ -10,13 +10,13 @@ public class AccountLoginException extends BizException {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = -3040996790739138556L; private static final long serialVersionUID = -3040996790739138556L;
private static final int DEFAULT_ERR_CODE = 4030000; private static final String DEFAULT_ERR_CODE = "4030000";
private AccountLoginException() { private AccountLoginException() {
super(DEFAULT_ERR_CODE, "用户登录异常"); super(DEFAULT_ERR_CODE, "用户登录异常");
} }
private AccountLoginException(int code, String message) { private AccountLoginException(String code, String message) {
super(code, message); super(code, message);
} }
@@ -25,7 +25,7 @@ public class AccountLoginException extends BizException {
} }
public static AccountLoginException accountNotExistException(String msg) { public static AccountLoginException accountNotExistException(String msg) {
return new AccountLoginException(4030101, msg); return new AccountLoginException("4030101", msg);
} }
public static AccountLoginException otpErrorException() { public static AccountLoginException otpErrorException() {
@@ -33,7 +33,7 @@ public class AccountLoginException extends BizException {
} }
public static AccountLoginException otpErrorException(String msg) { public static AccountLoginException otpErrorException(String msg) {
return new AccountLoginException(4030501, msg); return new AccountLoginException("4030501", msg);
} }
public static AccountLoginException otpNotExistsException() { public static AccountLoginException otpNotExistsException() {
@@ -41,7 +41,7 @@ public class AccountLoginException extends BizException {
} }
public static AccountLoginException otpNotExistsException(String msg) { public static AccountLoginException otpNotExistsException(String msg) {
return new AccountLoginException(4030502, msg); return new AccountLoginException("4030502", msg);
} }
public static AccountLoginException passwordErrorException() { public static AccountLoginException passwordErrorException() {
@@ -49,6 +49,6 @@ public class AccountLoginException extends BizException {
} }
public static AccountLoginException passwordErrorException(String msg) { public static AccountLoginException passwordErrorException(String msg) {
return new AccountLoginException(4030200, msg); return new AccountLoginException("4030200", msg);
} }
} }

View File

@@ -12,46 +12,46 @@ public class AccountRegisterException extends BizException {
private static final long serialVersionUID = 7580245181633370195L; private static final long serialVersionUID = 7580245181633370195L;
public AccountRegisterException() { public AccountRegisterException() {
this(4020000, "用户注册错误"); this("4020000", "用户注册错误");
} }
public AccountRegisterException(String message) { public AccountRegisterException(String message) {
this(4020000, message); this("4020000", message);
} }
public AccountRegisterException(Throwable cause) { public AccountRegisterException(Throwable cause) {
super(4020000, cause); super("4020000", cause);
} }
public AccountRegisterException(int code, String message) { public AccountRegisterException(String code, String message) {
super(code, message); super(code, message);
} }
public AccountRegisterException(int code, Throwable cause) { public AccountRegisterException(String code, Throwable cause) {
super(code, cause); super(code, cause);
} }
public static AccountRegisterException emailOrMobilePhoneRequiredException() { public static AccountRegisterException emailOrMobilePhoneRequiredException() {
return new AccountRegisterException(4020300, "邮箱和手机号应至少绑定一个"); return new AccountRegisterException("4020300", "邮箱和手机号应至少绑定一个");
} }
public static AccountRegisterException usernameAlreadyExists(String username) { public static AccountRegisterException usernameAlreadyExists(String username) {
return new AccountRegisterException(4020400, String.format("用户名 %s 已存在", username)); return new AccountRegisterException("4020400", String.format("用户名 %s 已存在", username));
} }
public static AccountRegisterException emailAlreadyExists(String value) { public static AccountRegisterException emailAlreadyExists(String value) {
return new AccountRegisterException(4020500, String.format("邮箱 %s 已存在", value)); return new AccountRegisterException("4020500", String.format("邮箱 %s 已存在", value));
} }
public static AccountRegisterException mobilePhoneAlreadyExists(String value) { public static AccountRegisterException mobilePhoneAlreadyExists(String value) {
return new AccountRegisterException(4020600, String.format("手机号 %s 已存在", value)); return new AccountRegisterException("4020600", String.format("手机号 %s 已存在", value));
} }
public static AccountRegisterException codeErrorException() { public static AccountRegisterException codeErrorException() {
return new AccountRegisterException(4020701, "校验码错误"); return new AccountRegisterException("4020701", "校验码错误");
} }
public static AccountRegisterException codeNotExistsException() { public static AccountRegisterException codeNotExistsException() {
return new AccountRegisterException(4020702, "校验码不存在或已过期"); return new AccountRegisterException("4020702", "校验码不存在或已过期");
} }
} }

View File

@@ -7,11 +7,13 @@ public class UnsupportedMenuTypeException extends InvalidInputException {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = -769169844015637730L; private static final long serialVersionUID = -769169844015637730L;
public static final String ERROR_CODE = "4040209";
public UnsupportedMenuTypeException() { public UnsupportedMenuTypeException() {
this("不支持的菜单类型"); this("不支持的菜单类型");
} }
public UnsupportedMenuTypeException(String message) { public UnsupportedMenuTypeException(String message) {
super(message); super(ERROR_CODE, message);
} }
} }

View File

@@ -11,7 +11,7 @@ public class UnsupportedPrincipalTypeException extends BizException {
private static final long serialVersionUID = 5207757290868470762L; private static final long serialVersionUID = 5207757290868470762L;
public static final int ERR_CODE = 4040201; public static final String ERR_CODE = "4040201";
private static final String DEFAULT_ERROR_MSG = "不支持的 PrincipalType"; private static final String DEFAULT_ERROR_MSG = "不支持的 PrincipalType";
public UnsupportedPrincipalTypeException() { public UnsupportedPrincipalTypeException() {

View File

@@ -1,22 +1,26 @@
package xyz.zhouxy.plusone.system.application.common.exception.handler; package xyz.zhouxy.plusone.system.application.common.exception.handler;
import java.util.Objects;
import javax.annotation.Nonnull;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
import xyz.zhouxy.plusone.system.application.common.exception.AccountLoginException; import xyz.zhouxy.plusone.system.application.common.exception.AccountLoginException;
@RestControllerAdvice @RestControllerAdvice
public class AccountLoginExceptionHandler extends BaseExceptionHandler { public class AccountLoginExceptionHandler extends BaseExceptionHandler {
public AccountLoginExceptionHandler(ExceptionInfoHolder exceptionInfoHolder) { public AccountLoginExceptionHandler(@Nonnull ExceptionInfoHolder exceptionInfoHolder) {
super(exceptionInfoHolder); super(exceptionInfoHolder);
} }
@ExceptionHandler({ AccountLoginException.class }) @ExceptionHandler({ AccountLoginException.class })
public ResponseEntity<RestfulResult> handleException(Exception e) { public ResponseEntity<UnifiedResponse> handleException(Exception e) {
return buildExceptionResponse(e); return buildExceptionResponse(Objects.requireNonNull(e));
} }
} }

View File

@@ -17,7 +17,7 @@ import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.exception.SameTokenInvalidException; import cn.dev33.satoken.exception.SameTokenInvalidException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler; import xyz.zhouxy.plusone.commons.exception.handler.BaseExceptionHandler;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
/** /**
* Sa-Token 异常处理器 * Sa-Token 异常处理器
@@ -52,7 +52,7 @@ public class SaTokenExceptionHandler extends BaseExceptionHandler {
} }
@ExceptionHandler(SaTokenException.class) @ExceptionHandler(SaTokenException.class)
public ResponseEntity<RestfulResult> handleSaTokenException(SaTokenException e) { public ResponseEntity<UnifiedResponse> handleSaTokenException(SaTokenException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return buildExceptionResponse(e); return buildExceptionResponse(e);
} }

View File

@@ -59,7 +59,7 @@ public class AuthenticationInfo<T> {
if (this.metadata.containsKey(key)) { if (this.metadata.containsKey(key)) {
return this.metadata.get(key); return this.metadata.get(key);
} }
throw new BizException(String.format("不存在 key 为 \"%s\"的元数据。", key)); throw BizException.of(String.format("不存在 key 为 \"%s\"的元数据。", key));
} }
public OptionalDouble getMetadataAsDouble(String key) { public OptionalDouble getMetadataAsDouble(String key) {

View File

@@ -1,61 +0,0 @@
package xyz.zhouxy.plusone.system.application.common.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import xyz.zhouxy.plusone.domain.IWithOrderNumber;
import xyz.zhouxy.plusone.system.application.query.result.MenuViewObject;
import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType;
/**
* 菜单工具类
*
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
*/
public class MenuUtil {
private MenuUtil() {
throw new IllegalStateException("Utility class");
}
/**
* 构建菜单树
*
* @param allMenus 菜单列表
* @return 菜单树
*/
public static List<MenuViewObject> buildMenuTree(Collection<MenuViewObject> allMenus) {
// 先排序,保证添加到 rootMenus 中的顺序,以及 addChild 添加的子菜单的顺序
allMenus = allMenus.stream()
.sorted(Comparator.comparing(IWithOrderNumber::getOrderNumber))
.toList();
// 一级菜单
List<MenuViewObject> rootMenus = new ArrayList<>();
// key: 菜单 id; value: 菜单对象. 方便根据 id 查找相应对象。
Map<Long, MenuViewObject> menuListMap = new HashMap<>();
for (var menu : allMenus) {
// 添加 MENU_LIST 到 map 中,方便后面调用对象的方法
if (menu.getType() == MenuType.MENU_LIST.ordinal()) {
menuListMap.put(menu.getId(), menu);
}
// 一级菜单
if (menu.getParentId() == 0) {
rootMenus.add(menu);
}
}
for (var menu : allMenus) {
var parent = menuListMap.getOrDefault(menu.getParentId(), null);
// 父菜单存在于 map 中,调用父菜单的 addChild 方法将当前菜单添加为父菜单的子菜单。
if (parent != null) {
parent.addChild(menu);
}
}
return rootMenus;
}
}

View File

@@ -2,9 +2,10 @@ package xyz.zhouxy.plusone.system.application.query.result;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.SortedSet;
import java.util.TreeSet;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
@@ -81,18 +82,18 @@ public class MenuViewObject implements IWithOrderNumber {
List<Action> actions; List<Action> actions;
// MENU_LIST // MENU_LIST
List<MenuViewObject> children; SortedSet<MenuViewObject> children;
public void addChild(MenuViewObject child) { public void addChild(MenuViewObject child) {
if (this.children == null) { if (this.children == null) {
this.children = new ArrayList<>(); this.children = new TreeSet<>();
} }
this.children.add(child); this.children.add(child);
} }
public void addChildren(Collection<MenuViewObject> children) { public void addChildren(Collection<MenuViewObject> children) {
if (this.children == null) { if (this.children == null) {
this.children = new ArrayList<>(); this.children = new TreeSet<>();
} }
this.children.addAll(children); this.children.addAll(children);
} }
@@ -121,11 +122,33 @@ public class MenuViewObject implements IWithOrderNumber {
} }
public List<MenuViewObject> getChildren() { public List<MenuViewObject> getChildren() {
return Objects.nonNull(this.children) return this.children == null || this.children.isEmpty()
? this.children ? Collections.emptyList()
.stream() : new ArrayList<>(this.children);
.sorted(Comparator.comparing(IWithOrderNumber::getOrderNumber)) }
.toList()
: null; @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MenuViewObject other = (MenuViewObject) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
} }
} }

View File

@@ -1,7 +1,6 @@
package xyz.zhouxy.plusone.system.application.service; package xyz.zhouxy.plusone.system.application.service;
import java.util.Comparator; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@@ -13,8 +12,8 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import xyz.zhouxy.plusone.commons.util.MoreCollections;
import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.domain.IWithOrderNumber;
import xyz.zhouxy.plusone.exception.DataNotExistException; import xyz.zhouxy.plusone.exception.DataNotExistException;
import xyz.zhouxy.plusone.system.application.common.exception.UnsupportedMenuTypeException; import xyz.zhouxy.plusone.system.application.common.exception.UnsupportedMenuTypeException;
import xyz.zhouxy.plusone.system.application.query.result.MenuViewObject; import xyz.zhouxy.plusone.system.application.query.result.MenuViewObject;
@@ -108,7 +107,7 @@ public class MenuManagementService {
command.getIcon(), command.getIcon(),
command.getHidden(), command.getHidden(),
command.getOrderNumber(), command.getOrderNumber(),
EntityStatus.of(command.getStatus()), EntityStatus.of(command.getStatus()),
command.getComponent(), command.getComponent(),
command.getResource(), command.getResource(),
command.getCache(), command.getCache(),
@@ -139,38 +138,33 @@ public class MenuManagementService {
@Transactional(propagation = Propagation.SUPPORTS) @Transactional(propagation = Propagation.SUPPORTS)
public List<MenuViewObject> buildMenuTree(List<MenuViewObject> menus) { public List<MenuViewObject> buildMenuTree(List<MenuViewObject> menus) {
List<MenuViewObject> rootMenus = menus // 创建并填充 Map
.stream() final Map<Long, MenuViewObject> menuMap = MoreCollections.toHashMap(menus, MenuViewObject::getId);
.filter(menu -> Objects.equals(menu.getParentId(), 0L))
.toList();
Map<Long, MenuViewObject> allMenus = new HashMap<>();
for (var item : menus) {
allMenus.put(item.getId(), item);
}
for (MenuViewObject menu : menus) { for (MenuViewObject menu : menus) {
long parentId = menu.getParentId(); long parentId = menu.getParentId();
while (parentId != 0 && !allMenus.containsKey(parentId)) { if (parentId != 0L) {
MenuViewObject parent = findById(parentId); while (!menuMap.containsKey(parentId)) {
if (parent == null) { MenuViewObject parent = findById(parentId);
break; if (parent == null) {
break;
}
menuMap.put(parent.getId(), parent);
parentId = parent.getParentId();
} }
allMenus.put(parent.getId(), parent);
parentId = parent.getParentId();
} }
} }
for (var menu : allMenus.values()) { Collection<MenuViewObject> allMenus = menuMap.values();
var parent = allMenus.getOrDefault(menu.getParentId(), null); for (var menu : allMenus) {
var parent = menuMap.get(menu.getParentId());
if (parent != null) { if (parent != null) {
parent.addChild(menu); parent.addChild(menu);
} }
} }
return rootMenus return allMenus.stream()
.stream() .filter(menu -> (menu != null) && Objects.equals(menu.getParentId(), 0L))
.sorted(Comparator.comparing(IWithOrderNumber::getOrderNumber)) .sorted()
.toList(); .toList();
} }
} }

View File

@@ -16,7 +16,7 @@ public class LoginByOtpCommandValidator extends BaseValidator<LoginByOtpCommand>
ruleForString(LoginByOtpCommand::getPrincipal) ruleForString(LoginByOtpCommand::getPrincipal)
.notNull("输入邮箱地址或手机号") .notNull("输入邮箱地址或手机号")
.notEmpty("输入邮箱地址或手机号") .notEmpty("输入邮箱地址或手机号")
.matchesOr(List.of(PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE), "输入用户名、邮箱地址或手机号"); .matchesOne(List.of(PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE), "输入用户名、邮箱地址或手机号");
ruleForString(LoginByOtpCommand::getOtp) ruleForString(LoginByOtpCommand::getOtp)
.notNull("验证码不能为空") .notNull("验证码不能为空")
.notEmpty("验证码不能为空") .notEmpty("验证码不能为空")

View File

@@ -15,7 +15,7 @@ public class LoginByPasswordCommandValidator extends BaseValidator<LoginByPasswo
ruleForString(LoginByPasswordCommand::getPrincipal) ruleForString(LoginByPasswordCommand::getPrincipal)
.notNull("输入用户名、邮箱地址或手机号") .notNull("输入用户名、邮箱地址或手机号")
.notEmpty("输入用户名、邮箱地址或手机号") .notEmpty("输入用户名、邮箱地址或手机号")
.matchesOr(List.of(PatternConsts.USERNAME, PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE), .matchesOne(List.of(PatternConsts.USERNAME, PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE),
"输入用户名、邮箱地址或手机号"); "输入用户名、邮箱地址或手机号");
ruleForString(LoginByPasswordCommand::getPassword) ruleForString(LoginByPasswordCommand::getPassword)
.notNull("密码不能为空") .notNull("密码不能为空")

View File

@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
import xyz.zhouxy.plusone.system.application.service.AccountContextService; import xyz.zhouxy.plusone.system.application.service.AccountContextService;
import xyz.zhouxy.plusone.system.application.service.command.ChangePasswordCommand; import xyz.zhouxy.plusone.system.application.service.command.ChangePasswordCommand;
import xyz.zhouxy.plusone.system.application.service.command.ChangePasswordWithoutLoginCommand; import xyz.zhouxy.plusone.system.application.service.command.ChangePasswordWithoutLoginCommand;
@@ -28,34 +28,34 @@ public class AccountContextController {
} }
@GetMapping("info") @GetMapping("info")
public RestfulResult getAccountInfo() { public UnifiedResponse getAccountInfo() {
adminAuthLogic.checkLogin(); adminAuthLogic.checkLogin();
var result = service.getAccountInfo(); var result = service.getAccountInfo();
return RestfulResult.success("查询成功", result); return UnifiedResponse.success("查询成功", result);
} }
@GetMapping("logout") @GetMapping("logout")
public RestfulResult logout() { public UnifiedResponse logout() {
service.logout(); service.logout();
return RestfulResult.success("注销成功"); return UnifiedResponse.success("注销成功");
} }
@GetMapping("menus") @GetMapping("menus")
public RestfulResult getMenuTree() { public UnifiedResponse getMenuTree() {
adminAuthLogic.checkLogin(); adminAuthLogic.checkLogin();
var result = service.getMenuTree(); var result = service.getMenuTree();
return RestfulResult.success("查询成功", result); return UnifiedResponse.success("查询成功", result);
} }
@PostMapping("changePassword") @PostMapping("changePassword")
public RestfulResult changePassword(ChangePasswordCommand command) { public UnifiedResponse changePassword(ChangePasswordCommand command) {
service.changePassword(command); service.changePassword(command);
return RestfulResult.success("修改成功,请重新登录。"); return UnifiedResponse.success("修改成功,请重新登录。");
} }
@PostMapping("changePasswordWithoutLogin") @PostMapping("changePasswordWithoutLogin")
public RestfulResult changePasswordWithoutLogin(ChangePasswordWithoutLoginCommand command) { public UnifiedResponse changePasswordWithoutLogin(ChangePasswordWithoutLoginCommand command) {
service.changePasswordWithoutLogin(command); service.changePasswordWithoutLogin(command);
return RestfulResult.success("修改成功,请重新登录。"); return UnifiedResponse.success("修改成功,请重新登录。");
} }
} }

View File

@@ -1,7 +1,7 @@
package xyz.zhouxy.plusone.system.application.web.controller; package xyz.zhouxy.plusone.system.application.web.controller;
import static xyz.zhouxy.plusone.system.constant.AuthLogic.adminAuthLogic; import static xyz.zhouxy.plusone.system.constant.AuthLogic.adminAuthLogic;
import static xyz.zhouxy.plusone.commons.util.RestfulResult.success; import static xyz.zhouxy.plusone.commons.util.UnifiedResponse.success;
import java.util.List; import java.util.List;
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
import xyz.zhouxy.plusone.system.application.query.params.AccountQueryParams; import xyz.zhouxy.plusone.system.application.query.params.AccountQueryParams;
import xyz.zhouxy.plusone.system.application.service.AccountManagementService; import xyz.zhouxy.plusone.system.application.service.AccountManagementService;
import xyz.zhouxy.plusone.system.application.service.command.CreateAccountCommand; import xyz.zhouxy.plusone.system.application.service.command.CreateAccountCommand;
@@ -38,7 +38,7 @@ public class AccountManagementController {
} }
@PostMapping @PostMapping
public RestfulResult createAccount(@RequestBody @Valid CreateAccountCommand command) { public UnifiedResponse createAccount(@RequestBody @Valid CreateAccountCommand command) {
adminAuthLogic.checkLogin(); adminAuthLogic.checkLogin();
adminAuthLogic.checkPermission("sys-account-create"); adminAuthLogic.checkPermission("sys-account-create");
service.createAccount(command); service.createAccount(command);
@@ -46,7 +46,7 @@ public class AccountManagementController {
} }
@DeleteMapping @DeleteMapping
public RestfulResult deleteAccounts(@RequestBody List<Long> ids) { public UnifiedResponse deleteAccounts(@RequestBody List<Long> ids) {
adminAuthLogic.checkLogin(); adminAuthLogic.checkLogin();
adminAuthLogic.checkPermission("sys-account-delete"); adminAuthLogic.checkPermission("sys-account-delete");
service.deleteAccounts(ids); service.deleteAccounts(ids);
@@ -54,7 +54,7 @@ public class AccountManagementController {
} }
@PatchMapping("{id}") @PatchMapping("{id}")
public RestfulResult updateAccountInfo( public UnifiedResponse updateAccountInfo(
@PathVariable("id") Long id, @PathVariable("id") Long id,
@RequestBody @Valid UpdateAccountCommand command) { @RequestBody @Valid UpdateAccountCommand command) {
adminAuthLogic.checkLogin(); adminAuthLogic.checkLogin();
@@ -64,7 +64,7 @@ public class AccountManagementController {
} }
@GetMapping("query") @GetMapping("query")
public RestfulResult queryAccountOverviewList(AccountQueryParams queryParams) { public UnifiedResponse queryAccountOverviewList(AccountQueryParams queryParams) {
adminAuthLogic.checkLogin(); adminAuthLogic.checkLogin();
adminAuthLogic.checkPermission("sys-account-list"); adminAuthLogic.checkPermission("sys-account-list");
var accountOverviewList = service.queryAccountOverviewList(queryParams); var accountOverviewList = service.queryAccountOverviewList(queryParams);
@@ -72,7 +72,7 @@ public class AccountManagementController {
} }
@GetMapping("{accountId}") @GetMapping("{accountId}")
public RestfulResult queryAccountDetails(@PathVariable("accountId") Long accountId) { public UnifiedResponse queryAccountDetails(@PathVariable("accountId") Long accountId) {
adminAuthLogic.checkLogin(); adminAuthLogic.checkLogin();
adminAuthLogic.checkPermission("sys-account-details"); adminAuthLogic.checkPermission("sys-account-details");
var accountDetails = service.queryAccountDetails(accountId); var accountDetails = service.queryAccountDetails(accountId);

View File

@@ -1,6 +1,6 @@
package xyz.zhouxy.plusone.system.application.web.controller; package xyz.zhouxy.plusone.system.application.web.controller;
import static xyz.zhouxy.plusone.commons.util.RestfulResult.success; import static xyz.zhouxy.plusone.commons.util.UnifiedResponse.success;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
import xyz.zhouxy.plusone.system.application.service.AdminLoginService; import xyz.zhouxy.plusone.system.application.service.AdminLoginService;
import xyz.zhouxy.plusone.system.application.service.command.LoginByOtpCommand; import xyz.zhouxy.plusone.system.application.service.command.LoginByOtpCommand;
import xyz.zhouxy.plusone.system.application.service.command.LoginByPasswordCommand; import xyz.zhouxy.plusone.system.application.service.command.LoginByPasswordCommand;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
/** /**
* Admin 账号登录 * Admin 账号登录
@@ -30,19 +30,19 @@ public class AdminLoginController {
} }
@PostMapping("byPassword") @PostMapping("byPassword")
public RestfulResult loginByPassword(@RequestBody LoginByPasswordCommand command) { public UnifiedResponse loginByPassword(@RequestBody LoginByPasswordCommand command) {
var loginInfo = service.loginByPassword(command); var loginInfo = service.loginByPassword(command);
return success("登录成功", loginInfo); return success("登录成功", loginInfo);
} }
@PostMapping("byOtp") @PostMapping("byOtp")
public RestfulResult loginByOtp(@RequestBody LoginByOtpCommand command) { public UnifiedResponse loginByOtp(@RequestBody LoginByOtpCommand command) {
var loginInfo = service.loginByOtp(command); var loginInfo = service.loginByOtp(command);
return success("登录成功", loginInfo); return success("登录成功", loginInfo);
} }
@GetMapping("sendOtp") @GetMapping("sendOtp")
public RestfulResult sendOtp(@RequestParam String principal) { public UnifiedResponse sendOtp(@RequestParam String principal) {
service.sendOtp(principal); service.sendOtp(principal);
return success("发送成功"); return success("发送成功");
} }

View File

@@ -1,7 +1,7 @@
package xyz.zhouxy.plusone.system.application.web.controller; package xyz.zhouxy.plusone.system.application.web.controller;
import static xyz.zhouxy.plusone.system.constant.AuthLogic.adminAuthLogic; import static xyz.zhouxy.plusone.system.constant.AuthLogic.adminAuthLogic;
import static xyz.zhouxy.plusone.commons.util.RestfulResult.success; import static xyz.zhouxy.plusone.commons.util.UnifiedResponse.success;
import java.util.List; import java.util.List;
@@ -20,7 +20,7 @@ import xyz.zhouxy.plusone.system.application.query.params.DictQueryParams;
import xyz.zhouxy.plusone.system.application.service.DictManagementService; import xyz.zhouxy.plusone.system.application.service.DictManagementService;
import xyz.zhouxy.plusone.system.application.service.command.CreateDictCommand; import xyz.zhouxy.plusone.system.application.service.command.CreateDictCommand;
import xyz.zhouxy.plusone.system.application.service.command.UpdateDictCommand; import xyz.zhouxy.plusone.system.application.service.command.UpdateDictCommand;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
/** /**
* 数据字典管理 * 数据字典管理
@@ -38,21 +38,21 @@ public class DictManagementController {
} }
@PostMapping @PostMapping
public RestfulResult createDict(@RequestBody @Valid CreateDictCommand command) { public UnifiedResponse createDict(@RequestBody @Valid CreateDictCommand command) {
adminAuthLogic.checkPermission("sys-dict-create"); adminAuthLogic.checkPermission("sys-dict-create");
service.createDict(command); service.createDict(command);
return success(); return success();
} }
@DeleteMapping @DeleteMapping
public RestfulResult deleteDicts(@RequestBody List<Long> ids) { public UnifiedResponse deleteDicts(@RequestBody List<Long> ids) {
adminAuthLogic.checkPermission("sys-dict-delete"); adminAuthLogic.checkPermission("sys-dict-delete");
service.deleteDicts(ids); service.deleteDicts(ids);
return success(); return success();
} }
@PatchMapping("{id}") @PatchMapping("{id}")
public RestfulResult updateDict( public UnifiedResponse updateDict(
@PathVariable("id") Long id, @PathVariable("id") Long id,
@RequestBody @Valid UpdateDictCommand command) { @RequestBody @Valid UpdateDictCommand command) {
adminAuthLogic.checkPermission("sys-dict-update"); adminAuthLogic.checkPermission("sys-dict-update");
@@ -61,21 +61,21 @@ public class DictManagementController {
} }
@GetMapping("{dictId}") @GetMapping("{dictId}")
public RestfulResult findDictDetails(@PathVariable("dictId") Long dictId) { public UnifiedResponse findDictDetails(@PathVariable("dictId") Long dictId) {
adminAuthLogic.checkPermission("sys-dict-details"); adminAuthLogic.checkPermission("sys-dict-details");
var dictDetails = service.findDictDetails(dictId); var dictDetails = service.findDictDetails(dictId);
return success("查询成功", dictDetails); return success("查询成功", dictDetails);
} }
@GetMapping("all") @GetMapping("all")
public RestfulResult loadAllDicts() { public UnifiedResponse loadAllDicts() {
adminAuthLogic.checkPermissionAnd("sys-dict-list", "sys-dict-details"); adminAuthLogic.checkPermissionAnd("sys-dict-list", "sys-dict-details");
var dicts = service.loadAllDicts(); var dicts = service.loadAllDicts();
return success("查询成功", dicts); return success("查询成功", dicts);
} }
@GetMapping("query") @GetMapping("query")
public RestfulResult queryDictOverviewList(@Valid DictQueryParams queryParams) { public UnifiedResponse queryDictOverviewList(@Valid DictQueryParams queryParams) {
adminAuthLogic.checkPermission("sys-dict-list"); adminAuthLogic.checkPermission("sys-dict-list");
var dicts = service.queryDictOverviewList(queryParams); var dicts = service.queryDictOverviewList(queryParams);
return success("查询成功", dicts); return success("查询成功", dicts);

View File

@@ -1,7 +1,7 @@
package xyz.zhouxy.plusone.system.application.web.controller; package xyz.zhouxy.plusone.system.application.web.controller;
import static xyz.zhouxy.plusone.system.constant.AuthLogic.adminAuthLogic; import static xyz.zhouxy.plusone.system.constant.AuthLogic.adminAuthLogic;
import static xyz.zhouxy.plusone.commons.util.RestfulResult.success; import static xyz.zhouxy.plusone.commons.util.UnifiedResponse.success;
import javax.validation.Valid; import javax.validation.Valid;
@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import xyz.zhouxy.plusone.system.application.service.MenuManagementService; import xyz.zhouxy.plusone.system.application.service.MenuManagementService;
import xyz.zhouxy.plusone.system.application.service.command.CreateMenuCommand; import xyz.zhouxy.plusone.system.application.service.command.CreateMenuCommand;
import xyz.zhouxy.plusone.system.application.service.command.UpdateMenuCommand; import xyz.zhouxy.plusone.system.application.service.command.UpdateMenuCommand;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
/** /**
* 菜单管理 * 菜单管理
@@ -37,7 +37,7 @@ public class MenuManagementController {
// ==================== create ==================== // ==================== create ====================
@PostMapping @PostMapping
public RestfulResult createMenu(@RequestBody @Valid CreateMenuCommand command) { public UnifiedResponse createMenu(@RequestBody @Valid CreateMenuCommand command) {
adminAuthLogic.checkPermission("sys-menu-create"); adminAuthLogic.checkPermission("sys-menu-create");
service.createMenu(command); service.createMenu(command);
return success(); return success();
@@ -45,7 +45,7 @@ public class MenuManagementController {
// ==================== delete ==================== // ==================== delete ====================
@DeleteMapping("{id}") @DeleteMapping("{id}")
public RestfulResult deleteMenu(@PathVariable("id") Long id) { public UnifiedResponse deleteMenu(@PathVariable("id") Long id) {
adminAuthLogic.checkPermission("sys-menu-delete"); adminAuthLogic.checkPermission("sys-menu-delete");
service.deleteMenu(id); service.deleteMenu(id);
return success(); return success();
@@ -53,7 +53,7 @@ public class MenuManagementController {
// ==================== update ==================== // ==================== update ====================
@PatchMapping("{id}") @PatchMapping("{id}")
public RestfulResult updateMenu( public UnifiedResponse updateMenu(
@PathVariable("id") Long id, @PathVariable("id") Long id,
@RequestBody @Valid UpdateMenuCommand command) { @RequestBody @Valid UpdateMenuCommand command) {
adminAuthLogic.checkPermission("sys-menu-update"); adminAuthLogic.checkPermission("sys-menu-update");
@@ -63,21 +63,21 @@ public class MenuManagementController {
// ==================== query ==================== // ==================== query ====================
@GetMapping("{id}") @GetMapping("{id}")
public RestfulResult findById(@PathVariable("id") Long id) { public UnifiedResponse findById(@PathVariable("id") Long id) {
adminAuthLogic.checkPermission("sys-menu-details"); adminAuthLogic.checkPermission("sys-menu-details");
var result = service.findById(id); var result = service.findById(id);
return RestfulResult.success("查询成功", result); return UnifiedResponse.success("查询成功", result);
} }
@GetMapping("queryByAccountId") @GetMapping("queryByAccountId")
public RestfulResult queryByAccountId(@RequestParam Long accountId) { public UnifiedResponse queryByAccountId(@RequestParam Long accountId) {
adminAuthLogic.checkPermission("sys-menu-details"); adminAuthLogic.checkPermission("sys-menu-details");
var result = service.queryByAccountId(accountId); var result = service.queryByAccountId(accountId);
return success("查询成功", result); return success("查询成功", result);
} }
@GetMapping("queryByRoleId") @GetMapping("queryByRoleId")
public RestfulResult queryByRoleId(@RequestParam Long roleId) { public UnifiedResponse queryByRoleId(@RequestParam Long roleId) {
adminAuthLogic.checkPermission("sys-menu-details"); adminAuthLogic.checkPermission("sys-menu-details");
var result = service.queryByRoleId(roleId); var result = service.queryByRoleId(roleId);
return success("查询成功", result); return success("查询成功", result);

View File

@@ -1,6 +1,6 @@
package xyz.zhouxy.plusone.system.application.web.controller; package xyz.zhouxy.plusone.system.application.web.controller;
import static xyz.zhouxy.plusone.commons.util.RestfulResult.success; import static xyz.zhouxy.plusone.commons.util.UnifiedResponse.success;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
import xyz.zhouxy.plusone.system.application.service.RegisterAccountService; import xyz.zhouxy.plusone.system.application.service.RegisterAccountService;
import xyz.zhouxy.plusone.system.application.service.command.RegisterAccountCommand; import xyz.zhouxy.plusone.system.application.service.command.RegisterAccountCommand;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
/** /**
* 注册账号服务 * 注册账号服务
@@ -29,13 +29,13 @@ public class RegisterAccountController {
} }
@PostMapping @PostMapping
public RestfulResult registerAccount(@RequestBody RegisterAccountCommand command) { public UnifiedResponse registerAccount(@RequestBody RegisterAccountCommand command) {
service.registerAccount(command); service.registerAccount(command);
return success("注册成功"); return success("注册成功");
} }
@GetMapping("sendCode") @GetMapping("sendCode")
public RestfulResult sendCode(@RequestParam String principal) { public UnifiedResponse sendCode(@RequestParam String principal) {
service.sendCode(principal); service.sendCode(principal);
return success("发送成功"); return success("发送成功");
} }

View File

@@ -17,7 +17,7 @@ import xyz.zhouxy.plusone.system.application.query.params.RoleQueryParams;
import xyz.zhouxy.plusone.system.application.service.RoleManagementService; import xyz.zhouxy.plusone.system.application.service.RoleManagementService;
import xyz.zhouxy.plusone.system.application.service.command.CreateRoleCommand; import xyz.zhouxy.plusone.system.application.service.command.CreateRoleCommand;
import xyz.zhouxy.plusone.system.application.service.command.UpdateRoleCommand; import xyz.zhouxy.plusone.system.application.service.command.UpdateRoleCommand;
import xyz.zhouxy.plusone.commons.util.RestfulResult; import xyz.zhouxy.plusone.commons.util.UnifiedResponse;
/** /**
* 角色管理服务 * 角色管理服务
@@ -35,44 +35,44 @@ public class RoleManagementController {
} }
@PostMapping @PostMapping
public RestfulResult createRole(@RequestBody @Valid CreateRoleCommand command) { public UnifiedResponse createRole(@RequestBody @Valid CreateRoleCommand command) {
adminAuthLogic.checkPermission("sys-role-create"); adminAuthLogic.checkPermission("sys-role-create");
service.createRole(command); service.createRole(command);
return RestfulResult.success(); return UnifiedResponse.success();
} }
@PatchMapping @PatchMapping
public RestfulResult updateRole(@RequestBody @Valid UpdateRoleCommand command) { public UnifiedResponse updateRole(@RequestBody @Valid UpdateRoleCommand command) {
adminAuthLogic.checkPermission("sys-role-update"); adminAuthLogic.checkPermission("sys-role-update");
service.updateRole(command); service.updateRole(command);
return RestfulResult.success(); return UnifiedResponse.success();
} }
@DeleteMapping("{id}") @DeleteMapping("{id}")
public RestfulResult delete(@PathVariable("id") Long id) { public UnifiedResponse delete(@PathVariable("id") Long id) {
adminAuthLogic.checkPermission("sys-role-delete"); adminAuthLogic.checkPermission("sys-role-delete");
service.delete(id); service.delete(id);
return RestfulResult.success(); return UnifiedResponse.success();
} }
@GetMapping("exists") @GetMapping("exists")
public RestfulResult exists(@RequestParam("id") Long id) { public UnifiedResponse exists(@RequestParam("id") Long id) {
adminAuthLogic.checkPermissionOr("sys-role-list", "sys-role-details"); adminAuthLogic.checkPermissionOr("sys-role-list", "sys-role-details");
var isExists = service.exists(id); var isExists = service.exists(id);
return RestfulResult.success(isExists ? "存在" : "不存在", isExists); return UnifiedResponse.success(isExists ? "存在" : "不存在", isExists);
} }
@GetMapping("{id}") @GetMapping("{id}")
public RestfulResult findById(@PathVariable("id") Long id) { public UnifiedResponse findById(@PathVariable("id") Long id) {
adminAuthLogic.checkPermission("sys-role-details"); adminAuthLogic.checkPermission("sys-role-details");
var result = service.findById(id); var result = service.findById(id);
return RestfulResult.success("查询成功", result); return UnifiedResponse.success("查询成功", result);
} }
@GetMapping("query") @GetMapping("query")
public RestfulResult query(RoleQueryParams params) { public UnifiedResponse query(RoleQueryParams params) {
adminAuthLogic.checkPermission("sys-role-list"); adminAuthLogic.checkPermission("sys-role-list");
var result = service.query(params); var result = service.query(params);
return RestfulResult.success("查询成功", result); return UnifiedResponse.success("查询成功", result);
} }
} }

View File

@@ -87,10 +87,13 @@
AND sar.role_id = #{roleId} AND sar.role_id = #{roleId}
AND sr.deleted = 0 AND sr.deleted = 0
</if> </if>
<if test="orderBy != null"> <if test="orderBy != null and !orderBy.isEmpty()">
ORDER BY sa.${orderBy}, sa.id ORDER BY
<foreach item="col" index="index" collection="orderBy" open="" separator="," close="">
sa.${col}
</foreach>
</if> </if>
<if test="orderBy == null"> <if test="orderBy == null or orderBy.isEmpty()">
ORDER BY sa.id ORDER BY sa.id
</if> </if>
LIMIT #{size} OFFSET #{offset} LIMIT #{size} OFFSET #{offset}
@@ -99,7 +102,7 @@
</select> </select>
<!-- <!--
long count(SysAccountQuery queryParams); long count(AccountQueryParams queryParams);
--> -->
<select id="count" resultType="long"> <select id="count" resultType="long">
SELECT COUNT(*) SELECT COUNT(*)

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone-system</artifactId> <artifactId>plusone-system</artifactId>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>xyz.zhouxy</groupId> <groupId>xyz.zhouxy</groupId>

View File

@@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import xyz.zhouxy.plusone.commons.exception.IWithIntCode; import xyz.zhouxy.plusone.commons.base.IWithIntCode;
import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.domain.AggregateRoot; import xyz.zhouxy.plusone.domain.AggregateRoot;
import xyz.zhouxy.plusone.domain.IWithOrderNumber; import xyz.zhouxy.plusone.domain.IWithOrderNumber;

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone-system</artifactId> <artifactId>plusone-system</artifactId>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>plusone</artifactId> <artifactId>plusone</artifactId>

10
pom.xml
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -25,9 +25,9 @@
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<spring-boot.version>2.7.13</spring-boot.version> <spring-boot.version>2.7.18</spring-boot.version>
<sa-token.version>1.34.0</sa-token.version> <sa-token.version>1.34.0</sa-token.version>
<hutool.version>5.8.16</hutool.version> <hutool.version>5.8.20</hutool.version>
<mybatis-starter.version>3.0.1</mybatis-starter.version> <mybatis-starter.version>3.0.1</mybatis-starter.version>
<mybatis-plus.version>3.5.3.1</mybatis-plus.version> <mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<commons-io.version>2.11.0</commons-io.version> <commons-io.version>2.11.0</commons-io.version>
@@ -40,7 +40,7 @@
<commons-pool2.version>2.11.1</commons-pool2.version> <commons-pool2.version>2.11.1</commons-pool2.version>
<tencentcloud-sdk.version>3.1.681</tencentcloud-sdk.version> <tencentcloud-sdk.version>3.1.681</tencentcloud-sdk.version>
<fastdfs.version>1.30-SNAPSHOT</fastdfs.version> <fastdfs.version>1.30-SNAPSHOT</fastdfs.version>
<okio.version>3.0.0</okio.version> <okio.version>3.5.0</okio.version>
<okhttp.version>4.10.0</okhttp.version> <okhttp.version>4.10.0</okhttp.version>
<plusone-basic.version>1.0.0-SNAPSHOT</plusone-basic.version> <plusone-basic.version>1.0.0-SNAPSHOT</plusone-basic.version>