Kaynağa Gözat

排课查询

wuheng 1 yıl önce
ebeveyn
işleme
24ca817ab4

+ 10 - 0
controller/src/main/java/com/koobietech/eas/controller/EasEduScheduleController.java

@@ -5,6 +5,8 @@ import com.koobietech.eas.common.result.JsonPageResult;
 import com.koobietech.eas.common.result.JsonResult;
 import com.koobietech.eas.common.result.JsonResult;
 import com.koobietech.eas.common.result.PageDataResult;
 import com.koobietech.eas.common.result.PageDataResult;
 import com.koobietech.eas.dao.dto.ConflictDto;
 import com.koobietech.eas.dao.dto.ConflictDto;
+import com.koobietech.eas.dao.dto.ScheduleDto;
+import com.koobietech.eas.dao.pojo.SchedulePojo;
 import com.koobietech.eas.mbg.model.EasEduSchedule;
 import com.koobietech.eas.mbg.model.EasEduSchedule;
 import com.koobietech.eas.service.EasEduScheduleService;
 import com.koobietech.eas.service.EasEduScheduleService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
@@ -12,6 +14,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.List;
 
 
 @RestController
 @RestController
 @Tag(name = "课程表模块")
 @Tag(name = "课程表模块")
@@ -61,6 +64,13 @@ public class EasEduScheduleController {
         return JsonPageResult.data(ret);
         return JsonPageResult.data(ret);
     }
     }
 
 
