init: spring_server_v3 (Spring Boot 3 + Flyway + Sa-Token)
@@ -0,0 +1,21 @@
|
||||
# Java / Maven
|
||||
target/
|
||||
*.class
|
||||
*.jar
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
*.iml
|
||||
.vscode/
|
||||
*.swp
|
||||
|
||||
# 运行时产物
|
||||
logs/
|
||||
*.log
|
||||
uploads/
|
||||
.attach_pid*
|
||||
|
||||
# 系统文件
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
After Width: | Height: | Size: 605 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 182 KiB |
|
After Width: | Height: | Size: 820 KiB |
|
After Width: | Height: | Size: 697 KiB |
|
After Width: | Height: | Size: 786 KiB |
|
After Width: | Height: | Size: 822 KiB |
|
After Width: | Height: | Size: 790 KiB |
|
After Width: | Height: | Size: 651 KiB |
|
After Width: | Height: | Size: 804 KiB |
|
After Width: | Height: | Size: 758 KiB |
|
After Width: | Height: | Size: 843 KiB |
|
After Width: | Height: | Size: 776 KiB |
|
After Width: | Height: | Size: 863 KiB |
|
After Width: | Height: | Size: 720 KiB |
|
After Width: | Height: | Size: 628 KiB |
|
After Width: | Height: | Size: 720 KiB |
|
After Width: | Height: | Size: 845 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 339 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 727 KiB |
|
After Width: | Height: | Size: 908 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 873 KiB |
@@ -0,0 +1,115 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.5.5</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<groupId>com.puddy</groupId>
|
||||
<artifactId>puddy-blog-server</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>spring_server_v3</name>
|
||||
<description>puddy_blog 后端重写版(Spring Boot 3 + Flyway + Sa-Token)</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<mybatis-plus.version>3.5.9</mybatis-plus.version>
|
||||
<sa-token.version>1.39.0</sa-token.version>
|
||||
<!-- Spring Boot 3.5 默认管理 Flyway 11.x(不支持 MySQL 5.7),显式降级 -->
|
||||
<flyway.version>10.20.1</flyway.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis-Plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<!-- 3.5.9 起分页插件拆分至此模块 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-jsqlparser</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Flyway(core + mysql 模块,10.x 支持 MySQL 5.7) -->
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-mysql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Sa-Token(登录态,与前端 satoken token 兼容) -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-spring-boot3-starter</artifactId>
|
||||
<version>${sa-token.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- BCrypt(sys_user 密码哈希) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 对象存储(与旧后端一致:local / minio / qiniu) -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>8.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>7.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.puddy.blog;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@MapperScan("com.puddy.blog.mapper")
|
||||
public class BlogServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(BlogServerApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.puddy.blog.config;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.resource.NoResourceFoundException;
|
||||
|
||||
/**
|
||||
* 统一异常语义:
|
||||
* - 未登录 → HTTP 401(两前端 request.ts 已有 401 分支,可直接跳登录)
|
||||
* - 静态资源缺失 → HTTP 404
|
||||
* - 其他异常 → HTTP 500 + 通用文案(不外发内部异常细节,全栈仅落服务端日志)
|
||||
* 业务性失败仍走 SaResult.error(...) 的 HTTP 200 + code 非 200(沿用 Sa-Token 惯例)。
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
private static final String GENERIC_ERROR_MSG = "服务器内部错误,请稍后重试";
|
||||
|
||||
@ExceptionHandler(NotLoginException.class)
|
||||
public ResponseEntity<SaResult> handlerNotLoginException(NotLoginException nle) {
|
||||
String msg = "登录状态已失效,请重新登录";
|
||||
if (NotLoginException.NOT_TOKEN.equals(nle.getType())) {
|
||||
msg = "未携带登录 Token,请先登录";
|
||||
} else if (NotLoginException.INVALID_TOKEN.equals(nle.getType())) {
|
||||
msg = "Token 无效,请重新登录";
|
||||
} else if (NotLoginException.TOKEN_TIMEOUT.equals(nle.getType())) {
|
||||
msg = "登录已超时,请重新登录";
|
||||
} else if (NotLoginException.BE_REPLACED.equals(nle.getType())) {
|
||||
msg = "您的账户已在其他地方登录,您已被迫下线";
|
||||
} else if (NotLoginException.KICK_OUT.equals(nle.getType())) {
|
||||
msg = "您已被管理员踢下线";
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(SaResult.error(msg).setCode(401));
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoResourceFoundException.class)
|
||||
public ResponseEntity<SaResult> handlerNoResourceFoundException(NoResourceFoundException nrfe) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(SaResult.error("未找到指定的静态资源: " + nrfe.getResourcePath()).setCode(404));
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<SaResult> handlerException(Exception e) {
|
||||
if (isClientAbortException(e)) {
|
||||
// 浏览器主动断开(路由预取/切歌/组件重挂载),不算错误,静默丢弃
|
||||
return null;
|
||||
}
|
||||
log.error("Unhandled exception", e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body(SaResult.error(GENERIC_ERROR_MSG).setCode(500));
|
||||
}
|
||||
|
||||
private boolean isClientAbortException(Throwable e) {
|
||||
if (e == null) {
|
||||
return false;
|
||||
}
|
||||
String className = e.getClass().getName();
|
||||
if ("org.apache.catalina.connector.ClientAbortException".equals(className)) {
|
||||
return true;
|
||||
}
|
||||
String msg = e.getMessage();
|
||||
if (msg != null && (msg.contains("Connection reset by peer") || msg.contains("Broken pipe"))) {
|
||||
return true;
|
||||
}
|
||||
return isClientAbortException(e.getCause());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.puddy.blog.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.puddy.blog.config;
|
||||
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* 鉴权策略:默认全部拦截 + 显式公开白名单。
|
||||
* 新增写接口无需登记即默认受保护,避免"漏配前缀"导致的越权写入。
|
||||
*/
|
||||
@Configuration
|
||||
public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 公开访问白名单(拦截器按不含 context-path 的路径匹配,同时兼容 /api 前缀写法)。
|
||||
*/
|
||||
private static final String[] WHITELIST = {
|
||||
// 认证
|
||||
"/auth/login", "/api/auth/login",
|
||||
"/auth/status", "/api/auth/status",
|
||||
// 前台引导与页面内容
|
||||
"/config/bootstrap", "/api/config/bootstrap",
|
||||
"/config/verify-passcode", "/api/config/verify-passcode",
|
||||
"/about/view", "/api/about/view",
|
||||
"/now/view", "/api/now/view",
|
||||
"/love/config", "/api/love/config",
|
||||
// 公开读列表与详情
|
||||
"/blogs/list", "/api/blogs/list",
|
||||
"/blogs/detail/*", "/api/blogs/detail/*",
|
||||
"/blogs/detail/by-slug/*", "/api/blogs/detail/by-slug/*",
|
||||
"/categories/list", "/api/categories/list",
|
||||
"/love/list", "/api/love/list",
|
||||
"/love/detail/*", "/api/love/detail/*",
|
||||
"/love/bucket/list", "/api/love/bucket/list",
|
||||
"/love/capsule/list", "/api/love/capsule/list",
|
||||
"/love/capsule/*/open", "/api/love/capsule/*/open",
|
||||
"/gallery/list", "/api/gallery/list",
|
||||
"/gallery/detail/*", "/api/gallery/detail/*",
|
||||
"/footprint-category/list", "/api/footprint-category/list",
|
||||
"/time-letter/list", "/api/time-letter/list",
|
||||
"/achievements/list", "/api/achievements/list",
|
||||
"/achievement-metas/list", "/api/achievement-metas/list",
|
||||
// 随笔与鱼塘反馈(访客可提交)
|
||||
"/notes/list", "/api/notes/list",
|
||||
"/notes/create", "/api/notes/create",
|
||||
"/links/list", "/api/links/list",
|
||||
"/pond/feedback", "/api/pond/feedback",
|
||||
"/pond/feedback/*", "/api/pond/feedback/*",
|
||||
"/pond/feedback-type/list", "/api/pond/feedback-type/list",
|
||||
// 静态资源与容器内建路径(必须放行,否则全站图片 401)
|
||||
"/uploads/**", "/api/uploads/**",
|
||||
"/assets/**", "/api/assets/**",
|
||||
"/error", "/api/error",
|
||||
"/favicon.ico", "/api/favicon.ico"
|
||||
};
|
||||
|
||||
@Value("${app.cors.allowed-origins:http://localhost:3000,http://localhost:5173}")
|
||||
private String[] allowedOrigins;
|
||||
|
||||
/** 上传目录(绝对路径,与 FileService 同源),避免随启动目录变化 */
|
||||
@Value("${upload.local-dir:D:/code/puddy_blog/spring_server_v3/uploads}")
|
||||
private String uploadDir;
|
||||
|
||||
/** 内置静态资源目录(绝对路径) */
|
||||
@Value("${app.assets-dir:D:/code/puddy_blog/spring_server_v3/assets}")
|
||||
private String assetsDir;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new SaInterceptor(handle ->
|
||||
SaRouter.match("/**")
|
||||
.notMatch(WHITELIST)
|
||||
.check(r -> StpUtil.checkLogin())
|
||||
)).addPathPatterns("/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins(allowedOrigins)
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
.allowedHeaders("*")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600);
|
||||
}
|
||||
|
||||
// 上传目录与静态资源目录以 /api 前缀对外(context-path 已含 /api)
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
String uploadLocation = "file:" + Paths.get(uploadDir).toAbsolutePath().normalize() + File.separator;
|
||||
String assetsLocation = "file:" + Paths.get(assetsDir).toAbsolutePath().normalize() + File.separator;
|
||||
registry.addResourceHandler("/uploads/**").addResourceLocations(uploadLocation);
|
||||
registry.addResourceHandler("/assets/**").addResourceLocations(assetsLocation);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.Achievement;
|
||||
import com.puddy.blog.entity.AchievementMeta;
|
||||
import com.puddy.blog.service.AchievementService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
public class AchievementController {
|
||||
|
||||
private final AchievementService achievementService;
|
||||
|
||||
public AchievementController(AchievementService achievementService) {
|
||||
this.achievementService = achievementService;
|
||||
}
|
||||
|
||||
@GetMapping("/achievements/list")
|
||||
public SaResult list() {
|
||||
return SaResult.ok().setData(achievementService.listAll());
|
||||
}
|
||||
|
||||
@PostMapping("/achievements/create")
|
||||
public SaResult create(@RequestBody Achievement achievement) {
|
||||
return SaResult.ok("创建成功").setData(achievementService.save(achievement));
|
||||
}
|
||||
|
||||
@PutMapping("/achievements/update")
|
||||
public SaResult update(@RequestBody Achievement achievement) {
|
||||
return SaResult.ok("更新成功").setData(achievementService.save(achievement));
|
||||
}
|
||||
|
||||
@DeleteMapping("/achievements/delete/{id}")
|
||||
public SaResult delete(@PathVariable Long id) {
|
||||
achievementService.delete(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
|
||||
@GetMapping("/achievement-metas/list")
|
||||
public SaResult listMetas() {
|
||||
return SaResult.ok().setData(achievementService.listMetas());
|
||||
}
|
||||
|
||||
@PostMapping("/achievement-metas/create")
|
||||
public SaResult createMeta(@RequestBody AchievementMeta meta) {
|
||||
return SaResult.ok("创建成功").setData(achievementService.saveMeta(meta));
|
||||
}
|
||||
|
||||
@PutMapping("/achievement-metas/update")
|
||||
public SaResult updateMeta(@RequestBody AchievementMeta meta) {
|
||||
return SaResult.ok("更新成功").setData(achievementService.saveMeta(meta));
|
||||
}
|
||||
|
||||
@DeleteMapping("/achievement-metas/delete/{id}")
|
||||
public SaResult deleteMeta(@PathVariable Long id) {
|
||||
achievementService.deleteMeta(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.dto.AccountDTO;
|
||||
import com.puddy.blog.service.AuthService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
private final AuthService authService;
|
||||
|
||||
public AuthController(AuthService authService) {
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public SaResult login(@RequestParam(required = false) String username,
|
||||
@RequestParam(required = false) String password) {
|
||||
return authService.login(username, password);
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public SaResult logout() {
|
||||
return authService.logout();
|
||||
}
|
||||
|
||||
@PostMapping("/change-password")
|
||||
public SaResult changePassword(@RequestParam String oldPassword,
|
||||
@RequestParam String newPassword) {
|
||||
return authService.changePassword(oldPassword, newPassword);
|
||||
}
|
||||
|
||||
@RequestMapping("/status")
|
||||
public SaResult status() {
|
||||
return authService.status();
|
||||
}
|
||||
|
||||
/** 个人中心维护管理员账号(password 留空表示不改密码) */
|
||||
@PostMapping("/account")
|
||||
public SaResult updateAccount(@RequestBody AccountDTO dto) {
|
||||
return authService.updateAccount(dto.username(), dto.password());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.Blog;
|
||||
import com.puddy.blog.service.BlogService;
|
||||
import com.puddy.blog.service.DeepSeekService;
|
||||
import com.puddy.blog.service.FileService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/blogs")
|
||||
public class BlogController {
|
||||
|
||||
private final BlogService blogService;
|
||||
private final DeepSeekService deepSeekService;
|
||||
private final FileService fileService;
|
||||
|
||||
public BlogController(BlogService blogService, DeepSeekService deepSeekService, FileService fileService) {
|
||||
this.blogService = blogService;
|
||||
this.deepSeekService = deepSeekService;
|
||||
this.fileService = fileService;
|
||||
}
|
||||
|
||||
/** 访客仅见已发布文章;已登录管理端返回全量(含草稿与私密) */
|
||||
@GetMapping("/list")
|
||||
public SaResult list(@RequestParam(required = false) String status,
|
||||
@RequestParam(required = false) Long categoryId,
|
||||
@RequestParam(required = false) Long tagId,
|
||||
@RequestParam(required = false) String keyword) {
|
||||
List<Blog> list = blogService.listAll(status, categoryId, tagId, keyword, !StpUtil.isLogin());
|
||||
return SaResult.data(list);
|
||||
}
|
||||
|
||||
@GetMapping("/detail/{id}")
|
||||
public SaResult detailById(@PathVariable Long id) {
|
||||
Blog blog = blogService.detail(id, !StpUtil.isLogin());
|
||||
return blog != null ? SaResult.data(blog) : SaResult.error("文章不存在");
|
||||
}
|
||||
|
||||
@GetMapping("/detail/by-slug/{slug}")
|
||||
public SaResult detailBySlug(@PathVariable String slug) {
|
||||
Blog blog = blogService.detailBySlug(slug, !StpUtil.isLogin());
|
||||
return blog != null ? SaResult.data(blog) : SaResult.error("文章不存在");
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public SaResult create(@RequestBody Blog blog) {
|
||||
return SaResult.ok("创建成功").setData(blogService.save(blog));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public SaResult update(@RequestBody Blog blog) {
|
||||
return SaResult.ok("更新成功").setData(blogService.save(blog));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public SaResult delete(@PathVariable Long id) {
|
||||
return blogService.delete(id) ? SaResult.ok("删除成功") : SaResult.error("文章不存在");
|
||||
}
|
||||
|
||||
/** 上传文件(旧版契约:data 为 URL 字符串),type 决定存储子目录 */
|
||||
@PostMapping("/upload")
|
||||
public SaResult upload(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "blog") String type) {
|
||||
try {
|
||||
Map<String, Object> result = fileService.upload(file, type, null);
|
||||
return SaResult.data(result.get("url")).setMsg("上传成功");
|
||||
} catch (IOException e) {
|
||||
return SaResult.error(e.getMessage() == null ? "上传失败" : e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** 批量上传(旧版契约:data 为 URL 数组) */
|
||||
@PostMapping("/upload-batch")
|
||||
public SaResult uploadBatch(@RequestParam("files") MultipartFile[] files,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "blog") String type) {
|
||||
if (files == null || files.length == 0) {
|
||||
return SaResult.error("没有检测到上传的文件");
|
||||
}
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
try {
|
||||
Map<String, Object> result = fileService.upload(file, type, null);
|
||||
urls.add((String) result.get("url"));
|
||||
} catch (IOException e) {
|
||||
return SaResult.error(e.getMessage() == null ? "上传失败" : e.getMessage());
|
||||
}
|
||||
}
|
||||
return SaResult.data(urls).setMsg("上传成功");
|
||||
}
|
||||
|
||||
/** AI 生成摘要(DeepSeek,配置取 sys_config) */
|
||||
@PostMapping("/generate-summary")
|
||||
public SaResult generateSummary(@RequestBody Map<String, Object> payload) {
|
||||
String content = String.valueOf(payload.getOrDefault("content", ""));
|
||||
if (content.isBlank()) {
|
||||
return SaResult.error("文章内容不能为空");
|
||||
}
|
||||
return deepSeekService.generateSummary(content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.Category;
|
||||
import com.puddy.blog.service.CategoryService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/categories")
|
||||
public class CategoryController {
|
||||
|
||||
private final CategoryService categoryService;
|
||||
|
||||
public CategoryController(CategoryService categoryService) {
|
||||
this.categoryService = categoryService;
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public SaResult list() {
|
||||
List<Category> list = categoryService.listAll();
|
||||
return SaResult.ok().setData(list);
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public SaResult save(@RequestBody Category category) {
|
||||
return SaResult.ok("保存成功").setData(categoryService.save(category));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public SaResult update(@RequestBody Category category) {
|
||||
return SaResult.ok("更新成功").setData(categoryService.save(category));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public SaResult delete(@PathVariable Long id) {
|
||||
return categoryService.delete(id)
|
||||
? SaResult.ok("删除成功")
|
||||
: SaResult.error("该分类下仍有文章,无法删除");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.dto.AiDTO;
|
||||
import com.puddy.blog.dto.StorageDTO;
|
||||
import com.puddy.blog.dto.VisibilityDTO;
|
||||
import com.puddy.blog.entity.SiteBeian;
|
||||
import com.puddy.blog.entity.SiteMap;
|
||||
import com.puddy.blog.entity.SiteProfile;
|
||||
import com.puddy.blog.entity.ThemeConfig;
|
||||
import com.puddy.blog.service.AboutService;
|
||||
import com.puddy.blog.service.NowService;
|
||||
import com.puddy.blog.service.SiteSettingService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class ConfigController {
|
||||
|
||||
/** 数据库连接信息中的密码恒以此占位返回(真实凭据只存在于服务端配置) */
|
||||
private static final String MASKED_PASSWORD = "******";
|
||||
|
||||
private final SiteSettingService siteSettingService;
|
||||
private final AboutService aboutService;
|
||||
private final NowService nowService;
|
||||
private final DataSource dataSource;
|
||||
|
||||
@Value("${spring.datasource.url:}")
|
||||
private String datasourceUrl;
|
||||
@Value("${spring.datasource.username:}")
|
||||
private String datasourceUsername;
|
||||
|
||||
public ConfigController(SiteSettingService siteSettingService, AboutService aboutService,
|
||||
NowService nowService, DataSource dataSource) {
|
||||
this.siteSettingService = siteSettingService;
|
||||
this.aboutService = aboutService;
|
||||
this.nowService = nowService;
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
/** 前台唯一引导调用:公开返回 {site, theme, pages, about, now, love} 强类型聚合 */
|
||||
@GetMapping("/config/bootstrap")
|
||||
public SaResult bootstrap() {
|
||||
return SaResult.ok().setData(siteSettingService.bootstrap());
|
||||
}
|
||||
|
||||
// ---- 主题 ----
|
||||
|
||||
@GetMapping("/config/theme")
|
||||
public SaResult getTheme() {
|
||||
return SaResult.ok().setData(siteSettingService.getTheme());
|
||||
}
|
||||
|
||||
@PutMapping("/config/theme")
|
||||
public SaResult saveTheme(@RequestBody ThemeConfig theme) {
|
||||
siteSettingService.saveTheme(theme);
|
||||
return SaResult.ok("主题配置已保存");
|
||||
}
|
||||
|
||||
// ---- 品牌与全局文案 ----
|
||||
|
||||
@GetMapping("/config/site")
|
||||
public SaResult getSite() {
|
||||
return SaResult.ok().setData(siteSettingService.getSiteProfile());
|
||||
}
|
||||
|
||||
@PutMapping("/config/site")
|
||||
public SaResult saveSite(@RequestBody SiteProfile profile) {
|
||||
siteSettingService.saveSiteProfile(profile);
|
||||
return SaResult.ok("品牌配置已保存");
|
||||
}
|
||||
|
||||
// ---- 备案 ----
|
||||
|
||||
@GetMapping("/config/beian")
|
||||
public SaResult getBeian() {
|
||||
return SaResult.ok().setData(siteSettingService.getBeian());
|
||||
}
|
||||
|
||||
@PutMapping("/config/beian")
|
||||
public SaResult saveBeian(@RequestBody SiteBeian beian) {
|
||||
siteSettingService.saveBeian(beian);
|
||||
return SaResult.ok("备案信息已保存");
|
||||
}
|
||||
|
||||
// ---- 高德地图 ----
|
||||
|
||||
@GetMapping("/config/amap")
|
||||
public SaResult getAmap() {
|
||||
return SaResult.ok().setData(siteSettingService.getMap());
|
||||
}
|
||||
|
||||
@PutMapping("/config/amap")
|
||||
public SaResult saveAmap(@RequestBody SiteMap map) {
|
||||
siteSettingService.saveMap(map);
|
||||
return SaResult.ok("地图服务配置已保存");
|
||||
}
|
||||
|
||||
// ---- 页面可见性与全站口令 ----
|
||||
|
||||
@GetMapping("/config/visibility")
|
||||
public SaResult getVisibility() {
|
||||
return SaResult.ok().setData(siteSettingService.getVisibility());
|
||||
}
|
||||
|
||||
@PutMapping("/config/visibility")
|
||||
public SaResult saveVisibility(@RequestBody VisibilityDTO dto) {
|
||||
siteSettingService.saveVisibility(dto);
|
||||
return SaResult.ok("页面可见性配置已保存");
|
||||
}
|
||||
|
||||
/** 校验全站私密口令(公开):只校验,不回传口令本身,避免口令被公开接口泄露 */
|
||||
@PostMapping("/config/verify-passcode")
|
||||
public SaResult verifyPasscode(@RequestBody Map<String, String> body) {
|
||||
String code = body != null ? body.getOrDefault("code", "") : "";
|
||||
return siteSettingService.verifyPasscode(code)
|
||||
? SaResult.ok("口令验证通过")
|
||||
: SaResult.error("口令错误");
|
||||
}
|
||||
|
||||
// ---- 对象存储 ----
|
||||
|
||||
@GetMapping("/config/storage")
|
||||
public SaResult getStorage() {
|
||||
return SaResult.ok().setData(siteSettingService.getStorage());
|
||||
}
|
||||
|
||||
@PutMapping("/config/storage")
|
||||
public SaResult saveStorage(@RequestBody StorageDTO dto) {
|
||||
siteSettingService.saveStorage(dto);
|
||||
return SaResult.ok("存储配置已保存");
|
||||
}
|
||||
|
||||
// ---- AI 能力 ----
|
||||
|
||||
@GetMapping("/config/ai")
|
||||
public SaResult getAi() {
|
||||
return SaResult.ok().setData(siteSettingService.getAi());
|
||||
}
|
||||
|
||||
@PutMapping("/config/ai")
|
||||
public SaResult saveAi(@RequestBody AiDTO dto) {
|
||||
siteSettingService.saveAi(dto);
|
||||
return SaResult.ok("AI 服务配置已保存");
|
||||
}
|
||||
|
||||
// ---- 数据库信息(只读) ----
|
||||
|
||||
/** 当前数据源信息(密码脱敏) */
|
||||
@GetMapping("/config/database")
|
||||
public SaResult getDatabaseConfig() {
|
||||
String dbInfo = "未知";
|
||||
try (Connection conn = dataSource.getConnection()) {
|
||||
dbInfo = conn.getMetaData().getDatabaseProductVersion();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
Map<String, Object> data = new LinkedHashMap<>();
|
||||
data.put("url", datasourceUrl);
|
||||
data.put("host", hostOf(datasourceUrl));
|
||||
data.put("port", portOf(datasourceUrl));
|
||||
data.put("databaseName", databaseNameOf(datasourceUrl));
|
||||
data.put("username", datasourceUsername);
|
||||
data.put("password", MASKED_PASSWORD);
|
||||
data.put("driverClassName", "com.mysql.cj.jdbc.Driver");
|
||||
data.put("databaseVersion", dbInfo);
|
||||
return SaResult.ok().setData(data);
|
||||
}
|
||||
|
||||
/** 数据库连接不能存放在被它配置的库里(鸡生蛋),运维侧改配置后重启生效 */
|
||||
@PostMapping("/config/database")
|
||||
public SaResult updateDatabaseConfig() {
|
||||
return SaResult.error("数据库连接为服务端启动配置,请在 application-dev.yml 中修改后重启服务");
|
||||
}
|
||||
|
||||
// ---- 关于作者:管理端编辑(聚合结构) ----
|
||||
|
||||
@GetMapping("/about/view")
|
||||
public SaResult aboutView() {
|
||||
return SaResult.ok().setData(aboutService.buildProfile());
|
||||
}
|
||||
|
||||
@PostMapping("/about/save")
|
||||
public SaResult aboutSave(@RequestBody Map<String, Object> profile) {
|
||||
aboutService.saveProfile(profile);
|
||||
return SaResult.ok("保存成功");
|
||||
}
|
||||
|
||||
/** 个人中心身份档案:只更新 name/role/tags/avatar */
|
||||
@PostMapping("/about/save-identity")
|
||||
public SaResult aboutSaveIdentity(@RequestBody Map<String, Object> body) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> tags = (List<String>) body.get("tags");
|
||||
aboutService.saveIdentity(
|
||||
(String) body.get("name"),
|
||||
(String) body.get("role"),
|
||||
tags,
|
||||
(String) body.get("avatar"));
|
||||
return SaResult.ok("身份档案已保存");
|
||||
}
|
||||
|
||||
// ---- 此时此刻:管理端编辑(聚合结构) ----
|
||||
|
||||
@GetMapping("/now/view")
|
||||
public SaResult nowView() {
|
||||
return SaResult.ok().setData(nowService.buildContent());
|
||||
}
|
||||
|
||||
@PostMapping("/now/save")
|
||||
public SaResult nowSave(@RequestBody Map<String, Object> content) {
|
||||
nowService.saveContent(content);
|
||||
return SaResult.ok("保存成功");
|
||||
}
|
||||
|
||||
/** jdbc:mysql://host:port/database?... → host */
|
||||
private String hostOf(String url) {
|
||||
Map<String, String> parts = parseJdbcUrl(url);
|
||||
return parts.getOrDefault("host", "");
|
||||
}
|
||||
|
||||
private String portOf(String url) {
|
||||
Map<String, String> parts = parseJdbcUrl(url);
|
||||
return parts.getOrDefault("port", "");
|
||||
}
|
||||
|
||||
private String databaseNameOf(String url) {
|
||||
Map<String, String> parts = parseJdbcUrl(url);
|
||||
return parts.getOrDefault("database", "");
|
||||
}
|
||||
|
||||
private Map<String, String> parseJdbcUrl(String url) {
|
||||
Map<String, String> parts = new LinkedHashMap<>();
|
||||
if (url == null) {
|
||||
return parts;
|
||||
}
|
||||
int prefix = url.indexOf("//");
|
||||
if (prefix < 0) {
|
||||
return parts;
|
||||
}
|
||||
String rest = url.substring(prefix + 2);
|
||||
int slash = rest.indexOf('/');
|
||||
String hostPort = slash < 0 ? rest : rest.substring(0, slash);
|
||||
if (slash >= 0) {
|
||||
String db = rest.substring(slash + 1);
|
||||
int q = db.indexOf('?');
|
||||
parts.put("database", q < 0 ? db : db.substring(0, q));
|
||||
}
|
||||
int colon = hostPort.indexOf(':');
|
||||
if (colon < 0) {
|
||||
parts.put("host", hostPort);
|
||||
} else {
|
||||
parts.put("host", hostPort.substring(0, colon));
|
||||
parts.put("port", hostPort.substring(colon + 1));
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.service.FileService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/files")
|
||||
public class FileController {
|
||||
|
||||
private final FileService fileService;
|
||||
|
||||
public FileController(FileService fileService) {
|
||||
this.fileService = fileService;
|
||||
}
|
||||
|
||||
@GetMapping("/storage-type")
|
||||
public SaResult storageType() {
|
||||
return SaResult.ok().setData(Map.of("type", fileService.getStorageType()));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public SaResult list() {
|
||||
return SaResult.ok().setData(fileService.listFiles());
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
public SaResult delete(@RequestParam String fileName) {
|
||||
try {
|
||||
return fileService.delete(fileName)
|
||||
? SaResult.ok("删除成功")
|
||||
: SaResult.error("文件不存在或路径不合法");
|
||||
} catch (Exception e) {
|
||||
return SaResult.error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/upload")
|
||||
public SaResult upload(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(required = false) String purpose) {
|
||||
Long uploaderId = StpUtil.isLogin() ? Long.valueOf(StpUtil.getLoginId().toString()) : null;
|
||||
try {
|
||||
Map<String, Object> result = fileService.upload(file, purpose, uploaderId);
|
||||
return SaResult.ok("上传成功").setData(result);
|
||||
} catch (Exception e) {
|
||||
return SaResult.error("上传失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.FriendLink;
|
||||
import com.puddy.blog.service.FriendLinkService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/links")
|
||||
public class FriendLinkController {
|
||||
|
||||
private final FriendLinkService linkService;
|
||||
|
||||
public FriendLinkController(FriendLinkService linkService) {
|
||||
this.linkService = linkService;
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public SaResult list() {
|
||||
return SaResult.ok().setData(linkService.listAll());
|
||||
}
|
||||
|
||||
/** 与旧版一致:create 与 update 均为 POST */
|
||||
@PostMapping("/create")
|
||||
public SaResult create(@RequestBody FriendLink link) {
|
||||
return SaResult.ok("创建成功").setData(linkService.save(link));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public SaResult update(@RequestBody FriendLink link) {
|
||||
return SaResult.ok("更新成功").setData(linkService.save(link));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public SaResult delete(@PathVariable Long id) {
|
||||
linkService.delete(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.FootprintCategory;
|
||||
import com.puddy.blog.entity.GalleryPhoto;
|
||||
import com.puddy.blog.service.GalleryService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
public class GalleryController {
|
||||
|
||||
private final GalleryService galleryService;
|
||||
|
||||
public GalleryController(GalleryService galleryService) {
|
||||
this.galleryService = galleryService;
|
||||
}
|
||||
|
||||
// ---- 相册照片 ----
|
||||
@GetMapping("/gallery/list")
|
||||
public SaResult listPhotos() {
|
||||
return SaResult.ok().setData(galleryService.listPhotos());
|
||||
}
|
||||
|
||||
/** 详情:id 或 slug */
|
||||
@GetMapping("/gallery/detail/{idOrSlug}")
|
||||
public SaResult detailPhoto(@PathVariable String idOrSlug) {
|
||||
GalleryPhoto photo = galleryService.detailPhoto(idOrSlug);
|
||||
return photo != null ? SaResult.data(photo) : SaResult.error("未找到该照片");
|
||||
}
|
||||
|
||||
@PostMapping("/gallery/create")
|
||||
public SaResult createPhoto(@RequestBody GalleryPhoto photo) {
|
||||
return SaResult.ok("创建成功").setData(galleryService.savePhoto(photo));
|
||||
}
|
||||
|
||||
@PutMapping("/gallery/update")
|
||||
public SaResult updatePhoto(@RequestBody GalleryPhoto photo) {
|
||||
return SaResult.ok("更新成功").setData(galleryService.savePhoto(photo));
|
||||
}
|
||||
|
||||
@DeleteMapping("/gallery/delete/{id}")
|
||||
public SaResult deletePhoto(@PathVariable Long id) {
|
||||
galleryService.deletePhoto(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
|
||||
// ---- 足迹分类 ----
|
||||
@GetMapping("/footprint-category/list")
|
||||
public SaResult listCategories() {
|
||||
return SaResult.ok().setData(galleryService.listCategories());
|
||||
}
|
||||
|
||||
@PostMapping("/footprint-category/create")
|
||||
public SaResult createCategory(@RequestBody FootprintCategory category) {
|
||||
return SaResult.ok("创建成功").setData(galleryService.saveCategory(category));
|
||||
}
|
||||
|
||||
@PutMapping("/footprint-category/update")
|
||||
public SaResult updateCategory(@RequestBody FootprintCategory category) {
|
||||
return SaResult.ok("更新成功").setData(galleryService.saveCategory(category));
|
||||
}
|
||||
|
||||
@DeleteMapping("/footprint-category/delete/{id}")
|
||||
public SaResult deleteCategory(@PathVariable Long id) {
|
||||
galleryService.deleteCategory(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.dto.LoveCoupleDTO;
|
||||
import com.puddy.blog.dto.LoveHeroDTO;
|
||||
import com.puddy.blog.dto.LoveStatsDTO;
|
||||
import com.puddy.blog.entity.LoveBucketItem;
|
||||
import com.puddy.blog.entity.LoveEntry;
|
||||
import com.puddy.blog.entity.LoveTimeCapsule;
|
||||
import com.puddy.blog.service.LoveService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/love")
|
||||
public class LoveController {
|
||||
|
||||
private final LoveService loveService;
|
||||
|
||||
public LoveController(LoveService loveService) {
|
||||
this.loveService = loveService;
|
||||
}
|
||||
|
||||
/** 恋爱域配置(公开):{couple, stats, heroBgUrl, atmospheres[]} */
|
||||
@GetMapping("/config")
|
||||
public SaResult config() {
|
||||
return SaResult.ok().setData(loveService.config());
|
||||
}
|
||||
|
||||
@PutMapping("/couple")
|
||||
public SaResult saveCouple(@RequestBody LoveCoupleDTO dto) {
|
||||
loveService.saveCouple(dto);
|
||||
return SaResult.ok("伴侣信息已保存");
|
||||
}
|
||||
|
||||
@PutMapping("/stats")
|
||||
public SaResult saveStats(@RequestBody LoveStatsDTO dto) {
|
||||
loveService.saveStats(dto);
|
||||
return SaResult.ok("陪伴数据已保存");
|
||||
}
|
||||
|
||||
@PutMapping("/hero")
|
||||
public SaResult saveHero(@RequestBody LoveHeroDTO dto) {
|
||||
loveService.saveHero(dto);
|
||||
return SaResult.ok("恋爱开屏配置已应用");
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public SaResult listEntries() {
|
||||
return SaResult.ok().setData(loveService.listEntries());
|
||||
}
|
||||
|
||||
/** 详情:id 或 slug */
|
||||
@GetMapping("/detail/{idOrSlug}")
|
||||
public SaResult detailEntry(@PathVariable String idOrSlug) {
|
||||
LoveEntry entry = loveService.detail(idOrSlug);
|
||||
return entry != null ? SaResult.data(entry) : SaResult.error("未找到该时光记录");
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public SaResult createEntry(@RequestBody LoveEntry entry) {
|
||||
return SaResult.ok("创建成功").setData(loveService.saveEntry(entry));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public SaResult updateEntry(@RequestBody LoveEntry entry) {
|
||||
return SaResult.ok("更新成功").setData(loveService.saveEntry(entry));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public SaResult deleteEntry(@PathVariable Long id) {
|
||||
loveService.deleteEntry(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
|
||||
@GetMapping("/bucket/list")
|
||||
public SaResult listBucket() {
|
||||
return SaResult.ok().setData(loveService.listBucket());
|
||||
}
|
||||
|
||||
@PostMapping("/bucket/create")
|
||||
public SaResult createBucket(@RequestBody LoveBucketItem item) {
|
||||
return SaResult.ok("创建成功").setData(loveService.saveBucket(item));
|
||||
}
|
||||
|
||||
@PutMapping("/bucket/update")
|
||||
public SaResult updateBucket(@RequestBody LoveBucketItem item) {
|
||||
return SaResult.ok("更新成功").setData(loveService.saveBucket(item));
|
||||
}
|
||||
|
||||
@DeleteMapping("/bucket/delete/{id}")
|
||||
public SaResult deleteBucket(@PathVariable Long id) {
|
||||
loveService.deleteBucket(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
|
||||
@GetMapping("/capsule/list")
|
||||
public SaResult listCapsules() {
|
||||
return SaResult.ok().setData(loveService.listCapsules());
|
||||
}
|
||||
|
||||
@PostMapping("/capsule/create")
|
||||
public SaResult createCapsule(@RequestBody LoveTimeCapsule capsule) {
|
||||
return SaResult.ok("创建成功").setData(loveService.saveCapsule(capsule));
|
||||
}
|
||||
|
||||
@PutMapping("/capsule/update")
|
||||
public SaResult updateCapsule(@RequestBody LoveTimeCapsule capsule) {
|
||||
return SaResult.ok("更新成功").setData(loveService.saveCapsule(capsule));
|
||||
}
|
||||
|
||||
@DeleteMapping("/capsule/delete/{id}")
|
||||
public SaResult deleteCapsule(@PathVariable Long id) {
|
||||
loveService.deleteCapsule(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
|
||||
@PostMapping("/capsule/{id}/open")
|
||||
public SaResult openCapsule(@PathVariable Long id, @RequestParam String code) {
|
||||
return loveService.bypassOpen(id, code)
|
||||
? SaResult.ok("开启成功")
|
||||
: SaResult.error("口令错误");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.Note;
|
||||
import com.puddy.blog.service.NoteService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/notes")
|
||||
public class NoteController {
|
||||
|
||||
private final NoteService noteService;
|
||||
|
||||
public NoteController(NoteService noteService) {
|
||||
this.noteService = noteService;
|
||||
}
|
||||
|
||||
/** 列表(旧版契约:返回数组;访客仅见公开随笔,管理端全量) */
|
||||
@GetMapping("/list")
|
||||
public SaResult list() {
|
||||
List<Note> list = noteService.list(!StpUtil.isLogin());
|
||||
return SaResult.data(list);
|
||||
}
|
||||
|
||||
/** 前台发布(公开接口):仅新增,不能按 id 覆盖已有随笔 */
|
||||
@PostMapping("/create")
|
||||
public SaResult create(@RequestBody Note note) {
|
||||
return SaResult.ok("随笔发布成功").setData(noteService.create(note));
|
||||
}
|
||||
|
||||
/** 管理端更新(需登录) */
|
||||
@PutMapping("/update")
|
||||
public SaResult update(@RequestBody Note note) {
|
||||
return SaResult.ok("更新成功").setData(noteService.update(note));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@SaCheckLogin
|
||||
public SaResult delete(@PathVariable Long id) {
|
||||
noteService.delete(id);
|
||||
return SaResult.ok("便签随笔删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.PondFeedback;
|
||||
import com.puddy.blog.entity.PondFeedbackReply;
|
||||
import com.puddy.blog.entity.PondFeedbackType;
|
||||
import com.puddy.blog.entity.PondTag;
|
||||
import com.puddy.blog.service.PondService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class PondController {
|
||||
|
||||
private final PondService pondService;
|
||||
|
||||
public PondController(PondService pondService) {
|
||||
this.pondService = pondService;
|
||||
}
|
||||
|
||||
// ---- 前台 ----
|
||||
@GetMapping("/pond/feedback")
|
||||
public SaResult list(@RequestParam(defaultValue = "1") int page,
|
||||
@RequestParam(defaultValue = "10") int pageSize,
|
||||
@RequestParam(required = false) String category) {
|
||||
List<PondFeedback> list = pondService.listPublic(page, pageSize, category);
|
||||
return SaResult.data(list);
|
||||
}
|
||||
|
||||
@PostMapping("/pond/feedback")
|
||||
public SaResult create(@RequestBody PondFeedback feedback, HttpServletRequest request) {
|
||||
String ip = request.getRemoteAddr();
|
||||
feedback.setIp(ip);
|
||||
String ua = request.getHeader("User-Agent");
|
||||
feedback.setUserAgent(ua != null && ua.length() > 500 ? ua.substring(0, 500) : ua);
|
||||
if (feedback.getVisitorId() == null) {
|
||||
feedback.setVisitorId(ip);
|
||||
}
|
||||
try {
|
||||
PondFeedback saved = pondService.create(feedback);
|
||||
return SaResult.data(saved)
|
||||
.setMsg("您的反馈已提交,博主会在后台审核后为您公开展示!感谢!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
return SaResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/pond/feedback/{id}/like")
|
||||
public SaResult like(@PathVariable Long id, HttpServletRequest request) {
|
||||
String visitorId = request.getRemoteAddr();
|
||||
return pondService.like(id, visitorId)
|
||||
? SaResult.ok("点赞成功")
|
||||
: SaResult.error("您已经为这条反馈点过赞啦");
|
||||
}
|
||||
|
||||
@GetMapping("/pond/feedback/{id}")
|
||||
public SaResult detail(@PathVariable Long id) {
|
||||
PondFeedback feedback = pondService.detail(id);
|
||||
return feedback != null ? SaResult.data(feedback) : SaResult.error("反馈不存在或已被删除");
|
||||
}
|
||||
|
||||
@GetMapping("/pond/feedback-type/list")
|
||||
public SaResult listTypes() {
|
||||
return SaResult.ok().setData(pondService.listTypes());
|
||||
}
|
||||
|
||||
@PostMapping("/pond/feedback-type/create")
|
||||
public SaResult createType(@RequestBody PondFeedbackType type) {
|
||||
return SaResult.ok("创建成功").setData(pondService.saveType(type));
|
||||
}
|
||||
|
||||
@PutMapping("/pond/feedback-type/update")
|
||||
public SaResult updateType(@RequestBody PondFeedbackType type) {
|
||||
return SaResult.ok("更新成功").setData(pondService.saveType(type));
|
||||
}
|
||||
|
||||
@DeleteMapping("/pond/feedback-type/delete/{id}")
|
||||
public SaResult deleteType(@PathVariable Long id) {
|
||||
return pondService.deleteType(id);
|
||||
}
|
||||
|
||||
// ---- 管理端(/api/admin/** 路由守卫统一鉴权) ----
|
||||
@GetMapping("/admin/pond/feedback")
|
||||
public SaResult adminList(@RequestParam(defaultValue = "1") int page,
|
||||
@RequestParam(defaultValue = "10") int pageSize,
|
||||
@RequestParam(required = false) String status,
|
||||
@RequestParam(required = false) String category) {
|
||||
List<PondFeedback> list = pondService.adminList(page, pageSize, status, category);
|
||||
return SaResult.data(list);
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/feedback/{id}/approve")
|
||||
public SaResult approve(@PathVariable Long id) {
|
||||
return pondService.approve(id) != null ? SaResult.ok("审核已通过且公开") : SaResult.error("未找到反馈");
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/feedback/{id}/reject")
|
||||
public SaResult reject(@PathVariable Long id) {
|
||||
return pondService.reject(id) != null ? SaResult.ok("审核已拒绝且隐藏") : SaResult.error("未找到反馈");
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/feedback/{id}/adopt")
|
||||
public SaResult adopt(@PathVariable Long id, @RequestBody Map<String, String> body) {
|
||||
String adoptedNote = body != null ? body.getOrDefault("adoptedNote", "") : "";
|
||||
return pondService.adopt(id, adoptedNote) != null
|
||||
? SaResult.ok("建议已成功采纳") : SaResult.error("未找到反馈");
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/feedback/{id}/pending")
|
||||
public SaResult resetToPending(@PathVariable Long id) {
|
||||
return pondService.resetToPending(id) != null ? SaResult.ok("已重置为待审核状态") : SaResult.error("未找到反馈");
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/feedback/{id}/complete")
|
||||
public SaResult complete(@PathVariable Long id) {
|
||||
return pondService.complete(id) != null ? SaResult.ok("已标记为已完成") : SaResult.error("未找到反馈");
|
||||
}
|
||||
|
||||
@PostMapping("/admin/pond/feedback/{id}/reply")
|
||||
public SaResult adminReply(@PathVariable Long id, @RequestBody Map<String, String> body) {
|
||||
String content = body != null ? body.get("content") : "";
|
||||
if (content == null || content.trim().isEmpty()) {
|
||||
return SaResult.error("回复内容不能为空");
|
||||
}
|
||||
PondFeedbackReply reply = pondService.adminReply(id, content);
|
||||
return SaResult.data(reply).setMsg("回复成功");
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/feedback/{id}/pin")
|
||||
public SaResult togglePin(@PathVariable Long id) {
|
||||
PondFeedback feedback = pondService.togglePin(id);
|
||||
if (feedback == null) return SaResult.error("未找到反馈");
|
||||
return SaResult.ok(Boolean.TRUE.equals(feedback.getIsPinned()) ? "已成功置顶" : "已取消置顶").setData(feedback);
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/feedback/{id}/feature")
|
||||
public SaResult toggleFeature(@PathVariable Long id) {
|
||||
PondFeedback feedback = pondService.toggleFeature(id);
|
||||
if (feedback == null) return SaResult.error("未找到反馈");
|
||||
return SaResult.ok(Boolean.TRUE.equals(feedback.getIsFeatured()) ? "已标为精选" : "已取消精选").setData(feedback);
|
||||
}
|
||||
|
||||
@DeleteMapping("/admin/pond/feedback/{id}")
|
||||
public SaResult delete(@PathVariable Long id) {
|
||||
return pondService.delete(id) ? SaResult.ok("删除成功") : SaResult.error("未找到反馈");
|
||||
}
|
||||
|
||||
@PostMapping("/admin/pond/feedback/{id}/tags")
|
||||
public SaResult bindTags(@PathVariable Long id, @RequestBody List<Long> tagIds) {
|
||||
pondService.bindTags(id, tagIds);
|
||||
return SaResult.ok("标签绑定已更新");
|
||||
}
|
||||
|
||||
@GetMapping("/admin/pond/tags")
|
||||
public SaResult listTags() {
|
||||
return SaResult.ok().setData(pondService.listTags());
|
||||
}
|
||||
|
||||
@PostMapping("/admin/pond/tags")
|
||||
public SaResult createTag(@RequestBody PondTag tag) {
|
||||
return pondService.createTag(tag);
|
||||
}
|
||||
|
||||
@PutMapping("/admin/pond/tags/{id}")
|
||||
public SaResult updateTag(@PathVariable Long id, @RequestBody PondTag tag) {
|
||||
return pondService.updateTag(id, tag) ? SaResult.ok("标签更新成功") : SaResult.error("未找到标签");
|
||||
}
|
||||
|
||||
@DeleteMapping("/admin/pond/tags/{id}")
|
||||
public SaResult deleteTag(@PathVariable Long id) {
|
||||
return pondService.deleteTag(id) ? SaResult.ok("标签删除成功") : SaResult.error("未找到标签");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.puddy.blog.controller;
|
||||
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.puddy.blog.entity.TimeLetter;
|
||||
import com.puddy.blog.service.TimeLetterService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/time-letter")
|
||||
public class TimeLetterController {
|
||||
|
||||
private final TimeLetterService letterService;
|
||||
|
||||
public TimeLetterController(TimeLetterService letterService) {
|
||||
this.letterService = letterService;
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public SaResult list() {
|
||||
return SaResult.ok().setData(letterService.listAll());
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public SaResult create(@RequestBody TimeLetter letter) {
|
||||
return SaResult.ok("创建成功").setData(letterService.save(letter));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public SaResult update(@RequestBody TimeLetter letter) {
|
||||
return SaResult.ok("更新成功").setData(letterService.save(letter));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public SaResult delete(@PathVariable Long id) {
|
||||
letterService.delete(id);
|
||||
return SaResult.ok("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.puddy.blog.dto;
|
||||
|
||||
/**
|
||||
* 管理员账户维护(sys_user 为唯一权威;password 为空表示不改密码)。
|
||||
*/
|
||||
public record AccountDTO(String username, String password) {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.puddy.blog.dto;
|
||||
|
||||
/**
|
||||
* AI 能力配置(落 sys_config 的 deepseek.* 键,api-key 加密存储)。
|
||||
*/
|
||||
public record AiDTO(String apiKey, String baseUrl, String modelName) {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.puddy.blog.dto;
|
||||
|
||||
/**
|
||||
* 伴侣信息(对应 love_couple 恒 1 行表)。
|
||||
*/
|
||||
public record LoveCoupleDTO(String name, String avatar) {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.puddy.blog.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 恋爱开屏配置:自定义背景(love_page)+ 氛围切换列表(love_atmosphere 整块替换)。
|
||||
*/
|
||||
public record LoveHeroDTO(String heroBgUrl, List<Atmosphere> atmospheres) {
|
||||
|
||||
/** id 即前端氛围 key(旧 page.love.atmospheres 的 id 字段) */
|
||||
public record Atmosphere(String id, String name, String src, String type) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.puddy.blog.dto;
|
||||
|
||||
/**
|
||||
* 恋爱陪伴数据(对应 love_stats 恒 1 行表;startDate 为 YYYY-MM-DD)。
|
||||
*/
|
||||
public record LoveStatsDTO(
|
||||
String startDate,
|
||||
Integer citiesCount,
|
||||
Integer flightDistance,
|
||||
Integer movieCount,
|
||||
Integer mealCount) {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.puddy.blog.dto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 对象存储配置(落 sys_config 的 storage.* 键)。
|
||||
*/
|
||||
public record StorageDTO(String storageType, Minio minio, Qiniu qiniu) {
|
||||
|
||||
public record Minio(String endpoint, String accessKey, String secretKey, String bucketName) {
|
||||
}
|
||||
|
||||
public record Qiniu(String domain, String accessKey, String secretKey, String bucketName) {
|
||||
}
|
||||
|
||||
private static String str(Map<String, String> source, String key) {
|
||||
String value = source.get(key);
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
|
||||
public static StorageDTO from(Map<String, String> c) {
|
||||
return new StorageDTO(
|
||||
str(c, "storage.type"),
|
||||
new Minio(str(c, "storage.minio.endpoint"), str(c, "storage.minio.accessKey"),
|
||||
str(c, "storage.minio.secretKey"), str(c, "storage.minio.bucketName")),
|
||||
new Qiniu(str(c, "storage.qiniu.domain"), str(c, "storage.qiniu.accessKey"),
|
||||
str(c, "storage.qiniu.secretKey"), str(c, "storage.qiniu.bucketName")));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.puddy.blog.dto;
|
||||
|
||||
/**
|
||||
* 页面可见性与全站口令(对应 site_access 恒 1 行表)。
|
||||
*/
|
||||
public record VisibilityDTO(
|
||||
Boolean loveEnabled,
|
||||
Boolean letterEnabled,
|
||||
Boolean nowEnabled,
|
||||
Boolean aboutEnabled,
|
||||
Boolean footprintsEnabled,
|
||||
Boolean pondEnabled,
|
||||
String accessPasscode) {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("about_belief")
|
||||
public class AboutBelief {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String content;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("about_fragment")
|
||||
public class AboutFragment {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** status / coordinate / ... */
|
||||
private String category;
|
||||
private String title;
|
||||
private String description;
|
||||
@TableField("media_url")
|
||||
private String mediaUrl;
|
||||
@TableField("media_type")
|
||||
private String mediaType;
|
||||
@TableField("link_url")
|
||||
private String linkUrl;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<AboutFragmentTag> tags;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("about_fragment_tag")
|
||||
public class AboutFragmentTag {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableField("fragment_id")
|
||||
private Long fragmentId;
|
||||
private String tag;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("about_link")
|
||||
public class AboutLink {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String title;
|
||||
private String url;
|
||||
private String icon;
|
||||
/** 1=新窗口打开 */
|
||||
private Boolean external;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("about_page")
|
||||
public class AboutPage {
|
||||
/** 恒 1 行,固定主键 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
private String name;
|
||||
private String role;
|
||||
private String headline;
|
||||
private String introduction;
|
||||
@TableField("avatar_url")
|
||||
private String avatarUrl;
|
||||
@TableField("status_text")
|
||||
private String statusText;
|
||||
@TableField("status_title")
|
||||
private String statusTitle;
|
||||
@TableField("coordinate_title")
|
||||
private String coordinateTitle;
|
||||
@TableField("fragment_title")
|
||||
private String fragmentTitle;
|
||||
@TableField("fragment_subtitle")
|
||||
private String fragmentSubtitle;
|
||||
@TableField("belief_title")
|
||||
private String beliefTitle;
|
||||
@TableField("belief_subtitle")
|
||||
private String beliefSubtitle;
|
||||
@TableField("location_name")
|
||||
private String locationName;
|
||||
private BigDecimal latitude;
|
||||
private BigDecimal longitude;
|
||||
@TableField("cta_title")
|
||||
private String ctaTitle;
|
||||
@TableField("cta_description")
|
||||
private String ctaDescription;
|
||||
@TableField("explore_closing")
|
||||
private String exploreClosing;
|
||||
@TableField("footer_subtitle")
|
||||
private String footerSubtitle;
|
||||
@TableField("footer_signature")
|
||||
private String footerSignature;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("about_tag")
|
||||
public class AboutTag {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String text;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("about_tagline")
|
||||
public class AboutTagline {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String text;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("achievement")
|
||||
public class Achievement {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** 分组(achievement_meta.id, type=category) */
|
||||
@TableField("meta_id")
|
||||
private Long metaId;
|
||||
/** 等级 gold/silver/bronze */
|
||||
@TableField("level_code")
|
||||
private String levelCode;
|
||||
/** 旧字段名 title,对应新列 name */
|
||||
@TableField("name")
|
||||
private String title;
|
||||
private String description;
|
||||
private String icon;
|
||||
private String cover;
|
||||
/** 旧字段名 achieveDate,对应新列 achieved_at */
|
||||
@TableField("achieved_at")
|
||||
private LocalDate achieveDate;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
// ---- 非库字段:旧 VO 兼容(service 层聚合) ----
|
||||
/** 分组 code(milestone/life/daily,聚合自 achievement_meta) */
|
||||
@TableField(exist = false)
|
||||
private String category;
|
||||
/** 等级 code(旧 level 字段) */
|
||||
@TableField(exist = false)
|
||||
private String level;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("achievement_meta")
|
||||
public class AchievementMeta {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** category 分组 / level 等级 */
|
||||
private String type;
|
||||
private String name;
|
||||
private String code;
|
||||
private String icon;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("blog")
|
||||
public class Blog {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String slug;
|
||||
private String title;
|
||||
private String summary;
|
||||
private String content;
|
||||
/** 旧字段名 cover,对应新列 cover_image */
|
||||
@TableField("cover_image")
|
||||
private String cover;
|
||||
private Long categoryId;
|
||||
@TableField("author_id")
|
||||
private Long authorId;
|
||||
/** draft / scheduled / published / archived */
|
||||
private String status;
|
||||
/** public / hidden / private */
|
||||
private String visibility;
|
||||
private String mood;
|
||||
@TableField("is_top")
|
||||
private Integer isTop;
|
||||
@TableField("is_original")
|
||||
private Integer isOriginal;
|
||||
@TableField("source_url")
|
||||
private String sourceUrl;
|
||||
private Integer views;
|
||||
@TableField("published_at")
|
||||
private LocalDateTime publishedAt;
|
||||
@TableField("scheduled_at")
|
||||
private LocalDateTime scheduledAt;
|
||||
@TableField("deleted_at")
|
||||
private LocalDateTime deletedAt;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
// ---- 非库字段:旧 VO 兼容(service 层聚合) ----
|
||||
/** 分类名 */
|
||||
@TableField(exist = false)
|
||||
private String category;
|
||||
/** 作者昵称 */
|
||||
@TableField(exist = false)
|
||||
private String author;
|
||||
/** 逗号拼接标签(旧格式,聚合自 tag/content_tag) */
|
||||
@TableField(exist = false)
|
||||
private String tags;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("category")
|
||||
public class Category {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String name;
|
||||
private String slug;
|
||||
private Long parentId;
|
||||
private String icon;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("content_image")
|
||||
public class ContentImage {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** NOTE / TIME_LETTER */
|
||||
private String targetType;
|
||||
private Long targetId;
|
||||
private String url;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("content_tag")
|
||||
public class ContentTag {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long tagId;
|
||||
/** POST / NOTE */
|
||||
private String targetType;
|
||||
private Long targetId;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("footprint_category")
|
||||
public class FootprintCategory {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String name;
|
||||
private String code;
|
||||
private String icon;
|
||||
private String description;
|
||||
@TableField("cover_url")
|
||||
private String coverUrl;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("friend_link")
|
||||
public class FriendLink {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** 旧字段名 title,对应新列 name */
|
||||
@TableField("name")
|
||||
private String title;
|
||||
private String url;
|
||||
/** 旧字段名 logo,对应新列 avatar */
|
||||
@TableField("avatar")
|
||||
private String logo;
|
||||
private String description;
|
||||
private String category;
|
||||
/** 1 展示 0 隐藏(service 与旧 visibility 字符串互转) */
|
||||
private Integer status;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 旧 visibility 字段("public"/"hidden",service 层与 status 互转) */
|
||||
@TableField(exist = false)
|
||||
private String visibility;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("gallery_photo")
|
||||
public class GalleryPhoto {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long categoryId;
|
||||
private String slug;
|
||||
private String title;
|
||||
/** 旧字段名 src,对应新列 url */
|
||||
@TableField("url")
|
||||
private String src;
|
||||
private String description;
|
||||
/** image / video */
|
||||
private String type;
|
||||
private String camera;
|
||||
private String lens;
|
||||
@TableField("film_stock")
|
||||
private String filmStock;
|
||||
private String settings;
|
||||
private String location;
|
||||
private BigDecimal longitude;
|
||||
private BigDecimal latitude;
|
||||
@TableField("footprint_type")
|
||||
private String footprintType;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
/** 旧字段名 date,对应新列 taken_at */
|
||||
@TableField("taken_at")
|
||||
private LocalDateTime date;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("love_atmosphere")
|
||||
public class LoveAtmosphere {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** 前端氛围 key(旧 id,如 cherry) */
|
||||
@TableField("code")
|
||||
private String code;
|
||||
/** 氛围名(如 樱落) */
|
||||
@TableField("name")
|
||||
private String name;
|
||||
/** 视频/图片地址 */
|
||||
@TableField("src")
|
||||
private String src;
|
||||
/** video / image */
|
||||
@TableField("type")
|
||||
private String type;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("love_bucket_item")
|
||||
public class LoveBucketItem {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String title;
|
||||
private String description;
|
||||
private String category;
|
||||
private String cover;
|
||||
private String thoughts;
|
||||
/** 旧字段名 completed,对应新列 is_done */
|
||||
@TableField("is_done")
|
||||
private Boolean completed;
|
||||
/** 旧字段名 completedDate(String),对应新列 done_at */
|
||||
@TableField("done_at")
|
||||
private LocalDateTime completedDate;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("love_couple")
|
||||
public class LoveCouple {
|
||||
/** 恒 1 行,非自增 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
/** 伴侣昵称 */
|
||||
@TableField("name")
|
||||
private String name;
|
||||
/** 伴侣头像 */
|
||||
@TableField("avatar")
|
||||
private String avatar;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("love_entry")
|
||||
public class LoveEntry {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String slug;
|
||||
private String title;
|
||||
private String content;
|
||||
/** 旧字段名 date,对应新列 event_date */
|
||||
@TableField("event_date")
|
||||
private LocalDateTime date;
|
||||
private String location;
|
||||
private String mood;
|
||||
private String visibility;
|
||||
private String cover;
|
||||
private BigDecimal longitude;
|
||||
private BigDecimal latitude;
|
||||
@TableField("footprint_type")
|
||||
private String footprintType;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("love_page")
|
||||
public class LovePage {
|
||||
/** 恒 1 行,非自增 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
/** 恋爱开屏自定义背景图/视频 URL */
|
||||
@TableField("hero_bg_url")
|
||||
private String heroBgUrl;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("love_stats")
|
||||
public class LoveStats {
|
||||
/** 恒 1 行,非自增 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
/** 恋爱开始日期 */
|
||||
@TableField("start_date")
|
||||
private LocalDate startDate;
|
||||
/** 共同走过的城市数 */
|
||||
@TableField("cities_count")
|
||||
private Integer citiesCount;
|
||||
/** 共同飞行的公里数 */
|
||||
@TableField("flight_distance")
|
||||
private Integer flightDistance;
|
||||
/** 一起看过的电影数 */
|
||||
@TableField("movie_count")
|
||||
private Integer movieCount;
|
||||
/** 一起吃过的火锅/大餐数 */
|
||||
@TableField("meal_count")
|
||||
private Integer mealCount;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("love_time_capsule")
|
||||
public class LoveTimeCapsule {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String title;
|
||||
private String content;
|
||||
private String sender;
|
||||
private String receiver;
|
||||
private LocalDate writeDate;
|
||||
/** 旧字段名 openDate(String),对应新列 open_at */
|
||||
@TableField("open_at")
|
||||
private LocalDateTime openDate;
|
||||
@TableField("is_opened")
|
||||
private Boolean isOpened;
|
||||
@TableField("bypass_code")
|
||||
private String bypassCode;
|
||||
private String prompt;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("media")
|
||||
public class Media {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String url;
|
||||
@TableField("original_name")
|
||||
private String originalName;
|
||||
private Long size;
|
||||
@TableField("mime_type")
|
||||
private String mimeType;
|
||||
private String purpose;
|
||||
@TableField("uploader_id")
|
||||
private Long uploaderId;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("note")
|
||||
public class Note {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String content;
|
||||
private String mood;
|
||||
@TableField("is_public")
|
||||
private Integer isPublic;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createTime;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 旧 images 逗号拼接格式(聚合自 content_image) */
|
||||
@TableField(exist = false)
|
||||
private String images;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("now_item")
|
||||
public class NowItem {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** reading / listening / setup */
|
||||
private String groupType;
|
||||
private String name;
|
||||
@TableField("sub_title")
|
||||
private String subTitle;
|
||||
private String detail;
|
||||
private String quote;
|
||||
private String badge;
|
||||
private String description;
|
||||
private String url;
|
||||
/** reading 封面图 */
|
||||
@TableField("cover_url")
|
||||
private String coverUrl;
|
||||
/** reading 阅读进度 0-100 */
|
||||
private Integer progress;
|
||||
/** setup 指示灯样式类名 */
|
||||
@TableField("light_color")
|
||||
private String lightColor;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("now_page")
|
||||
public class NowPage {
|
||||
/** 恒 1 行,固定主键 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
@TableField("location_name")
|
||||
private String locationName;
|
||||
@TableField("location_coordinates")
|
||||
private String locationCoordinates;
|
||||
@TableField("location_map_text")
|
||||
private String locationMapText;
|
||||
@TableField("location_desc")
|
||||
private String locationDesc;
|
||||
@TableField("mood_title")
|
||||
private String moodTitle;
|
||||
@TableField("mood_status")
|
||||
private String moodStatus;
|
||||
@TableField("mood_desc")
|
||||
private String moodDesc;
|
||||
/** 精神状态雷达图六维 0-100 */
|
||||
@TableField("mood_focus")
|
||||
private Integer moodFocus;
|
||||
@TableField("mood_creative")
|
||||
private Integer moodCreative;
|
||||
@TableField("mood_calm")
|
||||
private Integer moodCalm;
|
||||
@TableField("mood_energy")
|
||||
private Integer moodEnergy;
|
||||
@TableField("mood_social")
|
||||
private Integer moodSocial;
|
||||
@TableField("mood_physical")
|
||||
private Integer moodPhysical;
|
||||
@TableField("focus_title")
|
||||
private String focusTitle;
|
||||
@TableField("focus_subtitle")
|
||||
private String focusSubtitle;
|
||||
@TableField("focus_desc")
|
||||
private String focusDesc;
|
||||
@TableField("focus_code")
|
||||
private String focusCode;
|
||||
@TableField("setup_desc")
|
||||
private String setupDesc;
|
||||
/** 治愈电台播放器样式 bottom-bar / floating */
|
||||
@TableField("radio_player_style")
|
||||
private String radioPlayerStyle;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("now_radio_item")
|
||||
public class NowRadioItem {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** bgm / noise */
|
||||
@TableField("kind")
|
||||
private String kind;
|
||||
/** 曲名 / 音效名 */
|
||||
@TableField("name")
|
||||
private String name;
|
||||
/** bgm 的 artist */
|
||||
@TableField("sub_title")
|
||||
private String subTitle;
|
||||
/** 音频地址(src) */
|
||||
@TableField("url")
|
||||
private String url;
|
||||
/** noise 图标 tailwind 类名 */
|
||||
@TableField("icon")
|
||||
private String icon;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("pond_feedback")
|
||||
public class PondFeedback {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** 类型(新表外键 type_id,service 聚合为旧字段 category) */
|
||||
@TableField("type_id")
|
||||
private Long typeId;
|
||||
private String content;
|
||||
/** 旧字段名 nickname,对应新列 author_name */
|
||||
@TableField("author_name")
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private String email;
|
||||
private String website;
|
||||
private String source;
|
||||
@TableField("is_anonymous")
|
||||
private Boolean isAnonymous;
|
||||
@TableField("is_public")
|
||||
private Boolean isPublic;
|
||||
@TableField("is_pinned")
|
||||
private Boolean isPinned;
|
||||
@TableField("is_featured")
|
||||
private Boolean isFeatured;
|
||||
/** pending / approved / rejected / adopted / done */
|
||||
private String status;
|
||||
private Boolean adopted;
|
||||
@TableField("adopted_note")
|
||||
private String adoptedNote;
|
||||
@TableField("adopted_at")
|
||||
private LocalDateTime adoptedAt;
|
||||
@TableField("view_count")
|
||||
private Integer viewCount;
|
||||
@TableField("visitor_id")
|
||||
private String visitorId;
|
||||
private String ip;
|
||||
@TableField("user_agent")
|
||||
private String userAgent;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// ---- 非库字段:旧 VO 兼容(service 层聚合) ----
|
||||
/** 类型值(pond_feedback_type.value,旧 category 字段) */
|
||||
@TableField(exist = false)
|
||||
private String category;
|
||||
/** 点赞数(实时 COUNT reaction) */
|
||||
@TableField(exist = false)
|
||||
private Integer likeCount;
|
||||
/** 回复数(实时 COUNT reply) */
|
||||
@TableField(exist = false)
|
||||
private Integer replyCount;
|
||||
@TableField(exist = false)
|
||||
private List<PondTag> tags;
|
||||
@TableField(exist = false)
|
||||
private List<PondFeedbackReply> replies;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("pond_feedback_reply")
|
||||
public class PondFeedbackReply {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long feedbackId;
|
||||
private Long parentId;
|
||||
private String content;
|
||||
@TableField("is_admin")
|
||||
private Boolean isAdmin;
|
||||
/** 旧字段名 nickname,对应新列 author_name */
|
||||
@TableField("author_name")
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
@TableField("is_public")
|
||||
private Boolean isPublic;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("pond_feedback_tag")
|
||||
public class PondFeedbackTag {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long feedbackId;
|
||||
private Long tagId;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("pond_feedback_type")
|
||||
public class PondFeedbackType {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String value;
|
||||
private String label;
|
||||
private String icon;
|
||||
private String color;
|
||||
@TableField("sort_order")
|
||||
private Integer sortOrder;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("pond_tag")
|
||||
public class PondTag {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String name;
|
||||
private String color;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("reaction")
|
||||
public class Reaction {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** POST / NOTE / FEEDBACK */
|
||||
private String targetType;
|
||||
private Long targetId;
|
||||
@TableField("visitor_id")
|
||||
private String visitorId;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("site_access")
|
||||
public class SiteAccess {
|
||||
/** 恒 1 行,非自增 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
/** 恋爱纪实页面开关 */
|
||||
@TableField("love_enabled")
|
||||
private Boolean loveEnabled;
|
||||
/** 岁月信件页面开关 */
|
||||
@TableField("letter_enabled")
|
||||
private Boolean letterEnabled;
|
||||
/** 目前状态页面开关 */
|
||||
@TableField("now_enabled")
|
||||
private Boolean nowEnabled;
|
||||
/** 关于作者页面开关 */
|
||||
@TableField("about_enabled")
|
||||
private Boolean aboutEnabled;
|
||||
/** 岁月足迹页面开关 */
|
||||
@TableField("footprints_enabled")
|
||||
private Boolean footprintsEnabled;
|
||||
/** 鱼塘反馈页面开关 */
|
||||
@TableField("pond_enabled")
|
||||
private Boolean pondEnabled;
|
||||
/** 全站私密档案访问口令 */
|
||||
@TableField("access_passcode")
|
||||
private String accessPasscode;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("site_beian")
|
||||
public class SiteBeian {
|
||||
/** 恒 1 行,非自增 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
/** 工信部 ICP 备案号 */
|
||||
@TableField("icp")
|
||||
private String icp;
|
||||
/** ICP 跳转链接 */
|
||||
@TableField("icp_url")
|
||||
private String icpUrl;
|
||||
/** 公安联网备案号 */
|
||||
@TableField("police")
|
||||
private String police;
|
||||
/** 公安备案跳转链接 */
|
||||
@TableField("police_url")
|
||||
private String policeUrl;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("site_map")
|
||||
public class SiteMap {
|
||||
/** 恒 1 行,非自增 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
/** 高德地图 API Key */
|
||||
@TableField("amap_key")
|
||||
private String amapKey;
|
||||
/** 高德地图安全密钥 */
|
||||
@TableField("amap_security_js_code")
|
||||
private String amapSecurityJsCode;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("site_profile")
|
||||
public class SiteProfile {
|
||||
/** 恒 1 行,非自增 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
/** LOGO 图片链接 */
|
||||
@TableField("logo_url")
|
||||
private String logoUrl;
|
||||
/** LOGO 展示文字 */
|
||||
@TableField("logo_text")
|
||||
private String logoText;
|
||||
/** Favicon 图片链接 */
|
||||
@TableField("favicon_url")
|
||||
private String faviconUrl;
|
||||
/** 全站默认标题 */
|
||||
@TableField("title_default")
|
||||
private String titleDefault;
|
||||
/** 关于作者页标题 */
|
||||
@TableField("title_about")
|
||||
private String titleAbout;
|
||||
/** 主页开屏描边巨行 */
|
||||
@TableField("welcome_text")
|
||||
private String welcomeText;
|
||||
/** 开屏眉题中文(博客名) */
|
||||
@TableField("welcome_subtitle")
|
||||
private String welcomeSubtitle;
|
||||
/** 主页开屏巨字(英文压缩体展示) */
|
||||
@TableField("hero_title")
|
||||
private String heroTitle;
|
||||
/** 开屏眉题英文小标 */
|
||||
@TableField("eyebrow_tag")
|
||||
private String eyebrowTag;
|
||||
/** 开屏描述行 */
|
||||
@TableField("hero_description")
|
||||
private String heroDescription;
|
||||
/** 主页开屏背景图/视频 */
|
||||
@TableField("hero_bg_url")
|
||||
private String heroBgUrl;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("sys_config")
|
||||
public class SysConfig {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableField("config_key")
|
||||
private String configKey;
|
||||
@TableField("config_value")
|
||||
private String configValue;
|
||||
private String description;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("sys_user")
|
||||
public class SysUser {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String username;
|
||||
@TableField("password_hash")
|
||||
private String passwordHash;
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private String email;
|
||||
private String role;
|
||||
private Integer status;
|
||||
@TableField("last_login_at")
|
||||
private LocalDateTime lastLoginAt;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.puddy.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("tag")
|
||||
public class Tag {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String name;
|
||||
private String slug;
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||