浏览代码

排课查询 完毕

wuheng 1 年之前
父节点
当前提交
13f122b5c1

+ 7 - 0
controller/src/main/java/com/koobietech/eas/controller/EasSysStuProfileController.java

@@ -80,4 +80,11 @@ public class EasSysStuProfileController {
         return JsonResult.data(res);
     }
 
+    @GetMapping("/getStudentByKeyword")
+    @Operation(summary = "查询所有学员信息", description = "查询所有学员信息根据关键词")
+    public JsonResult getStudentByKeyword(@RequestParam(value = "", required = true) String keyword){
+        List<EasSysStudent> res = easStuProfileService.getStudentByKeyword(keyword);
+        return JsonResult.data(res);
+    }
+
 }

+ 4 - 1
dao/src/main/resources/com/koobietech/eas/dao/mapper/ScheduleMapper.xml

@@ -56,7 +56,7 @@
             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
+        WHERE s.disabled = 'N'
         <if test="week != null and week != ''">
             AND s.week = #{week}
         </if>
@@ -84,5 +84,8 @@
         <if test="subjectId != null and subjectId != 0">
             AND s.subjects_id = #{subjectId}
         </if>
+        <if test="studentId != null and studentId != 0">
+            AND s.class_id IN ( SELECT class_id FROM eas_edu_clt_relation WHERE student_id = #{studentId} )
+        </if>
     </select>
 </mapper>

+ 2 - 0
service/src/main/java/com/koobietech/eas/service/EasStuProfileService.java

@@ -22,4 +22,6 @@ public interface EasStuProfileService {
     boolean importExcel(InputStream inputStream);
 
     List<EasSysStudent> getAll();
+
+    List<EasSysStudent> getStudentByKeyword(String keyword);
 }

+ 18 - 4
service/src/main/java/com/koobietech/eas/service/impl/EasStuProfileServiceImpl.java

@@ -16,10 +16,7 @@ import com.koobietech.eas.dao.dto.EasArcTlsStudentsDto;
 import com.koobietech.eas.mbg.mapper.EasArcArchivesMapper;
 import com.koobietech.eas.mbg.mapper.EasArcTlsStudentsMapper;
 import com.koobietech.eas.mbg.mapper.EasSysStudentMapper;
-import com.koobietech.eas.mbg.model.EasArcArchives;
-import com.koobietech.eas.mbg.model.EasArcTlsStudents;
-import com.koobietech.eas.mbg.model.EasArcTlsStudentsExample;
-import com.koobietech.eas.mbg.model.EasSysStudent;
+import com.koobietech.eas.mbg.model.*;
 import com.koobietech.eas.service.EasArchivesFilesService;
 import com.koobietech.eas.service.EasStuProfileService;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -179,6 +176,23 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
         return easSysStudentMapper.selectByExample(null);
     }
 
+    @Override
+    public List<EasSysStudent> getStudentByKeyword(String keyword) {
+        EasSysStudentExample easSysStudentExample = new EasSysStudentExample();
+        EasSysStudentExample.Criteria criteria = easSysStudentExample.createCriteria();
+        criteria.andStudentNameLike("%" + keyword + "%");
+        EasSysStudentExample.Criteria criteria1 = easSysStudentExample.createCriteria();
+        criteria1.andStudentNumberLike("%" + keyword + "%");
+        easSysStudentExample.or(criteria1);
+        EasSysStudentExample.Criteria criteria2 = easSysStudentExample.createCriteria();
+        criteria2.andPhoneLike("%" + keyword + "%");
+        easSysStudentExample.or(criteria2);
+        EasSysStudentExample.Criteria criteria3 = easSysStudentExample.createCriteria();
+        criteria3.andIdEqualTo( Long.valueOf(keyword) );
+        easSysStudentExample.or(criteria3);
+        return easSysStudentMapper.selectByExample(easSysStudentExample);
+    }
+
     private Map<String, Object> generateDataMap(EasArcTlsStudents easArcTlsStudents, String studentNumber) {
         Map<String, Object> map = new HashMap<>();
         map.put("student_name", easArcTlsStudents.getStudentName());