feng_ting-ting hace 1 semana
padre
commit
bede12971b

+ 4 - 2
XiaoETech-admin/src/main/java/com/zhentao/web/controller/system/CourseController.java

@@ -2,6 +2,7 @@ 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;
@@ -35,7 +36,8 @@ public class CourseController extends BaseController {
     }
 
     @RequestMapping("/findById")
-    public List<Course> findById(Integer courseCategory){
-        return courseService.findById(courseCategory);
+    public AjaxResult findById(Integer courseCategory){
+        List<Course> byId = courseService.findById(courseCategory);
+        return AjaxResult.success(byId);
     }
 }

+ 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 #支付回调地址
+

+ 4 - 150
XiaoETech-system/src/main/java/com/zhentao/system/domain/Course.java

@@ -1,5 +1,7 @@
 package com.zhentao.system.domain;
 
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -10,9 +12,10 @@ import java.util.Date;
 /**
  * @TableName course
  */
-//@TableName(value ="course")
+@TableName(value ="course")
 @Data
 @NoArgsConstructor
+@AllArgsConstructor
 public class Course implements Serializable {
     private Integer courseId;
 
@@ -40,158 +43,9 @@ public class Course implements Serializable {
 
     private Integer isFree;
 
-    public Integer getCourseId() {
-        return courseId;
-    }
-
-    public void setCourseId(Integer courseId) {
-        this.courseId = courseId;
-    }
-
-    public String getCourseName() {
-        return courseName;
-    }
-
-    public void setCourseName(String courseName) {
-        this.courseName = courseName;
-    }
-
-    public String getCourseDescription() {
-        return courseDescription;
-    }
-
-    public void setCourseDescription(String courseDescription) {
-        this.courseDescription = courseDescription;
-    }
-
-    public Integer getCourseCategory() {
-        return courseCategory;
-    }
-
-    public void setCourseCategory(Integer courseCategory) {
-        this.courseCategory = courseCategory;
-    }
-
-    public Integer getInstructorId() {
-        return instructorId;
-    }
-
-    public void setInstructorId(Integer instructorId) {
-        this.instructorId = instructorId;
-    }
-
-    public String getCourseCover() {
-        return courseCover;
-    }
-
-    public void setCourseCover(String courseCover) {
-        this.courseCover = courseCover;
-    }
-
-    public BigDecimal getCoursePrice() {
-        return coursePrice;
-    }
-
-    public void setCoursePrice(BigDecimal coursePrice) {
-        this.coursePrice = coursePrice;
-    }
-
-    public Integer getCourseDuration() {
-        return courseDuration;
-    }
-
-    public void setCourseDuration(Integer courseDuration) {
-        this.courseDuration = courseDuration;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public Object getCourseStatus() {
-        return courseStatus;
-    }
-
-    public void setCourseStatus(Object courseStatus) {
-        this.courseStatus = courseStatus;
-    }
-
-    public Integer getStudyNum() {
-        return studyNum;
-    }
-
-    public void setStudyNum(Integer studyNum) {
-        this.studyNum = studyNum;
-    }
-
-    public Integer getIsFree() {
-        return isFree;
-    }
-
-    public void setIsFree(Integer isFree) {
-        this.isFree = isFree;
-    }
-
-    public Integer getRecommendIndex() {
-        return recommendIndex;
-    }
-
-    public void setRecommendIndex(Integer recommendIndex) {
-        this.recommendIndex = recommendIndex;
-    }
-
-    public String getCourseOutline() {
-        return courseOutline;
-    }
-
-    public void setCourseOutline(String courseOutline) {
-        this.courseOutline = courseOutline;
-    }
-
-    public CourseCategory getCategory() {
-        return category;
-    }
-
-    public void setCategory(CourseCategory category) {
-        this.category = category;
-    }
-
-    public Course(Integer courseId, String courseName, String courseDescription, Integer courseCategory, Integer instructorId, String courseCover, BigDecimal coursePrice, Integer courseDuration, Date createTime, Date updateTime, Object courseStatus, Integer studyNum, Integer isFree, Integer recommendIndex, String courseOutline, CourseCategory category) {
-        this.courseId = courseId;
-        this.courseName = courseName;
-        this.courseDescription = courseDescription;
-        this.courseCategory = courseCategory;
-        this.instructorId = instructorId;
-        this.courseCover = courseCover;
-        this.coursePrice = coursePrice;
-        this.courseDuration = courseDuration;
-        this.createTime = createTime;
-        this.updateTime = updateTime;
-        this.courseStatus = courseStatus;
-        this.studyNum = studyNum;
-        this.isFree = isFree;
-        this.recommendIndex = recommendIndex;
-        this.courseOutline = courseOutline;
-        this.category = category;
-    }
-
     private Integer recommendIndex;
 
     private String courseOutline;
 
-    private CourseCategory category;
-
     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();
+    }
+}

+ 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();
+    }
+}
+
+
+
+

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

@@ -18,7 +18,6 @@ public class CourseServiceImpl implements CourseService {
     @Autowired
     private CourseMapper courseMapper;
     @Override
-//    @DataScope(courseAlias = "c",categoryAlias = "cat")
     public List<Course> selectCourseList(Course course) {
         return courseMapper.selectCourseList(course);
     }

+ 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>