Przeglądaj źródła

增加查询班级学生接口

周箭河 5 lat temu
rodzic
commit
af16f09d88

+ 14 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -3,6 +3,8 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
 import com.ym.mec.biz.dal.dto.TeacherClassStudentDto;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
@@ -91,6 +93,7 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
 
     /**
      * 查找班级学生对应关系
+     *
      * @param userId
      * @param classGroupId
      * @return
@@ -98,11 +101,20 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
     ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId);
 
     /**
+     * @param classGroupIds: 班级编号列表
+     * @return java.util.List<com.ym.mec.biz.dal.entity.ClassGroupStudentMapper>
      * @describe 根据班级获取学员
      * @author Joburgess
      * @date 2019/10/24
-     * @param classGroupIds: 班级编号列表
-     * @return java.util.List<com.ym.mec.biz.dal.entity.ClassGroupStudentMapper>
      */
     List<ClassGroupStudentMapper> findByClassGroups(@Param("classGroupIds") List<Integer> classGroupIds);
+
+
+    /**
+     * 查询班级某状态下所有的学生
+     * @param classGroupId
+     * @param status
+     * @return
+     */
+    List<StudentRegistration> findClassStudentList(@Param("classGroupId") Integer classGroupId, @Param("status") ClassGroupStudentStatusEnum status);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupStudentMapperService.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.common.service.BaseService;
 
 import org.apache.ibatis.annotations.Param;
@@ -24,4 +26,13 @@ public interface ClassGroupStudentMapperService extends BaseService<Long, ClassG
      * @return
      */
     boolean delClassGroupStudent(Integer userId, Integer classGroupId) throws Exception;
+
+
+    /**
+     * 查询班级某状态下所有的学生
+     * @param classGroupId
+     * @param status
+     * @return
+     */
+    List<StudentRegistration> findClassStudentList(Integer classGroupId, ClassGroupStudentStatusEnum status);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -60,4 +60,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         courseScheduleStudentPaymentService.deleteStudentCourseSchedule(userId, courseScheduleList);
         return true;
     }
+
+    @Override
+    public List<StudentRegistration> findClassStudentList(Integer classGroupId, ClassGroupStudentStatusEnum status) {
+        return classGroupStudentMapperDao.findClassStudentList(classGroupId,status);
+    }
 }

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -8,6 +8,7 @@
 
     <resultMap type="com.ym.mec.biz.dal.entity.ClassGroupStudentMapper" id="ClassGroupStudentMapper">
         <result column="id_" property="id"/>
+        <result column="music_group_id_" property="musicGroupId">
         <result column="class_group_id_" property="classGroupId"/>
         <result column="user_id_" property="userId"/>
         <result column="create_time_" property="createTime"/>
@@ -151,4 +152,11 @@
             #{classGroupId}
         </foreach>
     </select>
+
+    <!-- 查询班级某状态的所有学生 -->
+    <select id="findClassStudentList" resultMap="com.ym.mec.biz.dal.dao.StudentRegistrationDao.StudentRegistration">
+        SELECT sr.* FROM class_group_student_mapper cgsm
+        LEFT JOIN student_registration sr ON (sr.user_id_ = cgsm.user_id_ AND sr.music_group_id_ = cgsm.music_group_id_)
+        WHERE cgsm.class_group_id_ = #{classGroupId} AND cgsm.status_ = #{status}
+    </select>
 </mapper>

+ 13 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupStudentController.java

@@ -1,9 +1,12 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.service.ClassGroupStudentMapperService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -23,8 +26,18 @@ public class ClassGroupStudentController extends BaseController {
     @ApiOperation(value = "删除班级学生")
     @PostMapping("/del")
     @PreAuthorize("@pcs.hasPermissions('classGroupStudent/del')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户id", required = true, dataType = "int"),
+            @ApiImplicitParam(name = "classGroupId", value = "班级id", required = true, dataType = "int")})
     public HttpResponseResult del(Integer userId, Integer classGroupId) throws Exception {
         return succeed(classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId));
     }
 
+    @ApiOperation(value = "查询班级所有学生")
+    @PostMapping("/findAllStudent")
+    @PreAuthorize("@pcs.hasPermissions('classGroupStudent/findAllStudent')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "classGroupId", value = "班级id", required = true, dataType = "int")})
+    public HttpResponseResult findAllStudent(Integer classGroupId) throws Exception {
+        return succeed(classGroupStudentMapperService.findClassStudentList(classGroupId, ClassGroupStudentStatusEnum.NORMAL));
+    }
+
 }