|
@@ -590,46 +590,49 @@
|
|
|
<select id="findByIds" resultMap="ActivityUserMapper">
|
|
|
SELECT * FROM activity_user_mapper aum WHERE FIND_IN_SET(aum.id_,#{activityUserMapperIds})
|
|
|
</select>
|
|
|
- <resultMap id="ActivityUserMapperDetailDto" type="com.ym.mec.biz.dal.dto.ActivityUserMapperDetailDto" extends="ActivityUserMapper">
|
|
|
- <result property="organId" column="organ_id_"/>
|
|
|
+ <resultMap id="ActivityUserMapperDetailDto" type="com.ym.mec.biz.dal.dto.ActivityUserMapperDetailDto">
|
|
|
+ <result property="activityId" column="activity_id_"/>
|
|
|
+ <result property="addMemo" column="add_memo_"/>
|
|
|
+ <result property="subCourseNum" column="sub_course_num_"/>
|
|
|
+ <result property="totalCourseNum" column="total_course_num_"/>
|
|
|
+ <result property="createTime" column="create_time_"/>
|
|
|
+ <result property="freeFlag" column="free_flag_"/>
|
|
|
+ <result property="subCoursePrice" column="sub_no_course_price_"/>
|
|
|
+ <result property="categoryName" column="name_"/>
|
|
|
</resultMap>
|
|
|
<select id="queryDetailPage" resultMap="ActivityUserMapperDetailDto">
|
|
|
- select aum.*,su.organ_id_ from activity_user_mapper aum
|
|
|
- left join sys_user su ON su.id_ = aum.user_id_
|
|
|
- <include refid="queryDetailPageSql"/>
|
|
|
- ORDER BY aum.id_ DESC
|
|
|
+ select aum.id_,aum.activity_id_,aum.add_memo_,vga.name_,aum.sub_course_num_,aum.total_course_num_,
|
|
|
+ aum.create_time_,false free_flag_,aum.sub_no_course_price_ from activity_user_mapper aum
|
|
|
+ left join vip_group_category vga ON vga.id_ = aum.category_id_
|
|
|
+ where (aum.vip_flag_ > 0 OR aum.practice_flag_ > 0) AND aum.return_fee_ = 0
|
|
|
+ <include refid="countDetailPageSql"/>
|
|
|
+ UNION ALL
|
|
|
+ select aum.id_,aum.activity_id_,aum.add_memo_,vga.name_,aum.sub_give_course_num_ sub_course_num_,
|
|
|
+ aum.total_give_course_num_ total_course_num_,aum.create_time_,true free_flag_,0 sub_no_course_price_ from activity_user_mapper aum
|
|
|
+ left join vip_group_category vga ON vga.id_ = aum.give_category_id_
|
|
|
+ where (aum.give_vip_flag_ > 0 OR aum.give_practice_flag_ > 0) AND aum.return_fee_ = 0
|
|
|
+ <include refid="countDetailPageSql"/>
|
|
|
+ order by id_ DESC
|
|
|
<include refid="global.limit"/>
|
|
|
</select>
|
|
|
- <sql id="queryDetailPageSql">
|
|
|
- <where>
|
|
|
- <if test="search != null and search != ''">
|
|
|
- AND (aum.activity_id_ = #{search} OR aum.add_memo_ LIKE CONCAT('%',#{search},'%'))
|
|
|
- </if>
|
|
|
- <if test="userId != null">
|
|
|
- AND aum.user_id_ = #{userId}
|
|
|
- </if>
|
|
|
- <if test="organId != null and organId != ''">
|
|
|
- AND FIND_IN_SET(su.organ_id_,#{organId})
|
|
|
- </if>
|
|
|
- <if test="returnFee != null">
|
|
|
- AND aum.return_fee_ = #{returnFee}
|
|
|
- </if>
|
|
|
- <if test="returnFee != null">
|
|
|
- AND aum.return_fee_ = #{returnFee}
|
|
|
- </if>
|
|
|
- <if test="hasSubCourse != null and hasSubCourse == true">
|
|
|
- and (aum.sub_course_num_ > 0 or aum.sub_give_course_num_ > 0)
|
|
|
- </if>
|
|
|
- <if test="hasSubCourse != null and hasSubCourse == false">
|
|
|
- and aum.sub_course_num_ <= 0 and aum.sub_give_course_num_ <= 0
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
<select id="countDetailPage" resultType="java.lang.Integer">
|
|
|
- select COUNT(aum.id_) from activity_user_mapper aum
|
|
|
- left join sys_user su ON su.id_ = aum.user_id_
|
|
|
- <include refid="queryDetailPageSql"/>
|
|
|
+ select COUNT(aum.id_) from (select aum.id_ from activity_user_mapper aum
|
|
|
+ where (aum.vip_flag_ > 0 OR aum.practice_flag_ > 0) AND aum.return_fee_ = 0
|
|
|
+ <include refid="countDetailPageSql"/>
|
|
|
+ UNION ALL
|
|
|
+ select aum.id_ from activity_user_mapper aum
|
|
|
+ where (aum.give_vip_flag_ > 0 OR aum.give_practice_flag_ > 0) AND aum.return_fee_ = 0
|
|
|
+ <include refid="countDetailPageSql"/>
|
|
|
+ ) aum
|
|
|
</select>
|
|
|
+ <sql id="countDetailPageSql">
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ AND (aum.activity_id_ = #{search} OR aum.add_memo_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ AND aum.user_id_ = #{userId}
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
<resultMap id="ActivityUserMapperSumDto" type="com.ym.mec.biz.dal.dto.ActivityUserMapperSumDto">
|
|
|
<result property="organId" column="organ_id_"/>
|
|
|
<result property="userId" column="user_id_"/>
|
|
@@ -647,7 +650,6 @@
|
|
|
</resultMap>
|
|
|
<sql id="querySumPageSql">
|
|
|
<where>
|
|
|
- aum.return_fee_ = 0 and aum.total_course_num_ > 0
|
|
|
<if test="organId != null and organId != ''">
|
|
|
AND FIND_IN_SET(su.organ_id_,#{organId})
|
|
|
</if>
|
|
@@ -658,23 +660,39 @@
|
|
|
</sql>
|
|
|
<select id="countSumPage" resultType="java.lang.Integer">
|
|
|
select COUNT(DISTINCT aum.user_id_)
|
|
|
+ from (select aum.user_id_,aum.category_id_,aum.sub_course_num_,aum.total_course_num_
|
|
|
from activity_user_mapper aum
|
|
|
+ left join vip_group_category vgc ON vgc.id_ = aum.category_id_
|
|
|
+ where aum.return_fee_ = 0 and aum.total_course_num_ > 0
|
|
|
+ UNION ALL
|
|
|
+ select aum.user_id_,aum.give_category_id_ category_id_,aum.sub_give_course_num_,aum.total_give_course_num_
|
|
|
+ from activity_user_mapper aum
|
|
|
+ left join vip_group_category vgc ON vgc.id_ = aum.category_id_
|
|
|
+ where aum.return_fee_ = 0 and aum.total_give_course_num_ > 0) aum
|
|
|
left join sys_user su ON su.id_ = aum.user_id_
|
|
|
<include refid="querySumPageSql"/>
|
|
|
</select>
|
|
|
<select id="querySumPage" resultType="com.ym.mec.biz.dal.dto.ActivityUserMapperSumDto">
|
|
|
select aum.user_id_,su.organ_id_,su.username_,su.phone_,
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '1v1' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v1' THEN aum.total_course_num_ ELSE 0 END)) 'one',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '1v2' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v2' THEN aum.total_course_num_ ELSE 0 END)) 'two',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '1v3' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v3' THEN aum.total_course_num_ ELSE 0 END)) 'three',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '1v4' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v4' THEN aum.total_course_num_ ELSE 0 END)) 'four',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '1v5' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v5' THEN aum.total_course_num_ ELSE 0 END)) 'five',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '1v6' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v6' THEN aum.total_course_num_ ELSE 0 END)) 'six',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '1v7' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v7' THEN aum.total_course_num_ ELSE 0 END)) 'seven',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ = '乐理课' THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '乐理课' THEN aum.total_course_num_ ELSE 0 END)) 'theory',
|
|
|
- CONCAT(SUM(CASE WHEN vgc.name_ IS NULL THEN aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ IS NULL THEN aum.total_course_num_ ELSE 0 END)) 'practice'
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '1v1' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v1' THEN aum.total_course_num_ ELSE 0 END)) 'one',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '1v2' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v2' THEN aum.total_course_num_ ELSE 0 END)) 'two',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '1v3' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v3' THEN aum.total_course_num_ ELSE 0 END)) 'three',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '1v4' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v4' THEN aum.total_course_num_ ELSE 0 END)) 'four',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '1v5' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v5' THEN aum.total_course_num_ ELSE 0 END)) 'five',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '1v6' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v6' THEN aum.total_course_num_ ELSE 0 END)) 'six',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '1v7' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '1v7' THEN aum.total_course_num_ ELSE 0 END)) 'seven',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ = '乐理课' THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ = '乐理课' THEN aum.total_course_num_ ELSE 0 END)) 'theory',
|
|
|
+ CONCAT(SUM(CASE WHEN vgc.name_ IS NULL THEN aum.total_course_num_ - aum.sub_course_num_ ELSE 0 END) ,'/',SUM(CASE WHEN vgc.name_ IS NULL THEN aum.total_course_num_ ELSE 0 END)) 'practice'
|
|
|
+ from (select aum.user_id_,aum.category_id_,aum.sub_course_num_,aum.total_course_num_
|
|
|
from activity_user_mapper aum
|
|
|
left join vip_group_category vgc ON vgc.id_ = aum.category_id_
|
|
|
+ where aum.return_fee_ = 0 and aum.total_course_num_ > 0
|
|
|
+ UNION ALL
|
|
|
+ select aum.user_id_,aum.give_category_id_ category_id_,aum.sub_give_course_num_,aum.total_give_course_num_
|
|
|
+ from activity_user_mapper aum
|
|
|
+ left join vip_group_category vgc ON vgc.id_ = aum.category_id_
|
|
|
+ where aum.return_fee_ = 0 and aum.total_give_course_num_ > 0) aum
|
|
|
+ left join vip_group_category vgc ON vgc.id_ = aum.category_id_
|
|
|
left join sys_user su ON su.id_ = aum.user_id_
|
|
|
<include refid="querySumPageSql"/>
|
|
|
group by aum.user_id_
|