【新增】教程

This commit is contained in:
2025-10-28 13:50:07 +08:00
parent ed2b7bfba6
commit 0df7f645a6
7 changed files with 264 additions and 0 deletions

View File

@@ -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_course
-- ----------------------------
DROP TABLE IF EXISTS `app_course`;
CREATE TABLE `app_course` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`course_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_course
-- ----------------------------
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);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,45 @@
<?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">
<!-- 结果映射 -->
<resultMap id="VOResultMap" type="com.corewing.app.vo.CourseVO">
<id column="id" property="id"/>
<result column="course_title" property="courseTitle"/>
<result column="description" property="description"/>
<result column="content" property="content"/>
<result column="view_count" property="viewCount"/>
<result column="recommend_status" property="recommendStatus"/>
<result column="status" property="status"/>
<result column="category_title" property="categoryTitle"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 基础查询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
</sql>
<!-- 分页查询 -->
<select id="pageList" resultMap="VOResultMap">
<include refid="selectVOSql"/>
<where>
c.status = 1
<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>
</where>
ORDER BY c.recommend_status,c.create_time asc
</select>
</mapper>