diff --git a/build.gradle b/build.gradle index 4e9d5f4..9fa6cb5 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,7 @@ dependencies { runtimeOnly 'com.mysql:mysql-connector-j' // MySQL 驱动 annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理 testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架 + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // thymeleaf模版引擎 } tasks.named('test') { diff --git a/src/main/java/com/corewing/app/config/SaTokenConfig.java b/src/main/java/com/corewing/app/config/SaTokenConfig.java index ac5df33..8e1af11 100644 --- a/src/main/java/com/corewing/app/config/SaTokenConfig.java +++ b/src/main/java/com/corewing/app/config/SaTokenConfig.java @@ -27,10 +27,12 @@ public class SaTokenConfig implements WebMvcConfigurer { .excludePathPatterns("/sys/user/login") // 排除反馈接口(支持匿名提交) .excludePathPatterns("/feedback", "/feedback/**") + // 排除教程接口(支持匿名查询) + .excludePathPatterns("/tutorial", "/tutorial/**") // 排除固件查询接口(不需要登录) .excludePathPatterns("/firmware/**") // 排除静态资源 - .excludePathPatterns("/", "/index.html", "/*.html", "/*.css", "/*.js", "/*.ico", "/static/**") + .excludePathPatterns("/", "/loading.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**") // 排除后台管理静态资源 .excludePathPatterns("/admin/**") // 排除 Druid 监控 diff --git a/src/main/java/com/corewing/app/entity/Tutorial.java b/src/main/java/com/corewing/app/entity/Tutorial.java new file mode 100644 index 0000000..bb2d1ba --- /dev/null +++ b/src/main/java/com/corewing/app/entity/Tutorial.java @@ -0,0 +1,73 @@ +package com.corewing.app.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 教程 + */ +@Data +@TableName("app_tutorial") +public class Tutorial implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 教程id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 教程标题 + */ + private String tutorialTitle; + + /** + * 教程描述 + */ + private String description; + + /** + * 教程详情 + */ + private String content; + + /** + * 查看次数 + */ + private Integer viewCount; + + /** + * 推荐状态:0不推荐,1推荐 + */ + private Integer recommendStatus; + + /** + * 状态:1正常,2关闭 + */ + private Integer status; + + /** + * 语言:中文zh,英文:en + */ + private String lang; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + +} diff --git a/src/main/java/com/corewing/app/entity/TutorialCategory.java b/src/main/java/com/corewing/app/entity/TutorialCategory.java new file mode 100644 index 0000000..21a078d --- /dev/null +++ b/src/main/java/com/corewing/app/entity/TutorialCategory.java @@ -0,0 +1,75 @@ +package com.corewing.app.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 教程分类 + */ +@Data +@TableName("app_tutorial_category") +public class TutorialCategory implements Serializable { + + /** + * 分类id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 图标 + */ + private String icon; + + /** + * 颜色 + */ + private String color; + + /** + * 分类名称 + */ + private String categoryTitle; + + /** + * 分类描述 + */ + private String description; + + /** + * 类别:category分类,tag标签 + */ + private String type; + + /** + * 置首页:0不置首,1置首页 + */ + private Integer firstStatus; + + /** + * 状态:1正常,2关闭 + */ + private Integer status; + + /** + * 语言:中文zh,英文:en + */ + private String lang; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + +} diff --git a/src/main/java/com/corewing/app/entity/TutorialCategoryRelation.java b/src/main/java/com/corewing/app/entity/TutorialCategoryRelation.java new file mode 100644 index 0000000..42fd192 --- /dev/null +++ b/src/main/java/com/corewing/app/entity/TutorialCategoryRelation.java @@ -0,0 +1,35 @@ +package com.corewing.app.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * 教程与分类关系实体 + */ +@Data +@TableName("app_tutorial_category_relation") +public class TutorialCategoryRelation implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 教程id + */ + private Long TutorialId; + + /** + * 教程分类id + */ + private Long CategoryId; + +} diff --git a/src/main/java/com/corewing/app/mapper/TutorialCategoryMapper.java b/src/main/java/com/corewing/app/mapper/TutorialCategoryMapper.java new file mode 100644 index 0000000..c6c0ddb --- /dev/null +++ b/src/main/java/com/corewing/app/mapper/TutorialCategoryMapper.java @@ -0,0 +1,12 @@ +package com.corewing.app.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.corewing.app.entity.TutorialCategory; +import org.apache.ibatis.annotations.Mapper; + +/** + * 教程分类 Mapper接口 + */ +@Mapper +public interface TutorialCategoryMapper extends BaseMapper { +} diff --git a/src/main/java/com/corewing/app/mapper/TutorialCategoryRelationMapper.java b/src/main/java/com/corewing/app/mapper/TutorialCategoryRelationMapper.java new file mode 100644 index 0000000..6c2ec38 --- /dev/null +++ b/src/main/java/com/corewing/app/mapper/TutorialCategoryRelationMapper.java @@ -0,0 +1,13 @@ +package com.corewing.app.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.corewing.app.entity.TutorialCategoryRelation; +import org.apache.ibatis.annotations.Mapper; + + +/** + * 教程与教程分类关系Mapper接口 + */ +@Mapper +public interface TutorialCategoryRelationMapper extends BaseMapper { +} diff --git a/src/main/java/com/corewing/app/mapper/TutorialMapper.java b/src/main/java/com/corewing/app/mapper/TutorialMapper.java new file mode 100644 index 0000000..27e1c55 --- /dev/null +++ b/src/main/java/com/corewing/app/mapper/TutorialMapper.java @@ -0,0 +1,17 @@ +package com.corewing.app.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.corewing.app.entity.Tutorial; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 教程 Mapper 接口 + */ + +@Mapper +public interface TutorialMapper extends BaseMapper { + + Page pageList(Page page, @Param("categoryId") int categoryId, @Param("tutorialTitle") String tutorialTitle, @Param("lang") String lang); +} diff --git a/src/main/java/com/corewing/app/modules/admin/SysMainController.java b/src/main/java/com/corewing/app/modules/admin/SysMainController.java new file mode 100644 index 0000000..9821937 --- /dev/null +++ b/src/main/java/com/corewing/app/modules/admin/SysMainController.java @@ -0,0 +1,24 @@ +package com.corewing.app.modules.admin; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class SysMainController { + + @GetMapping({"/", "/index.html"}) + public String loading() { + return "/admin/loading"; + } + + @GetMapping("/admin/login.html") + public String login() { + return "/admin/login"; + } + + @GetMapping("/admin/index.html") + public String adminIndex() { + return "/admin/index"; + } + +} diff --git a/src/main/java/com/corewing/app/controller/SysUserController.java b/src/main/java/com/corewing/app/modules/admin/SysUserController.java similarity index 98% rename from src/main/java/com/corewing/app/controller/SysUserController.java rename to src/main/java/com/corewing/app/modules/admin/SysUserController.java index 928013b..d04d69d 100644 --- a/src/main/java/com/corewing/app/controller/SysUserController.java +++ b/src/main/java/com/corewing/app/modules/admin/SysUserController.java @@ -1,4 +1,4 @@ -package com.corewing.app.controller; +package com.corewing.app.modules.admin; import cn.dev33.satoken.stp.StpUtil; import com.corewing.app.common.Result; diff --git a/src/main/java/com/corewing/app/controller/FeedbackController.java b/src/main/java/com/corewing/app/modules/app/FeedbackController.java similarity index 99% rename from src/main/java/com/corewing/app/controller/FeedbackController.java rename to src/main/java/com/corewing/app/modules/app/FeedbackController.java index 60925ee..fb4ff69 100644 --- a/src/main/java/com/corewing/app/controller/FeedbackController.java +++ b/src/main/java/com/corewing/app/modules/app/FeedbackController.java @@ -1,4 +1,4 @@ -package com.corewing.app.controller; +package com.corewing.app.modules.app; import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.core.metadata.IPage; diff --git a/src/main/java/com/corewing/app/controller/FirmwareController.java b/src/main/java/com/corewing/app/modules/app/FirmwareController.java similarity index 98% rename from src/main/java/com/corewing/app/controller/FirmwareController.java rename to src/main/java/com/corewing/app/modules/app/FirmwareController.java index 73f7d19..9978589 100644 --- a/src/main/java/com/corewing/app/controller/FirmwareController.java +++ b/src/main/java/com/corewing/app/modules/app/FirmwareController.java @@ -1,4 +1,4 @@ -package com.corewing.app.controller; +package com.corewing.app.modules.app; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; diff --git a/src/main/java/com/corewing/app/controller/ParamsCenterController.java b/src/main/java/com/corewing/app/modules/app/ParamsCenterController.java similarity index 99% rename from src/main/java/com/corewing/app/controller/ParamsCenterController.java rename to src/main/java/com/corewing/app/modules/app/ParamsCenterController.java index 19e9469..e123011 100644 --- a/src/main/java/com/corewing/app/controller/ParamsCenterController.java +++ b/src/main/java/com/corewing/app/modules/app/ParamsCenterController.java @@ -1,4 +1,4 @@ -package com.corewing.app.controller; +package com.corewing.app.modules.app; import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.core.metadata.IPage; diff --git a/src/main/java/com/corewing/app/modules/app/TutorialController.java b/src/main/java/com/corewing/app/modules/app/TutorialController.java new file mode 100644 index 0000000..ebd16ab --- /dev/null +++ b/src/main/java/com/corewing/app/modules/app/TutorialController.java @@ -0,0 +1,111 @@ +package com.corewing.app.modules.app; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.corewing.app.common.Result; +import com.corewing.app.entity.Tutorial; +import com.corewing.app.entity.TutorialCategory; +import com.corewing.app.service.TutorialCategoryService; +import com.corewing.app.service.TutorialService; +import com.corewing.app.util.I18nUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 教程接口 + */ +@RequestMapping("/tutorial") +@Controller +@Slf4j +public class TutorialController { + + private final TutorialService tutorialService; + private final TutorialCategoryService tutorialCategoryService; + + public TutorialController(TutorialService tutorialService, TutorialCategoryService tutorialCategoryService) { + this.tutorialService = tutorialService; + this.tutorialCategoryService = tutorialCategoryService; + } + + /** + * 跳转到界面查看教程详情 + * @param tutorialId 教程id + * @param model 数据模型 + * @return 详情页 + */ + @GetMapping("/viewDetail/{tutorialId}") + public String viewDetail(@PathVariable Long tutorialId, ModelMap model) { + Tutorial tutorial = tutorialService.getById(tutorialId); + model.put("tutorial", tutorial); + return "/app/tutorial/viewDetail"; + } + + + /** + * 添加查看次数 + * @param tutorialId 教程id + * @return + */ + @GetMapping("/addViewCount") + @ResponseBody + public Result addViewCount(@RequestParam Long tutorialId) { + Tutorial tutorial = tutorialService.getById(tutorialId); + if(tutorial == null) { + return Result.error(); + } + tutorial.setViewCount(tutorial.getViewCount() + 1); + tutorialService.updateById(tutorial); + return Result.success(); + } + + /** + * 分类查询列表 + * + * @param firstStatus 置首状态(选填) + * + */ + @GetMapping("/category") + @ResponseBody + public Result> category( + @RequestParam(required = false, defaultValue = "0") Integer firstStatus + ) { + log.info("当前语言环境:{}", I18nUtil.getCurrentLocale().getLanguage()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(firstStatus != 0, TutorialCategory::getFirstStatus, firstStatus); + wrapper.eq(TutorialCategory::getLang, I18nUtil.getCurrentLocale().getLanguage()); + List list = tutorialCategoryService.list(wrapper); + return Result.success(list); + } + + /** + * 分页查询教程列表 + * + * @param current 当前页码 + * @param size 每页数量 + * @param categoryId 分类ID(选填) + * @param tutorialTitle 教程标题(选填) + * + */ + @GetMapping("/page") + @ResponseBody + public Result> getPageList( + @RequestParam(defaultValue = "1") Long current, + @RequestParam(defaultValue = "10") Long size, + @RequestParam(required = false, defaultValue = "0") Integer categoryId, + @RequestParam(required = false) String tutorialTitle) { + try { + Page page = new Page<>(current, size); + IPage pageResult = tutorialService.pageList(page, categoryId, tutorialTitle, I18nUtil.getCurrentLocale().getLanguage()); + return Result.success(pageResult); + } catch (Exception e) { + return Result.error(e.getMessage()); + } + } + + +} diff --git a/src/main/java/com/corewing/app/controller/UserController.java b/src/main/java/com/corewing/app/modules/app/UserController.java similarity index 99% rename from src/main/java/com/corewing/app/controller/UserController.java rename to src/main/java/com/corewing/app/modules/app/UserController.java index f411ac0..769cb49 100644 --- a/src/main/java/com/corewing/app/controller/UserController.java +++ b/src/main/java/com/corewing/app/modules/app/UserController.java @@ -1,4 +1,4 @@ -package com.corewing.app.controller; +package com.corewing.app.modules.app; import cn.dev33.satoken.stp.StpUtil; import com.corewing.app.common.Result; diff --git a/src/main/java/com/corewing/app/service/TutorialCategoryRelationService.java b/src/main/java/com/corewing/app/service/TutorialCategoryRelationService.java new file mode 100644 index 0000000..64c5676 --- /dev/null +++ b/src/main/java/com/corewing/app/service/TutorialCategoryRelationService.java @@ -0,0 +1,7 @@ +package com.corewing.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.corewing.app.entity.TutorialCategoryRelation; + +public interface TutorialCategoryRelationService extends IService { +} diff --git a/src/main/java/com/corewing/app/service/TutorialCategoryService.java b/src/main/java/com/corewing/app/service/TutorialCategoryService.java new file mode 100644 index 0000000..fc1b2f5 --- /dev/null +++ b/src/main/java/com/corewing/app/service/TutorialCategoryService.java @@ -0,0 +1,7 @@ +package com.corewing.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.corewing.app.entity.TutorialCategory; + +public interface TutorialCategoryService extends IService { +} diff --git a/src/main/java/com/corewing/app/service/TutorialService.java b/src/main/java/com/corewing/app/service/TutorialService.java new file mode 100644 index 0000000..2c74498 --- /dev/null +++ b/src/main/java/com/corewing/app/service/TutorialService.java @@ -0,0 +1,10 @@ +package com.corewing.app.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.corewing.app.entity.Tutorial; + +public interface TutorialService extends IService { + IPage pageList(Page page, int categoryId, String tutorialTitle, String lang); +} diff --git a/src/main/java/com/corewing/app/service/impl/TutorialCategoryRelationServiceImpl.java b/src/main/java/com/corewing/app/service/impl/TutorialCategoryRelationServiceImpl.java new file mode 100644 index 0000000..795d826 --- /dev/null +++ b/src/main/java/com/corewing/app/service/impl/TutorialCategoryRelationServiceImpl.java @@ -0,0 +1,11 @@ +package com.corewing.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.corewing.app.entity.TutorialCategoryRelation; +import com.corewing.app.mapper.TutorialCategoryRelationMapper; +import com.corewing.app.service.TutorialCategoryRelationService; +import org.springframework.stereotype.Service; + +@Service +public class TutorialCategoryRelationServiceImpl extends ServiceImpl implements TutorialCategoryRelationService { +} diff --git a/src/main/java/com/corewing/app/service/impl/TutorialCategoryServiceImpl.java b/src/main/java/com/corewing/app/service/impl/TutorialCategoryServiceImpl.java new file mode 100644 index 0000000..06bf878 --- /dev/null +++ b/src/main/java/com/corewing/app/service/impl/TutorialCategoryServiceImpl.java @@ -0,0 +1,11 @@ +package com.corewing.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.corewing.app.entity.TutorialCategory; +import com.corewing.app.mapper.TutorialCategoryMapper; +import com.corewing.app.service.TutorialCategoryService; +import org.springframework.stereotype.Service; + +@Service +public class TutorialCategoryServiceImpl extends ServiceImpl implements TutorialCategoryService { +} diff --git a/src/main/java/com/corewing/app/service/impl/TutorialServiceImpl.java b/src/main/java/com/corewing/app/service/impl/TutorialServiceImpl.java new file mode 100644 index 0000000..a9e1827 --- /dev/null +++ b/src/main/java/com/corewing/app/service/impl/TutorialServiceImpl.java @@ -0,0 +1,24 @@ +package com.corewing.app.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.corewing.app.entity.Tutorial; +import com.corewing.app.mapper.TutorialMapper; +import com.corewing.app.service.TutorialService; +import org.springframework.stereotype.Service; + +@Service +public class TutorialServiceImpl extends ServiceImpl implements TutorialService { + + private final TutorialMapper tutorialMapper; + + public TutorialServiceImpl(TutorialMapper tutorialMapper) { + this.tutorialMapper = tutorialMapper; + } + + @Override + public IPage pageList(Page page, int categoryId, String tutorialTitle, String lang) { + return tutorialMapper.pageList(page, categoryId, tutorialTitle, lang); + } +} diff --git a/src/main/java/com/corewing/app/vo/TutorialVO.java b/src/main/java/com/corewing/app/vo/TutorialVO.java new file mode 100644 index 0000000..4bc0ec9 --- /dev/null +++ b/src/main/java/com/corewing/app/vo/TutorialVO.java @@ -0,0 +1,58 @@ +package com.corewing.app.vo; + +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +@Data +public class TutorialVO { + + private Long id; + + /** + * 教程标题 + */ + private String tutorialTitle; + + /** + * 教程描述 + */ + private String description; + + /** + * 教程详情 + */ + private String content; + + /** + * 查看次数 + */ + private Integer viewCount; + + /** + * 推荐状态:0不推荐,1推荐 + */ + private Integer recommendStatus; + + /** + * 状态:1正常,2关闭 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 教程分类名称 + */ + private String categoryTitle; + +} diff --git a/src/main/resources/db/app_tutorial.sql b/src/main/resources/db/app_tutorial.sql new file mode 100644 index 0000000..e4cd139 --- /dev/null +++ b/src/main/resources/db/app_tutorial.sql @@ -0,0 +1,44 @@ +/* + Navicat Premium Dump SQL + + Source Server : 120.24.204.180 + Source Server Type : MySQL + Source Server Version : 80036 (8.0.36) + Source Host : 120.24.204.180:3306 + Source Schema : app + + Target Server Type : MySQL + Target Server Version : 80036 (8.0.36) + File Encoding : 65001 + + Date: 28/10/2025 13:46:26 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for app_tutorial +-- ---------------------------- +DROP TABLE IF EXISTS `app_tutorial`; +CREATE TABLE `app_tutorial` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `tutorial_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '教程标题', + `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '教程描述', + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '教程详情', + `view_count` int DEFAULT '0' COMMENT '查看次数', + `recommend_status` int DEFAULT '0' COMMENT '推荐状态:0不推荐,1推荐', + `status` tinyint(1) DEFAULT '1' COMMENT '状态:1正常,2关闭', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='使用教程表'; + +-- ---------------------------- +-- Records of app_tutorial +-- ---------------------------- +BEGIN; +INSERT INTO `app_tutorial` (`id`, `tutorial_title`, `description`, `content`, `view_count`, `recommend_status`, `status`, `create_time`, `update_time`) VALUES (1, '快速开始指南', '了解酷翼应用的基本功能与布局,快速上手使用各项功能。', NULL, 0, 0, 1, '2025-10-28 12:03:52', NULL); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/src/main/resources/db/app_tutorial_category.sql b/src/main/resources/db/app_tutorial_category.sql new file mode 100644 index 0000000..92edc6a --- /dev/null +++ b/src/main/resources/db/app_tutorial_category.sql @@ -0,0 +1,44 @@ +/* + Navicat Premium Dump SQL + + Source Server : 120.24.204.180 + Source Server Type : MySQL + Source Server Version : 80036 (8.0.36) + Source Host : 120.24.204.180:3306 + Source Schema : app + + Target Server Type : MySQL + Target Server Version : 80036 (8.0.36) + File Encoding : 65001 + + Date: 28/10/2025 13:46:32 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for app_tutorial_category +-- ---------------------------- +DROP TABLE IF EXISTS `app_tutorial_category`; +CREATE TABLE `app_tutorial_category` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `icon` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '图标', + `category_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类名称', + `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类描述', + `first_status` int NOT NULL DEFAULT '2' COMMENT '置首页:1置首,2不置首', + `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类别:category分类,tag标签', + `status` tinyint(1) DEFAULT '0' COMMENT '状态:1正常,2关闭', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='使用教程分类/标签表'; + +-- ---------------------------- +-- Records of app_tutorial_category +-- ---------------------------- +BEGIN; +INSERT INTO `app_tutorial_category` (`id`, `icon`, `category_title`, `description`, `first_status`, `type`, `status`, `create_time`, `update_time`) VALUES (1, NULL, '快速指南', NULL, 1, 'category', 1, '2025-10-28 12:06:03', NULL); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/src/main/resources/db/app_tutorial_category_relation.sql b/src/main/resources/db/app_tutorial_category_relation.sql new file mode 100644 index 0000000..81c49d9 --- /dev/null +++ b/src/main/resources/db/app_tutorial_category_relation.sql @@ -0,0 +1,38 @@ +/* + Navicat Premium Dump SQL + + Source Server : 120.24.204.180 + Source Server Type : MySQL + Source Server Version : 80036 (8.0.36) + Source Host : 120.24.204.180:3306 + Source Schema : app + + Target Server Type : MySQL + Target Server Version : 80036 (8.0.36) + File Encoding : 65001 + + Date: 28/10/2025 13:46:38 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for app_tutorial_category_relation +-- ---------------------------- +DROP TABLE IF EXISTS `app_tutorial_category_relation`; +CREATE TABLE `app_tutorial_category_relation` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `tutorial_id` bigint DEFAULT NULL COMMENT '教程id', + `category_id` bigint DEFAULT NULL COMMENT '教程分类id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='教程与教程分类关系表'; + +-- ---------------------------- +-- Records of app_tutorial_category_relation +-- ---------------------------- +BEGIN; +INSERT INTO `app_tutorial_category_relation` (`id`, `tutorial_id`, `category_id`) VALUES (1, 1, 1); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/src/main/resources/mapper/TutorialMapper.xml b/src/main/resources/mapper/TutorialMapper.xml new file mode 100644 index 0000000..9b7316e --- /dev/null +++ b/src/main/resources/mapper/TutorialMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + select c.*, cc.category_title + from app_tutorial c + left join app_tutorial_category_relation ccr on c.id = ccr.tutorial_id + left join app_tutorial_category cc on cc.id = ccr.category_id + + + + + + diff --git a/src/main/resources/static/admin/index.html b/src/main/resources/templates/admin/index.html similarity index 100% rename from src/main/resources/static/admin/index.html rename to src/main/resources/templates/admin/index.html diff --git a/src/main/resources/static/index.html b/src/main/resources/templates/admin/loading.html similarity index 89% rename from src/main/resources/static/index.html rename to src/main/resources/templates/admin/loading.html index f6e97d9..e53478c 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/templates/admin/loading.html @@ -80,14 +80,14 @@ -
- -

CoreWing

-

后台管理系统

-
-
- 正在跳转... -
+
+ +

CoreWing

+

后台管理系统

+
+
+ 正在跳转...
+
\ No newline at end of file diff --git a/src/main/resources/static/admin/login.html b/src/main/resources/templates/admin/login.html similarity index 99% rename from src/main/resources/static/admin/login.html rename to src/main/resources/templates/admin/login.html index c0770fa..a739607 100644 --- a/src/main/resources/static/admin/login.html +++ b/src/main/resources/templates/admin/login.html @@ -488,7 +488,7 @@ const token = localStorage.getItem('token'); if (token) { // 如果已有 token,尝试跳转到主页 - // window.location.href = '/admin/index.html'; + // window.location.href = '/admin/loading.html'; } } }).mount('#app'); diff --git a/src/main/resources/templates/app/tutorial/viewDetail.html b/src/main/resources/templates/app/tutorial/viewDetail.html new file mode 100644 index 0000000..b19d9b6 --- /dev/null +++ b/src/main/resources/templates/app/tutorial/viewDetail.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file