2、自定义Jackson starter
This commit is contained in:
Vendored
+23
-21
@@ -18,39 +18,41 @@
|
|||||||
"类注释": {
|
"类注释": {
|
||||||
"prefix": "ccj",
|
"prefix": "ccj",
|
||||||
"body": [
|
"body": [
|
||||||
"/**",
|
"/**",
|
||||||
" *",
|
" *",
|
||||||
" * @Title: ${TM_FILENAME_BASE}",
|
" * @author ${2:}",
|
||||||
" * @Description: ${1:}",
|
" * @version V1.0",
|
||||||
" * @Author: ${2:}",
|
" * @title ${TM_FILENAME_BASE}",
|
||||||
" * @Date: ${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}",
|
" * @description ${1:}",
|
||||||
" */"
|
" * @date${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}",
|
||||||
|
" */"
|
||||||
],
|
],
|
||||||
"description": "生成类注释"
|
"description": "生成类注释"
|
||||||
},
|
},
|
||||||
"接口注释": {
|
"接口注释": {
|
||||||
"prefix": "icj",
|
"prefix": "icj",
|
||||||
"body": [
|
"body": [
|
||||||
"/**",
|
"/**",
|
||||||
" *",
|
" *",
|
||||||
" * @Title: ${TM_FILENAME_BASE}",
|
" * @author ${2:}",
|
||||||
" * @Description: ${1:}",
|
" * @version V1.0",
|
||||||
" * @Author: ${2:}",
|
" * @title ${TM_FILENAME_BASE}",
|
||||||
" * @Date: ${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}",
|
" * @description ${1:}",
|
||||||
" */"
|
" * @date${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}",
|
||||||
|
" */"
|
||||||
],
|
],
|
||||||
"description": "生成接口注释"
|
"description": "生成接口注释"
|
||||||
},
|
},
|
||||||
"注解注释": {
|
"注解注释": {
|
||||||
"prefix": "acj",
|
"prefix": "acj",
|
||||||
"body": [
|
"body": [
|
||||||
"/**",
|
"/**",
|
||||||
" *",
|
" *",
|
||||||
" * @Title: ${TM_FILENAME_BASE}",
|
" * @author ${2:}",
|
||||||
" * @Description: ${1:}",
|
" * @version V1.0",
|
||||||
" * @Author: ${2:}",
|
" * @title ${TM_FILENAME_BASE}",
|
||||||
" * @Date: ${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}",
|
" * @description ${1:}",
|
||||||
" */"
|
" * @date${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}",
|
||||||
],
|
],
|
||||||
"description": "生成注解注释"
|
"description": "生成注解注释"
|
||||||
},
|
},
|
||||||
|
|||||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"name": "Spring Boot-XiaoyiAuthApplication<xiaoyi-auth>",
|
"name": "Spring Boot-XiaoyiAuthApplication<xiaoyi-auth>",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"mainClass": "top.crushtj.xiaoyishu.auth.XiaoyiAuthApplication",
|
"mainClass": "com.jy.xiaoyishu.auth.XiaoyiAuthApplication",
|
||||||
"projectName": "xiaoyi-auth",
|
"projectName": "xiaoyi-auth",
|
||||||
"args": "",
|
"args": "",
|
||||||
"envFile": "${workspaceFolder}/.env"
|
"envFile": "${workspaceFolder}/.env"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://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>
|
||||||
|
|
||||||
<groupId>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyishu</artifactId>
|
<artifactId>xiaoyishu</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
|
|
||||||
@@ -48,16 +48,23 @@
|
|||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyi-common</artifactId>
|
<artifactId>xiaoyi-common</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 业务接口日志组件 -->
|
<!-- 业务接口日志组件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyi-spring-boot-starter-biz-operationlog</artifactId>
|
<artifactId>xiaoyi-spring-boot-starter-biz-operationlog</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务接口日志组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jy</groupId>
|
||||||
|
<artifactId>xiaoyi-spring-boot-starter-jackson</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
<!-- Spring Boot 官方依赖管理 -->
|
<!-- Spring Boot 官方依赖管理 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
+9
-3
@@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<!-- 指定父项目 -->
|
<!-- 指定父项目 -->
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyishu</artifactId>
|
<artifactId>xiaoyishu</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
@@ -19,14 +19,20 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyi-common</artifactId>
|
<artifactId>xiaoyi-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 业务接口日志组件 -->
|
<!-- 业务接口日志组件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyi-spring-boot-starter-biz-operationlog</artifactId>
|
<artifactId>xiaoyi-spring-boot-starter-biz-operationlog</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--Jackson-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jy</groupId>
|
||||||
|
<artifactId>xiaoyi-spring-boot-starter-jackson</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.jy.xiaoyishu.auth;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ayi
|
||||||
|
* @title XiaoyiAuthApplication
|
||||||
|
* @description 启动类
|
||||||
|
* @date 2025/11/20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class XiaoyiAuthApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(XiaoyiAuthApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.xiaoyishu.auth.config;
|
package com.jy.xiaoyishu.auth.config;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
@@ -8,14 +8,14 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author hanfuye
|
* @author ayi
|
||||||
* @title MyBatisConfig
|
* @title MyBatisConfig
|
||||||
* @date 2025/11/27
|
* @date 2025/11/27
|
||||||
* @description MybatisPlus配置类
|
* @description MybatisPlus配置类
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@MapperScan("top.crushtj.**.mappers")
|
@MapperScan("com.jy.**.mappers")
|
||||||
public class MybatisPlusConfig {
|
public class MybatisPlusConfig {
|
||||||
/**
|
/**
|
||||||
* 分页插件
|
* 分页插件
|
||||||
+9
-14
@@ -1,21 +1,21 @@
|
|||||||
package top.crushtj.xiaoyishu.auth.controller;
|
package com.jy.xiaoyishu.auth.controller;
|
||||||
|
|
||||||
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;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import top.crushtj.framework.biz.operationlog.aspect.ApiOperationLog;
|
import com.jy.framework.biz.operationlog.aspect.ApiOperationLog;
|
||||||
import top.crushtj.framework.common.response.Response;
|
import com.jy.framework.common.response.Response;
|
||||||
import top.crushtj.xiaoyishu.auth.vo.User;
|
import com.jy.xiaoyishu.auth.vo.User;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @Title: TestController
|
* @author ayi
|
||||||
* @Description: 测试控制器
|
* @title TestController
|
||||||
* @Author: ayi
|
* @description 测试控制器
|
||||||
* @Date: 2025/11/21
|
* @date 2025/11/21
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,12 +24,7 @@ public class TestController {
|
|||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
@ApiOperationLog(description = "测试接口")
|
@ApiOperationLog(description = "测试接口")
|
||||||
public Response<User> testController() {
|
public Response<User> testController() {
|
||||||
return Response.success(User.builder()
|
return Response.success(User.builder().id(1L).name("ayi").age(18).createTime(LocalDateTime.now()).build());
|
||||||
.id(1L)
|
|
||||||
.name("ayi")
|
|
||||||
.age(18)
|
|
||||||
.createTime(LocalDateTime.now())
|
|
||||||
.build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/test2")
|
@PostMapping("/test2")
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.xiaoyishu.auth.domain.entity;
|
package com.jy.xiaoyishu.auth.domain.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package top.crushtj.xiaoyishu.auth.domain.mappers;
|
package com.jy.xiaoyishu.auth.domain.mappers;
|
||||||
|
|
||||||
import top.crushtj.xiaoyishu.auth.domain.entity.UserEntity;
|
import com.jy.xiaoyishu.auth.domain.entity.UserEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="top.crushtj.xiaoyishu.auth.domain.mappers.UserMapper">
|
<mapper namespace="com.jy.xiaoyishu.auth.domain.mappers.UserMapper">
|
||||||
|
|
||||||
<resultMap type="top.crushtj.xiaoyishu.auth.domain.entity.UserEntity" id="UserMap">
|
<resultMap type="com.jy.xiaoyishu.auth.domain.entity.UserEntity" id="UserMap">
|
||||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
<result property="username" column="username" jdbcType="VARCHAR"/>
|
<result property="username" column="username" jdbcType="VARCHAR"/>
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.xiaoyishu.auth.vo;
|
package com.jy.xiaoyishu.auth.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@@ -10,10 +10,10 @@ import java.time.LocalDateTime;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @Title: User
|
* @author ayi
|
||||||
* @Description: 测试用户类
|
* @title User
|
||||||
* @Author: ayi
|
* @description 测试用户类
|
||||||
* @Date: 2025/11/26
|
* @date 2025/11/26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package top.crushtj.xiaoyishu.auth;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
public class XiaoyiAuthApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(XiaoyiAuthApplication.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -51,14 +51,14 @@ spring:
|
|||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
mapper-locations:
|
mapper-locations:
|
||||||
- classpath*:top/crushtj/**/*.xml # 匹配所有模块中的 Mapper XML 文件
|
- classpath*:top/crushtj/**/*.xml # 匹配所有模块中的 Mapper XML 文件
|
||||||
type-aliases-package: top.crushtj.xiaoyishu.auth.domain.entity # 实体类包路径
|
type-aliases-package: com.jy.xiaoyishu.auth.domain.entity # 实体类包路径
|
||||||
configuration:
|
configuration:
|
||||||
map-underscore-to-camel-case: true # 开启驼峰命名转换
|
map-underscore-to-camel-case: true # 开启驼峰命名转换
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 日志输出(调试用)
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 日志输出(调试用)
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
top.crushtj.xiaoyishu.auth.domain.mappers: debug
|
com.jy.xiaoyishu.auth.domain.mappers: debug
|
||||||
config: classpath:config/logback-dev.xml
|
config: classpath:config/logback-dev.xml
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.xiaoyishu.auth;
|
package com.jy.xiaoyishu.auth;
|
||||||
|
|
||||||
import com.alibaba.druid.filter.config.ConfigTools;
|
import com.alibaba.druid.filter.config.ConfigTools;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
@@ -7,10 +7,10 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hanfuye
|
* @author ayi
|
||||||
* @version V1.0
|
* @version V1.0
|
||||||
* @Title: DruidTest
|
* @title DruidTest
|
||||||
* @Description:
|
* @description
|
||||||
* @date 2025/12/01
|
* @date 2025/12/01
|
||||||
*/
|
*/
|
||||||
|
|
||||||
+15
-9
@@ -1,15 +1,23 @@
|
|||||||
package top.crushtj.xiaoyishu.auth;
|
package com.jy.xiaoyishu.auth;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import top.crushtj.xiaoyishu.auth.domain.entity.UserEntity;
|
import com.jy.xiaoyishu.auth.domain.entity.UserEntity;
|
||||||
import top.crushtj.xiaoyishu.auth.domain.mappers.UserMapper;
|
import com.jy.xiaoyishu.auth.domain.mappers.UserMapper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ayi
|
||||||
|
* @title XiaoyiAuthApplicationTests
|
||||||
|
* @description 测试类
|
||||||
|
* @date 2025/11/20
|
||||||
|
*/
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@Slf4j
|
@Slf4j
|
||||||
class XiaoyiAuthApplicationTests {
|
class XiaoyiAuthApplicationTests {
|
||||||
@@ -23,17 +31,15 @@ class XiaoyiAuthApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testInsert() {
|
void testInsert() {
|
||||||
UserEntity user = UserEntity.builder()
|
UserEntity user =
|
||||||
.username("刑加一")
|
UserEntity.builder().username("刑加一").createTime(LocalDateTime.now()).updateTime(LocalDateTime.now())
|
||||||
.createTime(LocalDateTime.now())
|
.build();
|
||||||
.updateTime(LocalDateTime.now())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
userMapper.insert(user);
|
userMapper.insert(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void queryTest(){
|
void queryTest() {
|
||||||
LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(UserEntity::getUsername, "刑加一");
|
queryWrapper.eq(UserEntity::getUsername, "刑加一");
|
||||||
UserEntity user = userMapper.selectOne(queryWrapper);
|
UserEntity user = userMapper.selectOne(queryWrapper);
|
||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://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>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyishu</artifactId>
|
<artifactId>xiaoyishu</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
@@ -15,9 +15,13 @@
|
|||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<description>平台基础设施层:封装一些常用功能,供各个业务线拿来即用</description>
|
<description>平台基础设施层:封装一些常用功能,供各个业务线拿来即用</description>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
<!--通用-->
|
||||||
<module>xiaoyi-common</module>
|
<module>xiaoyi-common</module>
|
||||||
|
<!--日志切面-->
|
||||||
<module>xiaoyi-spring-boot-starter-biz-operationlog</module>
|
<module>xiaoyi-spring-boot-starter-biz-operationlog</module>
|
||||||
|
<!--Jackson-->
|
||||||
|
<module>xiaoyi-spring-boot-starter-jackson</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://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>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyi-framework</artifactId>
|
<artifactId>xiaoyi-framework</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
@@ -36,6 +36,12 @@
|
|||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- AOP 切面 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
+6
-6
@@ -1,12 +1,12 @@
|
|||||||
package top.crushtj.framework.common.constant;
|
package com.jy.framework.common.constant;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Title: DateConstants
|
* @author ayi
|
||||||
* @Description: 日期常量
|
* @title DateConstants
|
||||||
* @Author: ayi
|
* @description 日期常量
|
||||||
* @Date: 2025/11/26
|
* @date 2025/11/26
|
||||||
*/
|
*/
|
||||||
public interface DateConstants {
|
public interface DateConstants {
|
||||||
/**
|
/**
|
||||||
@@ -27,5 +27,5 @@ public interface DateConstants {
|
|||||||
/**
|
/**
|
||||||
* DateTimeFormatter:年-月
|
* DateTimeFormatter:年-月
|
||||||
*/
|
*/
|
||||||
DateTimeFormatter DATE_FORMAT_Y_M = DateTimeFormatter.ofPattern("yyyy-MM");
|
DateTimeFormatter DATE_FORMAT_Y_M = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||||
}
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package com.jy.framework.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ayi
|
||||||
|
* @title BaseExceptionInterface
|
||||||
|
* @description 基础异常接口
|
||||||
|
* @date 2025/11/20
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface BaseExceptionInterface {
|
||||||
|
/**
|
||||||
|
* 获取异常码
|
||||||
|
*
|
||||||
|
* @return 异常码
|
||||||
|
*/
|
||||||
|
String getCode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取异常信息
|
||||||
|
*
|
||||||
|
* @return 异常信息
|
||||||
|
*/
|
||||||
|
String getMessage();
|
||||||
|
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.jy.framework.common.exception;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ayi
|
||||||
|
* @title BusiException
|
||||||
|
* @description 业务异常
|
||||||
|
* @date 2025/11/20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class BizException extends RuntimeException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常信息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造函数
|
||||||
|
*
|
||||||
|
* @param baseExceptionInterface 基础异常接口
|
||||||
|
*/
|
||||||
|
public BizException(BaseExceptionInterface baseExceptionInterface) {
|
||||||
|
this.code = baseExceptionInterface.getCode();
|
||||||
|
this.message = baseExceptionInterface.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+132
@@ -0,0 +1,132 @@
|
|||||||
|
package com.jy.framework.common.response;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import com.jy.framework.common.exception.BaseExceptionInterface;
|
||||||
|
import com.jy.framework.common.exception.BizException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ayi
|
||||||
|
* @title Response
|
||||||
|
* @description 响应体
|
||||||
|
* @date 2025/11/20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Response<T> implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -6624218097474846897L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应信息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否成功
|
||||||
|
*/
|
||||||
|
private boolean success = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应数据
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功响应
|
||||||
|
*
|
||||||
|
* @return 成功响应
|
||||||
|
*/
|
||||||
|
public static <T> Response<T> success() {
|
||||||
|
return new Response<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功响应
|
||||||
|
*
|
||||||
|
* @param data 响应数据
|
||||||
|
* @return 成功响应
|
||||||
|
*/
|
||||||
|
public static <T> Response<T> success(T data) {
|
||||||
|
Response<T> response = new Response<>();
|
||||||
|
response.setData(data);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败响应
|
||||||
|
*
|
||||||
|
* @return 失败响应
|
||||||
|
*/
|
||||||
|
public static <T> Response<T> failure() {
|
||||||
|
Response<T> response = new Response<>();
|
||||||
|
response.setSuccess(false);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败响应
|
||||||
|
*
|
||||||
|
* @param message 异常信息
|
||||||
|
* @return 失败响应
|
||||||
|
*/
|
||||||
|
public static <T> Response<T> failure(String message) {
|
||||||
|
Response<T> response = new Response<>();
|
||||||
|
response.setSuccess(false);
|
||||||
|
response.setMessage(message);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败响应
|
||||||
|
*
|
||||||
|
* @param code 异常码
|
||||||
|
* @param message 异常信息
|
||||||
|
* @return 失败响应
|
||||||
|
*/
|
||||||
|
public static <T> Response<T> failure(String code, String message) {
|
||||||
|
Response<T> response = new Response<>();
|
||||||
|
response.setSuccess(false);
|
||||||
|
response.setCode(code);
|
||||||
|
response.setMessage(message);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败响应
|
||||||
|
*
|
||||||
|
* @param bizException 业务异常
|
||||||
|
* @return 失败响应
|
||||||
|
*/
|
||||||
|
public static <T> Response<T> failure(BizException bizException) {
|
||||||
|
Response<T> response = new Response<>();
|
||||||
|
response.setSuccess(false);
|
||||||
|
response.setCode(bizException.getCode());
|
||||||
|
response.setMessage(bizException.getMessage());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败响应
|
||||||
|
*
|
||||||
|
* @param <T> 响应数据类型
|
||||||
|
* @param baseExceptionInterface 基础异常
|
||||||
|
* @return 失败响应
|
||||||
|
*/
|
||||||
|
public static <T> Response<T> failure(BaseExceptionInterface baseExceptionInterface) {
|
||||||
|
Response<T> response = new Response<>();
|
||||||
|
response.setSuccess(false);
|
||||||
|
response.setCode(baseExceptionInterface.getCode());
|
||||||
|
response.setMessage(baseExceptionInterface.getMessage());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.framework.common.utils;
|
package com.jy.framework.common.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -8,10 +8,10 @@ import lombok.SneakyThrows;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @Title: JsonUtils
|
* @author ayi
|
||||||
* @Description: JSON 工具类
|
* @title JsonUtils
|
||||||
* @Author: ayi
|
* @description JSON 工具类
|
||||||
* @Date: 2025/11/21
|
* @date 2025/11/21
|
||||||
*/
|
*/
|
||||||
public class JsonUtils {
|
public class JsonUtils {
|
||||||
private static ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
private static ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
package top.crushtj.framework.common.exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @Title: BaseExceptionInterface
|
|
||||||
* @Description: 基础异常接口
|
|
||||||
* @Author: ayi
|
|
||||||
* @Date: 2025/11/20
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface BaseExceptionInterface {
|
|
||||||
/**
|
|
||||||
* 获取异常码
|
|
||||||
*
|
|
||||||
* @return 异常码
|
|
||||||
*/
|
|
||||||
String getCode();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取异常信息
|
|
||||||
*
|
|
||||||
* @return 异常信息
|
|
||||||
*/
|
|
||||||
String getMessage();
|
|
||||||
|
|
||||||
}
|
|
||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
package top.crushtj.framework.common.exception;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @Title: BusiException
|
|
||||||
* @Description: 业务异常
|
|
||||||
* @Author: ayi
|
|
||||||
* @Date: 2025/11/20
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class BizException extends RuntimeException {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 异常码
|
|
||||||
*/
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 异常信息
|
|
||||||
*/
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造函数
|
|
||||||
*
|
|
||||||
* @param baseExceptionInterface 基础异常接口
|
|
||||||
*/
|
|
||||||
public BizException(BaseExceptionInterface baseExceptionInterface) {
|
|
||||||
this.code = baseExceptionInterface.getCode();
|
|
||||||
this.message = baseExceptionInterface.getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-131
@@ -1,131 +0,0 @@
|
|||||||
package top.crushtj.framework.common.response;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import top.crushtj.framework.common.exception.BaseExceptionInterface;
|
|
||||||
import top.crushtj.framework.common.exception.BizException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @Title: Response
|
|
||||||
* @Description: 响应体
|
|
||||||
* @Author: ayi
|
|
||||||
* @Date: 2025/11/20
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class Response<T> implements Serializable {
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -6624218097474846897L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应码
|
|
||||||
*/
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应信息
|
|
||||||
*/
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否成功
|
|
||||||
*/
|
|
||||||
private boolean success = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应数据
|
|
||||||
*/
|
|
||||||
private T data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 成功响应
|
|
||||||
*
|
|
||||||
* @return 成功响应
|
|
||||||
*/
|
|
||||||
public static <T> Response<T> success() {
|
|
||||||
return new Response<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 成功响应
|
|
||||||
*
|
|
||||||
* @param data 响应数据
|
|
||||||
* @return 成功响应
|
|
||||||
*/
|
|
||||||
public static <T> Response<T> success(T data) {
|
|
||||||
Response<T> response = new Response<>();
|
|
||||||
response.setData(data);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 失败响应
|
|
||||||
*
|
|
||||||
* @return 失败响应
|
|
||||||
*/
|
|
||||||
public static <T> Response<T> failure() {
|
|
||||||
Response<T> response = new Response<>();
|
|
||||||
response.setSuccess(false);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 失败响应
|
|
||||||
*
|
|
||||||
* @param message 异常信息
|
|
||||||
* @return 失败响应
|
|
||||||
*/
|
|
||||||
public static <T> Response<T> failure(String message) {
|
|
||||||
Response<T> response = new Response<>();
|
|
||||||
response.setSuccess(false);
|
|
||||||
response.setMessage(message);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 失败响应
|
|
||||||
*
|
|
||||||
* @param code 异常码
|
|
||||||
* @param message 异常信息
|
|
||||||
* @return 失败响应
|
|
||||||
*/
|
|
||||||
public static <T> Response<T> failure(String code, String message) {
|
|
||||||
Response<T> response = new Response<>();
|
|
||||||
response.setSuccess(false);
|
|
||||||
response.setCode(code);
|
|
||||||
response.setMessage(message);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 失败响应
|
|
||||||
*
|
|
||||||
* @param bizException 业务异常
|
|
||||||
* @return 失败响应
|
|
||||||
*/
|
|
||||||
public static <T> Response<T> failure(BizException bizException) {
|
|
||||||
Response<T> response = new Response<>();
|
|
||||||
response.setSuccess(false);
|
|
||||||
response.setCode(bizException.getCode());
|
|
||||||
response.setMessage(bizException.getMessage());
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 失败响应
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* @param baseExceptionInterface 基础异常
|
|
||||||
* @return 失败响应
|
|
||||||
*/
|
|
||||||
public static <T> Response<T> failure(BaseExceptionInterface baseExceptionInterface) {
|
|
||||||
Response<T> response = new Response<>();
|
|
||||||
response.setSuccess(false);
|
|
||||||
response.setCode(baseExceptionInterface.getCode());
|
|
||||||
response.setMessage(baseExceptionInterface.getMessage());
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,25 +4,23 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://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>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyi-framework</artifactId>
|
<artifactId>xiaoyi-framework</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<artifactId>xiaoyi-spring-boot-starter-biz-operationlog</artifactId>
|
<artifactId>xiaoyi-spring-boot-starter-biz-operationlog</artifactId>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<description>平台基础设施层:操作日志记录器</description>
|
<description>平台基础设施层:操作日志记录器</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.crushtj</groupId>
|
<groupId>com.jy</groupId>
|
||||||
<artifactId>xiaoyi-common</artifactId>
|
<artifactId>xiaoyi-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- AOP 切面 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
+17
-8
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.framework.biz.operationlog;
|
package com.jy.framework.biz.operationlog;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -12,19 +12,28 @@ import org.aspectj.lang.annotation.Pointcut;
|
|||||||
import org.aspectj.lang.reflect.MethodSignature;
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import top.crushtj.framework.biz.operationlog.aspect.ApiOperationLog;
|
import com.jy.framework.biz.operationlog.aspect.ApiOperationLog;
|
||||||
import top.crushtj.framework.common.utils.JsonUtils;
|
import com.jy.framework.common.utils.JsonUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ayi
|
||||||
|
* @title ApiOperationLog
|
||||||
|
* @description 自定义注解,用于标记需要记录操作日志的方法
|
||||||
|
* @date 2025/11/21
|
||||||
|
*/
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Aspect
|
@Aspect
|
||||||
public class ApiOperationLogAspect {
|
public class ApiOperationLogAspect {
|
||||||
/** 以自定义 @ApiOperationLog 注解为切点,凡是添加 @ApiOperationLog 的方法,都会执行环绕中的代码 */
|
/** 以自定义 @ApiOperationLog 注解为切点,凡是添加 @ApiOperationLog 的方法,都会执行环绕中的代码 */
|
||||||
@Pointcut("@annotation(top.crushtj.framework.biz.operationlog.aspect.ApiOperationLog)")
|
@Pointcut("@annotation(com.jy.framework.biz.operationlog.aspect.ApiOperationLog)")
|
||||||
public void apiOperationLog() {}
|
public void apiOperationLog() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 环绕
|
* 环绕
|
||||||
*
|
*
|
||||||
* @param joinPoint 连接点
|
* @param joinPoint 连接点
|
||||||
* @return 方法执行结果
|
* @return 方法执行结果
|
||||||
* @throws Throwable 方法执行过程中抛出的异常
|
* @throws Throwable 方法执行过程中抛出的异常
|
||||||
@@ -65,7 +74,7 @@ public class ApiOperationLogAspect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取注解的描述信息
|
* 获取注解的描述信息
|
||||||
*
|
*
|
||||||
* @param joinPoint 连接点
|
* @param joinPoint 连接点
|
||||||
* @return 注解的描述信息
|
* @return 注解的描述信息
|
||||||
*/
|
*/
|
||||||
@@ -85,7 +94,7 @@ public class ApiOperationLogAspect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 转 JSON 字符串
|
* 转 JSON 字符串
|
||||||
*
|
*
|
||||||
* @return 入参的 JSON 字符串
|
* @return 入参的 JSON 字符串
|
||||||
*/
|
*/
|
||||||
private Function<Object, String> toJsonStr() {
|
private Function<Object, String> toJsonStr() {
|
||||||
+6
-6
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.framework.biz.operationlog.aspect;
|
package com.jy.framework.biz.operationlog.aspect;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
@@ -8,10 +8,10 @@ import java.lang.annotation.Target;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @Title: ApiOperationLog
|
* @author ayi
|
||||||
* @Description: 自定义注解,用于标记需要记录操作日志的方法
|
* @title ApiOperationLog
|
||||||
* @Author: ayi
|
* @description 自定义注解,用于标记需要记录操作日志的方法
|
||||||
* @Date: 2025/11/21
|
* @date 2025/11/21
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target({ElementType.METHOD})
|
@Target({ElementType.METHOD})
|
||||||
@@ -20,7 +20,7 @@ public @interface ApiOperationLog {
|
|||||||
/**
|
/**
|
||||||
* API 功能描述
|
* API 功能描述
|
||||||
*
|
*
|
||||||
* @return
|
* @return 功能描述
|
||||||
*/
|
*/
|
||||||
String description() default "";
|
String description() default "";
|
||||||
}
|
}
|
||||||
+10
-2
@@ -1,9 +1,17 @@
|
|||||||
package top.crushtj.framework.biz.operationlog.config;
|
package com.jy.framework.biz.operationlog.config;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
import top.crushtj.framework.biz.operationlog.ApiOperationLogAspect;
|
import com.jy.framework.biz.operationlog.ApiOperationLogAspect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ayi
|
||||||
|
* @title ApiOperationLog
|
||||||
|
* @description 自定义注解,用于标记需要记录操作日志的方法
|
||||||
|
* @date 2025/11/21
|
||||||
|
*/
|
||||||
|
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
public class ApiOperationLogAutoConfiguration {
|
public class ApiOperationLogAutoConfiguration {
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
top.crushtj.framework.biz.operationlog.config.ApiOperationLogAutoConfiguration
|
com.jy.framework.biz.operationlog.config.ApiOperationLogAutoConfiguration
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.jy</groupId>
|
||||||
|
<artifactId>xiaoyi-framework</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<artifactId>xiaoyi-spring-boot-starter-jackson</artifactId>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>平台基础设施层:Jackson 配置</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jy</groupId>
|
||||||
|
<artifactId>xiaoyi-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
+10
-8
@@ -1,4 +1,4 @@
|
|||||||
package top.crushtj.xiaoyishu.auth.config;
|
package com.jy.framework.jackson;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -12,10 +12,10 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
|||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.YearMonthSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.YearMonthSerializer;
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import com.jy.framework.common.constant.DateConstants;
|
||||||
import top.crushtj.framework.common.constant.DateConstants;
|
import com.jy.framework.common.utils.JsonUtils;
|
||||||
import top.crushtj.framework.common.utils.JsonUtils;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -31,8 +31,8 @@ import java.util.TimeZone;
|
|||||||
* @date 2026/01/06
|
* @date 2026/01/06
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Configuration
|
@AutoConfiguration
|
||||||
public class JacksonConfig {
|
public class JacksonAutoConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ObjectMapper objectMapper() {
|
public ObjectMapper objectMapper() {
|
||||||
@@ -53,8 +53,10 @@ public class JacksonConfig {
|
|||||||
|
|
||||||
// 支持 LocalDateTime、LocalDate、LocalTime
|
// 支持 LocalDateTime、LocalDate、LocalTime
|
||||||
// 支持 LocalDateTime、LocalDate、LocalTime
|
// 支持 LocalDateTime、LocalDate、LocalTime
|
||||||
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateConstants.DATE_FORMAT_Y_M_D_H_M_S));
|
javaTimeModule.addSerializer(LocalDateTime.class,
|
||||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateConstants.DATE_FORMAT_Y_M_D_H_M_S));
|
new LocalDateTimeSerializer(DateConstants.DATE_FORMAT_Y_M_D_H_M_S));
|
||||||
|
javaTimeModule.addDeserializer(LocalDateTime.class,
|
||||||
|
new LocalDateTimeDeserializer(DateConstants.DATE_FORMAT_Y_M_D_H_M_S));
|
||||||
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateConstants.DATE_FORMAT_Y_M_D));
|
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateConstants.DATE_FORMAT_Y_M_D));
|
||||||
javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateConstants.DATE_FORMAT_Y_M_D));
|
javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateConstants.DATE_FORMAT_Y_M_D));
|
||||||
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateConstants.DATE_FORMAT_H_M_S));
|
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateConstants.DATE_FORMAT_H_M_S));
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
com.jy.framework.jackson.JacksonAutoConfiguration
|
||||||
Reference in New Issue
Block a user