Ver Fonte

(*)学生查看导向目标;

linxiaobin há 8 meses atrás
pai
commit
db066e7452

+ 13 - 0
education-api/src/main/java/com/education/api/controller/student/StuGoalInfoController.java

@@ -5,8 +5,10 @@ import com.education.business.service.education.StuGoalInfoService;
 import com.education.common.base.BaseController;
 import com.education.common.utils.Result;
 import com.education.model.dto.StuGoalInfoDto;
+import com.education.model.dto.StuGoalInfoRespDto;
 import com.education.model.entity.StuGoalInfo;
 import com.education.model.request.PageParam;
+import jakarta.validation.constraints.NotNull;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
@@ -21,6 +23,17 @@ public class StuGoalInfoController extends BaseController {
     @Resource
     private StuGoalInfoService stuGoalInfoService;
 
+    /**
+     * 查询学生导出目标列表
+     * @param pageParam
+     * @param courseId
+     * @return
+     */
+    @GetMapping("/listByCourseId")
+    public Result selectPageByCourseId(PageParam pageParam, @NotNull Integer courseId) {
+        return Result.success(stuGoalInfoService.selectPageByCourseId(pageParam, courseId));
+    }
+
     /**
      * 答题
      * @param stuGoalInfo

+ 5 - 0
education-business/src/main/java/com/education/business/mapper/education/StuGoalInfoMapper.java

@@ -3,7 +3,10 @@ package com.education.business.mapper.education;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.education.model.dto.StuGoalInfoDto;
+import com.education.model.dto.StuGoalInfoRespDto;
+import com.education.model.entity.GoalInfo;
 import com.education.model.entity.StuGoalInfo;
+import com.education.model.request.PageParam;
 
 /**
  * @author zhangj
@@ -19,4 +22,6 @@ public interface StuGoalInfoMapper extends BaseMapper<StuGoalInfo> {
      * @return
      */
     Page<StuGoalInfoDto> selectPageList(Page<StuGoalInfoDto> page, StuGoalInfo stuGoalInfo);
+
+    Page<StuGoalInfoRespDto> selectPageByCourseId(Page<StuGoalInfoRespDto> page, Integer courseId, int studentId);
 }

+ 15 - 0
education-business/src/main/java/com/education/business/service/education/StuGoalInfoService.java

@@ -1,10 +1,15 @@
 package com.education.business.service.education;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.education.auth.AuthUtil;
+import com.education.auth.session.UserSession;
 import com.education.business.mapper.education.StuGoalInfoMapper;
 import com.education.business.service.BaseService;
+import com.education.common.enums.LoginEnum;
 import com.education.common.model.PageInfo;
 import com.education.model.dto.StuGoalInfoDto;
+import com.education.model.dto.StuGoalInfoRespDto;
+import com.education.model.entity.GoalInfo;
 import com.education.model.entity.StuGoalInfo;
 import com.education.model.request.PageParam;
 import org.springframework.stereotype.Service;
@@ -26,4 +31,14 @@ public class StuGoalInfoService extends BaseService<StuGoalInfoMapper, StuGoalIn
     public boolean saveOrUpdate(StuGoalInfo stuGoalInfo) {
         return super.saveOrUpdate(stuGoalInfo);
     }
+
+    public PageInfo<StuGoalInfoRespDto> selectPageByCourseId(PageParam pageParam, Integer courseId) {
+        UserSession userSession = AuthUtil.getSession(LoginEnum.STUDENT.getValue());
+        int studentId = userSession.getId().intValue();
+
+        Page<StuGoalInfoRespDto> page = new Page<>(pageParam.getPageNumber(), pageParam.getPageSize());
+
+        return selectPage(baseMapper.selectPageByCourseId(page, courseId, studentId));
+    }
+
 }

+ 0 - 60
education-business/src/main/java/com/education/business/service/education/impl/HomeworkInfoServiceImpl.java

