【优化】统一名称
This commit is contained in:
@@ -28,7 +28,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
||||
// 排除反馈接口(支持匿名提交)
|
||||
.excludePathPatterns("/feedback", "/feedback/**")
|
||||
// 排除教程接口(支持匿名查询)
|
||||
.excludePathPatterns("/course", "/course/**")
|
||||
.excludePathPatterns("/tutorial", "/tutorial/**")
|
||||
// 排除固件查询接口(不需要登录)
|
||||
.excludePathPatterns("/firmware/**")
|
||||
// 排除静态资源
|
||||
|
||||
@@ -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<List<CourseCategory>> category(
|
||||
public Result<List<TutorialCategory>> category(
|
||||
@RequestParam(required = false, defaultValue = "0") Integer firstStatus
|
||||
) {
|
||||
log.info("当前语言环境:{}", I18nUtil.getCurrentLocale().getLanguage());
|
||||
LambdaQueryWrapper<CourseCategory> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(firstStatus != 0, CourseCategory::getFirstStatus, firstStatus);
|
||||
wrapper.eq(CourseCategory::getLang, I18nUtil.getCurrentLocale().getLanguage());
|
||||
List<CourseCategory> list = courseCategoryService.list(wrapper);
|
||||
LambdaQueryWrapper<TutorialCategory> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(firstStatus != 0, TutorialCategory::getFirstStatus, firstStatus);
|
||||
wrapper.eq(TutorialCategory::getLang, I18nUtil.getCurrentLocale().getLanguage());
|
||||
List<TutorialCategory> 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<IPage<Course>> getPageList(
|
||||
public Result<IPage<Tutorial>> 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<Course> page = new Page<>(current, size);
|
||||
IPage<Course> pageResult = courseService.pageList(page, categoryId, courseTitle, I18nUtil.getCurrentLocale().getLanguage());
|
||||
Page<Tutorial> page = new Page<>(current, size);
|
||||
IPage<Tutorial> pageResult = tutorialService.pageList(page, categoryId, tutorialTitle, I18nUtil.getCurrentLocale().getLanguage());
|
||||
return Result.success(pageResult);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* 教程描述
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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<CourseCategory> {
|
||||
public interface TutorialCategoryMapper extends BaseMapper<TutorialCategory> {
|
||||
}
|
||||
@@ -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<CourseCategoryRelation> {
|
||||
public interface TutorialCategoryRelationMapper extends BaseMapper<TutorialCategoryRelation> {
|
||||
}
|
||||
@@ -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<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);
|
||||
}
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -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<Course> {
|
||||
IPage<Course> pageList(Page<Course> page, int categoryId, String courseTitle, String lang);
|
||||
public interface TutorialService extends IService<Tutorial> {
|
||||
IPage<Tutorial> pageList(Page<Tutorial> page, int categoryId, String tutorialTitle, String lang);
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* 教程描述
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -1,11 +1,11 @@
|
||||
<?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">
|
||||
<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"/>
|
||||
<result column="course_title" property="courseTitle"/>
|
||||
<result column="tutorial_title" property="tutorialTitle"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="view_count" property="viewCount"/>
|
||||
@@ -19,9 +19,9 @@
|
||||
<!-- 基础查询SQL片段 -->
|
||||
<sql id="selectVOSql">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
@@ -33,8 +33,8 @@
|
||||
<if test="categoryId != null and categoryId != 0">
|
||||
AND cc.id = #{categoryId}
|
||||
</if>
|
||||
<if test="courseTitle != null and courseTitle != ''">
|
||||
AND c.course_title like CONCAT('%', #{courseTitle}, '%')
|
||||
<if test="tutorialTitle != null and tutorialTitle != ''">
|
||||
AND c.tutorial_title like CONCAT('%', #{tutorialTitle}, '%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
Reference in New Issue
Block a user