Browse Source

Merge branch 'master' of https://e.coding.net/chuanghaikeji/smarCampus/iHotel_student_houtai

liu 1 year ago
parent
commit
a50277d08a

+ 1 - 1
src/main/java/com/template/api/ClassScheduleAPI.java

@@ -18,7 +18,7 @@ public interface ClassScheduleAPI {
 
     @GetMapping("/downloadSchedule")
     @ApiOperation(value = "导出课表", notes = "导出课表", httpMethod = "GET")
-    void downloadSchedule(String stateTime, String endTime, String teacherName, HttpServletResponse response);
+    void downloadSchedule(String stateTime, String endTime, String teacherName,String jsgh, HttpServletResponse response);
 
     @PostMapping("/uploadSchedule")
     @ApiOperation(value = "导入课表", notes = "导入课表", httpMethod = "POST")

+ 3 - 9
src/main/java/com/template/controller/ClassScheduleController.java

@@ -17,6 +17,7 @@ import com.template.model.vo.ClassListVo;
 import com.template.model.vo.ClassScheduleExportVo;
 import com.template.model.vo.ScheduleVo;
 import com.template.services.ClassScheduleService;
+import com.template.services.OrganizationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -104,7 +105,7 @@ public class ClassScheduleController implements ClassScheduleAPI {
     }
 
     @Override
-    public void downloadSchedule(String stateTime, String endTime, String teacherName, HttpServletResponse response) {
+    public void downloadSchedule(String stateTime, String endTime, String teacherName,String jsgh, HttpServletResponse response) {
         DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         if (ObjectUtils.isEmpty(stateTime) && ObjectUtils.isEmpty(endTime)) {
@@ -122,14 +123,7 @@ public class ClassScheduleController implements ClassScheduleAPI {
         }
 
 
-        LocalDate date = LocalDate.parse(stateTime, dateTimeFormatter2);
-        LocalDate end = LocalDate.parse(endTime, dateTimeFormatter2);
-        QueryWrapper<ClassSchedule> qw = new QueryWrapper<>();
-        qw.between("date_time",stateTime,endTime);
-        if(teacherName!=null){
-            qw.like("jsxm",teacherName);
-        }
-        List<ClassSchedule> classSchedulesList= classScheduleService.list(qw);
+        List<ClassSchedule> classSchedulesList= classScheduleService.listByTime(stateTime,endTime,teacherName,jsgh);
         List<ClassScheduleExportVo> exportVoList=new ArrayList<>();
         for(ClassSchedule classSchedule:classSchedulesList){
             ClassScheduleExportVo classScheduleExportVo=JSON.parseObject(JSON.toJSONString(classSchedule), ClassScheduleExportVo.class);

+ 22 - 0
src/main/java/com/template/mapper/ClassScheduleMapper.java

@@ -44,4 +44,26 @@ public interface ClassScheduleMapper extends BaseMapper<ClassSchedule> {
             "</script>"
     })
     List<ClassSchedule> listVo(String teacherName, String jsgh, LocalDate dateTime);
+
+    @Select({"<script>"+
+            "select cs.*,o.name as orginizationName from class_schedule cs " +
+            "   left join users u on cs.jsgh=u.card_number and u.deleted=0" +
+            "   left join organization o on o.id=u.organ_id " +
+            "where"+
+            "   cs.deleted=0" +
+            "   <if test=\"stateTime != null and stateTime != ''\">" +
+            "       and cs.date_time >=  #{stateTime} " +
+            "   </if>" +
+            "   <if test=\"endTime != null and endTime != ''\">" +
+            "       and #{endTime}>=cs.date_time " +
+            "   </if>" +
+            "   <if test=\"teacherName != null and teacherName != ''\">" +
+            "       and cs.jsxm like '%' #{teacherName} '%'" +
+            "   </if>" +
+            "   <if test=\"jsgh != null and jsgh != ''\">" +
+            "       and cs.jsgh = #{jsgh}\n" +
+            "   </if>"+
+            "</script>"
+    })
+    List<ClassSchedule> listByTime(String stateTime, String endTime, String teacherName, String jsgh);
 }

+ 4 - 1
src/main/java/com/template/model/vo/ClassScheduleExportVo.java

@@ -24,7 +24,10 @@ import java.io.Serializable;
 public class ClassScheduleExportVo {
 
     @ExcelIgnore
-    private Integer id;
+    private String id;
+
+    @ExcelProperty(value = "学院名称" , index = 9)
+    private String orginizationName;
 
     @ColumnWidth(11)
     @ExcelProperty(value = "节次" , index = 8)

+ 2 - 0
src/main/java/com/template/services/ClassScheduleService.java

@@ -5,6 +5,7 @@ import com.template.model.pojo.ClassSchedule;
 import com.template.model.vo.ClassListVo;
 
 import java.time.LocalDate;
+import java.util.List;
 
 /**
  * <p>
@@ -21,4 +22,5 @@ public interface ClassScheduleService extends IService<ClassSchedule> {
     int removeByRemark(String remark);
 
 
+    List<ClassSchedule> listByTime(String stateTime, String endTime, String teacherName, String jsgh);
 }

+ 13 - 0
src/main/java/com/template/services/impl/ClassScheduleServiceImpl.java

@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDate;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -47,5 +48,17 @@ public class ClassScheduleServiceImpl extends ServiceImpl<ClassScheduleMapper, C
         return classScheduleMapper.removeByRemark(remark);
     }
 
+    /**
+     * @param stateTime
+     * @param endTime
+     * @param teacherName
+     * @param jsgh
+     * @return
+     */
+    @Override
+    public List<ClassSchedule> listByTime(String stateTime, String endTime, String teacherName, String jsgh) {
+        return classScheduleMapper.listByTime(stateTime,endTime,teacherName,jsgh);
+    }
+
 
 }