@@ -1,60 +0,0 @@
-/*
-package com.education.business.service.education.impl;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.education.business.service.BaseService;
-import com.education.business.service.education.HomeworkInfoService;
-import com.education.business.session.AdminUserSession;
-import com.education.business.session.StudentSession;
-import com.education.business.session.UserSessionContext;
-import com.education.common.model.PageInfo;
-import com.education.model.dto.HomeworkInfoReqDto;
-import com.education.model.dto.TestPaperInfoDto;
-import com.education.model.entity.GoalInfo;
-import com.education.model.entity.HomeworkInfo;
-import com.education.business.mapper.education.HomeworkInfoMapper;
-import com.education.model.entity.TestPaperInfo;
-import com.education.model.request.PageParam;
-import org.springframework.stereotype.Service;
-
-import java.util.Collections;
-import java.util.List;
-
-*/
-/**
-* @author harri
-* @description 针对表【homework_info(作业信息表)】的数据库操作Service实现
-* @createDate 2025-07-15 17:02:49
-*//*
-
-@Service
-public class HomeworkInfoServiceImpl extends BaseService<HomeworkInfoMapper, HomeworkInfo>
-    implements HomeworkInfoService {
-    @Override
-    public PageInfo<HomeworkInfo> selectPageList(PageParam pageParam, HomeworkInfoReqDto req) {
-        Page<HomeworkInfo> page = new Page<>(pageParam.getPageNumber(), pageParam.getPageSize());
-        HomeworkInfo homeworkInfo = new HomeworkInfo();
-        homeworkInfo.setSubjectId(req.getSubjectId());
-        homeworkInfo.setGradeInfoId(req.getGradeInfoId());
-        //AdminUserSession adminUserSession = UserSessionContext.getAdminUserSession();
-        //todo implement selectPage(baseMapper.selectPageList(page, homeworkInfo)
-        return new PageInfo<>();
-    }
-
-    @Override
-    public List<GoalInfo> getGoals(Integer id) {
-        //todo implement getGoals
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void assign(Integer id) {
-        //todo implement assign
-    }
-}
-
-
-
-
-*/

+ 0 - 22
education-business/src/main/java/com/education/business/service/education/impl/StuGoalInfoServiceImpl.java

@@ -1,22 +0,0 @@
-//package com.education.business.service.education.impl;
-//
-//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-//import com.education.model.entity.StuGoalInfo;
-//import com.education.business.service.education.StuGoalInfoService;
-//import com.education.business.mapper.education.StuGoalInfoMapper;
-//import org.springframework.stereotype.Service;
-//
-///**
-//* @author harri
-//* @description 针对表【stu_goal_info(学生导向目标答题记录表)】的数据库操作Service实现
-//* @createDate 2025-07-15 20:01:51
-//*/
-//@Service
-//public class StuGoalInfoServiceImpl extends ServiceImpl<StuGoalInfoMapper, StuGoalInfo>
-//    implements StuGoalInfoService{
-//
-//}
-//
-//
-//
-//

+ 57 - 0
education-business/src/main/resources/mapper/education/StuGoalInfoMapper.xml

@@ -2,6 +2,44 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.education.business.mapper.education.StuGoalInfoMapper">
 
+    <resultMap id="BaseResultMap" type="com.education.model.dto.StuGoalInfoRespDto">
+        <id property="id" column="id"/>
+        <result property="subjectId" column="subject_id"/>
+        <result property="schoolType" column="school_type"/>
+        <result property="courseSectionId" column="course_section_id"/>
+        <result property="courseId" column="course_id"/>
+        <result property="gradeId" column="grade_id"/>
+        <result property="courseName" column="course_name"/>
+        <result property="courseSectionName" column="course_section_name"/>
+        <result property="content" column="content"/>
+        <result property="gOriented" column="g_oriented"/>
+        <result property="pScoreStd" column="p_score_std"/>
+        <result property="sScoreStd" column="s_score_std"/>
+        <result property="rScoreStd" column="r_score_std"/>
+        <result property="eScoreStd" column="e_score_std"/>
+        <result property="nScoreStd" column="n_score_std"/>
+        <result property="createUser" column="create_user"/>
+        <result property="knowPoints" column="know_points"/>
+        <result property="publishFlag" column="publish_flag"/>
+        <result property="createDate" column="create_date"/>
+        <result property="updateDate" column="update_date"/>
+
+        <result property="stuGoalInfoId" column="stu_goal_info_id"/>
+        <result property="studentId" column="student_id"/>
+        <result property="correctStatus" column="correct_status"/>
+        <result property="pAnswer" column="p_answer"/>
+        <result property="pScore" column="p_score"/>
+        <result property="sAnswer" column="s_answer"/>
+        <result property="sScore" column="s_score"/>
+        <result property="rAnswer" column="r_answer"/>
+        <result property="rScore" column="r_score"/>
+        <result property="eAnswer" column="e_answer"/>
+        <result property="eScore" column="e_score"/>
+        <result property="nAnswer" column="n_answer"/>
+        <result property="nScore" column="n_score"/>
+        <result property="comment" column="comment"/>
+    </resultMap>
+
     <!-- 学生导向目标答题记录列表 -->
     <select id="selectPageList" resultType="stuGoalInfoDto">
         select * from stu_goal_info
