| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.education.business.mapper.education.StudentInfoMapper">
- <!-- 学员列表 -->
- <select id="selectPageList" resultType="studentInfoDto">
- select student.*, grade.name grade_name from student_info student left join grade_info grade
- on student.grade_info_id = grade.id
- <where>
- <if test="studentInfo.gradeInfoId != null">
- and student.grade_info_id = #{studentInfo.gradeInfoId}
- </if>
- <if test="studentInfo.name != null and studentInfo.name != ''">
- <bind name="name" value="'%' + studentInfo.name + '%'"/>
- and student.name like #{name} or student.mobile like #{name}
- </if>
- </where>
- order by student.id desc
- </select>
- <select id="selectById" resultType="com.education.model.dto.StudentInfoDto">
- SELECT
- si.*,
- CONCAT(
- ROUND(
- (
- SELECT COUNT(DISTINCT sgi.goal_info_id)
- FROM stu_goal_info sgi
- WHERE sgi.student_id = si.id AND sgi.correct_status >= 2
- ) / NULLIF(
- (
- SELECT COUNT( gi.id)
- FROM student_course_collect scc
- JOIN goal_info gi ON scc.course_id = gi.course_id
- WHERE scc.student_id = si.id AND gi.publish_flag = 1
- ), 0
- ) * 100, 2
- ), '%'
- ) AS progress
- FROM
- student_info si
- WHERE
- si.id = #{id}
- </select>
- <!-- 提醒列表 -->
- <select id="selectStudentRemindList" resultType="goalInfo">
- SELECT
- goal.*
- FROM
- goal_info goal
- WHERE
- goal.publish_flag >0 AND (
- NOT EXISTS ( SELECT 1 FROM stu_goal_info sgi WHERE sgi.student_id = #{studentId} AND sgi.goal_info_id = goal.id )
- OR (
- EXISTS ( SELECT 1 FROM stu_goal_info sg WHERE sg.student_id = #{studentId} AND sg.goal_info_id = goal.id AND sg.correct_status < 2 )
- AND NOT EXISTS ( SELECT 1 FROM stu_goal_info si WHERE si.student_id = #{studentId} AND si.goal_info_id = goal.id AND si.correct_status >= 2 )))
- ORDER BY goal.id
- </select>
- <!-- 学习记录列表 -->
- <select id="selectStudyHistoryPageList" resultType="com.education.model.dto.StuGoalInfoDto">
- select student.student_id as studentId, student.create_date as createDate,
- student.goal_info_id as goalInfoId, course.id as courseId, course.name as courseName,
- goal.g_oriented as goalContent
- from stu_goal_info student
- left join goal_info goal on student.goal_info_id = goal.id
- left join course_info course on goal.course_id = course.id
- <where>
- <if test="stuGoalInfoDto.studentId != null">
- and student.student_id = #{stuGoalInfoDto.studentId}
- </if>
- <if test="stuGoalInfoDto.goalInfoId != null">
- and goal.id = #{stuGoalInfoDto.goalInfoId}
- </if>
- <if test="stuGoalInfoDto.createDate != null and stuGoalInfoDto.createDate != ''">
- AND student.create_date BETWEEN #{stuGoalInfoDto.startDate} AND #{stuGoalInfoDto.endDate}
- </if>
- </where>
- order by student.goal_info_id
- </select>
- </mapper>
|