【优化】统一名称

This commit is contained in:
2025-10-28 15:24:03 +08:00
parent 577b37b768
commit 53d3a88a1c
24 changed files with 130 additions and 127 deletions

View File

@@ -28,7 +28,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
// 排除反馈接口(支持匿名提交) // 排除反馈接口(支持匿名提交)
.excludePathPatterns("/feedback", "/feedback/**") .excludePathPatterns("/feedback", "/feedback/**")
// 排除教程接口(支持匿名查询) // 排除教程接口(支持匿名查询)
.excludePathPatterns("/course", "/course/**") .excludePathPatterns("/tutorial", "/tutorial/**")
// 排除固件查询接口(不需要登录) // 排除固件查询接口(不需要登录)
.excludePathPatterns("/firmware/**") .excludePathPatterns("/firmware/**")
// 排除静态资源 // 排除静态资源

View File

@@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corewing.app.common.Result; import com.corewing.app.common.Result;
import com.corewing.app.entity.Course; import com.corewing.app.entity.Tutorial;
import com.corewing.app.entity.CourseCategory; import com.corewing.app.entity.TutorialCategory;
import com.corewing.app.service.CourseCategoryService; import com.corewing.app.service.TutorialCategoryService;
import com.corewing.app.service.CourseService; import com.corewing.app.service.TutorialService;
import com.corewing.app.util.I18nUtil; import com.corewing.app.util.I18nUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -20,17 +20,17 @@ import java.util.List;
/** /**
* 教程接口 * 教程接口
*/ */
@RequestMapping("/course") @RequestMapping("/tutorial")
@RestController @RestController
@Slf4j @Slf4j
public class CourseController { public class TutorialController {
private final CourseService courseService; private final TutorialService tutorialService;
private final CourseCategoryService courseCategoryService; private final TutorialCategoryService tutorialCategoryService;
public CourseController(CourseService courseService, CourseCategoryService courseCategoryService) { public TutorialController(TutorialService tutorialService, TutorialCategoryService tutorialCategoryService) {
this.courseService = courseService; this.tutorialService = tutorialService;
this.courseCategoryService = courseCategoryService; this.tutorialCategoryService = tutorialCategoryService;
} }
/** /**
@@ -40,14 +40,14 @@ public class CourseController {
* *
*/ */
@GetMapping("/category") @GetMapping("/category")
public Result<List<CourseCategory>> category( public Result<List<TutorialCategory>> category(
@RequestParam(required = false, defaultValue = "0") Integer firstStatus @RequestParam(required = false, defaultValue = "0") Integer firstStatus
) { ) {
log.info("当前语言环境:{}", I18nUtil.getCurrentLocale().getLanguage()); log.info("当前语言环境:{}", I18nUtil.getCurrentLocale().getLanguage());
LambdaQueryWrapper<CourseCategory> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TutorialCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(firstStatus != 0, CourseCategory::getFirstStatus, firstStatus); wrapper.eq(firstStatus != 0, TutorialCategory::getFirstStatus, firstStatus);
wrapper.eq(CourseCategory::getLang, I18nUtil.getCurrentLocale().getLanguage()); wrapper.eq(TutorialCategory::getLang, I18nUtil.getCurrentLocale().getLanguage());
List<CourseCategory> list = courseCategoryService.list(wrapper); List<TutorialCategory> list = tutorialCategoryService.list(wrapper);
return Result.success(list); return Result.success(list);
} }
@@ -57,18 +57,18 @@ public class CourseController {
* @param current 当前页码 * @param current 当前页码
* @param size 每页数量 * @param size 每页数量
* @param categoryId 分类ID选填 * @param categoryId 分类ID选填
* @param courseTitle 教程标题选填 * @param tutorialTitle 教程标题选填
* *
*/ */
@GetMapping("/page") @GetMapping("/page")
public Result<IPage<Course>> getPageList( public Result<IPage<Tutorial>> getPageList(
@RequestParam(defaultValue = "1") Long current, @RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size, @RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false, defaultValue = "0") Integer categoryId, @RequestParam(required = false, defaultValue = "0") Integer categoryId,
@RequestParam(required = false) String courseTitle) { @RequestParam(required = false) String tutorialTitle) {
try { try {
Page<Course> page = new Page<>(current, size); Page<Tutorial> page = new Page<>(current, size);
IPage<Course> pageResult = courseService.pageList(page, categoryId, courseTitle, I18nUtil.getCurrentLocale().getLanguage()); IPage<Tutorial> pageResult = tutorialService.pageList(page, categoryId, tutorialTitle, I18nUtil.getCurrentLocale().getLanguage());
return Result.success(pageResult); return Result.success(pageResult);
} catch (Exception e) { } catch (Exception e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@@ -12,8 +13,8 @@ import java.util.Date;
* 教程 * 教程
*/ */
@Data @Data
@TableName("app_course") @TableName("app_tutorial")
public class Course implements Serializable { public class Tutorial implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -26,7 +27,7 @@ public class Course implements Serializable {
/** /**
* 教程标题 * 教程标题
*/ */
private String courseTitle; private String tutorialTitle;
/** /**
* 教程描述 * 教程描述

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@@ -12,8 +13,8 @@ import java.util.Date;
* 教程分类 * 教程分类
*/ */
@Data @Data
@TableName("app_course_category") @TableName("app_tutorial_category")
public class CourseCategory implements Serializable { public class TutorialCategory implements Serializable {
/** /**
* 分类id * 分类id

View File

@@ -9,8 +9,8 @@ import java.io.Serializable;
* 教程与分类关系实体 * 教程与分类关系实体
*/ */
@Data @Data
@TableName("app_course_category_relation") @TableName("app_tutorial_category_relation")
public class CourseCategoryRelation implements Serializable { public class TutorialCategoryRelation implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -22,7 +22,7 @@ public class CourseCategoryRelation implements Serializable {
/** /**
* 教程id * 教程id
*/ */
private Long CourseId; private Long TutorialId;
/** /**
* 教程分类id * 教程分类id

View File

@@ -1,12 +1,12 @@
package com.corewing.app.mapper; package com.corewing.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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; import org.apache.ibatis.annotations.Mapper;
/** /**
* 教程分类 Mapper接口 * 教程分类 Mapper接口
*/ */
@Mapper @Mapper
public interface CourseCategoryMapper extends BaseMapper<CourseCategory> { public interface TutorialCategoryMapper extends BaseMapper<TutorialCategory> {
} }

View File

@@ -1,7 +1,7 @@
package com.corewing.app.mapper; package com.corewing.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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; import org.apache.ibatis.annotations.Mapper;
@@ -9,5 +9,5 @@ import org.apache.ibatis.annotations.Mapper;
* 教程与教程分类关系Mapper接口 * 教程与教程分类关系Mapper接口
*/ */
@Mapper @Mapper
public interface CourseCategoryRelationMapper extends BaseMapper<CourseCategoryRelation> { public interface TutorialCategoryRelationMapper extends BaseMapper<TutorialCategoryRelation> {
} }

View File

@@ -2,7 +2,7 @@ package com.corewing.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Param;
*/ */
@Mapper @Mapper
public interface CourseMapper extends BaseMapper<Course> { public interface TutorialMapper extends BaseMapper<Tutorial> {
Page<Course> pageList(Page<Course> page, @Param("categoryId") int categoryId, @Param("courseTitle") String courseTitle, @Param("lang") String lang); Page<Tutorial> pageList(Page<Tutorial> page, @Param("categoryId") int categoryId, @Param("tutorialTitle") String tutorialTitle, @Param("lang") String lang);
} }

View File

@@ -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<CourseCategoryRelation> {
}

View File

@@ -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<CourseCategory> {
}

View File

@@ -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<TutorialCategoryRelation> {
}

View File

@@ -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<TutorialCategory> {
}

View File

@@ -3,8 +3,8 @@ package com.corewing.app.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.corewing.app.entity.Course; import com.corewing.app.entity.Tutorial;
public interface CourseService extends IService<Course> { public interface TutorialService extends IService<Tutorial> {
IPage<Course> pageList(Page<Course> page, int categoryId, String courseTitle, String lang); IPage<Tutorial> pageList(Page<Tutorial> page, int categoryId, String tutorialTitle, String lang);
} }

View File

@@ -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<CourseCategoryRelationMapper, CourseCategoryRelation> implements CourseCategoryRelationService {
}

View File

@@ -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<CourseCategoryMapper, CourseCategory> implements CourseCategoryService {
}

View File

@@ -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<CourseMapper, Course> implements CourseService {
private final CourseMapper courseMapper;
public CourseServiceImpl(CourseMapper courseMapper) {
this.courseMapper = courseMapper;
}
@Override
public IPage<Course> pageList(Page<Course> page, int categoryId, String courseTitle, String lang) {
return courseMapper.pageList(page, categoryId, courseTitle, lang);
}
}

View File

@@ -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<TutorialCategoryRelationMapper, TutorialCategoryRelation> implements TutorialCategoryRelationService {
}

View File

@@ -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<TutorialCategoryMapper, TutorialCategory> implements TutorialCategoryService {
}

View File

@@ -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<TutorialMapper, Tutorial> implements TutorialService {
private final TutorialMapper tutorialMapper;
public TutorialServiceImpl(TutorialMapper tutorialMapper) {
this.tutorialMapper = tutorialMapper;
}
@Override
public IPage<Tutorial> pageList(Page<Tutorial> page, int categoryId, String tutorialTitle, String lang) {
return tutorialMapper.pageList(page, categoryId, tutorialTitle, lang);
}
}

View File

@@ -1,18 +1,19 @@
package com.corewing.app.vo; package com.corewing.app.vo;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@Data @Data
public class CourseVO { public class TutorialVO {
private Long id; private Long id;
/** /**
* 教程标题 * 教程标题
*/ */
private String courseTitle; private String tutorialTitle;
/** /**
* 教程描述 * 教程描述

View File

@@ -18,12 +18,12 @@ SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0; SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------- -- ----------------------------
-- Table structure for app_course -- Table structure for app_tutorial
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `app_course`; DROP TABLE IF EXISTS `app_tutorial`;
CREATE TABLE `app_course` ( CREATE TABLE `app_tutorial` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `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 '教程描述', `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '教程描述',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '教程详情', `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '教程详情',
`view_count` int DEFAULT '0' 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='使用教程表'; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='使用教程表';
-- ---------------------------- -- ----------------------------
-- Records of app_course -- Records of app_tutorial
-- ---------------------------- -- ----------------------------
BEGIN; 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; COMMIT;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -18,10 +18,10 @@ SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0; SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------- -- ----------------------------
-- Table structure for app_course_category -- Table structure for app_tutorial_category
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `app_course_category`; DROP TABLE IF EXISTS `app_tutorial_category`;
CREATE TABLE `app_course_category` ( CREATE TABLE `app_tutorial_category` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`icon` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '图标', `icon` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '图标',
`category_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT 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='使用教程分类/标签表'; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='使用教程分类/标签表';
-- ---------------------------- -- ----------------------------
-- Records of app_course_category -- Records of app_tutorial_category
-- ---------------------------- -- ----------------------------
BEGIN; 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; COMMIT;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -18,21 +18,21 @@ SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0; 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`; DROP TABLE IF EXISTS `app_tutorial_category_relation`;
CREATE TABLE `app_course_category_relation` ( CREATE TABLE `app_tutorial_category_relation` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `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', `category_id` bigint DEFAULT NULL COMMENT '教程分类id',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='教程与教程分类关系表'; ) 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; 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; COMMIT;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.corewing.app.mapper.CourseMapper"> <mapper namespace="com.corewing.app.mapper.TutorialMapper">
<!-- 结果映射 --> <!-- 结果映射 -->
<resultMap id="VOResultMap" type="com.corewing.app.vo.CourseVO"> <resultMap id="VOResultMap" type="com.corewing.app.vo.TutorialVO">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="course_title" property="courseTitle"/> <result column="tutorial_title" property="tutorialTitle"/>
<result column="description" property="description"/> <result column="description" property="description"/>
<result column="content" property="content"/> <result column="content" property="content"/>
<result column="view_count" property="viewCount"/> <result column="view_count" property="viewCount"/>
@@ -19,9 +19,9 @@
<!-- 基础查询SQL片段 --> <!-- 基础查询SQL片段 -->
<sql id="selectVOSql"> <sql id="selectVOSql">
select c.*, cc.category_title select c.*, cc.category_title
from app_course c from app_tutorial c
left join app_course_category_relation ccr on c.id = ccr.course_id left join app_tutorial_category_relation ccr on c.id = ccr.tutorial_id
left join app_course_category cc on cc.id = ccr.category_id left join app_tutorial_category cc on cc.id = ccr.category_id
</sql> </sql>
<!-- 分页查询 --> <!-- 分页查询 -->
@@ -33,8 +33,8 @@
<if test="categoryId != null and categoryId != 0"> <if test="categoryId != null and categoryId != 0">
AND cc.id = #{categoryId} AND cc.id = #{categoryId}
</if> </if>
<if test="courseTitle != null and courseTitle != ''"> <if test="tutorialTitle != null and tutorialTitle != ''">
AND c.course_title like CONCAT('%', #{courseTitle}, '%') AND c.tutorial_title like CONCAT('%', #{tutorialTitle}, '%')
</if> </if>
</where> </where>