|
@@ -5,103 +5,99 @@
|
|
|
不要修改此文件。所有改动将在下次重新自动生成时丢失。
|
|
|
-->
|
|
|
<mapper namespace="com.ym.mec.biz.dal.dao.DemoGroupDao">
|
|
|
-
|
|
|
- <resultMap type="com.ym.mec.biz.dal.entity.DemoGroup" id="DemoGroup">
|
|
|
- <result column="id_" property="id"/>
|
|
|
- <result column="name_" property="name"/>
|
|
|
- <result column="single_class_minutes_" property="singleClassMinutes"/>
|
|
|
- <result column="organ_id_list_" property="organIdList"/>
|
|
|
- <result column="create_time_" property="createTime"/>
|
|
|
- <result column="update_time_" property="updateTime"/>
|
|
|
- <result column="user_id_" property="userId"/>
|
|
|
- <result column="price_" property="price"/>
|
|
|
- <result column="subject_id_" property="subjectId"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <resultMap id="studentDemoGroupListDto" type="com.ym.mec.biz.dal.dto.StudentDemoGroupListDto">
|
|
|
- <result property="demoGroupId" column="demo_group_id_"/>
|
|
|
- <result property="userId" column="user_id_"/>
|
|
|
- <result property="userName" column="username_"/>
|
|
|
- <result property="avatar" column="avatar_"/>
|
|
|
- <result property="introduction" column="introduction_"/>
|
|
|
- <result property="numberOfClasses" column="number_of_classes_"/>
|
|
|
- <result property="subjectName" column="subject_name_"/>
|
|
|
- <collection property="coursesPlans"
|
|
|
- resultMap="com.ym.mec.biz.dal.dao.DemoGroupCoursesPlanDao.DemoGroupCoursesPlan" column="dgcp.id_"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <select id="get" resultMap="DemoGroup">
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.entity.DemoGroup" id="DemoGroup">
|
|
|
+ <result column="id_" property="id" />
|
|
|
+ <result column="name_" property="name" />
|
|
|
+ <result column="single_class_minutes_" property="singleClassMinutes" />
|
|
|
+ <result column="organ_id_list_" property="organIdList" />
|
|
|
+ <result column="create_time_" property="createTime" />
|
|
|
+ <result column="update_time_" property="updateTime" />
|
|
|
+ <result column="user_id_" property="userId" />
|
|
|
+ <result column="price_" property="price"/>
|
|
|
+ <result column="subject_id_" property="subjectId"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="studentDemoGroupListDto" type="com.ym.mec.biz.dal.dto.StudentDemoGroupListDto">
|
|
|
+ <result property="demoGroupId" column="demo_group_id_"/>
|
|
|
+ <result property="userId" column="user_id_"/>
|
|
|
+ <result property="userName" column="username_"/>
|
|
|
+ <result property="avatar" column="avatar_"/>
|
|
|
+ <result property="introduction" column="introduction_"/>
|
|
|
+ <result property="numberOfClasses" column="number_of_classes_"/>
|
|
|
+ <result property="subjectName" column="subject_name_"/>
|
|
|
+ <collection property="coursesPlans" resultMap="com.ym.mec.biz.dal.dao.DemoGroupCoursesPlanDao.DemoGroupCoursesPlan" column="dgcp.id_"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <select id="get" resultMap="DemoGroup" >
|
|
|
SELECT * FROM demo_group WHERE id_ = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
- <!-- 全查询 -->
|
|
|
- <select id="findAll" resultMap="DemoGroup">
|
|
|
+
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="DemoGroup">
|
|
|
SELECT * FROM demo_group ORDER BY id_
|
|
|
</select>
|
|
|
-
|
|
|
- <!-- 向数据库增加一条记录 -->
|
|
|
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.DemoGroup" useGeneratedKeys="true" keyColumn="id"
|
|
|
- keyProperty="id">
|
|
|
- <!--
|
|
|
- <selectKey resultClass="int" keyProperty="id" >
|
|
|
- SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
- </selectKey>
|
|
|
- -->
|
|
|
- INSERT INTO demo_group
|
|
|
- (id_,name_,single_class_minutes_,organ_id_list_,create_time_,update_time_,user_id_,price_,subject_id_)
|
|
|
- VALUES(#{id},#{name},#{singleClassMinutes},#{organIdList},#{createTime},#{updateTime},#{userId},#{price},#{subjectId})
|
|
|
- </insert>
|
|
|
-
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.DemoGroup">
|
|
|
- UPDATE demo_group
|
|
|
- <set>
|
|
|
- <if test="userId != null">
|
|
|
- user_id_ = #{userId},
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">
|
|
|
- update_time_ = #{updateTime},
|
|
|
- </if>
|
|
|
- <if test="singleClassMinutes != null">
|
|
|
- single_class_minutes_ = #{singleClassMinutes},
|
|
|
- </if>
|
|
|
- <if test="organIdList != null">
|
|
|
- organ_id_list_ = #{organIdList},
|
|
|
- </if>
|
|
|
- <if test="name != null">
|
|
|
- name_ = #{name},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- create_time_ = #{createTime},
|
|
|
- </if>
|
|
|
- <if test="price != null">
|
|
|
- price_ = #{price},
|
|
|
- </if>
|
|
|
- <if test="subjectId != null">
|
|
|
- subject_id_ = #{subjectId},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- WHERE id_ = #{id}
|
|
|
- </update>
|
|
|
-
|
|
|
- <!-- 根据主键删除一条记录 -->
|
|
|
- <delete id="delete">
|
|
|
+
|
|
|
+ <!-- 向数据库增加一条记录 -->
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.DemoGroup" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ <!--
|
|
|
+ <selectKey resultClass="int" keyProperty="id" >
|
|
|
+ SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
+ </selectKey>
|
|
|
+ -->
|
|
|
+ INSERT INTO demo_group (id_,name_,single_class_minutes_,organ_id_list_,create_time_,update_time_,user_id_,price_,subject_id_) VALUES(#{id},#{name},#{singleClassMinutes},#{organIdList},#{createTime},#{updateTime},#{userId},#{price},#{subjectId})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.DemoGroup">
|
|
|
+ UPDATE demo_group <set>
|
|
|
+<if test="userId != null">
|
|
|
+user_id_ = #{userId},
|
|
|
+</if>
|
|
|
+<if test="id != null">
|
|
|
+id_ = #{id},
|
|
|
+</if>
|
|
|
+<if test="updateTime != null">
|
|
|
+update_time_ = #{updateTime},
|
|
|
+</if>
|
|
|
+<if test="singleClassMinutes != null">
|
|
|
+single_class_minutes_ = #{singleClassMinutes},
|
|
|
+</if>
|
|
|
+<if test="organIdList != null">
|
|
|
+organ_id_list_ = #{organIdList},
|
|
|
+</if>
|
|
|
+<if test="name != null">
|
|
|
+name_ = #{name},
|
|
|
+</if>
|
|
|
+<if test="createTime != null">
|
|
|
+create_time_ = #{createTime},
|
|
|
+</if>
|
|
|
+ <if test="price != null">
|
|
|
+ price_ = #{price},
|
|
|
+ </if>
|
|
|
+ <if test="subjectId != null">
|
|
|
+ subject_id_ = #{subjectId},
|
|
|
+ </if>
|
|
|
+</set> WHERE id_ = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键删除一条记录 -->
|
|
|
+ <delete id="delete" >
|
|
|
DELETE FROM demo_group WHERE id_ = #{id}
|
|
|
</delete>
|
|
|
-
|
|
|
- <!-- 分页查询 -->
|
|
|
- <select id="queryPage" resultMap="DemoGroup" parameterType="map">
|
|
|
- SELECT * FROM demo_group ORDER BY id_
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 查询当前表的总记录数 -->
|
|
|
- <select id="queryCount" resultType="int">
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="DemoGroup" parameterType="map">
|
|
|
+ SELECT * FROM demo_group ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
SELECT COUNT(*) FROM demo_group
|
|
|
</select>
|
|
|
|
|
|
- <select id="organIdListByDemoGroupId" resultType="int">
|
|
|
+ <select id="organIdListByDemoGroupId" resultType="int">
|
|
|
SELECT
|
|
|
su.organ_id_
|
|
|
FROM
|
|
@@ -110,25 +106,38 @@
|
|
|
LEFT JOIN sys_user su ON cgsm.user_id_=su.id_
|
|
|
WHERE dgcgm.demo_group_id_=#{demoGroupId}
|
|
|
</select>
|
|
|
- <select id="getOrganIdByUserId" resultType="java.lang.Integer">
|
|
|
+ <select id="getOrganIdByUserId" resultType="java.lang.Integer">
|
|
|
select organ_id_ from sys_user where id_=#{userId}
|
|
|
</select>
|
|
|
- <select id="createCourseScheduleByDemoGroup" parameterType="com.ym.mec.biz.dal.entity.DemoGroup"
|
|
|
- resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">
|
|
|
+ <select id="createCourseSchedulesByDemoGroup" parameterType="com.ym.mec.biz.dal.entity.DemoGroup" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">
|
|
|
+ SELECT
|
|
|
+ #{classGroupId} class_group_id_,
|
|
|
+ 'NOT_START' status_,
|
|
|
+ DATE_FORMAT(dgcp.courses_start_time_,'%Y-%m-%d') class_date_,
|
|
|
+ dgcp.courses_start_time_ start_class_time_,
|
|
|
+ DATE_ADD(dgcp.courses_start_time_,INTERVAL #{demoGroup.singleClassMinutes} MINUTE) end_class_time_,
|
|
|
+ #{demoGroup.userId} teacher_id_,
|
|
|
+ 'ONLINE' teach_mode_,
|
|
|
+ 'demo' type_
|
|
|
+ FROM
|
|
|
+ demo_group_courses_plan dgcp
|
|
|
+ WHERE dgcp.demo_group_id_=#{demoGroup.id} AND dgcp.courses_start_time_ = #{startTime}
|
|
|
+ </select>
|
|
|
+ <select id="createCourseScheduleByDemoGroupPlan" parameterType="com.ym.mec.biz.dal.entity.DemoGroup" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">
|
|
|
SELECT
|
|
|
#{classGroupId} class_group_id_,
|
|
|
'NOT_START' status_,
|
|
|
- DATE_FORMAT(dgcp.start_time_,'%Y-%m-%d') class_date_,
|
|
|
- dgcp.start_time_ start_class_time_,
|
|
|
- DATE_ADD(dgcp.start_time_,INTERVAL #{demoGroup.singleClassMinutes} MINUTE) end_class_time_,
|
|
|
+ dgcp.course_date_ class_date_,
|
|
|
+ CONCAT(dgcp.course_date_,' ',dgcp.start_time_) start_class_time_,
|
|
|
+ DATE_ADD( CONCAT(dgcp.course_date_,' ',dgcp.start_time_),INTERVAL #{demoGroup.singleClassMinutes} MINUTE) end_class_time_,
|
|
|
#{demoGroup.userId} teacher_id_,
|
|
|
'ONLINE' teach_mode_,
|
|
|
'demo' type_
|
|
|
FROM
|
|
|
demo_group_courses_plan dgcp
|
|
|
- WHERE dgcp.demo_group_id_=#{demoGroup.id} AND dgcp.start_time_ = #{startTime}
|
|
|
+ WHERE dgcp.id_=#{coursePlanId}
|
|
|
</select>
|
|
|
- <select id="countDemoGroupStudents" resultType="java.lang.Integer">
|
|
|
+ <select id="countDemoGroupStudents" resultType="java.lang.Integer">
|
|
|
SELECT
|
|
|
count(cgsm.user_id_)
|
|
|
FROM
|
|
@@ -137,55 +146,55 @@
|
|
|
WHERE dgcgm.demo_group_id_=#{demoGroupId}
|
|
|
</select>
|
|
|
|
|
|
- <sql id="demoGroupQueryCondition">
|
|
|
- <where>
|
|
|
- dgcp.status_=0
|
|
|
- <if test="search!=null">
|
|
|
- AND su.username_ like concat('%',#{search},'%')
|
|
|
- </if>
|
|
|
- <if test="subjectIds!=null and subjectIds!=''">
|
|
|
- AND FIND_IN_SET(dg.subject_id_,#{subjectIds})
|
|
|
- </if>
|
|
|
- <if test="startTime!=null and endTime==null">
|
|
|
- AND dgcp.start_time_=#{startTime}
|
|
|
- </if>
|
|
|
- <if test="startTime!=null and endTime!=null">
|
|
|
- AND dgcp.start_time_>=#{startTime} AND dgcp.start_time_ <= #{endTime}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
-
|
|
|
- <select id="findDemoGroupList" resultMap="studentDemoGroupListDto">
|
|
|
- SELECT
|
|
|
- dg.id_ demo_group_id_,
|
|
|
- su.username_,
|
|
|
- su.avatar_,
|
|
|
- t.introduction_,
|
|
|
- s.name_ subject_name_,
|
|
|
- COUNT(dgcgm.class_group_id_) number_of_classes_,
|
|
|
- dgcp.*
|
|
|
- FROM
|
|
|
- demo_group dg
|
|
|
- LEFT JOIN demo_group_courses_plan dgcp ON dg.id_=dgcp.demo_group_id_
|
|
|
- LEFT JOIN teacher t ON dg.user_id_=t.id_
|
|
|
- LEFT JOIN sys_user su ON dg.user_id_=su.id_
|
|
|
- LEFT JOIN `subject` s ON dg.subject_id_=s.id_
|
|
|
- LEFT JOIN demo_group_class_group_mapper dgcgm ON dg.id_=dgcgm.demo_group_id_
|
|
|
- <include refid="demoGroupQueryCondition"/>
|
|
|
- GROUP BY dgcp.id_,dg.id_
|
|
|
- ORDER BY dgcp.start_time_
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
- <select id="countDemoGroupList" resultType="java.lang.Integer">
|
|
|
- SELECT
|
|
|
- count(*)
|
|
|
- FROM
|
|
|
- demo_group dg
|
|
|
- LEFT JOIN demo_group_courses_plan dgcp ON dg.id_=dgcp.demo_group_id_
|
|
|
- LEFT JOIN sys_user su ON dg.user_id_=su.id_
|
|
|
- <include refid="demoGroupQueryCondition"/>
|
|
|
- </select>
|
|
|
- <select id="findClassGroupIDByDemoGroupId" resultType="java.lang.Integer">
|
|
|
+ <sql id="demoGroupQueryCondition">
|
|
|
+ <where>
|
|
|
+ dgcp.status_=0
|
|
|
+ <if test="search!=null">
|
|
|
+ AND su.username_ like concat('%',#{search},'%')
|
|
|
+ </if>
|
|
|
+ <if test="subjectIds!=null and subjectIds!=''">
|
|
|
+ AND FIND_IN_SET(dg.subject_id_,#{subjectIds})
|
|
|
+ </if>
|
|
|
+ <if test="startTime!=null and endTime==null">
|
|
|
+ AND dgcp.start_time_=#{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="startTime!=null and endTime!=null">
|
|
|
+ AND dgcp.start_time_>=#{startTime} AND dgcp.start_time_ <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="findDemoGroupList" resultMap="studentDemoGroupListDto">
|
|
|
+ SELECT
|
|
|
+ dg.id_ demo_group_id_,
|
|
|
+ su.username_,
|
|
|
+ su.avatar_,
|
|
|
+ t.introduction_,
|
|
|
+ s.name_ subject_name_,
|
|
|
+ COUNT(dgcgm.class_group_id_) number_of_classes_,
|
|
|
+ dgcp.*
|
|
|
+ FROM
|
|
|
+ demo_group dg
|
|
|
+ LEFT JOIN demo_group_courses_plan dgcp ON dg.id_=dgcp.demo_group_id_
|
|
|
+ LEFT JOIN teacher t ON dg.user_id_=t.id_
|
|
|
+ LEFT JOIN sys_user su ON dg.user_id_=su.id_
|
|
|
+ LEFT JOIN `subject` s ON dg.subject_id_=s.id_
|
|
|
+ LEFT JOIN demo_group_class_group_mapper dgcgm ON dg.id_=dgcgm.demo_group_id_
|
|
|
+ <include refid="demoGroupQueryCondition"/>
|
|
|
+ GROUP BY dgcp.id_,dg.id_
|
|
|
+ ORDER BY dgcp.start_time_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+ <select id="countDemoGroupList" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ count(*)
|
|
|
+ FROM
|
|
|
+ demo_group dg
|
|
|
+ LEFT JOIN demo_group_courses_plan dgcp ON dg.id_=dgcp.demo_group_id_
|
|
|
+ LEFT JOIN sys_user su ON dg.user_id_=su.id_
|
|
|
+ <include refid="demoGroupQueryCondition"/>
|
|
|
+ </select>
|
|
|
+ <select id="findClassGroupIDByDemoGroupId" resultType="java.lang.Integer">
|
|
|
SELECT
|
|
|
class_group_id_
|
|
|
FROM
|
|
@@ -196,41 +205,40 @@
|
|
|
SELECT * FROM demo_group WHERE user_id_=#{teacherId}
|
|
|
</select>
|
|
|
|
|
|
- <sql id="teacherDemoGroupsQueryCondition">
|
|
|
- <where>
|
|
|
- dg.user_id_=#{teacherId}
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
+ <sql id="teacherDemoGroupsQueryCondition">
|
|
|
+ <where>
|
|
|
+ dg.user_id_=#{teacherId}
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
|
|
|
- <select id="findTeacherDemoGroups" resultType="com.ym.mec.biz.dal.dto.TeacherManageDemoGroupListDto">
|
|
|
- SELECT
|
|
|
- cs.class_date_ classDate,
|
|
|
- GROUP_CONCAT(DISTINCT CONCAT(cs.start_class_time_,cs.end_class_time_)) startTimes,
|
|
|
- GROUP_CONCAT(s.name_) subjectNames
|
|
|
- FROM
|
|
|
- demo_group dg
|
|
|
- LEFT JOIN demo_group_class_group_mapper dgcgm ON dg.id_=dgcgm.demo_group_id_
|
|
|
- LEFT JOIN class_group cg ON dgcgm.class_group_id_=cg.id_
|
|
|
- LEFT JOIN course_schedule cs ON cg.id_=cs.class_group_id_
|
|
|
- LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,cg.subject_id_list_)
|
|
|
- <include refid="teacherDemoGroupsQueryCondition"/>
|
|
|
- GROUP BY cs.class_date_
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
- <select id="countTeacherDemoGroups" resultType="int">
|
|
|
- SELECT
|
|
|
- count(*)
|
|
|
- FROM
|
|
|
- demo_group dg
|
|
|
- LEFT JOIN demo_group_class_group_mapper dgcgm ON dg.id_=dgcgm.demo_group_id_
|
|
|
- LEFT JOIN class_group cg ON dgcgm.class_group_id_=cg.id_
|
|
|
- LEFT JOIN course_schedule cs ON cg.id_=cs.class_group_id_
|
|
|
- <include refid="teacherDemoGroupsQueryCondition"/>
|
|
|
- GROUP BY cs.class_date_
|
|
|
- </select>
|
|
|
+ <select id="findTeacherDemoGroups" resultType="com.ym.mec.biz.dal.dto.TeacherManageDemoGroupListDto">
|
|
|
+ SELECT
|
|
|
+ cs.class_date_ classDate,
|
|
|
+ GROUP_CONCAT(DISTINCT CONCAT(cs.start_class_time_,' ',cs.end_class_time_)) startTimes,
|
|
|
+ GROUP_CONCAT(s.name_) subjectNames
|
|
|
+ FROM
|
|
|
+ demo_group dg
|
|
|
+ LEFT JOIN demo_group_class_group_mapper dgcgm ON dg.id_=dgcgm.demo_group_id_
|
|
|
+ LEFT JOIN class_group cg ON dgcgm.class_group_id_=cg.id_
|
|
|
+ LEFT JOIN course_schedule cs ON cg.id_=cs.class_group_id_
|
|
|
+ LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,cg.subject_id_list_)
|
|
|
+ <include refid="teacherDemoGroupsQueryCondition"/>
|
|
|
+ GROUP BY cs.class_date_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+ <select id="countTeacherDemoGroups" resultType="int">
|
|
|
+ SELECT
|
|
|
+ count(*)
|
|
|
+ FROM
|
|
|
+ demo_group dg
|
|
|
+ LEFT JOIN demo_group_class_group_mapper dgcgm ON dg.id_=dgcgm.demo_group_id_
|
|
|
+ LEFT JOIN class_group cg ON dgcgm.class_group_id_=cg.id_
|
|
|
+ LEFT JOIN course_schedule cs ON cg.id_=cs.class_group_id_
|
|
|
+ <include refid="teacherDemoGroupsQueryCondition"/>
|
|
|
+ GROUP BY cs.class_date_
|
|
|
+ </select>
|
|
|
|
|
|
- <select id="findDemoGroupStartClassTimesWithWeekByTeacherId"
|
|
|
- resultType="com.ym.mec.biz.dal.dto.EducationDemoGroupListDto">
|
|
|
+ <select id="findDemoGroupStartClassTimesWithWeekByTeacherId" resultType="com.ym.mec.biz.dal.dto.EducationDemoGroupListDto">
|
|
|
SELECT
|
|
|
class_date_ classDate,
|
|
|
GROUP_CONCAT(start_class_time_) startClassTimes
|