| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 会议表 前端控制器 |
| | |
| | | |
| | | private final MeetService meetService; |
| | | |
| | | @GetMapping("/page") |
| | | @PostMapping("/page") |
| | | @ApiOperation(value = "分页", notes = "分页") |
| | | public Result page(MeetQuery query) { |
| | | public Result page(@RequestBody MeetQuery query) { |
| | | return meetService.studentPage(query); |
| | | } |
| | | |
| | | @GetMapping("/classes") |
| | | @ApiOperation(value = "获取学生的班级", notes = "获取学生的班级") |
| | | public Result getStudentClasses() { |
| | | return meetService.getStudentClasses(); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "学生上课", notes = "学生上课") |
| | | public Result detail(@PathVariable("id") Integer id) { |
| | |
| | | @Data |
| | | @ApiModel(value = "Meet查询", description = "会议表查询") |
| | | public class MeetQuery extends AbsQuery { |
| | | |
| | | private List<Integer> classesIds; |
| | | private Integer teacherId; |
| | | |
| | |
| | | |
| | | /** 班级id */ |
| | | private Integer classesId; |
| | | private String classesName; |
| | | |
| | | /** 创建人 */ |
| | | private Integer createUser; |
| | | /** 老师列表 */ |
| | | private List<Integer> teacherIds; |
| | | private List<String> teacherNames; |
| | | /** 老师姓名 */ |
| | | private String teacherName; |
| | | private String teacherNamesStr; |
| | | /** 开始时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private Date startTime; |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ycl.jxkg.domain.entity.User; |
| | | import com.ycl.jxkg.domain.query.ClassesUserQuery; |
| | | import com.ycl.jxkg.domain.vo.ClassesUserVO; |
| | | import com.ycl.jxkg.domain.vo.*; |
| | | import com.ycl.jxkg.domain.form.ClassesUserForm; |
| | | import java.util.List; |
| | | |
| | | import com.ycl.jxkg.domain.vo.StudentExamInfoVO; |
| | | import com.ycl.jxkg.domain.vo.StudentVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | */ |
| | | List<Integer> getClassesByUserId(@Param("userId") Integer userId); |
| | | |
| | | List<ClassesVO> getClassesByUserId1(@Param("userId") Integer userId); |
| | | |
| | | /** |
| | | * 根据学生获取班级名称 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | Result getStudentList(Integer meetId, String keyword); |
| | | |
| | | /** |
| | | * 获取学生所在的班级 |
| | | * |
| | | * @return |
| | | */ |
| | | Result getStudentClasses(); |
| | | } |
| | |
| | | import com.ycl.jxkg.domain.entity.StudyRecord; |
| | | import com.ycl.jxkg.domain.form.MeetForm; |
| | | import com.ycl.jxkg.domain.query.MeetQuery; |
| | | import com.ycl.jxkg.domain.vo.ClassesVO; |
| | | import com.ycl.jxkg.domain.vo.MeetVO; |
| | | import com.ycl.jxkg.domain.vo.StudentSimpleVO; |
| | | import com.ycl.jxkg.enums.MeetStatusEnum; |
| | |
| | | @Override |
| | | public Result studentPage(MeetQuery query) { |
| | | Integer userId = webContext.getCurrentUser().getId(); |
| | | //查出学生所在班级 |
| | | List<Integer> classes = classesUserMapper.getClassesByUserId(userId); |
| | | if(CollectionUtils.isEmpty(classes)){ |
| | | return Result.ok("您暂未加入班级"); |
| | | if (CollectionUtils.isEmpty(query.getClassesIds())) { |
| | | //查出学生所在班级 |
| | | List<Integer> classes = classesUserMapper.getClassesByUserId(userId); |
| | | if(CollectionUtils.isEmpty(classes)){ |
| | | return Result.fail(500, "您暂未加入班级"); |
| | | } |
| | | query.setClassesIds(classes); |
| | | } |
| | | query.setClassesIds(classes); |
| | | IPage<MeetVO> page = PageUtil.getPage(query, MeetVO.class); |
| | | baseMapper.getPage(page, query); |
| | | |
| | | for (MeetVO vo : page.getRecords()) { |
| | | if (!CollectionUtils.isEmpty(vo.getTeacherNames())) { |
| | | vo.setTeacherNamesStr(vo.getTeacherNames().stream().collect(Collectors.joining("、"))); |
| | | } |
| | | } |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | |
| | |
| | | return Result.ok().data(studentList); |
| | | } |
| | | |
| | | @Override |
| | | public Result getStudentClasses() { |
| | | Integer userId = webContext.getCurrentUser().getId(); |
| | | List<ClassesVO> classes = classesUserMapper.getClassesByUserId1(userId); |
| | | return Result.ok().data(classes); |
| | | } |
| | | |
| | | /** |
| | | * 发送mq消息 |
| | | * |
| | |
| | | <select id="getClassesByUserId" resultType="java.lang.Integer"> |
| | | select classes_id |
| | | from t_classes_user |
| | | where user_id = #{userId} and deleted = 0 |
| | | where user_id = #{userId} and deleted = 0 and teacher = 0 |
| | | </select> |
| | | |
| | | <select id="getClassesByUserId1" resultType="com.ycl.jxkg.domain.vo.ClassesVO"> |
| | | select distinct tc.id, tc.class_name |
| | | from t_classes_user tcu inner join t_classes tc ON tcu.classes_id = tc.id |
| | | and tcu.user_id = #{userId} and tcu.teacher = 0 |
| | | </select> |
| | | |
| | | <select id="getClassesNameByUserId" resultType="java.lang.String"> |
| | |
| | | <result column="status" property="status" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="PageMap" type="com.ycl.jxkg.domain.vo.MeetVO"> |
| | | <result column="meet_name" property="meetName" /> |
| | | <result column="meet_cover" property="meetCover" /> |
| | | <result column="classes_id" property="classesId" /> |
| | | <result column="start_time" property="startTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="status" property="status" /> |
| | | <collection property="teacherNames" ofType="string" column="classes_id" select="getTeacherNames"></collection> |
| | | </resultMap> |
| | | |
| | | <select id="getTeacherNames" resultType="string"> |
| | | SELECT tu.real_name FROM t_user tu INNER JOIN t_classes_user tcu ON tu.id = tcu.user_id AND tcu.classes_id = #{classesId} AND tcu.teacher = 1 |
| | | </select> |
| | | |
| | | <select id="getById" resultMap="BaseResultMap"> |
| | | SELECT |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="getPage" resultType="com.ycl.jxkg.domain.vo.MeetVO"> |
| | | <select id="getPage" resultMap="PageMap"> |
| | | SELECT |
| | | TM.meet_name, |
| | | TM.meet_cover, |
| | | TM.classes_id, |
| | | TM.create_user, |
| | | TU.user_name as teacherName, |
| | | TM.start_time, |
| | | TM.end_time, |
| | | TM.status, |
| | | TM.id |
| | | FROM |
| | | t_meet TM left join t_user TU on TM.create_user = TU.id |
| | | t_meet TM |
| | | <where> |
| | | TM.deleted = 0 |
| | | <if test="query.classesIds !=null"> |