Преглед изворни кода

add:课程权重表单查询

caozixuan пре 1 година
родитељ
комит
0b83e0a110

+ 117 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/CourseWeightFormDto.java

@@ -0,0 +1,117 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.distributed.print.business.enums.CourseEvaluationTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+/**
+ * @Description: 课程权重表单dto(展开的结构)
+ * @Author: CaoZixuan
+ * @Date: 2024-03-06
+ */
+public class CourseWeightFormDto {
+
+    @ApiModelProperty("课程目标id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long targetId;
+
+    @ApiModelProperty("课程目标名称")
+    private String targetName;
+
+    @ApiModelProperty("目标创建时间")
+    private Long targetCreateTime;
+
+    @ApiModelProperty("对应课程目标分值")
+    private BigDecimal targetScore;
+
+    @ApiModelProperty("评价方式id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long evaluationId;
+
+    @ApiModelProperty("评价方式(项目)")
+    private String evaluation;
+
+    @ApiModelProperty("评价方式内容(考核内容及其要求)")
+    private String evaluationDesc;
+
+    @ApiModelProperty("评价方式创建时间")
+    private Long evaluationCreateTime;
+
+    @ApiModelProperty("评价方式类型(默认/自定义)")
+    private CourseEvaluationTypeEnum type;
+
+    public Long getTargetId() {
+        return targetId;
+    }
+
+    public void setTargetId(Long targetId) {
+        this.targetId = targetId;
+    }
+
+    public String getTargetName() {
+        return targetName;
+    }
+
+    public void setTargetName(String targetName) {
+        this.targetName = targetName;
+    }
+
+    public Long getTargetCreateTime() {
+        return targetCreateTime;
+    }
+
+    public void setTargetCreateTime(Long targetCreateTime) {
+        this.targetCreateTime = targetCreateTime;
+    }
+
+    public BigDecimal getTargetScore() {
+        return targetScore;
+    }
+
+    public void setTargetScore(BigDecimal targetScore) {
+        this.targetScore = targetScore;
+    }
+
+    public Long getEvaluationId() {
+        return evaluationId;
+    }
+
+    public void setEvaluationId(Long evaluationId) {
+        this.evaluationId = evaluationId;
+    }
+
+    public String getEvaluation() {
+        return evaluation;
+    }
+
+    public void setEvaluation(String evaluation) {
+        this.evaluation = evaluation;
+    }
+
+    public String getEvaluationDesc() {
+        return evaluationDesc;
+    }
+
+    public void setEvaluationDesc(String evaluationDesc) {
+        this.evaluationDesc = evaluationDesc;
+    }
+
+    public Long getEvaluationCreateTime() {
+        return evaluationCreateTime;
+    }
+
+    public void setEvaluationCreateTime(Long evaluationCreateTime) {
+        this.evaluationCreateTime = evaluationCreateTime;
+    }
+
+    public CourseEvaluationTypeEnum getType() {
+        return type;
+    }
+
+    public void setType(CourseEvaluationTypeEnum type) {
+        this.type = type;
+    }
+}

+ 10 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/CourseWeightMapper.java

@@ -1,7 +1,11 @@
 package com.qmth.distributed.print.business.mapper;
 
+import com.qmth.distributed.print.business.bean.dto.CourseWeightFormDto;
 import com.qmth.distributed.print.business.entity.CourseWeight;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface CourseWeightMapper extends BaseMapper<CourseWeight> {
 
+    /**
+     * 获取权重表单
+     * @param teachCourseId 教学课程id
+     * @return 表单
+     */
+    List<CourseWeightFormDto> findCourseWeightForm(@Param("teachCourseId") Long teachCourseId);
 }

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/CourseWeightService.java

@@ -1,6 +1,7 @@
 package com.qmth.distributed.print.business.service;
 
 import com.qmth.distributed.print.business.bean.dto.CourseWeightDto;
+import com.qmth.distributed.print.business.bean.dto.CourseWeightFormDto;
 import com.qmth.distributed.print.business.bean.params.CourseWeightParam;
 import com.qmth.distributed.print.business.entity.CourseWeight;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -42,4 +43,14 @@ public interface CourseWeightService extends IService<CourseWeight> {
      * @param teachCourseId 教学课程id
      */
     void deleteCourseWeight(Long teachCourseId);
+
+    /**
+     * 获取课程权重表单数据
+     *
+     * @param examId     考试id
+     * @param courseCode 课程编号
+     * @param userId     教师id
+     * @return 课程权重表单平铺数据
+     */
+    List<CourseWeightFormDto> findCourseWeightForm(Long examId, String courseCode, Long userId);
 }

+ 9 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/CourseWeightServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.distributed.print.business.bean.dto.CourseDimensionDto;
 import com.qmth.distributed.print.business.bean.dto.CourseWeightDetailDto;
 import com.qmth.distributed.print.business.bean.dto.CourseWeightDto;
+import com.qmth.distributed.print.business.bean.dto.CourseWeightFormDto;
 import com.qmth.distributed.print.business.bean.params.CourseWeightParam;
 import com.qmth.distributed.print.business.bean.result.CourseEvaluationResult;
 import com.qmth.distributed.print.business.bean.result.CourseTargetResult;
@@ -102,7 +103,7 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
                     detail.setEnable(enable);
                     detail.setWeight(weight);
                     detail.setTargetScore(targetScore);
-                    if (enable){
+                    if (enable) {
                         totalScore = totalScore.add(targetScore);
                     }
                     courseWeightDetailDtoList.add(detail);
@@ -240,4 +241,11 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
                 .set(CourseTarget::getTotalWeight, null);
         courseTargetService.update(courseTargetUpdateWrapper);
     }
+
+    @Override
+    public List<CourseWeightFormDto> findCourseWeightForm(Long examId, String courseCode, Long userId) {
+        TeachCourse teachCourse = teachCourseService.findByExamIdCourseCodeAndUserId(examId, courseCode, userId);
+        Long teachCourseId = teachCourse.getId();
+        return this.baseMapper.findCourseWeightForm(teachCourseId);
+    }
 }

+ 26 - 0
distributed-print-business/src/main/resources/mapper/CourseWeightMapper.xml

@@ -2,4 +2,30 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.distributed.print.business.mapper.CourseWeightMapper">
 
+    <select id="findCourseWeightForm"
+            resultType="com.qmth.distributed.print.business.bean.dto.CourseWeightFormDto">
+        SELECT
+            ct.id AS targetId,
+            ct.target_name AS targetName,
+            ct.create_time AS targetCreateTime,
+            cw.target_score AS targetScore,
+            ce.id AS evaluationId,
+            ce.evaluation AS evaluation,
+            ce.evaluation_desc AS evaluationDesc,
+            ce.create_time AS evaluationCreateTime,
+            ce.type AS type
+        FROM
+            course_weight cw
+                LEFT JOIN
+            course_target ct ON cw.target_id = ct.id
+                LEFT JOIN
+            course_evaluation ce ON cw.evaluation_id = ce.id
+        <where>
+            AND cw.enable
+            <if test="teachCourseId != null">
+                AND cw.teach_course_id = #{teachCourseId}
+            </if>
+        </where>
+        ORDER BY ct.id,ce.id
+    </select>
 </mapper>