4 Commits 8f93d3b16e ... bede12971b

Author SHA1 Message Date
  feng_ting-ting bede12971b . 1 month ago
  feng_ting-ting 10a52b05b1 . 1 month ago
  feng_ting-ting ab09ecc5a3 . 1 month ago
  feng_ting-ting 9b3fc4c5c0 数据库同步 2 months ago

+ 1 - 1
XiaoETech-admin/src/main/java/com/zhentao/RuoYiApplication.java

@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 
 /**
  * 启动程序
- * 
+ *
  * @author ruoyi
  */
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })

+ 29 - 0
XiaoETech-admin/src/main/java/com/zhentao/web/controller/system/CourseCategoryController.java

@@ -0,0 +1,29 @@
+package com.zhentao.web.controller.system;
+
+import com.zhentao.common.annotation.Anonymous;
+import com.zhentao.common.core.domain.AjaxResult;
+import com.zhentao.system.domain.CourseCategory;
+import com.zhentao.system.service.CourseCategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @date: 2025/5/12 9:06
+ * @author: ftt
+ */
+@RestController
+@Anonymous
+@RequestMapping("/system/category")
+public class CourseCategoryController {
+    @Autowired
+    private CourseCategoryService service;
+
+    @RequestMapping("/findAll")
+    public AjaxResult findAll(){
+        List<CourseCategory> list = service.findAll();
+        return AjaxResult.success(list);
+    }
+}

+ 43 - 0
XiaoETech-admin/src/main/java/com/zhentao/web/controller/system/CourseController.java

@@ -0,0 +1,43 @@
+package com.zhentao.web.controller.system;
+
+import com.zhentao.common.annotation.Anonymous;
+import com.zhentao.common.core.controller.BaseController;
+import com.zhentao.common.core.domain.AjaxResult;
+import com.zhentao.common.core.page.TableDataInfo;
+import com.zhentao.system.domain.Course;
+import com.zhentao.system.service.CourseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author: wzy
+ * @date: 2025/5/8 16:14
+ */
+@RestController
+@Anonymous
+@RequestMapping("/system/course")
+public class CourseController extends BaseController {
+    @Autowired
+    private CourseService courseService;
+
+    /**
+     * 课程列表查询
+     * @param course
+     * @return
+     */
+    @RequestMapping("/list")
+    public TableDataInfo list(Course course){
+        startPage();
+        List<Course> courseList = courseService.selectCourseList(course);
+        return getDataTable(courseList);
+    }
+
+    @RequestMapping("/findById")
+    public AjaxResult findById(Integer courseCategory){
+        List<Course> byId = courseService.findById(courseCategory);
+        return AjaxResult.success(byId);
+    }
+}

+ 2 - 2
XiaoETech-admin/src/main/resources/application-druid.yml

@@ -6,9 +6,9 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://localhost:3306/xiao?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                url: jdbc:mysql://123.57.134.90:3306/xiao?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                 username: root
-                password: root
+                password: Tingting520
             # 从库数据源
             slave:
                 # 从数据源开关/默认关闭

+ 9 - 0
XiaoETech-admin/src/main/resources/application.yml

@@ -133,3 +133,12 @@ xss:
 wx-app:
   appId: wxa2a76a594be60e4d
   appSecret: 73e228a4fea627fb74d5a9de8585d880
+
+wx:
+  pay:
+    appId:  #微信公众号或者小程序等的appid
+    secret:
+    mchId: 1516562401 #微信支付商户号
+    mchKey: 7f633cbfbd892b4d256bc6edffe3b089 #微信支付商户密钥
+    notifyUrl: http://8.130.135.74:8053/api/order/student/pay/wxCallback #支付回调地址
+

+ 1 - 1
XiaoETech-framework/src/main/java/com/zhentao/framework/config/SecurityConfig.java

@@ -114,7 +114,7 @@ public class SecurityConfig
                 requests.antMatchers("/login", "/wxLogin","/register", "/captchaImage").permitAll()
                     // 静态资源,可匿名访问
                     .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
-                    .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
+                    .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**","/system/*", "/*/api-docs", "/druid/**").permitAll()
                     // 除上面外的所有请求全部需要鉴权认证
                     .anyRequest().authenticated();
             })

+ 11 - 2
XiaoETech-system/pom.xml

@@ -22,7 +22,16 @@
             <groupId>com.zhentao</groupId>
             <artifactId>zhentao-common</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.4.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
 
-</project>
+</project>

+ 51 - 0
XiaoETech-system/src/main/java/com/zhentao/system/domain/Course.java

@@ -0,0 +1,51 @@
+package com.zhentao.system.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @TableName course
+ */
+@TableName(value ="course")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Course implements Serializable {
+    private Integer courseId;
+
+    private String courseName;
+
+    private String courseDescription;
+
+    private Integer courseCategory;
+
+    private Integer instructorId;
+
+    private String courseCover;
+
+    private BigDecimal coursePrice;
+
+    private Integer courseDuration;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    private Object courseStatus;
+
+    private Integer studyNum;
+
+    private Integer isFree;
+
+    private Integer recommendIndex;
+
+    private String courseOutline;
+
+    private static final long serialVersionUID = 1L;
+}

