瀏覽代碼

增加查询,不存在某种类型班级的学生

周箭河 5 年之前
父節點
當前提交
ddb780bed7

+ 18 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
@@ -101,7 +102,7 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
      * @param classGroupId
      * @return
      */
-    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId,@Param("status") String status);
+    ClassGroupStudentMapper findClassStudentMapperByUserIdAndClassGroupId(@Param("userId") Integer userId, @Param("classGroupId") Integer classGroupId, @Param("status") String status);
 
     /**
      * @param classGroupIds: 班级编号列表
@@ -172,33 +173,42 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
     Integer countClassGroupStudentNum(@Param("classGroupId") Integer classGroupId);
 
     /**
+     * @param classGroupId: 班级编号
+     * @param userIds:      学生编号
+     * @return java.lang.Integer
      * @describe 统计指定班级的重复人数
      * @author Joburgess
      * @date 2019/11/22
-     * @param classGroupId: 班级编号
-     * @param userIds: 学生编号
-     * @return java.lang.Integer
      */
     Integer countClassGroupExitStudentNum(@Param("classGroupId") Integer classGroupId,
                                           @Param("userIds") List<Integer> userIds);
 
     /**
+     * @param userId:    用户编号
+     * @param groupType: 乐团编号
+     * @return java.lang.Integer
      * @describe 统计用户对应加入乐团/小课/试听课的数量
      * @author Joburgess
      * @date 2019/11/29
-     * @param userId: 用户编号
-     * @param groupType: 乐团编号
-     * @return java.lang.Integer
      */
     Integer countUserGroups(@Param("userId") Integer userId,
                             @Param("groupType") String groupType);
 
     /**
      * 查询学生所在的班级编号
+     *
      * @param musicGroupId
      * @param userId
      * @param groupTpye
      * @return
      */
-	List<Integer> queryClassGroupIdList(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId, @Param("groupType") GroupType groupType);
+    List<Integer> queryClassGroupIdList(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId, @Param("groupType") GroupType groupType);
+
+    /**
+     * 查询乐团某种类型班级的学生
+     * @param musicGroupId
+     * @param classGroupType
+     * @return
+     */
+    List<ClassGroupStudentMapper> findMusicGroupClassGroupByType(@Param("musicGroupId") String musicGroupId, @Param("classGroupType") ClassGroupTypeEnum classGroupType);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -9,6 +9,7 @@ import java.util.Set;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -228,4 +229,13 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	StudentRegistration queryUserByPhone(String mobile);
+
+	/**
+	 * 获取没有某种班级类型的学生
+	 * @param musicGroupId
+	 * @param type
+	 * @param subjectId
+	 * @return
+	 */
+	List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer subjectId);
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -774,4 +774,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentRegistration queryUserByPhone(String mobile) {
         return studentRegistrationDao.queryUserByPhone(mobile);
     }
+
+    @Override
+    public List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer subjectId) {
+        List<StudentRegistration> students = studentRegistrationDao.findMusicGroupStudent(musicGroupId, subjectId);
+        List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findMusicGroupClassGroupByType(musicGroupId, type);
+        for (StudentRegistration student : students) {
+            for (ClassGroupStudentMapper classGroupStudentMapper : classGroupStudentMappers) {
+                if(classGroupStudentMapper.getUserId().equals(student.getUserId())){
+                    students.remove(student);
+                }
+            }
+        }
+        return null;
+    }
 }

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

@@ -240,4 +240,10 @@
     <select id="queryClassGroupIdList" resultType="int" parameterType="map">
       SELECT distinct class_group_id_ FROM class_group_student_mapper WHERE user_id_=#{userId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND music_group_id_ = #{musicGroupId}
     </select>
+
+    <select id="findMusicGroupClassGroupByType" resultMap="ClassGroupStudentMapper">
+        SELECT  cgsm.* FROM  class_group_student_mapper cgsm
+        LEFT JOIN class_group cg on cgsm.class_group_id_ = cg.id_
+        WHERE cgsm.music_group_id_ = #{musicGroupId} AND cg.group_type_ ='MUSIC' AND cg.type_=#{classGroupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND cg.del_flag_='0' AND cgsm.status_='NORMAL'
+    </select>
 </mapper>

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -123,4 +124,14 @@ public class StudentRegistrationController extends BaseController {
         return succeed(studentRegistrationService.openPayment(ids));
     }
 
+    @ApiOperation(value = "获取乐团(声部)的(没有某种班级类型)学生")
+    @GetMapping("/getMusicGroupStuNoClassType")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getMusicGroupStuNoClassType')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "类型(MIX,HIGH)", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "ClassGroupTypeEnum")})
+    public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer actualSubjectId) {
+        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type,actualSubjectId));
+    }
+
 }