diff --git a/src/main/java/com/corewing/app/config/SaTokenConfig.java b/src/main/java/com/corewing/app/config/SaTokenConfig.java index f936ae9..5cb6b84 100644 --- a/src/main/java/com/corewing/app/config/SaTokenConfig.java +++ b/src/main/java/com/corewing/app/config/SaTokenConfig.java @@ -28,7 +28,7 @@ public class SaTokenConfig implements WebMvcConfigurer { // 排除反馈接口(支持匿名提交) .excludePathPatterns("/feedback", "/feedback/**") // 排除教程接口(支持匿名查询) - .excludePathPatterns("/course", "/course/**") + .excludePathPatterns("/tutorial", "/tutorial/**") // 排除固件查询接口(不需要登录) .excludePathPatterns("/firmware/**") // 排除静态资源 diff --git a/src/main/java/com/corewing/app/controller/CourseController.java b/src/main/java/com/corewing/app/controller/TutorialController.java similarity index 54% rename from src/main/java/com/corewing/app/controller/CourseController.java rename to src/main/java/com/corewing/app/controller/TutorialController.java index a4d3daf..428b66f 100644 --- a/src/main/java/com/corewing/app/controller/CourseController.java +++ b/src/main/java/com/corewing/app/controller/TutorialController.java @@ -4,10 +4,10 @@ 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.Course; -import com.corewing.app.entity.CourseCategory; -import com.corewing.app.service.CourseCategoryService; -import com.corewing.app.service.CourseService; +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.web.bind.annotation.GetMapping; @@ -20,17 +20,17 @@ import java.util.List; /** * 教程接口 */ -@RequestMapping("/course") +@RequestMapping("/tutorial") @RestController @Slf4j -public class CourseController { +public class TutorialController { - private final CourseService courseService; - private final CourseCategoryService courseCategoryService; + private final TutorialService tutorialService; + private final TutorialCategoryService tutorialCategoryService; - public CourseController(CourseService courseService, CourseCategoryService courseCategoryService) { - this.courseService = courseService; - this.courseCategoryService = courseCategoryService; + public TutorialController(TutorialService tutorialService, TutorialCategoryService tutorialCategoryService) { + this.tutorialService = tutorialService; + this.tutorialCategoryService = tutorialCategoryService; } /** @@ -40,14 +40,14 @@ public class CourseController { * */ @GetMapping("/category") - public Result> category( + public Result> category( @RequestParam(required = false, defaultValue = "0") Integer firstStatus ) { log.info("当前语言环境:{}", I18nUtil.getCurrentLocale().getLanguage()); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(firstStatus != 0, CourseCategory::getFirstStatus, firstStatus); - wrapper.eq(CourseCategory::getLang, I18nUtil.getCurrentLocale().getLanguage()); - List list = courseCategoryService.list(wrapper); + 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); } @@ -57,18 +57,18 @@ public class CourseController { * @param current 当前页码 * @param size 每页数量 * @param categoryId 分类ID(选填) - * @param courseTitle 教程标题(选填) + * @param tutorialTitle 教程标题(选填) * */ @GetMapping("/page") - public Result> getPageList( + public Result> getPageList( @RequestParam(defaultValue = "1") Long current, @RequestParam(defaultValue = "10") Long size, @RequestParam(required = false, defaultValue = "0") Integer categoryId, - @RequestParam(required = false) String courseTitle) { + @RequestParam(required = false) String tutorialTitle) { try { - Page page = new Page<>(current, size); - IPage pageResult = courseService.pageList(page, categoryId, courseTitle, I18nUtil.getCurrentLocale().getLanguage()); + 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/entity/Course.java b/src/main/java/com/corewing/app/entity/Tutorial.java similarity index 86% rename from src/main/java/com/corewing/app/entity/Course.java rename to src/main/java/com/corewing/app/entity/Tutorial.java index ee6fe51..bb2d1ba 100644 --- a/src/main/java/com/corewing/app/entity/Course.java +++ b/src/main/java/com/corewing/app/entity/Tutorial.java @@ -4,6 +4,7 @@ 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; @@ -12,8 +13,8 @@ import java.util.Date; * 教程 */ @Data -@TableName("app_course") -public class Course implements Serializable { +@TableName("app_tutorial") +public class Tutorial implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +27,7 @@ public class Course implements Serializable { /** * 教程标题 */ - private String courseTitle; + private String tutorialTitle; /** * 教程描述 diff --git a/src/main/java/com/corewing/app/entity/CourseCategory.java b/src/main/java/com/corewing/app/entity/TutorialCategory.java similarity index 87% rename from src/main/java/com/corewing/app/entity/CourseCategory.java rename to src/main/java/com/corewing/app/entity/TutorialCategory.java index ee9af4e..624fc23 100644 --- a/src/main/java/com/corewing/app/entity/CourseCategory.java +++ b/src/main/java/com/corewing/app/entity/TutorialCategory.java @@ -4,6 +4,7 @@ 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; @@ -12,8 +13,8 @@ import java.util.Date; * 教程分类 */ @Data -@TableName("app_course_category") -public class CourseCategory implements Serializable { +@TableName("app_tutorial_category") +public class TutorialCategory implements Serializable { /** * 分类id diff --git a/src/main/java/com/corewing/app/entity/CourseCategoryRelation.java b/src/main/java/com/corewing/app/entity/TutorialCategoryRelation.java similarity index 73% rename from src/main/java/com/corewing/app/entity/CourseCategoryRelation.java rename to src/main/java/com/corewing/app/entity/TutorialCategoryRelation.java index dad1658..da7310f 100644 --- a/src/main/java/com/corewing/app/entity/CourseCategoryRelation.java +++ b/src/main/java/com/corewing/app/entity/TutorialCategoryRelation.java @@ -9,8 +9,8 @@ import java.io.Serializable; * 教程与分类关系实体 */ @Data -@TableName("app_course_category_relation") -public class CourseCategoryRelation implements Serializable { +@TableName("app_tutorial_category_relation") +public class TutorialCategoryRelation implements Serializable { private static final long serialVersionUID = 1L; @@ -22,7 +22,7 @@ public class CourseCategoryRelation implements Serializable { /** * 教程id */ - private Long CourseId; + private Long TutorialId; /** * 教程分类id diff --git a/src/main/java/com/corewing/app/mapper/CourseCategoryMapper.java b/src/main/java/com/corewing/app/mapper/TutorialCategoryMapper.java similarity index 58% rename from src/main/java/com/corewing/app/mapper/CourseCategoryMapper.java rename to src/main/java/com/corewing/app/mapper/TutorialCategoryMapper.java index c790d4e..c6c0ddb 100644 --- a/src/main/java/com/corewing/app/mapper/CourseCategoryMapper.java +++ b/src/main/java/com/corewing/app/mapper/TutorialCategoryMapper.java @@ -1,12 +1,12 @@ package com.corewing.app.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.corewing.app.entity.CourseCategory; +import com.corewing.app.entity.TutorialCategory; import org.apache.ibatis.annotations.Mapper; /** * 教程分类 Mapper接口 */ @Mapper -public interface CourseCategoryMapper extends BaseMapper { +public interface TutorialCategoryMapper extends BaseMapper { } diff --git a/src/main/java/com/corewing/app/mapper/CourseCategoryRelationMapper.java b/src/main/java/com/corewing/app/mapper/TutorialCategoryRelationMapper.java similarity index 56% rename from src/main/java/com/corewing/app/mapper/CourseCategoryRelationMapper.java rename to src/main/java/com/corewing/app/mapper/TutorialCategoryRelationMapper.java index f31211e..6c2ec38 100644 --- a/src/main/java/com/corewing/app/mapper/CourseCategoryRelationMapper.java +++ b/src/main/java/com/corewing/app/mapper/TutorialCategoryRelationMapper.java @@ -1,7 +1,7 @@ package com.corewing.app.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.corewing.app.entity.CourseCategoryRelation; +import com.corewing.app.entity.TutorialCategoryRelation; import org.apache.ibatis.annotations.Mapper; @@ -9,5 +9,5 @@ import org.apache.ibatis.annotations.Mapper; * 教程与教程分类关系Mapper接口 */ @Mapper -public interface CourseCategoryRelationMapper extends BaseMapper { +public interface TutorialCategoryRelationMapper extends BaseMapper { } diff --git a/src/main/java/com/corewing/app/mapper/CourseMapper.java b/src/main/java/com/corewing/app/mapper/TutorialMapper.java similarity index 52% rename from src/main/java/com/corewing/app/mapper/CourseMapper.java rename to src/main/java/com/corewing/app/mapper/TutorialMapper.java index ead0a19..27e1c55 100644 --- a/src/main/java/com/corewing/app/mapper/CourseMapper.java +++ b/src/main/java/com/corewing/app/mapper/TutorialMapper.java @@ -2,7 +2,7 @@ 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.Course; +import com.corewing.app.entity.Tutorial; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Param; */ @Mapper -public interface CourseMapper extends BaseMapper { +public interface TutorialMapper extends BaseMapper { - Page pageList(Page page, @Param("categoryId") int categoryId, @Param("courseTitle") String courseTitle, @Param("lang") String lang); + 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/service/CourseCategoryRelationService.java b/src/main/java/com/corewing/app/service/CourseCategoryRelationService.java deleted file mode 100644 index ffad240..0000000 --- a/src/main/java/com/corewing/app/service/CourseCategoryRelationService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.corewing.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.corewing.app.entity.CourseCategoryRelation; - -public interface CourseCategoryRelationService extends IService { -} diff --git a/src/main/java/com/corewing/app/service/CourseCategoryService.java b/src/main/java/com/corewing/app/service/CourseCategoryService.java deleted file mode 100644 index 16042c4..0000000 --- a/src/main/java/com/corewing/app/service/CourseCategoryService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.corewing.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.corewing.app.entity.CourseCategory; - -public interface CourseCategoryService extends IService { -} 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/CourseService.java b/src/main/java/com/corewing/app/service/TutorialService.java similarity index 51% rename from src/main/java/com/corewing/app/service/CourseService.java rename to src/main/java/com/corewing/app/service/TutorialService.java index e56052b..2c74498 100644 --- a/src/main/java/com/corewing/app/service/CourseService.java +++ b/src/main/java/com/corewing/app/service/TutorialService.java @@ -3,8 +3,8 @@ 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.Course; +import com.corewing.app.entity.Tutorial; -public interface CourseService extends IService { - IPage pageList(Page page, int categoryId, String courseTitle, String lang); +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/CourseCategoryRelationServiceImpl.java b/src/main/java/com/corewing/app/service/impl/CourseCategoryRelationServiceImpl.java deleted file mode 100644 index b98372e..0000000 --- a/src/main/java/com/corewing/app/service/impl/CourseCategoryRelationServiceImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.corewing.app.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.corewing.app.entity.CourseCategoryRelation; -import com.corewing.app.mapper.CourseCategoryRelationMapper; -import com.corewing.app.service.CourseCategoryRelationService; -import org.springframework.stereotype.Service; - -@Service -public class CourseCategoryRelationServiceImpl extends ServiceImpl implements CourseCategoryRelationService { -} diff --git a/src/main/java/com/corewing/app/service/impl/CourseCategoryServiceImpl.java b/src/main/java/com/corewing/app/service/impl/CourseCategoryServiceImpl.java deleted file mode 100644 index a061047..0000000 --- a/src/main/java/com/corewing/app/service/impl/CourseCategoryServiceImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.corewing.app.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.corewing.app.entity.CourseCategory; -import com.corewing.app.mapper.CourseCategoryMapper; -import com.corewing.app.service.CourseCategoryService; -import org.springframework.stereotype.Service; - -@Service -public class CourseCategoryServiceImpl extends ServiceImpl implements CourseCategoryService { -} diff --git a/src/main/java/com/corewing/app/service/impl/CourseServiceImpl.java b/src/main/java/com/corewing/app/service/impl/CourseServiceImpl.java deleted file mode 100644 index 902f6fe..0000000 --- a/src/main/java/com/corewing/app/service/impl/CourseServiceImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -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.Course; -import com.corewing.app.mapper.CourseMapper; -import com.corewing.app.service.CourseService; -import org.springframework.stereotype.Service; - -@Service -public class CourseServiceImpl extends ServiceImpl implements CourseService { - - private final CourseMapper courseMapper; - - public CourseServiceImpl(CourseMapper courseMapper) { - this.courseMapper = courseMapper; - } - - @Override - public IPage pageList(Page page, int categoryId, String courseTitle, String lang) { - return courseMapper.pageList(page, categoryId, courseTitle, 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/CourseVO.java b/src/main/java/com/corewing/app/vo/TutorialVO.java similarity index 85% rename from src/main/java/com/corewing/app/vo/CourseVO.java rename to src/main/java/com/corewing/app/vo/TutorialVO.java index dd2c7db..4bc0ec9 100644 --- a/src/main/java/com/corewing/app/vo/CourseVO.java +++ b/src/main/java/com/corewing/app/vo/TutorialVO.java @@ -1,18 +1,19 @@ package com.corewing.app.vo; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data -public class CourseVO { +public class TutorialVO { private Long id; /** * 教程标题 */ - private String courseTitle; + private String tutorialTitle; /** * 教程描述 diff --git a/src/main/resources/db/app_course.sql b/src/main/resources/db/app_tutorial.sql similarity index 69% rename from src/main/resources/db/app_course.sql rename to src/main/resources/db/app_tutorial.sql index cd4782f..e4cd139 100644 --- a/src/main/resources/db/app_course.sql +++ b/src/main/resources/db/app_tutorial.sql @@ -18,12 +18,12 @@ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- --- Table structure for app_course +-- Table structure for app_tutorial -- ---------------------------- -DROP TABLE IF EXISTS `app_course`; -CREATE TABLE `app_course` ( +DROP TABLE IF EXISTS `app_tutorial`; +CREATE TABLE `app_tutorial` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', - `course_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '教程标题', + `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 '查看次数', @@ -35,10 +35,10 @@ CREATE TABLE `app_course` ( ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='使用教程表'; -- ---------------------------- --- Records of app_course +-- Records of app_tutorial -- ---------------------------- BEGIN; -INSERT INTO `app_course` (`id`, `course_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); +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_course_category.sql b/src/main/resources/db/app_tutorial_category.sql similarity index 78% rename from src/main/resources/db/app_course_category.sql rename to src/main/resources/db/app_tutorial_category.sql index 3d12be6..92edc6a 100644 --- a/src/main/resources/db/app_course_category.sql +++ b/src/main/resources/db/app_tutorial_category.sql @@ -18,10 +18,10 @@ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- --- Table structure for app_course_category +-- Table structure for app_tutorial_category -- ---------------------------- -DROP TABLE IF EXISTS `app_course_category`; -CREATE TABLE `app_course_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 '分类名称', @@ -35,10 +35,10 @@ CREATE TABLE `app_course_category` ( ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='使用教程分类/标签表'; -- ---------------------------- --- Records of app_course_category +-- Records of app_tutorial_category -- ---------------------------- BEGIN; -INSERT INTO `app_course_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); +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_course_category_relation.sql b/src/main/resources/db/app_tutorial_category_relation.sql similarity index 69% rename from src/main/resources/db/app_course_category_relation.sql rename to src/main/resources/db/app_tutorial_category_relation.sql index 7952eca..81c49d9 100644 --- a/src/main/resources/db/app_course_category_relation.sql +++ b/src/main/resources/db/app_tutorial_category_relation.sql @@ -18,21 +18,21 @@ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- --- Table structure for app_course_category_relation +-- Table structure for app_tutorial_category_relation -- ---------------------------- -DROP TABLE IF EXISTS `app_course_category_relation`; -CREATE TABLE `app_course_category_relation` ( +DROP TABLE IF EXISTS `app_tutorial_category_relation`; +CREATE TABLE `app_tutorial_category_relation` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', - `course_id` bigint DEFAULT NULL 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_course_category_relation +-- Records of app_tutorial_category_relation -- ---------------------------- BEGIN; -INSERT INTO `app_course_category_relation` (`id`, `course_id`, `category_id`) VALUES (1, 1, 1); +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/CourseMapper.xml b/src/main/resources/mapper/TutorialMapper.xml similarity index 70% rename from src/main/resources/mapper/CourseMapper.xml rename to src/main/resources/mapper/TutorialMapper.xml index 5db8871..9b7316e 100644 --- a/src/main/resources/mapper/CourseMapper.xml +++ b/src/main/resources/mapper/TutorialMapper.xml @@ -1,11 +1,11 @@ - + - + - + @@ -19,9 +19,9 @@ select c.*, cc.category_title - from app_course c - left join app_course_category_relation ccr on c.id = ccr.course_id - left join app_course_category cc on cc.id = ccr.category_id + 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 @@ -33,8 +33,8 @@ AND cc.id = #{categoryId} - - AND c.course_title like CONCAT('%', #{courseTitle}, '%') + + AND c.tutorial_title like CONCAT('%', #{tutorialTitle}, '%')