+ 91 - 0
XiaoETech-system/src/main/java/com/zhentao/system/domain/CourseCategory.java

@@ -0,0 +1,91 @@
+package com.zhentao.system.domain;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @TableName course_category
+ */
+
+@Data
+public class CourseCategory implements Serializable {
+    private Integer categoryId;
+
+    private String categoryName;
+
+    private String categoryDescription;
+
+    public Integer getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(Integer categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public String getCategoryName() {
+        return categoryName;
+    }
+
+    public void setCategoryName(String categoryName) {
+        this.categoryName = categoryName;
+    }
+
+    public String getCategoryDescription() {
+        return categoryDescription;
+    }
+
+    public void setCategoryDescription(String categoryDescription) {
+        this.categoryDescription = categoryDescription;
+    }
+
+    public CourseCategory(Integer categoryId, String categoryName, String categoryDescription) {
+        this.categoryId = categoryId;
+        this.categoryName = categoryName;
+        this.categoryDescription = categoryDescription;
+    }
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        CourseCategory other = (CourseCategory) that;
+        return (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
+            && (this.getCategoryName() == null ? other.getCategoryName() == null : this.getCategoryName().equals(other.getCategoryName()))
+            && (this.getCategoryDescription() == null ? other.getCategoryDescription() == null : this.getCategoryDescription().equals(other.getCategoryDescription()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
+        result = prime * result + ((getCategoryName() == null) ? 0 : getCategoryName().hashCode());
+        result = prime * result + ((getCategoryDescription() == null) ? 0 : getCategoryDescription().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", categoryId=").append(categoryId);
+        sb.append(", categoryName=").append(categoryName);
+        sb.append(", categoryDescription=").append(categoryDescription);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 21 - 0
XiaoETech-system/src/main/java/com/zhentao/system/mapper/CourseCategoryMapper.java

@@ -0,0 +1,21 @@
+package com.zhentao.system.mapper;
+
+import com.zhentao.system.domain.CourseCategory;
+
+import java.util.List;
+
+/**
+* @author ASUS
+* @description 针对表【course_category(课程分类表)】的数据库操作Mapper
+* @createDate 2025-05-12 09:05:20
+* @Entity com.zhentao.system.domain.CourseCategory
+*/
+
+public interface CourseCategoryMapper{
+
+    List<CourseCategory> findAll();
+}
+
+
+
+

+ 16 - 0
XiaoETech-system/src/main/java/com/zhentao/system/mapper/CourseMapper.java

@@ -0,0 +1,16 @@
+package com.zhentao.system.mapper;
+
+
+import com.zhentao.system.domain.Course;
+
+import java.util.List;
+
+/**
+ * @author: wzy
+ * @date: 2025/5/8 17:11
+ */
+public interface CourseMapper{
+    List<Course> selectCourseList(Course course);
+
+    List<Course> findById(Integer courseCategory);
+}

+ 21 - 0
XiaoETech-system/src/main/java/com/zhentao/system/service/CourseService.java

@@ -0,0 +1,21 @@
+package com.zhentao.system.service;
+
+
+import com.zhentao.system.domain.Course;
+
+import java.util.List;
+
+/**
+ * @author: wzy
+ * @date: 2025/5/8 17:04
+ */
+public interface CourseService {
+    /**
+     * 根据条件分页查询课程列表
+     * @param course
+     * @return
+     */
+    List<Course> selectCourseList(Course course);
+
+    List<Course> findById(Integer courseCategory);
+}

+ 28 - 0
XiaoETech-system/src/main/java/com/zhentao/system/service/impl/CourseCategoryServiceImpl.java

@@ -0,0 +1,28 @@
+package com.zhentao.system.service.impl;
+
+import com.zhentao.system.domain.CourseCategory;
+import com.zhentao.system.mapper.CourseCategoryMapper;
+import com.zhentao.system.service.CourseCategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+* @author ASUS
+* @description 针对表【course_category(课程分类表)】的数据库操作Service实现
+* @createDate 2025-05-12 09:05:20
+*/
+@Service
+public class CourseCategoryServiceImpl implements CourseCategoryService{
+    @Autowired
+    private CourseCategoryMapper mapper;
+    @Override
+    public List<CourseCategory> findAll() {
+        return mapper.findAll();
+    }
+}
+
+
+
+

+ 29 - 0
XiaoETech-system/src/main/java/com/zhentao/system/service/impl/CourseServiceImpl.java

@@ -0,0 +1,29 @@
+package com.zhentao.system.service.impl;
+
+
+import com.zhentao.system.domain.Course;
+import com.zhentao.system.mapper.CourseMapper;
+import com.zhentao.system.service.CourseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author: wzy
+ * @date: 2025/5/8 17:04
+ */
+@Service
+public class CourseServiceImpl implements CourseService {
+    @Autowired
+    private CourseMapper courseMapper;
+    @Override
+    public List<Course> selectCourseList(Course course) {
+        return courseMapper.selectCourseList(course);
+    }
+
+    @Override
+    public List<Course> findById(Integer courseCategory) {
+        return courseMapper.findById(courseCategory);
+    }
+}

+ 20 - 0
XiaoETech-system/src/main/resources/mapper/system/CourseCategoryMapper.xml

@@ -0,0 +1,20 @@
+<?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.zhentao.system.mapper.CourseCategoryMapper">
+
+    <resultMap id="BaseResultMap" type="com.zhentao.system.domain.CourseCategory">
+            <id property="categoryId" column="category_id" jdbcType="INTEGER"/>
+            <result property="categoryName" column="category_name" jdbcType="VARCHAR"/>
+            <result property="categoryDescription" column="category_description" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        category_id,category_name,category_description
+    </sql>
+    <select id="findAll" resultType="com.zhentao.system.domain.CourseCategory">
+        select * from course_category
+    </select>
+
+</mapper>

+ 41 - 0
XiaoETech-system/src/main/resources/mapper/system/CourseMapper.xml

@@ -0,0 +1,41 @@
+<?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.zhentao.system.mapper.CourseMapper">
+    <resultMap id="CourseResult" type="course">
+        <id property="courseId" column="course_id"/>
+        <result property="courseName" column="course_name"/>
+        <result property="courseDescription" column="course_description"/>
+        <result property="courseCategory" column="course_category"/>
+        <result property="instructorId" column="instructor_id"/>
+        <result property="courseCover" column="course_cover"/>
+        <result property="coursePrice" column="course_price"/>
+        <result property="courseDuration" column="course_duration"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="courseStatus" column="course_status"/>
+        <result property="studyNum" column="student_num"/>
+        <result property="isFree" column="is_free"/>
+        <result property="recommendIndex" column="recommend_index"/>
+        <result property="courseOutline" column="course_outline"/>
+        <association property="category" javaType="courseCategory" resultMap="categoryResult"/>
+    </resultMap>
+    <resultMap id="categoryResult" type="courseCategory">
+        <id property="categoryId" column="category_id"/>
+        <result property="categoryName" column="category_name"/>
+        <result property="categoryDescription" column="category_description"/>
+    </resultMap>
+    <select id="selectCourseList" resultType="com.zhentao.system.domain.Course">
+        select c.*, cc.category_name, i.instructor_name from course c left join course_category cc on c.course_category = cc.category_id
+        left join instructor i on c.instructor_id = i.instructor_id
+        where c.course_status = '上线'
+        <if test="courseName != null and courseName != ''">
+            and c.course_name like concat('%', #{courseName}, '%')
+        </if>
+        <if test="courseCategory != null">
+            and c.course_category = #{courseCategory}
+        </if>
+    </select>
+    <select id="findById" resultType="com.zhentao.system.domain.Course">
+        select * from course where course_category = #{courseCategory}
+    </select>
+</mapper>

+ 10 - 3
pom.xml

@@ -3,7 +3,7 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
-	
+
     <groupId>com.zhentao</groupId>
     <artifactId>zhentao</artifactId>
     <version>3.8.9</version>
@@ -11,7 +11,7 @@
     <name>XiaoETech</name>
     <url>http://www.ruoyi.vip</url>
     <description>小鹅通管理平台</description>
-    
+
     <properties>
         <zhentao.version>3.8.9</zhentao.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -40,6 +40,13 @@
     <!-- 依赖声明 -->
     <dependencyManagement>
         <dependencies>
+            <!-- https://mvnrepository.com/artifact/com.github.wxpay/wxpay-sdk -->
+            <dependency>
+                <groupId>com.github.wxpay</groupId>
+                <artifactId>wxpay-sdk</artifactId>
+                <version>0.0.3</version>
+            </dependency>
+
 
             <!-- 覆盖SpringFramework的依赖配置-->
             <dependency>
@@ -271,4 +278,4 @@
         </pluginRepository>
     </pluginRepositories>
 
-</project>
+</project>