|
@@ -29,6 +29,7 @@
|
|
|
<result column="practice_group_id_" property="practiceGroupId" />
|
|
|
<result column="give_practice_group_id_" property="givePracticeGroupId" />
|
|
|
<result column="return_fee_" property="returnFee" />
|
|
|
+ <result column="sub_no_course_price_" property="subNoCoursePrice" />
|
|
|
<result column="actual_price_" property="actualPrice" />
|
|
|
<result column="add_memo_" property="addMemo" />
|
|
|
<result column="cut_memo_" property="cutMemo" />
|
|
@@ -54,26 +55,26 @@
|
|
|
practice_flag_,give_practice_flag_,member_flag_,give_member_flag_,create_time_,update_time_,payment_order_id_,
|
|
|
vip_group_id_,give_vip_group_id_,practice_group_id_,give_practice_group_id_,return_fee_,
|
|
|
member_order_id_,give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_,tenant_id_,give_coupon_id_,
|
|
|
- total_course_num_,total_give_course_num_,sub_course_num_,sub_give_course_num_)
|
|
|
+ total_course_num_,total_give_course_num_,sub_course_num_,sub_give_course_num_,sub_no_course_price_)
|
|
|
VALUES(#{activityId},#{userId},#{vipFlag},#{giveVipFlag},#{practiceFlag},
|
|
|
#{givePracticeFlag},#{memberFlag},#{giveMemberFlag},NOW(),NOW(),#{paymentOrderId},#{vipGroupId},
|
|
|
#{giveVipGroupId},#{practiceGroupId},#{givePracticeGroupId},#{returnFee},
|
|
|
#{memberOrderId},#{giveMemberOrderId},#{teacherId},#{actualPrice},#{addMemo},#{cutMemo},#{tenantId},#{giveCouponId},
|
|
|
- #{totalCourseNum},#{totalGiveCourseNum},#{subCourseNum},#{subGiveCourseNum})
|
|
|
+ #{totalCourseNum},#{totalGiveCourseNum},#{subCourseNum},#{subGiveCourseNum},#{subNoCoursePrice})
|
|
|
</insert>
|
|
|
<insert id="batchInsert">
|
|
|
INSERT INTO activity_user_mapper (activity_id_,user_id_,vip_flag_,give_vip_flag_,
|
|
|
practice_flag_,give_practice_flag_,member_flag_,give_member_flag_,create_time_,update_time_,payment_order_id_,
|
|
|
vip_group_id_,give_vip_group_id_,practice_group_id_,give_practice_group_id_,return_fee_,member_order_id_,
|
|
|
give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_,tenant_id_,give_coupon_id_,
|
|
|
- total_course_num_,total_give_course_num_,sub_course_num_,sub_give_course_num_)
|
|
|
+ total_course_num_,total_give_course_num_,sub_course_num_,sub_give_course_num_,sub_no_course_price_)
|
|
|
VALUES
|
|
|
<foreach collection="activityUserMappers" item="item" separator=",">
|
|
|
(#{item.activityId},#{item.userId},#{item.vipFlag},#{item.giveVipFlag},#{item.practiceFlag},
|
|
|
#{item.givePracticeFlag},#{item.memberFlag},#{item.giveMemberFlag},NOW(),NOW(),#{item.paymentOrderId},#{item.vipGroupId},
|
|
|
#{item.giveVipGroupId},#{item.practiceGroupId},#{item.givePracticeGroupId},#{item.returnFee},
|
|
|
#{item.memberOrderId},#{item.giveMemberOrderId},#{item.teacherId},#{item.actualPrice},#{item.addMemo},#{item.cutMemo},
|
|
|
- #{item.tenantId},#{item.giveCouponId},#{item.totalCourseNum},#{item.totalGiveCourseNum},#{item.subCourseNum},#{item.subGiveCourseNum})
|
|
|
+ #{item.tenantId},#{item.giveCouponId},#{item.totalCourseNum},#{item.totalGiveCourseNum},#{item.subCourseNum},#{item.subGiveCourseNum},#{item.subNoCoursePrice})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -83,6 +84,9 @@
|
|
|
<if test="totalCourseNum != null">
|
|
|
total_course_num_ = #{totalCourseNum},
|
|
|
</if>
|
|
|
+ <if test="subNoCoursePrice != null">
|
|
|
+ sub_no_course_price_ = #{subNoCoursePrice},
|
|
|
+ </if>
|
|
|
<if test="totalGiveCourseNum != null">
|
|
|
total_give_course_num_ = #{totalGiveCourseNum},
|
|
|
</if>
|
|
@@ -326,4 +330,73 @@
|
|
|
</if>
|
|
|
group by t.user_id_ , t.activity_id_
|
|
|
</select>
|
|
|
+ <resultMap id="CourseFormDto" type="com.ym.mec.biz.dal.dto.CourseFormDto">
|
|
|
+ <result property="id" column="id_"/>
|
|
|
+ <result property="name" column="name_"/>
|
|
|
+ <result property="num" column="num_"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="queryWaitCourseCategory" resultMap="CourseFormDto">
|
|
|
+ SELECT vgc.name_,vgc.id_,COUNT(DISTINCT aum.user_id_) num_ FROM vip_group_category vgc
|
|
|
+ LEFT JOIN (select category_id_,user_id_ from activity_user_mapper aum
|
|
|
+ WHERE aum.category_id_ > 0 AND aum.return_fee_ = 0 AND (aum.vip_flag_ = 1 OR aum.practice_flag_ = 1)
|
|
|
+ UNION ALL
|
|
|
+ select give_category_id_ category_id_,user_id_ from activity_user_mapper aum
|
|
|
+ WHERE aum.give_category_id_ > 0 AND aum.return_fee_ = 0 AND (aum.give_vip_flag_ = 1 OR aum.give_practice_flag_ = 1)) aum ON aum.category_id_ = vgc.id_
|
|
|
+ <if test="userId != null">
|
|
|
+ LEFT JOIN student s ON s.user_id_ = aum.user_id_
|
|
|
+ </if>
|
|
|
+ <if test="organIds != null and organIds != ''">
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = aum.user_id_
|
|
|
+ </if>
|
|
|
+ WHERE aum.category_id_ = vgc.id_
|
|
|
+ <if test="userId != null">
|
|
|
+ AND s.teacher_id_ = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="organIds != null and organIds != ''">
|
|
|
+ AND FIND_IN_SET(su.organ_id_,#{organIds})
|
|
|
+ </if>
|
|
|
+ GROUP BY vgc.id_
|
|
|
+ </select>
|
|
|
+ <resultMap id="ActivityUserDto" type="com.ym.mec.biz.dal.dto.ActivityUserDto">
|
|
|
+ <result property="userId" column="user_id_"/>
|
|
|
+ <result property="username" column="username_"/>
|
|
|
+ <result property="subjectName" column="subject_name_"/>
|
|
|
+ <result property="subjectId" column="subject_id_"/>
|
|
|
+ <result property="subCourseNum" column="sub_course_num_"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="queryActivityStudentList" resultMap="ActivityUserDto">
|
|
|
+ SELECT aum.user_id_,su.avatar_,sj.id_ subject_id_,su.username_,sj.name_ subject_name_,
|
|
|
+ SUM(CASE WHEN aum.category_id_ = #{queryInfo.categoryId}
|
|
|
+ <if test="queryInfo.singleCourseTime != null">
|
|
|
+ AND aum.single_course_time_ = #{queryInfo.singleCourseTime}
|
|
|
+ </if>
|
|
|
+ THEN sub_course_num_ ELSE 0 END) +
|
|
|
+ SUM(CASE WHEN aum.give_category_id_ = #{queryInfo.categoryId}
|
|
|
+ <if test="queryInfo.singleCourseTime != null">
|
|
|
+ AND aum.give_single_course_time_ = #{queryInfo.singleCourseTime}
|
|
|
+ </if>
|
|
|
+ THEN sub_give_course_num_ ELSE 0 END) sub_course_num_
|
|
|
+ FROM activity_user_mapper aum
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = aum.user_id_
|
|
|
+ LEFT JOIN student s ON s.user_id_ = aum.user_id_
|
|
|
+ LEFT JOIN subject sj ON sj.id_ = s.subject_id_list_
|
|
|
+ WHERE ((aum.category_id_ = #{queryInfo.categoryId}
|
|
|
+ <if test="queryInfo.singleCourseTime != null">
|
|
|
+ AND aum.single_course_time_ = #{queryInfo.singleCourseTime}
|
|
|
+ </if>)
|
|
|
+ OR (aum.give_category_id_ = #{queryInfo.categoryId}
|
|
|
+ <if test="queryInfo.singleCourseTime != null">
|
|
|
+ AND aum.give_single_course_time_ = #{queryInfo.singleCourseTime}
|
|
|
+ </if>))
|
|
|
+ <if test="queryInfo.organIds != null and queryInfo.organIds != ''">
|
|
|
+ AND FIND_IN_SET(su.organ_id_,#{queryInfo.organIds})
|
|
|
+ </if>
|
|
|
+ <if test="queryInfo.subjectIds != null and queryInfo.subjectIds != ''">
|
|
|
+ AND FIND_IN_SET(sj.id_,#{queryInfo.subjectIds})
|
|
|
+ </if>
|
|
|
+ <if test="queryInfo.teacherId != null">
|
|
|
+ AND s.teacher_id_ = #{queryInfo.teacherId}
|
|
|
+ </if>
|
|
|
+ GROUP BY aum.user_id_ HAVING sum(sub_course_num_) > 0 OR sum(sub_give_course_num_) > 0;
|
|
|
+ </select>
|
|
|
</mapper>
|