@@ -27,6 +65,25 @@
         SELECT * FROM stu_goal_info WHERE id = #{id}
     </select>
 
+    <select id="selectPageByCourseId" resultType="com.education.model.dto.StuGoalInfoRespDto">
+        select distinct goal_info.*,course_info.name as course_name,course_section.title AS  course_section_name,
+        l.id as stuGoalInfoId, l.student_id, l.correct_status,
+        l.p_answer, l.p_score, l.s_answer, l.s_score, l.r_answer, l.r_score,
+        l.e_answer, l.e_score, l.n_answer, l.n_score, l.comment
+        from goal_info
+        left join course_info
+        on  goal_info.course_id = course_info.id
+        left join course_section
+        ON  goal_info.course_id = course_section.course_id AND goal_info.course_section_id = course_section.id
+        left join (select a.* from stu_goal_info a,
+        (select goal_info_id,max(id) as id from stu_goal_info where stu_goal_info.student_id = #{studentId}) AS b
+        where a.id = b.id) as l
+        on goal_info.id = l.goal_info_id
+        <where>
+            goal_info.course_id = #{courseId} and goal_info.publish_flag = 1
+        </where>
+    </select>
+
     <!-- 根据 ID 更新学生导向目标答题记录 -->
     <update id="updateStuGoalInfoById" parameterType="com.education.model.entity.StuGoalInfo">
         UPDATE stu_goal_info

+ 132 - 0
education-model/src/main/java/com/education/model/dto/StuGoalInfoRespDto.java

@@ -0,0 +1,132 @@
+package com.education.model.dto;
+
+import com.education.model.entity.GoalInfo;
+
+public class StuGoalInfoRespDto extends GoalInfoDto {
+    private Integer stuGoalInfoId;
+    private Integer studentId;
+    private Integer correctStatus;
+    private String pAnswer;
+    private Integer pScore;
+    private String sAnswer;
+    private Integer sScore;
+    private String rAnswer;
+    private Integer rScore;
+    private String eAnswer;
+    private Integer eScore;
+    private String nAnswer;
+    private Integer nScore;
+    private String comment;
+
+    public Integer getStuGoalInfoId() {
+        return stuGoalInfoId;
+    }
+
+    public void setStuGoalInfoId(Integer stuGoalInfoId) {
+        this.stuGoalInfoId = stuGoalInfoId;
+    }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public Integer getCorrectStatus() {
+        return correctStatus;
+    }
+
+    public void setCorrectStatus(Integer correctStatus) {
+        this.correctStatus = correctStatus;
+    }
+
+    public String getpAnswer() {
+        return pAnswer;
+    }
+
+    public void setpAnswer(String pAnswer) {
+        this.pAnswer = pAnswer;
+    }
+
+    public Integer getpScore() {
+        return pScore;
+    }
+
+    public void setpScore(Integer pScore) {
+        this.pScore = pScore;
+    }
+
+    public String getsAnswer() {
+        return sAnswer;
+    }
+
+    public void setsAnswer(String sAnswer) {
+        this.sAnswer = sAnswer;
+    }
+
+    public Integer getsScore() {
+        return sScore;
+    }
+
+    public void setsScore(Integer sScore) {
+        this.sScore = sScore;
+    }
+
+    public String getrAnswer() {
+        return rAnswer;
+    }
+
+    public void setrAnswer(String rAnswer) {
+        this.rAnswer = rAnswer;
+    }
+
+    public Integer getrScore() {
+        return rScore;
+    }
+
+    public void setrScore(Integer rScore) {
+        this.rScore = rScore;
+    }
+
+    public String geteAnswer() {
+        return eAnswer;
+    }
+
+    public void seteAnswer(String eAnswer) {
+        this.eAnswer = eAnswer;
+    }
+
+    public Integer geteScore() {
+        return eScore;
+    }
+
+    public void seteScore(Integer eScore) {
+        this.eScore = eScore;
+    }
+
+    public String getnAnswer() {
+        return nAnswer;
+    }
+
+    public void setnAnswer(String nAnswer) {
+        this.nAnswer = nAnswer;
+    }
+
+    public Integer getnScore() {
+        return nScore;
+    }
+
+    public void setnScore(Integer nScore) {
+        this.nScore = nScore;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+}