Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-08-01 08:38:13 +08:00
23 changed files with 1269 additions and 602 deletions

View File

@@ -3,6 +3,7 @@ package com.test.bijihoudaun.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -10,11 +11,12 @@ import org.springframework.context.annotation.Configuration;
public class MybatisPlusConfig {
/**
* 添加分页插件
* 添加分页插件和逻辑删除插件
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 分页插件
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.SQLITE));
return interceptor;
}

View File

@@ -61,10 +61,9 @@ public class MarkdownController {
@Parameters({
@Parameter(name = "id", description = "Markdown文件ID", required = true),
})
@PostMapping("/delete")
public R<Void> deleteMarkdown(String id) {
long l = Long.parseLong(id);
if (markdownFileService.deleteMarkdownFile(l)) {
@DeleteMapping("/{id}")
public R<Void> deleteMarkdown(@PathVariable Long id) {
if (markdownFileService.deleteMarkdownFile(id)) {
return R.success();
}
return R.fail();

View File

@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@@ -57,6 +58,10 @@ public class UserController {
return R.success("删除成功");
}
@Operation(summary = "验证Token有效性")
@PostMapping("/validate-token")
public R<String> validateToken() {
return R.success("Token is valid");
}
}

View File

@@ -3,15 +3,19 @@ package com.test.bijihoudaun.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@Schema(name = "分组实体")
@TableName("grouping")
public class Grouping {
public class Grouping implements Serializable {
@Schema(description = "分组id",implementation = Long.class)
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING) // 仅作用于此字段
@@ -24,4 +28,14 @@ public class Grouping {
@Schema(description = "分组名称",implementation = String.class)
private String grouping;
@Schema(description = "是否删除 0-未删除 1-已删除", implementation = Integer.class)
@TableLogic
private Integer isDeleted;
@Schema(description = "删除时间", implementation = Date.class)
private Date deletedAt;
@Schema(description = "删除人ID", implementation = Long.class)
private Long deletedBy;
}

View File

@@ -3,17 +3,19 @@ package com.test.bijihoudaun.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@Schema(name = "文本实体")
@TableName("markdown_file")
public class MarkdownFile {
public class MarkdownFile implements Serializable {
@Schema(description = "文本id",implementation = Long.class)
@TableId(type = IdType.AUTO)
@JsonFormat(shape = JsonFormat.Shape.STRING) // 仅作用于此字段
@@ -33,4 +35,14 @@ public class MarkdownFile {
private Date createdAt;
@Schema(description = "更新时间",implementation = Date.class)
private Date updatedAt;
@Schema(description = "是否删除 0-未删除 1-已删除", implementation = Integer.class)
@TableLogic
private Integer isDeleted;
@Schema(description = "删除时间", implementation = Date.class)
private Date deletedAt;
@Schema(description = "删除人ID", implementation = Long.class)
private Long deletedBy;
}

View File

@@ -2,8 +2,25 @@ package com.test.bijihoudaun.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.test.bijihoudaun.entity.Grouping;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface GroupingMapper extends BaseMapper<Grouping> {
@Select("SELECT * FROM grouping WHERE is_deleted = 1")
List<Grouping> selectDeleted();
@Delete("DELETE FROM grouping WHERE id = #{id}")
void physicalDeleteById(@Param("id") Long id);
@Update("UPDATE grouping SET is_deleted = 0, deleted_at = NULL, deleted_by = NULL WHERE id = #{id}")
void restoreById(@Param("id") Long id);
}

View File

@@ -9,12 +9,16 @@ import org.apache.ibatis.annotations.Select;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;
@Mapper
public interface MarkdownFileMapper extends BaseMapper<MarkdownFile> {
@Select("SELECT mf.*, g.grouping as groupingName " +
"FROM markdown_file mf " +
"LEFT JOIN grouping g ON mf.grouping_id = g.id " +
"WHERE mf.is_deleted = 0 " +
"ORDER BY mf.updated_at DESC " +
"LIMIT #{limit}")
List<MarkdownFileVO> selectRecentWithGrouping(@Param("limit") int limit);
@@ -22,7 +26,19 @@ public interface MarkdownFileMapper extends BaseMapper<MarkdownFile> {
@Select("SELECT mf.*, g.grouping as groupingName " +
"FROM markdown_file mf " +
"LEFT JOIN grouping g ON mf.grouping_id = g.id " +
"WHERE mf.grouping_id = #{groupingId} " +
"WHERE mf.grouping_id = #{groupingId} AND mf.is_deleted = 0 " +
"ORDER BY mf.updated_at DESC")
List<MarkdownFileVO> selectByGroupingIdWithGrouping(@Param("groupingId") String groupingId);
@Select("SELECT * FROM markdown_file WHERE is_deleted = 1")
List<MarkdownFile> selectDeleted();
@Delete("DELETE FROM markdown_file WHERE id = #{id}")
void physicalDeleteById(@Param("id") Long id);
@Delete("DELETE FROM markdown_file WHERE grouping_id = #{groupingId}")
void physicalDeleteByGroupingId(@Param("groupingId") Long groupingId);
@Update("UPDATE markdown_file SET is_deleted = 0, deleted_at = NULL, deleted_by = NULL WHERE id = #{id}")
void restoreById(@Param("id") Long id);
}

View File

@@ -54,12 +54,19 @@ public class GroupingServiceImpl
@Override
@Transactional
public void deleteGrouping(Long id) {
LambdaUpdateWrapper<MarkdownFile> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(MarkdownFile::getGroupingId, id)
.set(MarkdownFile::getGroupingId, 999L);
markdownFileMapper.update(null, updateWrapper);
// 1. 使用 LambdaUpdateWrapper 软删除分组本身,确保 isDeleted 和 deletedAt 都被更新
LambdaUpdateWrapper<Grouping> groupingUpdateWrapper = new LambdaUpdateWrapper<>();
groupingUpdateWrapper.eq(Grouping::getId, id)
.set(Grouping::getIsDeleted, 1)
.set(Grouping::getDeletedAt, new java.util.Date());
this.update(groupingUpdateWrapper);
this.removeById(id);
// 2. 将该分组下的所有笔记也一并软删除
LambdaUpdateWrapper<MarkdownFile> markdownFileUpdateWrapper = new LambdaUpdateWrapper<>();
markdownFileUpdateWrapper.eq(MarkdownFile::getGroupingId, id)
.set(MarkdownFile::getIsDeleted, 1)
.set(MarkdownFile::getDeletedAt, new java.util.Date());
markdownFileMapper.update(null, markdownFileUpdateWrapper);
}
@Override

View File

@@ -1,6 +1,7 @@
package com.test.bijihoudaun.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.test.bijihoudaun.entity.MarkdownFile;
import com.test.bijihoudaun.entity.MarkdownFileVO;
@@ -52,7 +53,11 @@ public class MarkdownFileServiceImpl
@Override
public boolean deleteMarkdownFile(Long id) {
return this.removeById(id);
LambdaUpdateWrapper<MarkdownFile> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(MarkdownFile::getId, id)
.set(MarkdownFile::getIsDeleted, 1)
.set(MarkdownFile::getDeletedAt, new Date());
return this.update(updateWrapper);
}
@Override

View File

@@ -1,8 +1,8 @@
spring:
datasource:
driver-class-name: org.sqlite.JDBC
# url: jdbc:sqlite:C:\it\houtaigunli\biji\mydatabase.db
url: jdbc:sqlite:C:\KAIFA\2\mydatabase.db
url: jdbc:sqlite:C:\it\houtaigunli\biji\mydatabase.db
# url: jdbc:sqlite:C:\KAIFA\2\mydatabase.db
jpa:
hibernate:
ddl-auto: none

View File

@@ -29,6 +29,11 @@ mybatis-plus:
mapper-locations: classpath:mapper/*.xml
configuration:
map-underscore-to-camel-case: true
global-config:
db-config:
logic-delete-field: isDeleted # 全局逻辑删除的实体字段名
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
# JWT 配置
jwt:

View File

@@ -12,6 +12,8 @@
"codemirror": "^6.0.1",
"element-plus": "^2.10.4",
"highlight.js": "^11.11.1",
"html2canvas": "^1.4.1",
"jspdf": "^3.0.1",
"pinia": "^3.0.3",
"pinia-plugin-persistedstate": "^4.4.1",
"vditor": "^3.11.1",
@@ -1132,6 +1134,20 @@
"undici-types": "~7.8.0"
}
},
"node_modules/@types/raf": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz",
"integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==",
"license": "MIT",
"optional": true
},
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
"license": "MIT",
"optional": true
},
"node_modules/@types/unist": {
"version": "2.0.11",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz",
@@ -1604,6 +1620,15 @@
"node": ">=0.10.0"
}
},
"node_modules/base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==",
"license": "MIT",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/birpc": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/birpc/-/birpc-2.5.0.tgz",
@@ -1665,6 +1690,18 @@
"node": ">=0.10.0"
}
},
"node_modules/btoa": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz",
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==",
"license": "(MIT OR Apache-2.0)",
"bin": {
"btoa": "bin/btoa.js"
},
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/cache-base": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
@@ -1691,6 +1728,26 @@
"integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==",
"license": "MIT"
},
"node_modules/canvg": {
"version": "3.0.11",
"resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.11.tgz",
"integrity": "sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==",
"license": "MIT",
"optional": true,
"dependencies": {
"@babel/runtime": "^7.12.5",
"@types/raf": "^3.4.0",
"core-js": "^3.8.3",
"raf": "^3.4.1",
"regenerator-runtime": "^0.13.7",
"rgbcolor": "^1.0.1",
"stackblur-canvas": "^2.0.0",
"svg-pathdata": "^6.0.3"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@@ -1855,6 +1912,18 @@
"toggle-selection": "^1.0.6"
}
},
"node_modules/core-js": {
"version": "3.44.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.44.0.tgz",
"integrity": "sha512-aFCtd4l6GvAXwVEh3XbbVqJGHDJt0OZRa+5ePGx3LLwi12WfexqQxcsohb2wgsa/92xtl19Hd66G/L+TaAxDMw==",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/cose-base": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/cose-base/-/cose-base-1.0.3.tgz",
@@ -1870,6 +1939,15 @@
"integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==",
"license": "MIT"
},
"node_modules/css-line-break": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz",
"integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
"license": "MIT",
"dependencies": {
"utrie": "^1.0.2"
}
},
"node_modules/cssfilter": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz",
@@ -2795,6 +2873,12 @@
}
}
},
"node_modules/fflate": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz",
"integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==",
"license": "MIT"
},
"node_modules/fill-range": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
@@ -3075,6 +3159,19 @@
"integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==",
"license": "MIT"
},
"node_modules/html2canvas": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz",
"integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
"license": "MIT",
"dependencies": {
"css-line-break": "^2.1.0",
"text-segmentation": "^1.0.3"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
@@ -3304,6 +3401,34 @@
"graceful-fs": "^4.1.6"
}
},
"node_modules/jspdf": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/jspdf/-/jspdf-3.0.1.tgz",
"integrity": "sha512-qaGIxqxetdoNnFQQXxTKUD9/Z7AloLaw94fFsOiJMxbfYdBbrBuhWmbzI8TVjrw7s3jBY1PFHofBKMV/wZPapg==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.26.7",
"atob": "^2.1.2",
"btoa": "^1.2.1",
"fflate": "^0.8.1"
},
"optionalDependencies": {
"canvg": "^3.0.11",
"core-js": "^3.6.0",
"dompurify": "^3.2.4",
"html2canvas": "^1.0.0-rc.5"
}
},
"node_modules/jspdf/node_modules/dompurify": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz",
"integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optional": true,
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
}
},
"node_modules/katex": {
"version": "0.13.24",
"resolved": "https://registry.npmjs.org/katex/-/katex-0.13.24.tgz",
@@ -4300,6 +4425,13 @@
"integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==",
"license": "MIT"
},
"node_modules/performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
"license": "MIT",
"optional": true
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@@ -4422,6 +4554,23 @@
"node": ">=6"
}
},
"node_modules/raf": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
"license": "MIT",
"optional": true,
"dependencies": {
"performance-now": "^2.1.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
"license": "MIT",
"optional": true
},
"node_modules/regex-not": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
@@ -4481,6 +4630,16 @@
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
"license": "MIT"
},
"node_modules/rgbcolor": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz",
"integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==",
"license": "MIT OR SEE LICENSE IN FEEL-FREE.md",
"optional": true,
"engines": {
"node": ">= 0.8.15"
}
},
"node_modules/robust-predicates": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz",
@@ -4844,6 +5003,16 @@
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"license": "BSD-3-Clause"
},
"node_modules/stackblur-canvas": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz",
"integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==",
"license": "MIT",
"optional": true,
"engines": {
"node": ">=0.1.14"
}
},
"node_modules/static-extend": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
@@ -4927,6 +5096,25 @@
"node": ">=4"
}
},
"node_modules/svg-pathdata": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-6.0.3.tgz",
"integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==",
"license": "MIT",
"optional": true,
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/text-segmentation": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz",
"integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
"license": "MIT",
"dependencies": {
"utrie": "^1.0.2"
}
},
"node_modules/tinyglobby": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz",
@@ -5149,6 +5337,15 @@
"node": ">=0.10.0"
}
},
"node_modules/utrie": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz",
"integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
"license": "MIT",
"dependencies": {
"base64-arraybuffer": "^1.0.2"
}
},
"node_modules/uuid": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",

View File

@@ -13,6 +13,8 @@
"codemirror": "^6.0.1",
"element-plus": "^2.10.4",
"highlight.js": "^11.11.1",
"html2canvas": "^1.4.1",
"jspdf": "^3.0.1",
"pinia": "^3.0.3",
"pinia-plugin-persistedstate": "^4.4.1",
"vditor": "^3.11.1",

View File

@@ -40,7 +40,7 @@ export const uploadImage = (file) => {
}
// 删除Markdown文件
export const deleteMarkdown = (id) => axiosApi.post(`/api/markdown/delete?id=${id}`);
export const deleteMarkdown = (id) => axiosApi.delete(`/api/markdown/${id}`);
// 根据分组ID获取Markdown文件列表
export const markdownList = (groupingId) => axiosApi.get(`/api/markdown/grouping/${groupingId}`);
@@ -115,3 +115,18 @@ export const MD5 = (data, file) => {
// 获取回收站内容
export const getTrash = () => axiosApi.get('/api/trash');
// 恢复项目
export const restoreTrashItem = (id, type) => axiosApi.post(`/api/trash/restore/${type}/${id}`);
// 彻底删除
export const permanentlyDeleteItem = (id, type) => axiosApi.delete(`/api/trash/permanently/${type}/${id}`);
// 清空回收站
export const cleanTrash = () => axiosApi.delete('/api/trash/clean');
// 验证Token
export const validateToken = () => axiosApi.post('/api/user/validate-token');

View File

@@ -7,9 +7,10 @@ body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: var(--bg-color);
background: var(--bg-gradient);
color: var(--text-color);
transition: background-color var(--transition-duration), color var(--transition-duration);
transition: background var(--transition-duration), color var(--transition-duration);
background-attachment: fixed;
}
/* 滚动条美化 */

View File

@@ -2,46 +2,66 @@
/* 默认浅色主题 */
:root {
/* 主色调 - 活力紫 */
--primary-color: #6a11cb;
--primary-color-light: #f3e5f5; /* 浅紫色,用于悬停 */
--primary-color-dark: #4a008f; /* 深紫色,用于激活 */
/* 辅助色 */
--secondary-color: #f7fafc;
--accent-color: #2575fc; /* 亮蓝色,用于强调 */
--danger-color: #f5365c;
--success-color: #2dce89;
--warning-color: #fb6340;
/* 背景色 - 带有色彩倾向的渐变 */
--bg-color: #ffffff;
--bg-color-secondary: #f7f8fa;
--bg-color-tertiary: #eff2f5;
--text-color: #303133;
--text-color-secondary: #606266;
--text-color-placeholder: #a8abb2;
--border-color: #dcdfe6;
--border-color-light: #e4e7ed;
--primary-color: #409eff;
--primary-color-light: #ecf5ff;
--danger-color: #f56c6c;
--success-color: #67c23a;
--warning-color: #e6a23c;
--info-color: #909399;
--bg-color-secondary: #f8f9fe;
--bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
--box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
--box-shadow-light: 0 2px 4px rgba(0, 0, 0, 0.08);
--box-shadow-dark: 0 4px 16px rgba(0, 0, 0, 0.15);
/* 文本色 */
--text-color: #32325d; /* 深蓝灰色 */
--text-color-secondary: #6b7c93; /* 灰蓝色 */
--text-color-placeholder: #adb5bd;
--transition-duration: 0.3s;
/* 边框和阴影 */
--border-color: #e9ecef;
--border-radius: 8px;
--box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
--box-shadow-light: 0 2px 4px rgba(50, 50, 93, 0.1);
--box-shadow-dark: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
/* 过渡 */
--transition-duration: 0.25s;
}
/* 深色主题 */
.dark-theme {
--bg-color: #141414;
--bg-color-secondary: #1a1a1a;
--bg-color-tertiary: #222222;
--text-color: #e5e5e5;
--text-color-secondary: #a3a3a3;
--text-color-placeholder: #5c5c5c;
--border-color: #3a3a3a;
--border-color-light: #2a2a2a;
--primary-color: #409eff;
--primary-color-light: #26334f;
--danger-color: #f56c6c;
--success-color: #67c23a;
--warning-color: #e6a23c;
--info-color: #909399;
/* 主色调 - 科技蓝 */
--primary-color: #007bff;
--primary-color-light: #1f2937;
--primary-color-dark: #0056b3;
--box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
--box-shadow-light: 0 2px 4px rgba(0, 0, 0, 0.25);
--box-shadow-dark: 0 4px 16px rgba(0, 0, 0, 0.4);
/* 辅助色 */
--secondary-color: #111827;
--accent-color: #10b981; /* 亮绿色 */
--danger-color: #ef4444;
--success-color: #22c55e;
--warning-color: #f97316;
/* 背景色 - 深邃的渐变 */
--bg-color: #0d1117;
--bg-color-secondary: #1f2937;
--bg-gradient: linear-gradient(135deg, #0d1117 0%, #1f2937 100%);
/* 文本色 */
--text-color: #e5e7eb;
--text-color-secondary: #9ca3af;
--text-color-placeholder: #4b5563;
/* 边框和阴影 */
--border-color: #374151;
--box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.15);
--box-shadow-light: 0 2px 4px rgba(0, 0, 0, 0.18);
--box-shadow-dark: 0 7px 14px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +1,36 @@
<template>
<div class="login-container">
<el-card class="login-card">
<template #header>
<div class="card-header">
<span>登录</span>
</div>
</template>
<el-form ref="loginFormRef" :model="loginForm" :rules="loginRules" label-width="80px">
<div class="login-card">
<div class="card-header">
<h2>欢迎回来</h2>
<p>使用您的凭据继续</p>
</div>
<el-form ref="loginFormRef" :model="loginForm" :rules="loginRules" label-position="top">
<el-form-item label="用户名" prop="username">
<el-input v-model="loginForm.username" placeholder="请输入用户名"></el-input>
<el-input v-model="loginForm.username" placeholder="请输入您的用户名" size="large">
<template #prefix>
<el-icon><User /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="loginForm.password" type="password" placeholder="请输入密码" show-password></el-input>
<el-input v-model="loginForm.password" type="password" placeholder="请输入您的密码" show-password size="large">
<template #prefix>
<el-icon><Lock /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleLogin">登录</el-button>
<el-button @click="goToRegister">注册</el-button>
<div class="button-group">
<el-button type="primary" @click="handleLogin" class="login-button">安全登录</el-button>
<el-button @click="goToRegister" class="register-button">立即注册</el-button>
</div>
</el-form-item>
</el-form>
</el-card>
<div class="card-footer">
<el-link @click="goToHome">返回首页</el-link>
</div>
</div>
</div>
</template>
@@ -27,6 +39,7 @@ import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { useUserStore } from '../stores/user';
import { ElMessage } from 'element-plus';
import { User, Lock } from '@element-plus/icons-vue';
const router = useRouter();
const userStore = useUserStore();
@@ -58,6 +71,10 @@ const handleLogin = async () => {
const goToRegister = () => {
router.push('/register');
};
const goToHome = () => {
router.push('/home');
};
</script>
<style scoped>
@@ -65,60 +82,128 @@ const goToRegister = () => {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: var(--bg-color-secondary);
background-image: linear-gradient(135deg, var(--bg-color) 0%, var(--bg-color-secondary) 100%);
min-height: 100vh;
padding: 2rem;
background: var(--bg-gradient);
background-attachment: fixed;
}
.login-card {
width: 420px;
padding: 20px 30px;
border-radius: 12px;
background-color: var(--bg-color);
width: 100%;
max-width: 420px;
padding: 2.5rem 2rem;
border-radius: var(--border-radius);
background-color: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(10px);
box-shadow: var(--box-shadow-dark);
border: 1px solid var(--border-color);
animation: slideInDown 0.5s ease-out;
border: 1px solid rgba(255, 255, 255, 0.2);
animation: fadeIn 0.5s ease-out;
overflow: hidden;
}
.dark-theme .login-card {
background-color: rgba(23, 23, 39, 0.85);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.card-header {
text-align: center;
font-size: 24px;
margin-bottom: 2.5rem;
}
.card-header h2 {
margin: 0 0 0.5rem 0;
font-size: 1.75rem;
font-weight: 600;
color: var(--text-color);
padding-bottom: 20px;
margin-bottom: 20px;
border-bottom: 1px solid var(--border-color-light);
}
.card-header p {
margin: 0;
color: var(--text-color-secondary);
}
.el-form-item {
margin-bottom: 25px;
margin-bottom: 1.5rem;
}
.el-button {
:deep(.el-form-item__label) {
color: var(--text-color-secondary);
line-height: 1.5;
margin-bottom: 0.5rem;
}
:deep(.el-input__wrapper) {
border-radius: var(--border-radius);
background-color: var(--bg-color-secondary);
box-shadow: none;
transition: all var(--transition-duration) ease;
border: 1px solid var(--border-color);
}
:deep(.el-input__wrapper.is-focus) {
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(var(--primary-color), 0.2);
}
.button-group {
display: flex;
width: 100%;
gap: 1rem;
}
.login-button, .register-button {
flex: 1;
height: 44px;
border-radius: var(--border-radius);
font-size: 1rem;
font-weight: 600;
border: none;
transition: all var(--transition-duration) ease;
}
.el-button--primary {
height: 40px;
.login-button {
background-color: var(--primary-color);
}
.el-button--primary:hover {
.register-button {
background-color: var(--secondary-color);
color: var(--text-color);
border: 1px solid var(--border-color);
}
.login-button:hover, .register-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(64, 158, 255, 0.4);
box-shadow: var(--box-shadow);
}
.el-button:last-child {
margin-left: 0;
margin-top: 10px;
color: var(--text-color-secondary);
border: none;
background: none;
.login-button:hover {
background-color: var(--primary-color-dark);
}
.el-button:last-child:hover {
.register-button:hover {
background-color: var(--border-color);
}
.card-footer {
margin-top: 2rem;
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
font-size: 0.875rem;
}
.link-highlight {
color: var(--primary-color);
font-weight: 600;
}
:deep(.el-link) {
color: var(--text-color-secondary);
}
:deep(.el-link:hover) {
color: var(--primary-color);
background-color: var(--primary-color-light);
}
</style>

View File

@@ -1,27 +1,43 @@
<template>
<div class="register-container">
<el-card class="register-card">
<template #header>
<div class="card-header">
<span>注册</span>
</div>
</template>
<el-form ref="registerFormRef" :model="registerForm" :rules="registerRules" label-width="80px">
<div class="register-card">
<div class="card-header">
<h2>创建您的账户</h2>
<p>加入我们开启您的旅程</p>
</div>
<el-form ref="registerFormRef" :model="registerForm" :rules="registerRules" label-position="top">
<el-form-item label="用户名" prop="username">
<el-input v-model="registerForm.username" placeholder="请输入用户名"></el-input>
<el-input v-model="registerForm.username" placeholder="设置一个独特的用户名" size="large">
<template #prefix>
<el-icon><User /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="registerForm.password" type="password" placeholder="请输入密码" show-password></el-input>
<el-input v-model="registerForm.password" type="password" placeholder="创建一个安全的密码" show-password size="large">
<template #prefix>
<el-icon><Lock /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item label="确认密码" prop="confirmPassword">
<el-input v-model="registerForm.confirmPassword" type="password" placeholder="请再次输入密码" show-password></el-input>
<el-input v-model="registerForm.confirmPassword" type="password" placeholder="请再次输入密码" show-password size="large">
<template #prefix>
<el-icon><CircleCheck /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleRegister">注册</el-button>
<el-button @click="goToLogin">返回登录</el-button>
<div class="button-group">
<el-button type="primary" @click="handleRegister" class="register-button">立即注册</el-button>
<el-button @click="goToLogin" class="login-button">返回登录</el-button>
</div>
</el-form-item>
</el-form>
</el-card>
<div class="card-footer">
<el-link @click="goToHome">返回首页</el-link>
</div>
</div>
</div>
</template>
@@ -30,6 +46,7 @@ import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { register } from '../api/CommonApi';
import { ElMessage } from 'element-plus';
import { User, Lock, CircleCheck } from '@element-plus/icons-vue';
const router = useRouter();
const registerFormRef = ref(null);
@@ -72,6 +89,10 @@ const handleRegister = async () => {
const goToLogin = () => {
router.push('/login');
};
const goToHome = () => {
router.push('/home');
};
</script>
<style scoped>
@@ -79,60 +100,128 @@ const goToLogin = () => {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: var(--bg-color-secondary);
background-image: linear-gradient(135deg, var(--bg-color) 0%, var(--bg-color-secondary) 100%);
min-height: 100vh;
padding: 2rem;
background: var(--bg-gradient);
background-attachment: fixed;
}
.register-card {
width: 420px;
padding: 20px 30px;
border-radius: 12px;
background-color: var(--bg-color);
width: 100%;
max-width: 420px;
padding: 2.5rem 2rem;
border-radius: var(--border-radius);
background-color: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(10px);
box-shadow: var(--box-shadow-dark);
border: 1px solid var(--border-color);
animation: slideInDown 0.5s ease-out;
border: 1px solid rgba(255, 255, 255, 0.2);
animation: fadeIn 0.5s ease-out;
overflow: hidden;
}
.dark-theme .register-card {
background-color: rgba(23, 23, 39, 0.85);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.card-header {
text-align: center;
font-size: 24px;
margin-bottom: 2.5rem;
}
.card-header h2 {
margin: 0 0 0.5rem 0;
font-size: 1.75rem;
font-weight: 600;
color: var(--text-color);
padding-bottom: 20px;
margin-bottom: 20px;
border-bottom: 1px solid var(--border-color-light);
}
.card-header p {
margin: 0;
color: var(--text-color-secondary);
}
.el-form-item {
margin-bottom: 25px;
margin-bottom: 1.5rem;
}
.el-button {
:deep(.el-form-item__label) {
color: var(--text-color-secondary);
line-height: 1.5;
margin-bottom: 0.5rem;
}
:deep(.el-input__wrapper) {
border-radius: var(--border-radius);
background-color: var(--bg-color-secondary);
box-shadow: none;
transition: all var(--transition-duration) ease;
border: 1px solid var(--border-color);
}
:deep(.el-input__wrapper.is-focus) {
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(var(--primary-color), 0.2);
}
.button-group {
display: flex;
width: 100%;
gap: 1rem;
}
.register-button, .login-button {
flex: 1;
height: 44px;
border-radius: var(--border-radius);
font-size: 1rem;
font-weight: 600;
border: none;
transition: all var(--transition-duration) ease;
}
.el-button--primary {
height: 40px;
.register-button {
background-color: var(--primary-color);
}
.el-button--primary:hover {
.login-button {
background-color: var(--secondary-color);
color: var(--text-color);
border: 1px solid var(--border-color);
}
.register-button:hover, .login-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(64, 158, 255, 0.4);
box-shadow: var(--box-shadow);
}
.el-button:last-child {
margin-left: 0;
margin-top: 10px;
color: var(--text-color-secondary);
border: none;
background: none;
.register-button:hover {
background-color: var(--primary-color-dark);
}
.el-button:last-child:hover {
.login-button:hover {
background-color: var(--border-color);
}
.card-footer {
margin-top: 2rem;
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
font-size: 0.875rem;
}
.link-highlight {
color: var(--primary-color);
font-weight: 600;
}
:deep(.el-link) {
color: var(--text-color-secondary);
}
:deep(.el-link:hover) {
color: var(--primary-color);
background-color: var(--primary-color-light);
}
</style>

View File

@@ -3,6 +3,7 @@ import HomePage from '../components/HomePage.vue';
import MarkdownEditor from '../components/MarkdownEditor.vue';
import LoginPage from '../components/LoginPage.vue';
import RegisterPage from '../components/RegisterPage.vue';
import TrashPage from '../components/TrashPage.vue';
const routes = [
{
@@ -34,6 +35,11 @@ const routes = [
path: '/register',
name: 'Register',
component: RegisterPage
},
{
path: '/trash',
name: 'Trash',
component: TrashPage
}
];

View File

@@ -101,3 +101,8 @@
- 全面更新了 `MarkdownFileService``MarkdownController`,将 `/api/markdown/recent``/api/markdown/grouping/{groupingId}` 两个接口的返回数据统一升级为包含分类名的 `MarkdownFileVO` 对象列表。
- **前端**:
- 修改了 `HomePage.vue` 中的笔记卡片模板,使其直接从每个笔记对象中获取并显示 `groupingName` 属性,取代了之前错误的全局变量方案。
~~~
能不能设计一个表,叫做系统表,设置一个值,只有登录的用户能控制注册按钮关闭和打开,并且注册需要一个注册码,只有已经登录过的用户才能生成一个注册码,注册码有效期只有一天。只有用户注册就把注册码和注册码过期时间从数据表中删除了,若是用户注册填的注册码过期了,就把注册码和注册码过期时间从数据表中删除。
~~~

Binary file not shown.

View File

@@ -21,7 +21,10 @@ CREATE TABLE IF NOT EXISTS markdown_file (
file_name TEXT NOT NULL,
content TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
is_deleted INTEGER DEFAULT 0,
deleted_at DATETIME,
deleted_by INTEGER
);
-- 图片表
@@ -42,5 +45,8 @@ CREATE TABLE "grouping" (
"id" INTEGER NOT NULL DEFAULT 0,
"grouping" TEXT NOT NULL,
"parentId" INTEGER,
"is_deleted" INTEGER DEFAULT 0,
"deleted_at" DATETIME,
"deleted_by" INTEGER,
PRIMARY KEY ("id")
);