| | |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="coursePeriod" column="course_period" /> |
| | | <result property="courseName" column="course_name" /> |
| | | <result property="companyName" column="company_name" /> |
| | | <result property="studentCount" column="student_count" /> |
| | | <result property="finishCount" column="finish_count" /> |
| | | <association property="coursePeriod" javaType="java.lang.Long" select="getCoursePeriod" column="{courseId=course_id}"/> |
| | | <association property="finishCount" javaType="java.lang.Integer" select="getFinishStudentCount" column="{courseId=course_id,phaseId=id}"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCoursePhaseVo"> |
| | | select a.id, a.name, a.code, a.company_id, a.course_id,a.level,a.del_flag,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.period as course_period |
| | | select a.id, a.name, a.code, a.company_id, a.course_id,a.level,a.del_flag,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as course_name |
| | | from ex_course_phase a |
| | | left join ex_course b on b.id=a.course_id |
| | | </sql> |
| | |
| | | </update> |
| | | |
| | | <select id="selectCoursePhaseList" resultMap="ExCoursePhaseResult"> |
| | | <include refid="selectCoursePhaseVo"/> |
| | | select a.id, a.name, a.code, a.company_id, a.course_id,a.level,a.del_flag,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, |
| | | b.name as course_name,c.name as company_name, |
| | | (select count(1) from ex_phase_student where phase_id=a.id) as student_count |
| | | from ex_course_phase a |
| | | left join ex_course b on b.id=a.course_id |
| | | left join sys_company c on c.id=a.company_id |
| | | <where> |
| | | and a.del_flag=0 |
| | | <if test="name != null and name != ''"> |
| | |
| | | </if> |
| | | <if test="courseId != null and courseId != ''"> |
| | | AND a.course_id =#{courseId} |
| | | </if> |
| | | <if test="level != null"> |
| | | AND a.level =#{level} |
| | | </if> |
| | | </where> |
| | | order by a.create_time desc |
| | |
| | | </select> |
| | | |
| | | <select id="selectCountByCourseId" resultType="java.lang.Integer"> |
| | | select count(1) from ex_course_phase where del_flag=0 and courde_id=#{courseId} |
| | | select count(1) from ex_course_phase where del_flag=0 and course_id=#{courseId} |
| | | </select> |
| | | |
| | | <select id="getCoursePeriod" resultType="java.lang.Long"> |
| | | select sum(b.resource_length) from ex_course_chapter_period a |
| | | inner join ex_resource b on a.resource_id=b.id |
| | | where a.course_id=#{courseId} |
| | | </select> |
| | | |
| | | <select id="getFinishStudentCount" resultType="java.lang.Integer"> |
| | | select count(1) from (select student_id,count(1) as study_count from ex_student_study where phase_id=#{phaseId} group by student_id) as a |
| | | where a.study_count=(select count(1) as period_count from ex_course_chapter_period where course_id=#{courseId}) |
| | | </select> |
| | | </mapper> |