+    @PostMapping("/querySchedule")
+    @Operation(summary = "查询课程表", description = "根据参数查询课程表信息")
+    public JsonResult querySchedule(@RequestBody(required = false) ScheduleDto schedule) {
+        List<SchedulePojo> ret = easEduScheduleService.querySchedule(schedule);
+        return JsonResult.data(ret);
+    }
+
     @PutMapping("/queryConflict")
     @PutMapping("/queryConflict")
     @Operation(summary = "查询排课是否冲突", description = "根据参数查询排课是否冲突")
     @Operation(summary = "查询排课是否冲突", description = "根据参数查询排课是否冲突")
     public JsonResult queryConflict(@RequestBody ConflictDto conflictDto) {
     public JsonResult queryConflict(@RequestBody ConflictDto conflictDto) {

+ 17 - 0
dao/src/main/java/com/koobietech/eas/dao/dto/ScheduleDto.java

@@ -0,0 +1,17 @@
+package com.koobietech.eas.dao.dto;
+
+import lombok.Data;
+
+@Data
+public class ScheduleDto {
+    Integer studentId;
+    Integer classId;
+    Integer subjectId;
+    Integer teacherId;
+    String startTime;
+    String endTime;
+    Integer week;
+    Integer roomId;
+    Integer assistantId;
+    Integer categoryId;
+}

+ 12 - 0
dao/src/main/java/com/koobietech/eas/dao/mapper/ScheduleMapper.java

@@ -0,0 +1,12 @@
+package com.koobietech.eas.dao.mapper;
+
+import com.koobietech.eas.dao.dto.ScheduleDto;
+import com.koobietech.eas.dao.pojo.SchedulePojo;
+
+import java.util.List;
+
+public interface ScheduleMapper {
+
+    List<SchedulePojo> getSchedules(ScheduleDto scheduleDto);
+
+}

+ 75 - 0
dao/src/main/java/com/koobietech/eas/dao/pojo/SchedulePojo.java

@@ -0,0 +1,75 @@
+package com.koobietech.eas.dao.pojo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class SchedulePojo {
+
+    private Long id;
+
+    @Schema(description = "当周周几")
+    private Integer week;
+
+    @Schema(description = "起始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date startTime;
+
+    @Schema(description = "结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date endTime;
+
+    @Schema(description = "教室ID")
+    private Integer roomId;
+
+    @Schema(description = "教室")
+    private String classroom;
+
+    @Schema(description = "班级ID")
+    private Integer classId;
+
+    @Schema(description = "班级")
+    private String className;
+
+    @Schema(description = "助教ID")
+    private Integer assistantId;
+
+    @Schema(description = "助教")
+    private String assistantName;
+
+    @Schema(description = "教师ID")
+    private Integer teacherId;
+
+    @Schema(description = "教师")
+    private String teacherName;
+
+    @Schema(description = "授课类别")
+    private Integer categoryId;
+
+    @Schema(description = "授课")
+    private String category;
+
+    @Schema(description = "授课内容")
+    private Integer subjectsId;
+
+    @Schema(description = "内容")
+    private String subjects;
+
+    @Schema(description = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date createTime;
+
+    @Schema(description = "修改时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date modifyTime;
+
+    @Schema(description = "创建用户ID")
+    private Integer createUid;
+
+    @Schema(description = "状态")
+    private String disabled;
+
+}

+ 88 - 0
dao/src/main/resources/com/koobietech/eas/dao/mapper/ScheduleMapper.xml

@@ -0,0 +1,88 @@
+<?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.koobietech.eas.dao.mapper.ScheduleMapper">
+
+    <resultMap id="scheduleResultMap" type="com.koobietech.eas.dao.pojo.SchedulePojo">
+        <result property="id" column="id"/>
+        <result property="week" column="week"/>
+        <result property="startTime" column="start_time"/>
+        <result property="endTime" column="end_time"/>
+        <result property="roomId" column="room_id"/>
+        <result property="classId" column="class_id"/>
+        <result property="assistantId" column="assistant_id"/>
+        <result property="teacherId" column="teacher_id"/>
+        <result property="categoryId" column="category_id"/>
+        <result property="subjectsId" column="subjects_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="modifyTime" column="modify_time"/>
+        <result property="createUid" column="create_uid"/>
+        <result property="disabled" column="disabled"/>
+        <result property="assistantName" column="assistantName" />
+        <result property="teacherName" column="teacherName" />
+        <result property="category" column="category" />
+        <result property="subjects" column="subjects" />
+        <result property="className" column="className" />
+        <result property="classroom" column="classroomName" />
+    </resultMap>
+
+    <select id="getSchedules" parameterType="com.koobietech.eas.dao.dto.ScheduleDto"
+        resultMap="scheduleResultMap"  >
+        SELECT
+            s.id,
+            s.`week`,
+            s.start_time,
+            s.end_time,
+            s.room_id,
+            s.class_id,
+            s.assistant_id,
+            s.teacher_id,
+            s.category_id,
+            s.subjects_id,
+            s.create_time,
+            s.modify_time,
+            s.create_uid,
+            s.disabled,
+            uu.relname AS assistantName,
+            u.relname AS teacherName,
+            c.`name` AS category,
+            su.`name` AS subjects ,
+            cl.`name` AS classroomName,
+            cc.`name` AS className
+        FROM
+            eas_edu_schedule AS s
+            LEFT JOIN eas_sys_userinfo AS u ON u.id = s.teacher_id
+            LEFT JOIN eas_sys_userinfo AS uu ON uu.id = s.assistant_id
+            LEFT JOIN eas_edu_category AS c ON c.id = s.category_id
+            LEFT JOIN eas_edu_subjects AS su ON su.id = s.subjects_id
+            LEFT JOIN eas_edu_classroom AS cl ON cl.id = s.room_id
+            LEFT JOIN eas_edu_class AS cc ON cc.id = s.class_id
+        WHERE 1 = 1
+        <if test="week != null and week != ''">
+            AND s.week = #{week}
+        </if>
+        <if test="startTime != null and startTime != ''">
+            AND s.start_time &gt;= #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND s.end_time &lt;= #{endTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="roomId != null and roomId != 0">
+            AND s.room_id = #{roomId}
+        </if>
+        <if test="classId != null and classId != 0">
+            AND s.class_id = #{classId}
+        </if>
+        <if test="teacherId != null and teacherId != 0">
+            AND s.teacher_id = #{teacherId}
+        </if>
+        <if test="assistantId != null and assistantId != 0">
+            AND s.assistant_id = #{assistantId}
+        </if>
+        <if test="categoryId != null and categoryId != 0">
+            AND s.category_id = #{categoryId}
+        </if>
+        <if test="subjectId != null and subjectId != 0">
+            AND s.subjects_id = #{subjectId}
+        </if>
+    </select>
+</mapper>

+ 6 - 0
service/src/main/java/com/koobietech/eas/service/EasEduScheduleService.java

@@ -2,8 +2,12 @@ package com.koobietech.eas.service;
 
 
 import com.koobietech.eas.common.result.PageDataResult;
 import com.koobietech.eas.common.result.PageDataResult;
 import com.koobietech.eas.dao.dto.ConflictDto;
 import com.koobietech.eas.dao.dto.ConflictDto;
+import com.koobietech.eas.dao.dto.ScheduleDto;
+import com.koobietech.eas.dao.pojo.SchedulePojo;
 import com.koobietech.eas.mbg.model.EasEduSchedule;
 import com.koobietech.eas.mbg.model.EasEduSchedule;
 
 
+import java.util.List;
+
 public interface EasEduScheduleService {
 public interface EasEduScheduleService {
     Boolean add(EasEduSchedule schedule, int repeatTime);
     Boolean add(EasEduSchedule schedule, int repeatTime);
 
 
@@ -13,5 +17,7 @@ public interface EasEduScheduleService {
 
 
     PageDataResult query(EasEduSchedule schedule);
     PageDataResult query(EasEduSchedule schedule);
 
 
+    List<SchedulePojo> querySchedule(ScheduleDto schedule);
+
     Boolean queryConflict(ConflictDto conflictDto);
     Boolean queryConflict(ConflictDto conflictDto);
 }
 }

+ 11 - 0
service/src/main/java/com/koobietech/eas/service/impl/EasEduScheduleServiceImpl.java

@@ -2,6 +2,9 @@ package com.koobietech.eas.service.impl;
 
 
 import com.koobietech.eas.common.result.PageDataResult;
 import com.koobietech.eas.common.result.PageDataResult;
 import com.koobietech.eas.dao.dto.ConflictDto;
 import com.koobietech.eas.dao.dto.ConflictDto;
+import com.koobietech.eas.dao.dto.ScheduleDto;
+import com.koobietech.eas.dao.mapper.ScheduleMapper;
+import com.koobietech.eas.dao.pojo.SchedulePojo;
 import com.koobietech.eas.mbg.mapper.EasEduClassroomMapper;
 import com.koobietech.eas.mbg.mapper.EasEduClassroomMapper;
 import com.koobietech.eas.mbg.mapper.EasEduScheduleMapper;
 import com.koobietech.eas.mbg.mapper.EasEduScheduleMapper;
 import com.koobietech.eas.mbg.model.EasEduClassroomExample;
 import com.koobietech.eas.mbg.model.EasEduClassroomExample;
@@ -26,6 +29,9 @@ public class EasEduScheduleServiceImpl implements EasEduScheduleService {
     @Resource
     @Resource
     EasEduClassroomMapper easEduClassroomMapper;
     EasEduClassroomMapper easEduClassroomMapper;
 
 
+    @Resource
+    ScheduleMapper scheduleMapper;
+
     @Override
     @Override
     public Boolean update(EasEduSchedule schedule) {
     public Boolean update(EasEduSchedule schedule) {
         schedule.setModifyTime(new Date());
         schedule.setModifyTime(new Date());
@@ -137,6 +143,11 @@ public class EasEduScheduleServiceImpl implements EasEduScheduleService {
         return ret;
         return ret;
     }
     }
 
 
+    @Override
+    public List<SchedulePojo> querySchedule(ScheduleDto schedule) {
+        return scheduleMapper.getSchedules(schedule);
+    }
+
     @Override
     @Override
     public Boolean queryConflict(ConflictDto conflictDto) {
     public Boolean queryConflict(ConflictDto conflictDto) {