From 9431f1557d41c960296f926588e80bfba0d7b38b Mon Sep 17 00:00:00 2001
From: Tong <864508127@qq.com>
Date: Thu, 23 Jan 2025 17:25:59 +0800
Subject: [PATCH] Initial commit
---
.gitignore | 28 +
LICENSE | 674 +
README.md | 5 +
backend/.gitignore | 37 +
backend/.mvn/wrapper/maven-wrapper.properties | 19 +
backend/Dockerfile | 23 +
backend/mvnw | 259 +
backend/mvnw.cmd | 149 +
backend/pom.xml | 150 +
.../java/com/kama/notes/NotesApplication.java | 20 +
.../com/kama/notes/annotation/NeedLogin.java | 9 +
.../kama/notes/aspect/NeedLoginAspect.java | 32 +
.../kama/notes/aspect/PutTraceIdAspect.java | 25 +
.../com/kama/notes/config/MyBatisConfig.java | 18 +
.../com/kama/notes/config/RedisConfig.java | 32 +
.../kama/notes/config/SchedulerConfig.java | 19 +
.../com/kama/notes/config/SecurityConfig.java | 40 +
.../java/com/kama/notes/config/WebConfig.java | 57 +
.../notes/controller/CategoryController.java | 90 +
.../controller/CollectionController.java | 87 +
.../controller/CollectionNoteController.java | 9 +
.../kama/notes/controller/NoteController.java | 128 +
.../notes/controller/NoteLikeController.java | 29 +
.../controller/NotificationController.java | 41 +
.../notes/controller/QuestionController.java | 118 +
.../controller/QuestionListController.java | 90 +
.../QuestionListItemController.java | 94 +
.../notes/controller/StatisticController.java | 28 +
.../kama/notes/controller/TestController.java | 29 +
.../notes/controller/UploadController.java | 31 +
.../kama/notes/controller/UserController.java | 137 +
.../exception/ParamExceptionHandler.java | 38 +
.../com/kama/notes/filter/TraceIdFilter.java | 33 +
.../notes/interceptor/TokenInterceptor.java | 49 +
.../com/kama/notes/mapper/CategoryMapper.java | 84 +
.../kama/notes/mapper/CollectionMapper.java | 71 +
.../notes/mapper/CollectionNoteMapper.java | 61 +
.../com/kama/notes/mapper/NoteLikeMapper.java | 52 +
.../com/kama/notes/mapper/NoteMapper.java | 167 +
.../notes/mapper/QuestionListItemMapper.java | 79 +
.../kama/notes/mapper/QuestionListMapper.java | 49 +
.../com/kama/notes/mapper/QuestionMapper.java | 101 +
.../kama/notes/mapper/StatisticMapper.java | 31 +
.../com/kama/notes/mapper/UserMapper.java | 119 +
.../kama/notes/model/base/ApiResponse.java | 14 +
.../com/kama/notes/model/base/EmptyVO.java | 6 +
.../com/kama/notes/model/base/Pagination.java | 12 +
.../model/base/PaginationApiResponse.java | 34 +
.../notes/model/base/TokenApiResponse.java | 36 +
.../dto/category/CreateCategoryBody.java | 21 +
.../dto/category/UpdateCategoryBody.java | 16 +
.../dto/collection/CollectionQueryParams.java | 16 +
.../dto/collection/CreateCollectionBody.java | 14 +
.../dto/collection/UpdateCollectionBody.java | 27 +
.../model/dto/note/CreateNoteRequest.java | 27 +
.../notes/model/dto/note/NoteQueryParams.java | 81 +
.../model/dto/note/UpdateNoteRequest.java | 19 +
.../dto/notification/NotificationDTO.java | 13 +
.../dto/question/CreateQuestionBody.java | 28 +
.../dto/question/QuestionQueryParam.java | 30 +
.../dto/question/SearchQuestionBody.java | 16 +
.../dto/question/UpdateQuestionBody.java | 33 +
.../questionList/CreateQuestionListBody.java | 26 +
.../questionList/UpdateQuestionListBody.java | 26 +
.../CreateQuestionListItemBody.java | 17 +
.../QuestionListItemQueryParams.java | 22 +
.../SortQuestionListItemBody.java | 17 +
.../dto/statistic/StatisticQueryParam.java | 17 +
.../notes/model/dto/user/LoginRequest.java | 29 +
.../notes/model/dto/user/RegisterRequest.java | 40 +
.../model/dto/user/UpdateUserRequest.java | 63 +
.../model/dto/user/UploadImageResponse.java | 38 +
.../notes/model/dto/user/UserQueryParam.java | 35 +
.../com/kama/notes/model/entity/Category.java | 40 +
.../kama/notes/model/entity/Collection.java | 40 +
.../notes/model/entity/CollectionNote.java | 34 +
.../com/kama/notes/model/entity/Note.java | 61 +
.../com/kama/notes/model/entity/NoteLike.java | 34 +
.../com/kama/notes/model/entity/Question.java | 57 +
.../kama/notes/model/entity/QuestionList.java | 44 +
.../notes/model/entity/QuestionListItem.java | 39 +
.../kama/notes/model/entity/Statistic.java | 51 +
.../com/kama/notes/model/entity/User.java | 103 +
.../enums/questionList/QuestionListType.java | 15 +
.../notes/model/enums/user/UserBanned.java | 6 +
.../notes/model/enums/user/UserGender.java | 7 +
.../kama/notes/model/enums/user/UserRole.java | 6 +
.../notes/model/vo/category/CategoryVO.java | 20 +
.../model/vo/category/CreateCategoryVO.java | 8 +
.../model/vo/collection/CollectionVO.java | 20 +
.../vo/collection/CreateCollectionVO.java | 8 +
.../notes/model/vo/note/CreateNoteVO.java | 8 +
.../notes/model/vo/note/DownloadNoteVO.java | 8 +
.../notes/model/vo/note/NoteHeatMapItem.java | 12 +
.../notes/model/vo/note/NoteRankListItem.java | 12 +
.../com/kama/notes/model/vo/note/NoteVO.java | 39 +
.../kama/notes/model/vo/note/Top3Count.java | 9 +
.../model/vo/notification/NotificationVO.java | 8 +
.../model/vo/question/BaseQuestionVO.java | 37 +
.../model/vo/question/CreateQuestionVO.java | 8 +
.../model/vo/question/QuestionNoteVO.java | 53 +
.../model/vo/question/QuestionUserVO.java | 43 +
.../notes/model/vo/question/QuestionVO.java | 18 +
.../model/vo/question/SimpleQuestionVO.java | 9 +
.../vo/questionList/CreateQuestionListVO.java | 8 +
.../model/vo/questionList/QuestionListVO.java | 5 +
.../CreateQuestionListItemVO.java | 8 +
.../QuestionListItemUserVO.java | 32 +
.../questionListItem/QuestionListItemVO.java | 22 +
.../kama/notes/model/vo/upload/ImageVO.java | 8 +
.../kama/notes/model/vo/user/AvatarVO.java | 8 +
.../kama/notes/model/vo/user/LoginUserVO.java | 62 +
.../kama/notes/model/vo/user/RegisterVO.java | 8 +
.../com/kama/notes/model/vo/user/UserVO.java | 46 +
.../kama/notes/scope/RequestScopeData.java | 18 +
.../kama/notes/service/CategoryService.java | 56 +
.../notes/service/CollectionNoteService.java | 18 +
.../kama/notes/service/CollectionService.java | 46 +
.../com/kama/notes/service/FileService.java | 22 +
.../kama/notes/service/NoteLikeService.java | 38 +
.../com/kama/notes/service/NoteService.java | 71 +
.../service/QuestionListItemService.java | 59 +
.../notes/service/QuestionListService.java | 52 +
.../kama/notes/service/QuestionService.java | 95 +
.../com/kama/notes/service/RedisService.java | 73 +
.../kama/notes/service/StatisticService.java | 18 +
.../com/kama/notes/service/UploadService.java | 12 +
.../com/kama/notes/service/UserService.java | 83 +
.../service/impl/CategoryServiceImpl.java | 144 +
.../impl/CollectionNoteServiceImpl.java | 24 +
.../service/impl/CollectionServiceImpl.java | 173 +
.../service/impl/LocalFileServiceImpl.java | 113 +
.../service/impl/NoteLikeServiceImpl.java | 76 +
.../notes/service/impl/NoteServiceImpl.java | 333 +
.../impl/QuestionListItemServiceImpl.java | 167 +
.../service/impl/QuestionListServiceImpl.java | 90 +
.../service/impl/QuestionServiceImpl.java | 218 +
.../notes/service/impl/RedisServiceImpl.java | 55 +
.../service/impl/StatisticServiceImpl.java | 38 +
.../notes/service/impl/UploadServiceImpl.java | 25 +
.../notes/service/impl/UserServiceImpl.java | 224 +
.../com/kama/notes/task/DailyStatistics.java | 68 +
.../com/kama/notes/utils/ApiResponseUtil.java | 44 +
.../java/com/kama/notes/utils/JwtUtil.java | 71 +
.../com/kama/notes/utils/MarkdownAST.java | 94 +
.../com/kama/notes/utils/MarkdownUtil.java | 14 +
.../com/kama/notes/utils/PaginationUtils.java | 21 +
backend/src/main/resources/application.yml | 35 +
backend/src/main/resources/log4j2-spring.xml | 45 +
.../main/resources/mapper/CategoryMapper.xml | 84 +
.../resources/mapper/CollectionMapper.xml | 49 +
.../resources/mapper/CollectionNoteMapper.xml | 55 +
.../main/resources/mapper/NoteLikeMapper.xml | 36 +
.../src/main/resources/mapper/NoteMapper.xml | 243 +
.../mapper/QuestionListItemMapper.xml | 80 +
.../resources/mapper/QuestionListMapper.xml | 37 +
.../main/resources/mapper/QuestionMapper.xml | 140 +
.../main/resources/mapper/StatisticMapper.xml | 22 +
.../src/main/resources/mapper/UserMapper.xml | 106 +
.../com/kama/notes/NotesApplicationTests.java | 40 +
frontend/.env | 0
frontend/.env.development | 2 +
frontend/.env.production | 2 +
frontend/.husky/pre-commit | 1 +
frontend/.nvmrc | 1 +
frontend/.prettierrc | 5 +
frontend/Dockerfile | 21 +
frontend/eslint.config.js | 29 +
frontend/index.html | 33 +
frontend/package-lock.json | 11956 ++++++++++++++++
frontend/package.json | 68 +
frontend/postcss.config.js | 6 +
frontend/public/favicon.ico | Bin 0 -> 13374 bytes
frontend/src/App.css | 0
frontend/src/App.tsx | 33 +
frontend/src/apps/admin/AdminApp.css | 0
frontend/src/apps/admin/AdminApp.tsx | 163 +
.../pages/adminCategory/AdminCategory.tsx | 12 +
.../adminNotification/AdminNotification.tsx | 42 +
.../pages/adminQuestion/AdminQuestion.tsx | 12 +
.../adminQuestionList/AdminQuestionList.tsx | 12 +
.../AdminQuestionListDetail.tsx | 141 +
.../apps/admin/pages/adminUser/AdminUser.tsx | 12 +
.../apps/admin/pages/dashBroad/DashBroad.tsx | 12 +
frontend/src/apps/admin/router/config.ts | 29 +
frontend/src/apps/admin/router/index.tsx | 94 +
frontend/src/apps/user/UserApp.css | 22 +
frontend/src/apps/user/UserApp.tsx | 32 +
.../src/apps/user/components/logo/Logo.tsx | 14 +
.../apps/user/components/navBar/NavBar.tsx | 73 +
.../components/searchInput/SearchInput.tsx | 44 +
frontend/src/apps/user/layout/Content.tsx | 15 +
frontend/src/apps/user/layout/Header.tsx | 11 +
frontend/src/apps/user/layout/Layout.tsx | 15 +
.../src/apps/user/pages/home/HomePage.tsx | 63 +
.../user/pages/home/components/RankList.tsx | 18 +
.../apps/user/pages/question/QuestionPage.tsx | 194 +
.../pages/questionList/QuestionListPage.tsx | 129 +
.../components/TrainingCampListHeader.tsx | 11 +
.../components/TrainingCampListInfo.tsx | 14 +
.../pages/questionSet/QuestionSetPage.tsx | 72 +
.../user/pages/userCenter/UserCenterPage.tsx | 67 +
.../userCenter/collect/CollectionDetail.tsx | 61 +
.../pages/userCenter/collect/UserCollect.tsx | 63 +
.../user/pages/userCenter/info/UserInfo.tsx | 12 +
.../user/pages/userCenter/note/UserNote.tsx | 43 +
.../apps/user/pages/userHome/UserHomePage.tsx | 39 +
.../userHome/components/UserCollectList.tsx | 11 +
.../userHome/components/UserNoteList.tsx | 51 +
frontend/src/apps/user/router/config.ts | 33 +
frontend/src/apps/user/router/index.tsx | 42 +
.../cherryMarkdown/CherryMarkdown.css | 0
.../cherryMarkdown/CherryMarkdown.tsx | 78 +
.../columnDivider/ColumnDivider.tsx | 7 +
.../errorFallback/ErrorFallback.tsx | 40 +
.../components/heatMap/CalendarHeatmap.css | 73 +
.../components/heatMap/CalendarHeatmap.tsx | 417 +
.../components/heatMap/constants/index.ts | 20 +
.../base/components/heatMap/utils/index.ts | 27 +
.../base/components/hostModal/HostModal.tsx | 49 +
frontend/src/base/components/index.tsx | 27 +
.../components/markdownRender/CopyButton.tsx | 42 +
.../markdownRender/MarkdownRender.tsx | 61 +
.../src/base/components/notFound/NotFound.tsx | 24 +
frontend/src/base/components/panel/Panel.tsx | 15 +
.../src/base/components/timeAgo/TimeAgo.tsx | 49 +
frontend/src/base/constants/index.ts | 14 +
frontend/src/base/hooks/index.ts | 3 +
frontend/src/base/hooks/useApp.ts | 12 +
frontend/src/base/icon/BronzeTrophy.tsx | 84 +
frontend/src/base/icon/GoldTrophy.tsx | 85 +
frontend/src/base/icon/SliverTrophy.tsx | 85 +
frontend/src/base/icon/index.ts | 5 +
frontend/src/base/regex/index.ts | 15 +
.../src/base/styles/github-markdown-light.css | 1128 ++
frontend/src/base/styles/github-markdown.css | 1263 ++
frontend/src/base/types/index.ts | 8 +
frontend/src/base/utils/index.ts | 27 +
frontend/src/domain/app/hooks/useTheme.ts | 0
frontend/src/domain/app/index.ts | 3 +
frontend/src/domain/app/types/index.ts | 1 +
.../src/domain/category/api/categoryApi.ts | 8 +
.../category/components/CategoryList.tsx | 160 +
.../category/components/CategoryOptDrawer.tsx | 165 +
.../category/components/CategoryTreeView.tsx | 85 +
.../src/domain/category/hooks/useCategory.ts | 167 +
frontend/src/domain/category/index.ts | 13 +
.../category/service/categoryService.ts | 51 +
.../domain/category/types/categoryService.ts | 11 +
frontend/src/domain/category/types/types.ts | 39 +
frontend/src/domain/category/utils/index.ts | 23 +
.../collection/api/collectionApiList.ts | 8 +
.../components/CollectModalFooter.tsx | 28 +
.../collection/components/CollectionList.tsx | 84 +
.../collection/components/CollectionList2.tsx | 86 +
.../collection/components/CollectionModal.tsx | 72 +
.../components/CreateCollectionModal.tsx | 74 +
.../domain/collection/hooks/useCollection2.ts | 98 +
frontend/src/domain/collection/index.ts | 5 +
.../collection/service/collectionService.ts | 51 +
frontend/src/domain/collection/types/types.ts | 43 +
frontend/src/domain/note/api/noteApi.ts | 12 +
.../src/domain/note/components/AuthorCard.tsx | 42 +
.../domain/note/components/CollectButton.tsx | 39 +
.../domain/note/components/DisplayContent.tsx | 11 +
.../note/components/DownloadNoteItem.tsx | 55 +
.../domain/note/components/ExpandButton.tsx | 39 +
.../src/domain/note/components/LikeButton.tsx | 37 +
.../domain/note/components/NoteContent.tsx | 13 +
.../domain/note/components/NoteHeatMap.tsx | 53 +
.../src/domain/note/components/NoteItem.tsx | 80 +
.../src/domain/note/components/NoteList.tsx | 131 +
.../domain/note/components/NoteRankList.tsx | 106 +
.../domain/note/components/OptionsCard.tsx | 93 +
.../src/domain/note/components/Top3Count.tsx | 27 +
frontend/src/domain/note/hooks/useNotes.ts | 188 +
.../src/domain/note/hooks/useTop3Count.ts | 29 +
frontend/src/domain/note/index.ts | 12 +
.../src/domain/note/service/noteService.ts | 78 +
.../src/domain/note/types/serviceTypes.ts | 77 +
frontend/src/domain/note/types/types.ts | 46 +
.../src/domain/noteLike/api/noteLikeApi.ts | 6 +
.../src/domain/noteLike/hooks/useNoteLike.ts | 16 +
frontend/src/domain/noteLike/index.ts | 3 +
.../noteLike/service/noteLikeService.ts | 22 +
.../src/domain/question/api/questionApi.ts | 21 +
.../question/components/DifficultyTag.tsx | 25 +
.../question/components/QuestionAddDrawer.tsx | 143 +
.../question/components/QuestionCard.tsx | 18 +
.../question/components/QuestionList.tsx | 267 +
.../question/components/QuestionTable.tsx | 172 +
.../question/components/QuestionView.tsx | 57 +
.../question/components/SearchModalFooter.tsx | 34 +
.../components/SearchQuestionModal.tsx | 133 +
.../src/domain/question/hooks/useQuestion.ts | 52 +
.../domain/question/hooks/useQuestionList.ts | 88 +
.../domain/question/hooks/useQuestionTable.ts | 40 +
.../question/hooks/useSearchQuestion.ts | 44 +
frontend/src/domain/question/index.ts | 24 +
.../question/service/questionService.ts | 116 +
frontend/src/domain/question/types/service.ts | 63 +
frontend/src/domain/question/types/types.ts | 71 +
.../questionList/api/questionListApi.ts | 29 +
.../components/QuestionListDetail.tsx | 9 +
.../components/QuestionListOptDrawer.tsx | 144 +
.../components/QuestionListTable.tsx | 176 +
.../components/QuestionListTreeView.tsx | 73 +
.../components/QuestionListView.tsx | 45 +
.../questionList/hooks/useQuestionList.ts | 32 +
.../questionList/hooks/useQuestionListItem.ts | 114 +
.../hooks/useQuestionListItem2.ts | 51 +
.../questionList/hooks/useQuestionLists.ts | 89 +
frontend/src/domain/questionList/index.ts | 21 +
.../service/questionListService.ts | 135 +
.../src/domain/questionList/types/types.ts | 92 +
.../src/domain/questionList/utils/index.ts | 52 +
frontend/src/domain/statistic/api/index.ts | 5 +
.../statistic/components/StatisticTable.tsx | 73 +
.../domain/statistic/hooks/useStatistic.ts | 39 +
frontend/src/domain/statistic/index.ts | 3 +
.../statistic/service/statisticService.ts | 14 +
frontend/src/domain/statistic/types/types.ts | 44 +
frontend/src/domain/user/api/userApi.ts | 17 +
.../src/domain/user/components/LoginModal.tsx | 154 +
.../domain/user/components/ProfileMenu.tsx | 65 +
.../domain/user/components/UserAvatarMenu.tsx | 33 +
.../user/components/UserHomeProfile.tsx | 54 +
.../domain/user/components/UserInfoForm.tsx | 187 +
.../src/domain/user/components/UserList.tsx | 147 +
frontend/src/domain/user/hooks/useLogin.ts | 45 +
frontend/src/domain/user/hooks/useLogout.ts | 13 +
frontend/src/domain/user/hooks/useRegister.ts | 43 +
frontend/src/domain/user/hooks/useUser.ts | 8 +
frontend/src/domain/user/hooks/useUser2.ts | 23 +
frontend/src/domain/user/hooks/useUserForm.ts | 52 +
frontend/src/domain/user/hooks/useUserList.ts | 55 +
frontend/src/domain/user/index.ts | 17 +
.../src/domain/user/service/userService.ts | 81 +
.../src/domain/user/types/serviceTypes.ts | 40 +
frontend/src/domain/user/types/types.ts | 49 +
frontend/src/index.css | 3 +
frontend/src/main.tsx | 36 +
frontend/src/request/fetchClient.ts | 103 +
frontend/src/request/index.ts | 37 +
frontend/src/request/types.ts | 71 +
frontend/src/store/appSlice.ts | 44 +
frontend/src/store/store.ts | 13 +
frontend/src/store/userSlice.ts | 32 +
frontend/src/vite-env.d.ts | 1 +
frontend/tailwind.config.js | 9 +
frontend/tsconfig.app.json | 26 +
frontend/tsconfig.json | 7 +
frontend/tsconfig.node.json | 24 +
frontend/upload.sh | 3 +
frontend/vite.config.ts | 7 +
kamanote-tech.sql | 324 +
package-lock.json | 6 +
357 files changed, 33323 insertions(+)
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 backend/.gitignore
create mode 100644 backend/.mvn/wrapper/maven-wrapper.properties
create mode 100644 backend/Dockerfile
create mode 100644 backend/mvnw
create mode 100644 backend/mvnw.cmd
create mode 100644 backend/pom.xml
create mode 100644 backend/src/main/java/com/kama/notes/NotesApplication.java
create mode 100644 backend/src/main/java/com/kama/notes/annotation/NeedLogin.java
create mode 100644 backend/src/main/java/com/kama/notes/aspect/NeedLoginAspect.java
create mode 100644 backend/src/main/java/com/kama/notes/aspect/PutTraceIdAspect.java
create mode 100644 backend/src/main/java/com/kama/notes/config/MyBatisConfig.java
create mode 100644 backend/src/main/java/com/kama/notes/config/RedisConfig.java
create mode 100644 backend/src/main/java/com/kama/notes/config/SchedulerConfig.java
create mode 100644 backend/src/main/java/com/kama/notes/config/SecurityConfig.java
create mode 100644 backend/src/main/java/com/kama/notes/config/WebConfig.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/CategoryController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/CollectionController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/CollectionNoteController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/NoteController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/NoteLikeController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/NotificationController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/QuestionController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/QuestionListController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/QuestionListItemController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/StatisticController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/TestController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/UploadController.java
create mode 100644 backend/src/main/java/com/kama/notes/controller/UserController.java
create mode 100644 backend/src/main/java/com/kama/notes/exception/ParamExceptionHandler.java
create mode 100644 backend/src/main/java/com/kama/notes/filter/TraceIdFilter.java
create mode 100644 backend/src/main/java/com/kama/notes/interceptor/TokenInterceptor.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/CategoryMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/CollectionMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/CollectionNoteMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/NoteLikeMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/NoteMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/QuestionListItemMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/QuestionListMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/QuestionMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/StatisticMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/mapper/UserMapper.java
create mode 100644 backend/src/main/java/com/kama/notes/model/base/ApiResponse.java
create mode 100644 backend/src/main/java/com/kama/notes/model/base/EmptyVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/base/Pagination.java
create mode 100644 backend/src/main/java/com/kama/notes/model/base/PaginationApiResponse.java
create mode 100644 backend/src/main/java/com/kama/notes/model/base/TokenApiResponse.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/category/CreateCategoryBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/category/UpdateCategoryBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/collection/CollectionQueryParams.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/collection/CreateCollectionBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/collection/UpdateCollectionBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/note/CreateNoteRequest.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/note/NoteQueryParams.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/note/UpdateNoteRequest.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/notification/NotificationDTO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/question/CreateQuestionBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/question/QuestionQueryParam.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/question/SearchQuestionBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/question/UpdateQuestionBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/questionList/CreateQuestionListBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/questionList/UpdateQuestionListBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/questionListItem/CreateQuestionListItemBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/questionListItem/QuestionListItemQueryParams.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/questionListItem/SortQuestionListItemBody.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/statistic/StatisticQueryParam.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/user/LoginRequest.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/user/RegisterRequest.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/user/UpdateUserRequest.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/user/UploadImageResponse.java
create mode 100644 backend/src/main/java/com/kama/notes/model/dto/user/UserQueryParam.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/Category.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/Collection.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/CollectionNote.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/Note.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/NoteLike.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/Question.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/QuestionList.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/QuestionListItem.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/Statistic.java
create mode 100644 backend/src/main/java/com/kama/notes/model/entity/User.java
create mode 100644 backend/src/main/java/com/kama/notes/model/enums/questionList/QuestionListType.java
create mode 100644 backend/src/main/java/com/kama/notes/model/enums/user/UserBanned.java
create mode 100644 backend/src/main/java/com/kama/notes/model/enums/user/UserGender.java
create mode 100644 backend/src/main/java/com/kama/notes/model/enums/user/UserRole.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/category/CategoryVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/category/CreateCategoryVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/collection/CollectionVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/collection/CreateCollectionVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/note/CreateNoteVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/note/DownloadNoteVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/note/NoteHeatMapItem.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/note/NoteRankListItem.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/note/NoteVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/note/Top3Count.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/notification/NotificationVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/question/BaseQuestionVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/question/CreateQuestionVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/question/QuestionNoteVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/question/QuestionUserVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/question/QuestionVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/question/SimpleQuestionVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/questionList/CreateQuestionListVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/questionList/QuestionListVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/questionListItem/CreateQuestionListItemVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/questionListItem/QuestionListItemUserVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/questionListItem/QuestionListItemVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/upload/ImageVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/user/AvatarVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/user/LoginUserVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/user/RegisterVO.java
create mode 100644 backend/src/main/java/com/kama/notes/model/vo/user/UserVO.java
create mode 100644 backend/src/main/java/com/kama/notes/scope/RequestScopeData.java
create mode 100644 backend/src/main/java/com/kama/notes/service/CategoryService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/CollectionNoteService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/CollectionService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/FileService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/NoteLikeService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/NoteService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/QuestionListItemService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/QuestionListService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/QuestionService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/RedisService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/StatisticService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/UploadService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/UserService.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/CategoryServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/CollectionNoteServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/CollectionServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/LocalFileServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/NoteLikeServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/NoteServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/QuestionListItemServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/QuestionListServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/QuestionServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/RedisServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/StatisticServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/UploadServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/service/impl/UserServiceImpl.java
create mode 100644 backend/src/main/java/com/kama/notes/task/DailyStatistics.java
create mode 100644 backend/src/main/java/com/kama/notes/utils/ApiResponseUtil.java
create mode 100644 backend/src/main/java/com/kama/notes/utils/JwtUtil.java
create mode 100644 backend/src/main/java/com/kama/notes/utils/MarkdownAST.java
create mode 100644 backend/src/main/java/com/kama/notes/utils/MarkdownUtil.java
create mode 100644 backend/src/main/java/com/kama/notes/utils/PaginationUtils.java
create mode 100644 backend/src/main/resources/application.yml
create mode 100644 backend/src/main/resources/log4j2-spring.xml
create mode 100644 backend/src/main/resources/mapper/CategoryMapper.xml
create mode 100644 backend/src/main/resources/mapper/CollectionMapper.xml
create mode 100644 backend/src/main/resources/mapper/CollectionNoteMapper.xml
create mode 100644 backend/src/main/resources/mapper/NoteLikeMapper.xml
create mode 100644 backend/src/main/resources/mapper/NoteMapper.xml
create mode 100644 backend/src/main/resources/mapper/QuestionListItemMapper.xml
create mode 100644 backend/src/main/resources/mapper/QuestionListMapper.xml
create mode 100644 backend/src/main/resources/mapper/QuestionMapper.xml
create mode 100644 backend/src/main/resources/mapper/StatisticMapper.xml
create mode 100644 backend/src/main/resources/mapper/UserMapper.xml
create mode 100644 backend/src/test/java/com/kama/notes/NotesApplicationTests.java
create mode 100644 frontend/.env
create mode 100644 frontend/.env.development
create mode 100644 frontend/.env.production
create mode 100644 frontend/.husky/pre-commit
create mode 100644 frontend/.nvmrc
create mode 100644 frontend/.prettierrc
create mode 100644 frontend/Dockerfile
create mode 100644 frontend/eslint.config.js
create mode 100644 frontend/index.html
create mode 100644 frontend/package-lock.json
create mode 100644 frontend/package.json
create mode 100644 frontend/postcss.config.js
create mode 100644 frontend/public/favicon.ico
create mode 100644 frontend/src/App.css
create mode 100644 frontend/src/App.tsx
create mode 100644 frontend/src/apps/admin/AdminApp.css
create mode 100644 frontend/src/apps/admin/AdminApp.tsx
create mode 100644 frontend/src/apps/admin/pages/adminCategory/AdminCategory.tsx
create mode 100644 frontend/src/apps/admin/pages/adminNotification/AdminNotification.tsx
create mode 100644 frontend/src/apps/admin/pages/adminQuestion/AdminQuestion.tsx
create mode 100644 frontend/src/apps/admin/pages/adminQuestionList/AdminQuestionList.tsx
create mode 100644 frontend/src/apps/admin/pages/adminQuestionListDetail/AdminQuestionListDetail.tsx
create mode 100644 frontend/src/apps/admin/pages/adminUser/AdminUser.tsx
create mode 100644 frontend/src/apps/admin/pages/dashBroad/DashBroad.tsx
create mode 100644 frontend/src/apps/admin/router/config.ts
create mode 100644 frontend/src/apps/admin/router/index.tsx
create mode 100644 frontend/src/apps/user/UserApp.css
create mode 100644 frontend/src/apps/user/UserApp.tsx
create mode 100644 frontend/src/apps/user/components/logo/Logo.tsx
create mode 100644 frontend/src/apps/user/components/navBar/NavBar.tsx
create mode 100644 frontend/src/apps/user/components/searchInput/SearchInput.tsx
create mode 100644 frontend/src/apps/user/layout/Content.tsx
create mode 100644 frontend/src/apps/user/layout/Header.tsx
create mode 100644 frontend/src/apps/user/layout/Layout.tsx
create mode 100644 frontend/src/apps/user/pages/home/HomePage.tsx
create mode 100644 frontend/src/apps/user/pages/home/components/RankList.tsx
create mode 100644 frontend/src/apps/user/pages/question/QuestionPage.tsx
create mode 100644 frontend/src/apps/user/pages/questionList/QuestionListPage.tsx
create mode 100644 frontend/src/apps/user/pages/questionList/components/TrainingCampListHeader.tsx
create mode 100644 frontend/src/apps/user/pages/questionList/components/TrainingCampListInfo.tsx
create mode 100644 frontend/src/apps/user/pages/questionSet/QuestionSetPage.tsx
create mode 100644 frontend/src/apps/user/pages/userCenter/UserCenterPage.tsx
create mode 100644 frontend/src/apps/user/pages/userCenter/collect/CollectionDetail.tsx
create mode 100644 frontend/src/apps/user/pages/userCenter/collect/UserCollect.tsx
create mode 100644 frontend/src/apps/user/pages/userCenter/info/UserInfo.tsx
create mode 100644 frontend/src/apps/user/pages/userCenter/note/UserNote.tsx
create mode 100644 frontend/src/apps/user/pages/userHome/UserHomePage.tsx
create mode 100644 frontend/src/apps/user/pages/userHome/components/UserCollectList.tsx
create mode 100644 frontend/src/apps/user/pages/userHome/components/UserNoteList.tsx
create mode 100644 frontend/src/apps/user/router/config.ts
create mode 100644 frontend/src/apps/user/router/index.tsx
create mode 100644 frontend/src/base/components/cherryMarkdown/CherryMarkdown.css
create mode 100644 frontend/src/base/components/cherryMarkdown/CherryMarkdown.tsx
create mode 100644 frontend/src/base/components/columnDivider/ColumnDivider.tsx
create mode 100644 frontend/src/base/components/errorFallback/ErrorFallback.tsx
create mode 100644 frontend/src/base/components/heatMap/CalendarHeatmap.css
create mode 100644 frontend/src/base/components/heatMap/CalendarHeatmap.tsx
create mode 100644 frontend/src/base/components/heatMap/constants/index.ts
create mode 100644 frontend/src/base/components/heatMap/utils/index.ts
create mode 100644 frontend/src/base/components/hostModal/HostModal.tsx
create mode 100644 frontend/src/base/components/index.tsx
create mode 100644 frontend/src/base/components/markdownRender/CopyButton.tsx
create mode 100644 frontend/src/base/components/markdownRender/MarkdownRender.tsx
create mode 100644 frontend/src/base/components/notFound/NotFound.tsx
create mode 100644 frontend/src/base/components/panel/Panel.tsx
create mode 100644 frontend/src/base/components/timeAgo/TimeAgo.tsx
create mode 100644 frontend/src/base/constants/index.ts
create mode 100644 frontend/src/base/hooks/index.ts
create mode 100644 frontend/src/base/hooks/useApp.ts
create mode 100644 frontend/src/base/icon/BronzeTrophy.tsx
create mode 100644 frontend/src/base/icon/GoldTrophy.tsx
create mode 100644 frontend/src/base/icon/SliverTrophy.tsx
create mode 100644 frontend/src/base/icon/index.ts
create mode 100644 frontend/src/base/regex/index.ts
create mode 100644 frontend/src/base/styles/github-markdown-light.css
create mode 100644 frontend/src/base/styles/github-markdown.css
create mode 100644 frontend/src/base/types/index.ts
create mode 100644 frontend/src/base/utils/index.ts
create mode 100644 frontend/src/domain/app/hooks/useTheme.ts
create mode 100644 frontend/src/domain/app/index.ts
create mode 100644 frontend/src/domain/app/types/index.ts
create mode 100644 frontend/src/domain/category/api/categoryApi.ts
create mode 100644 frontend/src/domain/category/components/CategoryList.tsx
create mode 100644 frontend/src/domain/category/components/CategoryOptDrawer.tsx
create mode 100644 frontend/src/domain/category/components/CategoryTreeView.tsx
create mode 100644 frontend/src/domain/category/hooks/useCategory.ts
create mode 100644 frontend/src/domain/category/index.ts
create mode 100644 frontend/src/domain/category/service/categoryService.ts
create mode 100644 frontend/src/domain/category/types/categoryService.ts
create mode 100644 frontend/src/domain/category/types/types.ts
create mode 100644 frontend/src/domain/category/utils/index.ts
create mode 100644 frontend/src/domain/collection/api/collectionApiList.ts
create mode 100644 frontend/src/domain/collection/components/CollectModalFooter.tsx
create mode 100644 frontend/src/domain/collection/components/CollectionList.tsx
create mode 100644 frontend/src/domain/collection/components/CollectionList2.tsx
create mode 100644 frontend/src/domain/collection/components/CollectionModal.tsx
create mode 100644 frontend/src/domain/collection/components/CreateCollectionModal.tsx
create mode 100644 frontend/src/domain/collection/hooks/useCollection2.ts
create mode 100644 frontend/src/domain/collection/index.ts
create mode 100644 frontend/src/domain/collection/service/collectionService.ts
create mode 100644 frontend/src/domain/collection/types/types.ts
create mode 100644 frontend/src/domain/note/api/noteApi.ts
create mode 100644 frontend/src/domain/note/components/AuthorCard.tsx
create mode 100644 frontend/src/domain/note/components/CollectButton.tsx
create mode 100644 frontend/src/domain/note/components/DisplayContent.tsx
create mode 100644 frontend/src/domain/note/components/DownloadNoteItem.tsx
create mode 100644 frontend/src/domain/note/components/ExpandButton.tsx
create mode 100644 frontend/src/domain/note/components/LikeButton.tsx
create mode 100644 frontend/src/domain/note/components/NoteContent.tsx
create mode 100644 frontend/src/domain/note/components/NoteHeatMap.tsx
create mode 100644 frontend/src/domain/note/components/NoteItem.tsx
create mode 100644 frontend/src/domain/note/components/NoteList.tsx
create mode 100644 frontend/src/domain/note/components/NoteRankList.tsx
create mode 100644 frontend/src/domain/note/components/OptionsCard.tsx
create mode 100644 frontend/src/domain/note/components/Top3Count.tsx
create mode 100644 frontend/src/domain/note/hooks/useNotes.ts
create mode 100644 frontend/src/domain/note/hooks/useTop3Count.ts
create mode 100644 frontend/src/domain/note/index.ts
create mode 100644 frontend/src/domain/note/service/noteService.ts
create mode 100644 frontend/src/domain/note/types/serviceTypes.ts
create mode 100644 frontend/src/domain/note/types/types.ts
create mode 100644 frontend/src/domain/noteLike/api/noteLikeApi.ts
create mode 100644 frontend/src/domain/noteLike/hooks/useNoteLike.ts
create mode 100644 frontend/src/domain/noteLike/index.ts
create mode 100644 frontend/src/domain/noteLike/service/noteLikeService.ts
create mode 100644 frontend/src/domain/question/api/questionApi.ts
create mode 100644 frontend/src/domain/question/components/DifficultyTag.tsx
create mode 100644 frontend/src/domain/question/components/QuestionAddDrawer.tsx
create mode 100644 frontend/src/domain/question/components/QuestionCard.tsx
create mode 100644 frontend/src/domain/question/components/QuestionList.tsx
create mode 100644 frontend/src/domain/question/components/QuestionTable.tsx
create mode 100644 frontend/src/domain/question/components/QuestionView.tsx
create mode 100644 frontend/src/domain/question/components/SearchModalFooter.tsx
create mode 100644 frontend/src/domain/question/components/SearchQuestionModal.tsx
create mode 100644 frontend/src/domain/question/hooks/useQuestion.ts
create mode 100644 frontend/src/domain/question/hooks/useQuestionList.ts
create mode 100644 frontend/src/domain/question/hooks/useQuestionTable.ts
create mode 100644 frontend/src/domain/question/hooks/useSearchQuestion.ts
create mode 100644 frontend/src/domain/question/index.ts
create mode 100644 frontend/src/domain/question/service/questionService.ts
create mode 100644 frontend/src/domain/question/types/service.ts
create mode 100644 frontend/src/domain/question/types/types.ts
create mode 100644 frontend/src/domain/questionList/api/questionListApi.ts
create mode 100644 frontend/src/domain/questionList/components/QuestionListDetail.tsx
create mode 100644 frontend/src/domain/questionList/components/QuestionListOptDrawer.tsx
create mode 100644 frontend/src/domain/questionList/components/QuestionListTable.tsx
create mode 100644 frontend/src/domain/questionList/components/QuestionListTreeView.tsx
create mode 100644 frontend/src/domain/questionList/components/QuestionListView.tsx
create mode 100644 frontend/src/domain/questionList/hooks/useQuestionList.ts
create mode 100644 frontend/src/domain/questionList/hooks/useQuestionListItem.ts
create mode 100644 frontend/src/domain/questionList/hooks/useQuestionListItem2.ts
create mode 100644 frontend/src/domain/questionList/hooks/useQuestionLists.ts
create mode 100644 frontend/src/domain/questionList/index.ts
create mode 100644 frontend/src/domain/questionList/service/questionListService.ts
create mode 100644 frontend/src/domain/questionList/types/types.ts
create mode 100644 frontend/src/domain/questionList/utils/index.ts
create mode 100644 frontend/src/domain/statistic/api/index.ts
create mode 100644 frontend/src/domain/statistic/components/StatisticTable.tsx
create mode 100644 frontend/src/domain/statistic/hooks/useStatistic.ts
create mode 100644 frontend/src/domain/statistic/index.ts
create mode 100644 frontend/src/domain/statistic/service/statisticService.ts
create mode 100644 frontend/src/domain/statistic/types/types.ts
create mode 100644 frontend/src/domain/user/api/userApi.ts
create mode 100644 frontend/src/domain/user/components/LoginModal.tsx
create mode 100644 frontend/src/domain/user/components/ProfileMenu.tsx
create mode 100644 frontend/src/domain/user/components/UserAvatarMenu.tsx
create mode 100644 frontend/src/domain/user/components/UserHomeProfile.tsx
create mode 100644 frontend/src/domain/user/components/UserInfoForm.tsx
create mode 100644 frontend/src/domain/user/components/UserList.tsx
create mode 100644 frontend/src/domain/user/hooks/useLogin.ts
create mode 100644 frontend/src/domain/user/hooks/useLogout.ts
create mode 100644 frontend/src/domain/user/hooks/useRegister.ts
create mode 100644 frontend/src/domain/user/hooks/useUser.ts
create mode 100644 frontend/src/domain/user/hooks/useUser2.ts
create mode 100644 frontend/src/domain/user/hooks/useUserForm.ts
create mode 100644 frontend/src/domain/user/hooks/useUserList.ts
create mode 100644 frontend/src/domain/user/index.ts
create mode 100644 frontend/src/domain/user/service/userService.ts
create mode 100644 frontend/src/domain/user/types/serviceTypes.ts
create mode 100644 frontend/src/domain/user/types/types.ts
create mode 100644 frontend/src/index.css
create mode 100644 frontend/src/main.tsx
create mode 100644 frontend/src/request/fetchClient.ts
create mode 100644 frontend/src/request/index.ts
create mode 100644 frontend/src/request/types.ts
create mode 100644 frontend/src/store/appSlice.ts
create mode 100644 frontend/src/store/store.ts
create mode 100644 frontend/src/store/userSlice.ts
create mode 100644 frontend/src/vite-env.d.ts
create mode 100644 frontend/tailwind.config.js
create mode 100644 frontend/tsconfig.app.json
create mode 100644 frontend/tsconfig.json
create mode 100644 frontend/tsconfig.node.json
create mode 100644 frontend/upload.sh
create mode 100644 frontend/vite.config.ts
create mode 100644 kamanote-tech.sql
create mode 100644 package-lock.json
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c25c5ae
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,28 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
+
+# 其它文件
+
+stats.html
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..24c5ddc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,5 @@
+# kama-notes
+
+【代码随想录知识星球】项目分享-卡码笔记
+
+## 项目介绍
diff --git a/backend/.gitignore b/backend/.gitignore
new file mode 100644
index 0000000..96df913
--- /dev/null
+++ b/backend/.gitignore
@@ -0,0 +1,37 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+## 排除 application-test.yml 和 application-prod.yml
+
+application-dev.yml
diff --git a/backend/.mvn/wrapper/maven-wrapper.properties b/backend/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..d58dfb7
--- /dev/null
+++ b/backend/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+wrapperVersion=3.3.2
+distributionType=only-script
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
diff --git a/backend/Dockerfile b/backend/Dockerfile
new file mode 100644
index 0000000..840f97c
--- /dev/null
+++ b/backend/Dockerfile
@@ -0,0 +1,23 @@
+# 构建阶段
+FROM maven:3.9.9-amazoncorretto-17 AS build
+
+WORKDIR /app
+
+# 复制文件并忽略不必要的内容(通过 .dockerignore 配置)
+COPY . .
+
+# 使用 Maven 构建项目
+RUN mvn -B clean package -DskipTests
+
+# 运行阶段
+FROM openjdk:17
+
+WORKDIR /app
+
+# 将构建产物复制到运行镜像
+COPY --from=build /app/target/*.jar app.jar
+
+# 设置启动命令并暴露端口
+CMD ["java", "-Dspring.profiles.active=dev", "-jar", "app.jar"]
+
+EXPOSE 8080
diff --git a/backend/mvnw b/backend/mvnw
new file mode 100644
index 0000000..19529dd
--- /dev/null
+++ b/backend/mvnw
@@ -0,0 +1,259 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Apache Maven Wrapper startup batch script, version 3.3.2
+#
+# Optional ENV vars
+# -----------------
+# JAVA_HOME - location of a JDK home dir, required when download maven via java source
+# MVNW_REPOURL - repo url base for downloading maven distribution
+# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
+# ----------------------------------------------------------------------------
+
+set -euf
+[ "${MVNW_VERBOSE-}" != debug ] || set -x
+
+# OS specific support.
+native_path() { printf %s\\n "$1"; }
+case "$(uname)" in
+CYGWIN* | MINGW*)
+ [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
+ native_path() { cygpath --path --windows "$1"; }
+ ;;
+esac
+
+# set JAVACMD and JAVACCMD
+set_java_home() {
+ # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
+ if [ -n "${JAVA_HOME-}" ]; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACCMD="$JAVA_HOME/jre/sh/javac"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ JAVACCMD="$JAVA_HOME/bin/javac"
+
+ if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
+ echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
+ return 1
+ fi
+ fi
+ else
+ JAVACMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v java
+ )" || :
+ JAVACCMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v javac
+ )" || :
+
+ if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
+ echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
+ return 1
+ fi
+ fi
+}
+
+# hash string like Java String::hashCode
+hash_string() {
+ str="${1:-}" h=0
+ while [ -n "$str" ]; do
+ char="${str%"${str#?}"}"
+ h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
+ str="${str#?}"
+ done
+ printf %x\\n $h
+}
+
+verbose() { :; }
+[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
+
+die() {
+ printf %s\\n "$1" >&2
+ exit 1
+}
+
+trim() {
+ # MWRAPPER-139:
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
+ # Needed for removing poorly interpreted newline sequences when running in more
+ # exotic environments such as mingw bash on Windows.
+ printf "%s" "${1}" | tr -d '[:space:]'
+}
+
+# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
+while IFS="=" read -r key value; do
+ case "${key-}" in
+ distributionUrl) distributionUrl=$(trim "${value-}") ;;
+ distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
+ esac
+done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+
+case "${distributionUrl##*/}" in
+maven-mvnd-*bin.*)
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
+ *)
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
+ distributionPlatform=linux-amd64
+ ;;
+ esac
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
+ ;;
+maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
+*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
+esac
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
+[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
+distributionUrlName="${distributionUrl##*/}"
+distributionUrlNameMain="${distributionUrlName%.*}"
+distributionUrlNameMain="${distributionUrlNameMain%-bin}"
+MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
+MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
+
+exec_maven() {
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
+}
+
+if [ -d "$MAVEN_HOME" ]; then
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+ exec_maven "$@"
+fi
+
+case "${distributionUrl-}" in
+*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
+*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
+esac
+
+# prepare tmp dir
+if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
+ trap clean HUP INT TERM EXIT
+else
+ die "cannot create temp dir"
+fi
+
+mkdir -p -- "${MAVEN_HOME%/*}"
+
+# Download and Install Apache Maven
+verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+verbose "Downloading from: $distributionUrl"
+verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+# select .zip or .tar.gz
+if ! command -v unzip >/dev/null; then
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
+ distributionUrlName="${distributionUrl##*/}"
+fi
+
+# verbose opt
+__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
+[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
+
+# normalize http auth
+case "${MVNW_PASSWORD:+has-password}" in
+'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+esac
+
+if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
+ verbose "Found wget ... using wget"
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
+elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
+ verbose "Found curl ... using curl"
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
+elif set_java_home; then
+ verbose "Falling back to use Java to download"
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
+ cat >"$javaSource" <<-END
+ public class Downloader extends java.net.Authenticator
+ {
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
+ {
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
+ }
+ public static void main( String[] args ) throws Exception
+ {
+ setDefault( new Downloader() );
+ java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
+ }
+ }
+ END
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
+ verbose " - Compiling Downloader.java ..."
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
+ verbose " - Running Downloader.java ..."
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
+fi
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+if [ -n "${distributionSha256Sum-}" ]; then
+ distributionSha256Result=false
+ if [ "$MVN_CMD" = mvnd.sh ]; then
+ echo "Checksum validation is not supported for maven-mvnd." >&2
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+ exit 1
+ elif command -v sha256sum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
+ distributionSha256Result=true
+ fi
+ elif command -v shasum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
+ distributionSha256Result=true
+ fi
+ else
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+ exit 1
+ fi
+ if [ $distributionSha256Result = false ]; then
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
+ exit 1
+ fi
+fi
+
+# unzip and move
+if command -v unzip >/dev/null; then
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
+else
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
+fi
+printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
+mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
+
+clean || :
+exec_maven "$@"
diff --git a/backend/mvnw.cmd b/backend/mvnw.cmd
new file mode 100644
index 0000000..249bdf3
--- /dev/null
+++ b/backend/mvnw.cmd
@@ -0,0 +1,149 @@
+<# : batch portion
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.3.2
+@REM
+@REM Optional ENV vars
+@REM MVNW_REPOURL - repo url base for downloading maven distribution
+@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
+@REM ----------------------------------------------------------------------------
+
+@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
+@SET __MVNW_CMD__=
+@SET __MVNW_ERROR__=
+@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
+@SET PSModulePath=
+@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
+)
+@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
+@SET __MVNW_PSMODULEP_SAVE=
+@SET __MVNW_ARG0_NAME__=
+@SET MVNW_USERNAME=
+@SET MVNW_PASSWORD=
+@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
+@echo Cannot start maven from wrapper >&2 && exit /b 1
+@GOTO :EOF
+: end batch / begin powershell #>
+
+$ErrorActionPreference = "Stop"
+if ($env:MVNW_VERBOSE -eq "true") {
+ $VerbosePreference = "Continue"
+}
+
+# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
+$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
+if (!$distributionUrl) {
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
+}
+
+switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
+ "maven-mvnd-*" {
+ $USE_MVND = $true
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
+ $MVN_CMD = "mvnd.cmd"
+ break
+ }
+ default {
+ $USE_MVND = $false
+ $MVN_CMD = $script -replace '^mvnw','mvn'
+ break
+ }
+}
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
+if ($env:MVNW_REPOURL) {
+ $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
+}
+$distributionUrlName = $distributionUrl -replace '^.*/',''
+$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
+$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
+if ($env:MAVEN_USER_HOME) {
+ $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
+}
+$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
+$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
+
+if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
+ exit $?
+}
+
+if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
+}
+
+# prepare tmp dir
+$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
+$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
+$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
+trap {
+ if ($TMP_DOWNLOAD_DIR.Exists) {
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+ }
+}
+
+New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
+
+# Download and Install Apache Maven
+Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+Write-Verbose "Downloading from: $distributionUrl"
+Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+$webclient = New-Object System.Net.WebClient
+if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
+}
+[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
+if ($distributionSha256Sum) {
+ if ($USE_MVND) {
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
+ }
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
+ }
+}
+
+# unzip and move
+Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
+Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
+try {
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
+} catch {
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
+ Write-Error "fail to move MAVEN_HOME"
+ }
+} finally {
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+}
+
+Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
diff --git a/backend/pom.xml b/backend/pom.xml
new file mode 100644
index 0000000..99341c7
--- /dev/null
+++ b/backend/pom.xml
@@ -0,0 +1,150 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.7.18
+
+
+ com.kama
+ notes
+ 0.0.1
+ notes-tech
+ kamaNotes
+ jar
+
+ 17
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.2.0
+
+
+ mysql
+ mysql-connector-java
+ 8.0.33
+
+
+ io.jsonwebtoken
+ jjwt
+ 0.9.1
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ junit
+ junit
+ test
+
+
+ javax.validation
+ validation-api
+ 2.0.1.Final
+
+
+ org.hibernate.validator
+ hibernate-validator
+ 6.2.4.Final
+
+
+ cn.hutool
+ hutool-core
+ 5.8.25
+
+
+ jakarta.xml.bind
+ jakarta.xml.bind-api
+ 2.3.2
+
+
+ org.glassfish.jaxb
+ jaxb-runtime
+ 2.3.2
+
+
+ com.vladsch.flexmark
+ flexmark-all
+ 0.64.8
+
+
+
+ org.springframework.boot
+ spring-boot-starter-log4j2
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+
+ aliyun
+ aliyun maven
+ https://maven.aliyun.com/repository/public
+
+ true
+
+
+ false
+
+
+
+
diff --git a/backend/src/main/java/com/kama/notes/NotesApplication.java b/backend/src/main/java/com/kama/notes/NotesApplication.java
new file mode 100644
index 0000000..f96d062
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/NotesApplication.java
@@ -0,0 +1,20 @@
+package com.kama.notes;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+/**
+ * @ClassName NotesApplication
+ * @Description ToDo
+ * @Author Tong
+ * @LastChangeDate 2024-12-16 11:08
+ * @Version v1.0
+ */
+@SpringBootApplication
+@EnableScheduling
+public class NotesApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(NotesApplication.class, args);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/annotation/NeedLogin.java b/backend/src/main/java/com/kama/notes/annotation/NeedLogin.java
new file mode 100644
index 0000000..683b13e
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/annotation/NeedLogin.java
@@ -0,0 +1,9 @@
+package com.kama.notes.annotation;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface NeedLogin {
+}
diff --git a/backend/src/main/java/com/kama/notes/aspect/NeedLoginAspect.java b/backend/src/main/java/com/kama/notes/aspect/NeedLoginAspect.java
new file mode 100644
index 0000000..19588f2
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/aspect/NeedLoginAspect.java
@@ -0,0 +1,32 @@
+package com.kama.notes.aspect;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.kama.notes.annotation.NeedLogin;
+import com.kama.notes.scope.RequestScopeData;
+import com.kama.notes.utils.ApiResponseUtil;
+
+@Aspect
+@Component
+public class NeedLoginAspect {
+
+ @Autowired
+ private RequestScopeData requestScopeData;
+
+ @Around("@annotation(needLogin)")
+ public Object around(ProceedingJoinPoint joinPoint, NeedLogin needLogin) throws Throwable {
+
+ if (!requestScopeData.isLogin()) {
+ return ApiResponseUtil.error("用户未登录");
+ }
+
+ if (requestScopeData.getUserId() == null) {
+ return ApiResponseUtil.error("用户 ID 异常");
+ }
+ return joinPoint.proceed();
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/aspect/PutTraceIdAspect.java b/backend/src/main/java/com/kama/notes/aspect/PutTraceIdAspect.java
new file mode 100644
index 0000000..b36d8f4
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/aspect/PutTraceIdAspect.java
@@ -0,0 +1,25 @@
+package com.kama.notes.aspect;
+
+import java.util.UUID;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+
+@Aspect
+@Component
+public class PutTraceIdAspect {
+ private static final String TRACE_ID_KEY = "traceId";
+ /**
+ * 切面切入点,拦截所有控制器的方法。
+ */
+ @Before("execution(* com.kama.notes..*(..))")
+ public void addTraceIdToLog() {
+ // 如果当前 MDC 中没有 traceId,则生成一个新的
+ if (MDC.get(TRACE_ID_KEY) == null) {
+ String traceId = UUID.randomUUID().toString();
+ MDC.put(TRACE_ID_KEY, traceId);
+ }
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/config/MyBatisConfig.java b/backend/src/main/java/com/kama/notes/config/MyBatisConfig.java
new file mode 100644
index 0000000..a79944f
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/config/MyBatisConfig.java
@@ -0,0 +1,18 @@
+package com.kama.notes.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * @ClassName MyBatisConfig
+ * @Description MyBatis 配置类
+ * @Author Tong
+ * @LastChangeDate 2024-12-17 16:22
+ * @Version v1.0
+ */
+@Configuration// 修改为正确的Mapper包路径
+@MapperScan("com.kama.notes.mapper")
+@EnableTransactionManagement
+public class MyBatisConfig {
+}
diff --git a/backend/src/main/java/com/kama/notes/config/RedisConfig.java b/backend/src/main/java/com/kama/notes/config/RedisConfig.java
new file mode 100644
index 0000000..3672bbb
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/config/RedisConfig.java
@@ -0,0 +1,32 @@
+package com.kama.notes.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+@Configuration
+public class RedisConfig {
+
+ @Bean
+ public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
+ RedisTemplate template = new RedisTemplate<>();
+ template.setConnectionFactory(factory);
+ // 使用 String 序列化键(key)
+ template.setKeySerializer(new StringRedisSerializer());
+ // 使用 JSON 序列化值(value)
+ template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
+ // 使用 String 序列化哈希键(hash key)和值(hash value)
+ template.setHashKeySerializer(new StringRedisSerializer());
+ template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
+ return template;
+ }
+
+ @Bean
+ public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
+ return new StringRedisTemplate(redisConnectionFactory);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/config/SchedulerConfig.java b/backend/src/main/java/com/kama/notes/config/SchedulerConfig.java
new file mode 100644
index 0000000..e73870c
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/config/SchedulerConfig.java
@@ -0,0 +1,19 @@
+package com.kama.notes.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
+
+@Configuration
+@EnableScheduling
+public class SchedulerConfig {
+
+ @Bean
+ public ThreadPoolTaskScheduler taskScheduler() {
+ ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
+ scheduler.setPoolSize(10);
+ scheduler.setThreadNamePrefix("ScheduledTask-");
+ return scheduler;
+ }
+}
\ No newline at end of file
diff --git a/backend/src/main/java/com/kama/notes/config/SecurityConfig.java b/backend/src/main/java/com/kama/notes/config/SecurityConfig.java
new file mode 100644
index 0000000..116eb00
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package com.kama.notes.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+/**
+ * @ClassName Security配置类
+ * @Description ToDo
+ * @Author Tong
+ * @LastChangeDate 2024-12-17 15:40
+ * @Version v1.0
+ */
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf()
+ .disable()
+ .authorizeRequests()
+ .antMatchers("/api/**", "/images/**")
+ .permitAll()
+ .anyRequest()
+ .authenticated()
+ .and()
+ .formLogin()
+ .disable();
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/config/WebConfig.java b/backend/src/main/java/com/kama/notes/config/WebConfig.java
new file mode 100644
index 0000000..d1f84e3
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/config/WebConfig.java
@@ -0,0 +1,57 @@
+package com.kama.notes.config;
+
+import com.kama.notes.filter.TraceIdFilter;
+import com.kama.notes.interceptor.TokenInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+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;
+
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+
+ @Value("${upload.path:D:/kamaNotes/upload}")
+ private String uploadPath;
+
+ @Autowired
+ private TokenInterceptor tokenInterceptor;
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/images/**")
+ .addResourceLocations("file:" + uploadPath + "/");
+ }
+
+ /**
+ * 添加拦截器,用于验证 token,初始化请求周期中的用户相关信息
+ */
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(tokenInterceptor)
+ .addPathPatterns("/**")
+ .excludePathPatterns("/login", "/error");
+ }
+
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowedOrigins("http://localhost:5173", "http://127.0.0.1:5173") // 允许的域名
+ .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")// 允许的 HTTP 方法
+ .allowedHeaders("*")
+ .allowCredentials(true)
+ .maxAge(3600);
+ }
+
+ @Bean
+ public FilterRegistrationBean traceIdFilter() {
+ FilterRegistrationBean registrationBean = new FilterRegistrationBean<>();
+ registrationBean.setFilter(new TraceIdFilter());
+ registrationBean.addUrlPatterns("/*");
+ return registrationBean;
+ }
+}
\ No newline at end of file
diff --git a/backend/src/main/java/com/kama/notes/controller/CategoryController.java b/backend/src/main/java/com/kama/notes/controller/CategoryController.java
new file mode 100644
index 0000000..eaa2872
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/CategoryController.java
@@ -0,0 +1,90 @@
+package com.kama.notes.controller;
+
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.model.dto.category.CreateCategoryBody;
+import com.kama.notes.model.dto.category.UpdateCategoryBody;
+import com.kama.notes.model.vo.category.CategoryVO;
+import com.kama.notes.model.vo.category.CreateCategoryVO;
+import com.kama.notes.service.CategoryService;
+
+@RestController
+@RequestMapping("/api")
+public class CategoryController {
+
+ @Autowired
+ private CategoryService categoryService;
+
+ /**
+ * 获取分类列表(用户端)。
+ *
+ * @return 包含分类列表的响应。
+ */
+ @GetMapping("/categories")
+ public ApiResponse> userCategories() {
+ return categoryService.categoryList();
+ }
+
+ /**
+ * 获取分类列表(管理员端)。
+ *
+ * @return 包含分类列表的响应。
+ */
+ @GetMapping("/admin/categories")
+ public ApiResponse> categories() {
+ return categoryService.categoryList();
+ }
+
+ /**
+ * 创建新的分类。
+ *
+ * @param createCategoryBody 包含分类创建信息的请求体。
+ * @return 包含创建成功的分类信息的响应。
+ */
+ @PostMapping("/admin/categories")
+ public ApiResponse createCategory(
+ @Valid @RequestBody CreateCategoryBody createCategoryBody) {
+ return categoryService.createCategory(createCategoryBody);
+ }
+
+ /**
+ * 更新指定的分类信息。
+ *
+ * @param categoryId 分类ID,必须为正整数。
+ * @param updateCategoryBody 包含更新信息的请求体。
+ * @return 包含更新操作结果的响应。
+ */
+ @PatchMapping("/admin/categories/{categoryId}")
+ public ApiResponse updateCategory(
+ @Min(value = 1, message = "categoryId 必须为正整数") @PathVariable Integer categoryId,
+ @Valid @RequestBody UpdateCategoryBody updateCategoryBody) {
+ return categoryService.updateCategory(categoryId, updateCategoryBody);
+ }
+
+ /**
+ * 删除指定的分类。
+ *
+ * @param categoryId 分类ID,必须为正整数。
+ * @return 包含删除操作结果的响应。
+ */
+ @DeleteMapping("/admin/categories/{categoryId}")
+ public ApiResponse deleteCategory(
+ @Min(value = 1, message = "categoryId 必须为正整数") @PathVariable Integer categoryId) {
+ return categoryService.deleteCategory(categoryId);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/CollectionController.java b/backend/src/main/java/com/kama/notes/controller/CollectionController.java
new file mode 100644
index 0000000..e8ea9a5
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/CollectionController.java
@@ -0,0 +1,87 @@
+package com.kama.notes.controller;
+
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.model.dto.collection.CollectionQueryParams;
+import com.kama.notes.model.dto.collection.CreateCollectionBody;
+import com.kama.notes.model.dto.collection.UpdateCollectionBody;
+import com.kama.notes.model.vo.collection.CollectionVO;
+import com.kama.notes.model.vo.collection.CreateCollectionVO;
+import com.kama.notes.service.CollectionService;
+
+@RestController
+@RequestMapping("/api")
+public class CollectionController {
+
+ @Autowired
+ private CollectionService collectionService;
+
+ /**
+ * 获取收藏夹列表接口
+ *
+ * @param queryParams 查询参数
+ * @return 收藏夹列表
+ */
+ @GetMapping("/collections")
+ public ApiResponse> getCollections(
+ @Valid
+ CollectionQueryParams queryParams) {
+ return collectionService.getCollections(queryParams);
+ }
+
+ /**
+ * 创建收藏夹接口
+ *
+ * @param requestBody 创建收藏夹请求体
+ * @return 创建结果,如果成功则包含收藏夹 ID
+ */
+ @PostMapping("/collections")
+ public ApiResponse createCollection(
+ @Valid
+ @RequestBody
+ CreateCollectionBody requestBody) {
+ return collectionService.createCollection(requestBody);
+ }
+
+ /**
+ * 删除收藏夹接口
+ *
+ * @param collectionId 收藏夹 ID
+ * @return 返回删除结果
+ */
+ @DeleteMapping("/collections/{collectionId}")
+ public ApiResponse deleteCollection(
+ @PathVariable
+ @Min(value = 1, message = "collectionId 必须为正整数")
+ Integer collectionId) {
+ return collectionService.deleteCollection(collectionId);
+ }
+
+ /**
+ * 批量修改收藏夹接口
+ *
+ * @param collectionBody 收藏夹 ID
+ * @return 返回修改结果
+ */
+ @PostMapping("/collections/batch")
+ public ApiResponse batchModifyCollection(
+ @Valid
+ @RequestBody
+ UpdateCollectionBody collectionBody) {
+ return collectionService.batchModifyCollection(collectionBody);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/CollectionNoteController.java b/backend/src/main/java/com/kama/notes/controller/CollectionNoteController.java
new file mode 100644
index 0000000..ccefa7f
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/CollectionNoteController.java
@@ -0,0 +1,9 @@
+package com.kama.notes.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/api")
+public class CollectionNoteController {
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/NoteController.java b/backend/src/main/java/com/kama/notes/controller/NoteController.java
new file mode 100644
index 0000000..a2ce89d
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/NoteController.java
@@ -0,0 +1,128 @@
+package com.kama.notes.controller;
+
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.model.dto.note.CreateNoteRequest;
+import com.kama.notes.model.dto.note.NoteQueryParams;
+import com.kama.notes.model.dto.note.UpdateNoteRequest;
+import com.kama.notes.model.vo.note.CreateNoteVO;
+import com.kama.notes.model.vo.note.DownloadNoteVO;
+import com.kama.notes.model.vo.note.NoteHeatMapItem;
+import com.kama.notes.model.vo.note.NoteRankListItem;
+import com.kama.notes.model.vo.note.NoteVO;
+import com.kama.notes.model.vo.note.Top3Count;
+import com.kama.notes.service.NoteService;
+
+import lombok.extern.log4j.Log4j2;
+
+/**
+ * 笔记控制器
+ */
+@Log4j2
+@RestController
+@RequestMapping("/api")
+public class NoteController {
+
+ // 自动注入 NoteService 实例,用于处理笔记相关的业务逻辑
+ @Autowired
+ private NoteService noteService;
+
+ /**
+ * 查询笔记列表
+ *
+ * @param params 查询参数对象,包含筛选条件
+ * @return 返回一个包含笔记列表的 ApiResponse 对象
+ */
+ @GetMapping("/notes")
+ public ApiResponse> getNotes(
+ @Valid NoteQueryParams params) {
+ return noteService.getNotes(params);
+ }
+
+ /**
+ * 发布笔记
+ *
+ * @param request 创建笔记的请求对象,包含笔记的内容等信息
+ * @return 返回一个包含新创建笔记信息的 ApiResponse 对象
+ */
+ @PostMapping("/notes")
+ public ApiResponse createNote(
+ @Valid @RequestBody CreateNoteRequest request) {
+ return noteService.createNote(request);
+ }
+
+ /**
+ * 更新笔记
+ *
+ * @param noteId 笔记的唯一标识符,用于定位要更新的笔记
+ * @param request 更新笔记的请求对象,包含需要修改的信息
+ * @return 返回一个包含更新后笔记信息的 ApiResponse 对象
+ */
+ @PatchMapping("/notes/{noteId}")
+ public ApiResponse updateNote(
+ @Min(value = 1, message = "noteId 必须为正整数") @PathVariable Integer noteId,
+ @Valid @RequestBody UpdateNoteRequest request) {
+ return noteService.updateNote(noteId, request);
+ }
+
+ /**
+ * 删除笔记
+ *
+ * @param noteId 笔记的唯一标识符,用于定位要删除的笔记
+ * @return 返回一个包含删除结果信息的 ApiResponse 对象
+ */
+ @DeleteMapping("/notes/{noteId}")
+ public ApiResponse deleteNote(
+ @Min(value = 1, message = "noteId 必须为正整数")
+ @PathVariable Integer noteId) {
+ return noteService.deleteNote(noteId);
+ }
+
+ /**
+ * 下载笔记
+ * @return
+ */
+ @GetMapping("/notes/download")
+ public ApiResponse downloadNote() {
+ return noteService.downloadNote();
+ }
+
+ /**
+ * 提交笔记排行榜
+ */
+ @GetMapping("/notes/ranklist")
+ public ApiResponse> submitNoteRank() {
+ return noteService.submitNoteRank();
+ }
+
+ /**
+ * 用户提交热力图
+ */
+ @GetMapping("/notes/heatmap")
+ public ApiResponse> submitNoteHeatMap() {
+ return noteService.submitNoteHeatMap();
+ }
+
+ /**
+ * 用户提交 top3 count
+ */
+ @GetMapping("/notes/top3count")
+ public ApiResponse submitNoteTop3Count() {
+ return noteService.submitNoteTop3Count();
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/NoteLikeController.java b/backend/src/main/java/com/kama/notes/controller/NoteLikeController.java
new file mode 100644
index 0000000..53049ad
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/NoteLikeController.java
@@ -0,0 +1,29 @@
+package com.kama.notes.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.service.NoteLikeService;
+
+@RestController
+@RequestMapping("/api")
+public class NoteLikeController {
+ @Autowired
+ private NoteLikeService noteLikeService;
+
+ @PostMapping("/like/note/{noteId}")
+ public ApiResponse likeNote(@PathVariable Integer noteId) {
+ return noteLikeService.likeNote(noteId);
+ }
+
+ @DeleteMapping("/like/note/{noteId}")
+ public ApiResponse unlikeNote(@PathVariable Integer noteId) {
+ return noteLikeService.unlikeNote(noteId);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/NotificationController.java b/backend/src/main/java/com/kama/notes/controller/NotificationController.java
new file mode 100644
index 0000000..ac1e810
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/NotificationController.java
@@ -0,0 +1,41 @@
+package com.kama.notes.controller;
+
+import javax.validation.Valid;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+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.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.model.dto.notification.NotificationDTO;
+import com.kama.notes.model.vo.notification.NotificationVO;
+import com.kama.notes.service.RedisService;
+import com.kama.notes.utils.ApiResponseUtil;
+
+@RestController
+@RequestMapping("/api")
+public class NotificationController {
+
+ // 由于比较简单,直接全写在 controller 内了,免得出现透传
+ @Autowired
+ private RedisService redisService;
+
+ @GetMapping("/notification")
+ public ApiResponse getNotifications() {
+ NotificationVO notificationVO = new NotificationVO();
+ Object o = redisService.get("kamanote:notification");
+ String content = o == null ? "" : o.toString();
+ notificationVO.setContent(content);
+ return ApiResponseUtil.success("获取通知成功", notificationVO);
+ }
+
+ @PostMapping("/notification")
+ public ApiResponse setNotifications(@Valid @RequestBody NotificationDTO notificationDTO) {
+ redisService.set("kamanote:notification", notificationDTO.getContent());
+ return ApiResponseUtil.success("设置通知成功");
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/QuestionController.java b/backend/src/main/java/com/kama/notes/controller/QuestionController.java
new file mode 100644
index 0000000..5c07d1f
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/QuestionController.java
@@ -0,0 +1,118 @@
+package com.kama.notes.controller;
+
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.model.dto.question.CreateQuestionBody;
+import com.kama.notes.model.dto.question.QuestionQueryParam;
+import com.kama.notes.model.dto.question.SearchQuestionBody;
+import com.kama.notes.model.dto.question.UpdateQuestionBody;
+import com.kama.notes.model.vo.question.CreateQuestionVO;
+import com.kama.notes.model.vo.question.QuestionNoteVO;
+import com.kama.notes.model.vo.question.QuestionUserVO;
+import com.kama.notes.model.vo.question.QuestionVO;
+import com.kama.notes.service.QuestionService;
+
+@RestController
+@RequestMapping("/api")
+public class QuestionController {
+
+ @Autowired
+ private QuestionService questionService;
+
+ /**
+ * 用户端获取问题列表
+ *
+ * @param queryParams 查询参数,用于过滤问题列表(如关键词、分类等)
+ * @return 包含用户可见问题的视图对象列表的响应
+ */
+ @GetMapping("/questions")
+ public ApiResponse> userGetQuestions(@Valid QuestionQueryParam queryParams) {
+ return questionService.userGetQuestions(queryParams);
+ }
+
+ /**
+ * 用户端搜索问题
+ *
+ * @param body 包含搜索关键词的请求体
+ * @return 包含搜索结果的视图对象列表的响应
+ */
+ @PostMapping("/questions/search")
+ public ApiResponse> searchQuestions(@Valid @RequestBody SearchQuestionBody body) {
+ return questionService.searchQuestions(body);
+ }
+
+ /**
+ * 用户端获取单个问题详情
+ *
+ * @param questionId 问题ID,必须为正整数
+ * @return 包含问题详情及关联笔记的视图对象的响应
+ */
+ @GetMapping("/questions/{questionId}")
+ public ApiResponse userGetQuestion(@Min(value = 1, message = "questionId 必须为正整数")
+ @PathVariable Integer questionId) {
+ return questionService.userGetQuestion(questionId);
+ }
+
+ /**
+ * 管理端获取问题列表
+ *
+ * @param queryParams 查询参数,用于过滤问题列表(如关键词、时间范围等)
+ * @return 包含所有问题的视图对象列表的响应
+ */
+ @GetMapping("/admin/questions")
+ public ApiResponse> getQuestions(@Valid QuestionQueryParam queryParams) {
+ return questionService.getQuestions(queryParams);
+ }
+
+ /**
+ * 管理端创建新问题
+ *
+ * @param createQuestionBody 创建问题的请求体,包含问题的标题、内容等信息
+ * @return 包含新创建问题视图对象的响应
+ */
+ @PostMapping("/admin/questions")
+ public ApiResponse createQuestion(@Valid @RequestBody CreateQuestionBody createQuestionBody) {
+ return questionService.createQuestion(createQuestionBody);
+ }
+
+ /**
+ * 管理端更新问题
+ *
+ * @param questionId 问题ID,必须为正整数
+ * @param updateQuestionBody 更新问题的请求体,包含要更新的字段和值
+ * @return 空视图对象的响应,表示更新操作成功
+ */
+ @PatchMapping("/admin/questions/{questionId}")
+ public ApiResponse updateQuestion(@Min(value = 1, message = "questionId 必须为正整数")
+ @PathVariable Integer questionId,
+ @Valid @RequestBody UpdateQuestionBody updateQuestionBody) {
+ return questionService.updateQuestion(questionId, updateQuestionBody);
+ }
+
+ /**
+ * 管理端删除问题
+ *
+ * @param questionId 问题ID,必须为正整数
+ * @return 空视图对象的响应,表示删除操作成功
+ */
+ @DeleteMapping("/admin/questions/{questionId}")
+ public ApiResponse deleteQuestion(@Min(value = 1, message = "questionId 必须为正整数")
+ @PathVariable Integer questionId) {
+ return questionService.deleteQuestion(questionId);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/QuestionListController.java b/backend/src/main/java/com/kama/notes/controller/QuestionListController.java
new file mode 100644
index 0000000..9711634
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/QuestionListController.java
@@ -0,0 +1,90 @@
+package com.kama.notes.controller;
+
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.model.dto.questionList.CreateQuestionListBody;
+import com.kama.notes.model.dto.questionList.UpdateQuestionListBody;
+import com.kama.notes.model.entity.QuestionList;
+import com.kama.notes.model.vo.questionList.CreateQuestionListVO;
+import com.kama.notes.service.QuestionListService;
+
+@RestController
+@RequestMapping("/api")
+public class QuestionListController {
+
+ @Autowired
+ private QuestionListService questionListService;
+
+ /**
+ * 获取题单。
+ *
+ * @return 包含题单列表的响应。
+ */
+ @GetMapping("/admin/questionlists/{questionListId}")
+ public ApiResponse getQuestionList(@Min(value = 1, message = "questionListId 必须为正整数")
+ @PathVariable Integer questionListId) {
+ return questionListService.getQuestionList(questionListId);
+ }
+
+ /**
+ * 获取题单列表。
+ *
+ * @return 包含题单列表的响应。
+ */
+ @GetMapping("/admin/questionlists")
+ public ApiResponse> getQuestionLists() {
+ return questionListService.getQuestionLists();
+ }
+
+ /**
+ * 创建新的题单。
+ *
+ * @param body 包含题单创建信息的请求体。
+ * @return 包含创建成功的题单信息的响应。
+ */
+ @PostMapping("/admin/questionlists")
+ public ApiResponse createQuestionList(@Valid @RequestBody CreateQuestionListBody body) {
+ return questionListService.createQuestionList(body);
+ }
+
+ /**
+ * 删除指定的题单。
+ *
+ * @param questionListId 要删除的题单ID,必须为正整数。
+ * @return 包含删除操作结果的响应。
+ */
+ @DeleteMapping("/admin/questionlists/{questionListId}")
+ public ApiResponse deleteQuestionList(@Min(value = 1, message = "questionListId 必须为正整数")
+ @PathVariable Integer questionListId) {
+ return questionListService.deleteQuestionList(questionListId);
+ }
+
+ /**
+ * 更新指定的题单信息。
+ *
+ * @param questionListId 要更新的题单ID,必须为正整数。
+ * @param body 包含更新信息的请求体。
+ * @return 包含更新操作结果的响应。
+ */
+ @PatchMapping("/admin/questionlists/{questionListId}")
+ public ApiResponse updateQuestionList(@Min(value = 1, message = "questionListId 必须为正整数")
+ @PathVariable Integer questionListId,
+ @Valid @RequestBody UpdateQuestionListBody body) {
+ return questionListService.updateQuestionList(questionListId, body);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/QuestionListItemController.java b/backend/src/main/java/com/kama/notes/controller/QuestionListItemController.java
new file mode 100644
index 0000000..54eebb5
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/QuestionListItemController.java
@@ -0,0 +1,94 @@
+package com.kama.notes.controller;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.base.EmptyVO;
+import com.kama.notes.model.dto.questionListItem.CreateQuestionListItemBody;
+import com.kama.notes.model.dto.questionListItem.QuestionListItemQueryParams;
+import com.kama.notes.model.dto.questionListItem.SortQuestionListItemBody;
+import com.kama.notes.model.vo.questionListItem.CreateQuestionListItemVO;
+import com.kama.notes.model.vo.questionListItem.QuestionListItemUserVO;
+import com.kama.notes.model.vo.questionListItem.QuestionListItemVO;
+import com.kama.notes.service.QuestionListItemService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+import java.util.List;
+
+@RestController
+@RequestMapping("/api")
+public class QuestionListItemController {
+
+ @Autowired
+ private QuestionListItemService questionListItemService;
+
+ /**
+ * 获取指定题单中的题单项列表(用户端)。
+ *
+ * @param queryParams 查询参数
+ * @return 包含题单项列表的响应。
+ */
+ @GetMapping("/questionlist-items")
+ public ApiResponse> userGetQuestionListItems(
+ @Valid QuestionListItemQueryParams queryParams) {
+ return questionListItemService.userGetQuestionListItems(queryParams);
+ }
+
+ /**
+ * 获取指定题单中的题单项列表(管理端)。
+ *
+ * @param questionListId 题单ID,可选参数,若提供则获取指定题单的题单项。
+ * @return 包含题单项列表的响应。
+ */
+ @GetMapping("/admin/questionlist-items/{questionListId}")
+ public ApiResponse> getQuestionListItems(
+ @Min(value = 1, message = "questionListId 必须为正整数")
+ @PathVariable Integer questionListId) {
+ return questionListItemService.getQuestionListItems(questionListId);
+ }
+
+ /**
+ * 创建新的题单项。
+ *
+ * @param body 包含题单项创建信息的请求体。
+ * @return 包含创建成功的题单项信息的响应。
+ */
+ @PostMapping("/admin/questionlist-items")
+ public ApiResponse createQuestionListItem(
+ @Valid
+ @RequestBody
+ CreateQuestionListItemBody body) {
+ return questionListItemService.createQuestionListItem(body);
+ }
+
+ /**
+ * 删除指定的题单项。
+ *
+ * @param questionListId 题单ID,必须为正整数。
+ * @param questionId 题目ID,必须为正整数。
+ * @return 包含删除操作结果的响应。
+ */
+ @DeleteMapping("/admin/questionlist-items/{questionListId}/{questionId}")
+ public ApiResponse deleteQuestionListItem(
+ @Min(value = 1, message = "questionListId 必须为正整数")
+ @PathVariable Integer questionListId,
+ @Min(value = 1, message = "questionId 必须为正整数")
+ @PathVariable Integer questionId) {
+ return questionListItemService.deleteQuestionListItem(questionListId, questionId);
+ }
+
+ /**
+ * 更新题单项的排序。
+ *
+ * @param body 包含题单项排序信息的请求体。
+ * @return 包含更新操作结果的响应。
+ */
+ @PatchMapping("/admin/questionlist-items/sort")
+ public ApiResponse sortQuestionListItem(
+ @Valid
+ @RequestBody
+ SortQuestionListItemBody body) {
+ return questionListItemService.sortQuestionListItem(body);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/StatisticController.java b/backend/src/main/java/com/kama/notes/controller/StatisticController.java
new file mode 100644
index 0000000..03b7fc5
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/StatisticController.java
@@ -0,0 +1,28 @@
+package com.kama.notes.controller;
+
+import java.util.List;
+
+import javax.validation.Valid;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.dto.statistic.StatisticQueryParam;
+import com.kama.notes.model.entity.Statistic;
+import com.kama.notes.service.StatisticService;
+
+@RestController
+@RequestMapping("/api")
+public class StatisticController {
+
+ @Autowired
+ StatisticService statisticService;
+
+ @GetMapping("/statistic")
+ public ApiResponse> getStatistic(@Valid StatisticQueryParam queryParam) {
+ return statisticService.getStatistic(queryParam);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/TestController.java b/backend/src/main/java/com/kama/notes/controller/TestController.java
new file mode 100644
index 0000000..e8b7e15
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/TestController.java
@@ -0,0 +1,29 @@
+package com.kama.notes.controller;
+
+import com.kama.notes.scope.RequestScopeData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/api")
+public class TestController {
+
+ @Autowired
+ private RequestScopeData requestScopeData;
+
+ @GetMapping("/hello")
+ public String hello() {
+
+ System.out.println("get data in /test/hello");
+ System.out.println(requestScopeData.getUserId());
+ System.out.println(requestScopeData.getToken());
+ return "Hello World!";
+ }
+
+ @GetMapping("/exception")
+ public String exception() {
+ throw new RuntimeException("test exception");
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/UploadController.java b/backend/src/main/java/com/kama/notes/controller/UploadController.java
new file mode 100644
index 0000000..30712cd
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/UploadController.java
@@ -0,0 +1,31 @@
+package com.kama.notes.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.vo.upload.ImageVO;
+import com.kama.notes.service.UploadService;
+
+/**
+ * 文件上传控制器
+ */
+@RestController
+@RequestMapping("/api")
+public class UploadController {
+
+ @Autowired
+ private UploadService uploadService;
+
+ /**
+ * 上传图片
+ */
+ @PostMapping("/upload/image")
+ public ApiResponse uploadImage(@RequestParam("file") MultipartFile file) {
+ return uploadService.uploadImage(file);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/controller/UserController.java b/backend/src/main/java/com/kama/notes/controller/UserController.java
new file mode 100644
index 0000000..d61a801
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/controller/UserController.java
@@ -0,0 +1,137 @@
+package com.kama.notes.controller;
+
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Pattern;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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 org.springframework.web.multipart.MultipartFile;
+
+import com.kama.notes.model.base.ApiResponse;
+import com.kama.notes.model.dto.user.LoginRequest;
+import com.kama.notes.model.dto.user.RegisterRequest;
+import com.kama.notes.model.dto.user.UpdateUserRequest;
+import com.kama.notes.model.dto.user.UserQueryParam;
+import com.kama.notes.model.entity.User;
+import com.kama.notes.model.vo.user.AvatarVO;
+import com.kama.notes.model.vo.user.LoginUserVO;
+import com.kama.notes.model.vo.user.RegisterVO;
+import com.kama.notes.model.vo.user.UserVO;
+import com.kama.notes.service.UserService;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@RestController
+@RequestMapping("/api")
+public class UserController {
+
+ // 自动注入UserService以使用用户相关服务
+ @Autowired
+ private UserService userService;
+
+ /**
+ * 用户注册接口
+ * 处理用户注册请求,验证请求体并调用 userService 进行注册
+ *
+ * @param request 用户注册请求对象,包含用户注册所需信息
+ * @return 返回注册结果,包括用户信息等
+ */
+ @PostMapping("/users")
+ public ApiResponse register(
+ @Valid
+ @RequestBody
+ RegisterRequest request) {
+ return userService.register(request);
+ }
+
+ /**
+ * 用户登录接口
+ * 处理用户登录请求,验证请求体并调用userService进行登录
+ *
+ * @param request 用户登录请求对象,包含用户登录所需信息
+ * @return 返回登录结果,包括用户信息和认证令牌等
+ */
+ @PostMapping("/users/login")
+ public ApiResponse login(
+ @Valid
+ @RequestBody
+ LoginRequest request) {
+ return userService.login(request);
+ }
+
+ /**
+ * 自动登录接口
+ * 当用户已登录并请求自动登录时,调用userService获取当前用户信息
+ *
+ * @return 返回当前用户信息
+ */
+ @PostMapping("/users/whoami")
+ public ApiResponse whoami() {
+ return userService.whoami();
+ }
+
+ /**
+ * 查询用户信息接口
+ * 根据用户ID查询用户信息,验证ID格式并调用userService获取用户详情
+ *
+ * @param userId 用户ID,需为数字格式
+ * @return 返回指定用户的详细信息
+ */
+ @GetMapping("/users/{userId}")
+ public ApiResponse getUserInfo(
+ @PathVariable
+ @Pattern(regexp = "\\d+", message = "ID 格式错误")
+ Long userId) {
+ return userService.getUserInfo(userId);
+ }
+
+ /**
+ * 更新用户信息接口
+ * 处理更新用户信息请求,验证请求体并调用userService更新用户详情
+ *
+ * @param request 更新用户请求对象,包含需要更新的用户信息
+ * @return 返回更新后的用户信息
+ */
+ @PatchMapping("/users/me")
+ public ApiResponse updateUserInfo(
+ @Valid
+ @RequestBody
+ UpdateUserRequest request) {
+ return userService.updateUserInfo(request);
+ }
+
+ /**
+ * 上传用户头像接口
+ *
+ * @param file 头像文件
+ * @return 返回上传结果,包括头像URL等
+ */
+ @PostMapping("/users/avatar")
+ public ApiResponse uploadAvatar(
+ @RequestParam("file") MultipartFile file) {
+ return userService.uploadAvatar(file);
+ }
+
+ /**
+ * 管理员获取用户信息列表的接口
+ * 该接口允许管理员查询系统的用户列表,支持分页和条件查询
+ *
+ * @param queryParam 查询参数对象,封装了用户查询条件和分页信息,通过验证确保参数有效性
+ * @return 返回一个包含用户列表的ApiResponse对象,响应中包含用户数据
+ */
+ @GetMapping("/admin/users")
+ public ApiResponse> adminGetUser(
+ @Valid UserQueryParam queryParam) {
+ return userService.getUserList(queryParam);
+ }
+}
diff --git a/backend/src/main/java/com/kama/notes/exception/ParamExceptionHandler.java b/backend/src/main/java/com/kama/notes/exception/ParamExceptionHandler.java
new file mode 100644
index 0000000..2011507
--- /dev/null
+++ b/backend/src/main/java/com/kama/notes/exception/ParamExceptionHandler.java
@@ -0,0 +1,38 @@
+package com.kama.notes.exception;
+
+import com.kama.notes.model.base.ApiResponse;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+import javax.validation.ConstraintViolationException;
+import java.util.HashMap;
+import java.util.Map;
+
+@RestControllerAdvice
+public class ParamExceptionHandler {
+
+ @ExceptionHandler(MethodArgumentNotValidException.class)
+ public ApiResponse