| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588 |
- <?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.ym.mec.biz.dal.dao.ActivityUserMapperDao">
-
- <resultMap type="com.ym.mec.biz.dal.entity.ActivityUserMapper" id="ActivityUserMapper">
- <result column="id_" property="id" />
- <result column="category_id_" property="categoryId" />
- <result column="give_category_id_" property="giveCategoryId" />
- <result column="single_course_time_" property="singleCourseTime" />
- <result column="give_single_course_time_" property="giveSingleCourseTime" />
- <result column="activity_id_" property="activityId" />
- <result column="user_id_" property="userId" />
- <result column="teacher_id_" property="teacherId" />
- <result column="vip_flag_" property="vipFlag" />
- <result column="give_vip_flag_" property="giveVipFlag" />
- <result column="practice_flag_" property="practiceFlag" />
- <result column="give_practice_flag_" property="givePracticeFlag" />
- <result column="member_flag_" property="memberFlag" />
- <result column="give_member_flag_" property="giveMemberFlag" />
- <result column="payment_order_id_" property="paymentOrderId" />
- <result column="vip_group_id_" property="vipGroupId" />
- <result column="total_course_num_" property="totalCourseNum" />
- <result column="total_give_course_num_" property="totalGiveCourseNum" />
- <result column="sub_course_num_" property="subCourseNum" />
- <result column="sub_give_course_num_" property="subGiveCourseNum" />
- <result column="give_vip_group_id_" property="giveVipGroupId" />
- <result column="member_order_id_" property="memberOrderId" />
- <result column="give_member_order_id_" property="giveMemberOrderId" />
- <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" />
- <result column="give_coupon_id_" property="giveCouponId" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="tenant_id_" property="tenantId" />
- </resultMap>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="ActivityUserMapper" >
- SELECT * FROM activity_user_mapper WHERE id_ = #{id}
- </select>
-
- <!-- 全查询 -->
- <select id="findAll" resultMap="ActivityUserMapper">
- SELECT * FROM activity_user_mapper where tenant_id_ = #{tenantId} ORDER BY id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ActivityUserMapper" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- 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_,sub_no_course_price_,single_course_time_,
- give_single_course_time_,category_id_,give_category_id_)
- 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},#{subNoCoursePrice},
- #{singleCourseTime},#{giveSingleCourseTime},#{categoryId},#{giveCategoryId})
- </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_,sub_no_course_price_,single_course_time_,
- give_single_course_time_,category_id_,give_category_id_)
- 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.subNoCoursePrice},#{item.singleCourseTime},#{item.giveSingleCourseTime},
- #{item.categoryId},#{item.giveCategoryId})
- </foreach>
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.ActivityUserMapper">
- UPDATE activity_user_mapper
- <set>
- <if test="singleCourseTime != null">
- single_course_time_ = #{singleCourseTime},
- </if>
- <if test="giveSingleCourseTime != null">
- give_single_course_time_ = #{giveSingleCourseTime},
- </if>
- <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>
- <if test="subCourseNum != null">
- sub_course_num_ = #{subCourseNum},
- </if>
- <if test="subGiveCourseNum != null">
- sub_give_course_num_ = #{subGiveCourseNum},
- </if>
- <if test="giveCouponId != null">
- give_coupon_id_ = #{giveCouponId},
- </if>
- <if test="cutMemo != null">
- cut_memo_ = #{cutMemo},
- </if>
- <if test="addMemo != null">
- add_memo_ = #{addMemo},
- </if>
- <if test="actualPrice != null">
- actual_price_ = #{actualPrice},
- </if>
- <if test="teacherId != null">
- teacher_id_ = #{teacherId},
- </if>
- <if test="memberOrderId != null">
- member_order_id_ = #{memberOrderId},
- </if>
- <if test="giveMemberOrderId != null">
- give_member_order_id_ = #{giveMemberOrderId},
- </if>
- <if test="returnFee != null">
- return_fee_ = #{returnFee},
- </if>
- <if test="vipGroupId != null">
- vip_group_id_ = #{vipGroupId},
- </if>
- <if test="giveVipGroupId != null">
- give_vip_group_id_ = #{giveVipGroupId},
- </if>
- <if test="practiceGroupId != null">
- practice_group_id_ = #{practiceGroupId},
- </if>
- <if test="givePracticeGroupId != null">
- give_practice_group_id_ = #{givePracticeGroupId},
- </if>
- <if test="paymentOrderId != null">
- payment_order_id_ = #{paymentOrderId},
- </if>
- <if test="userId != null">
- user_id_ = #{userId},
- </if>
- <if test="givePracticeFlag != null">
- give_practice_flag_ = #{givePracticeFlag},
- </if>
- <if test="giveVipFlag != null">
- give_vip_flag_ = #{giveVipFlag},
- </if>
- <if test="vipFlag != null">
- vip_flag_ = #{vipFlag},
- </if>
- <if test="activityId != null">
- activity_id_ = #{activityId},
- </if>
- <if test="practiceFlag != null">
- practice_flag_ = #{practiceFlag},
- </if>
- <if test="memberFlag != null">
- member_flag_ = #{memberFlag},
- </if>
- <if test="giveMemberFlag != null">
- give_member_flag_ = #{giveMemberFlag},
- </if>
- update_time_ = NOW()
- </set>WHERE id_ = #{id} and tenant_id_ = #{tenantId}
- </update>
- <update id="use">
- UPDATE activity_user_mapper SET
- <if test="type == 'VIP'">
- vip_flag_ = 2,vip_group_id_ = #{groupId},update_time_ = NOW()
- WHERE vip_flag_ = 1
- </if>
- <if test="type == 'GIVE_VIP'">
- give_vip_flag_ = 2,give_vip_group_id_ = #{groupId},update_time_ = NOW()
- WHERE give_vip_flag_ = 1
- </if>
- <if test="type == 'PRACTICE'">
- practice_flag_ = 2,practice_group_id_ = #{groupId},update_time_ = NOW()
- WHERE practice_flag_ = 1
- </if>
- <if test="type == 'GIVE_PRACTICE'">
- give_practice_flag_ = 2,give_practice_group_id_ = #{groupId},update_time_ = NOW()
- WHERE give_practice_flag_ = 1
- </if>
- AND FIND_IN_SET(id_,#{activityUserMapperIds}) AND FIND_IN_SET(user_id_,#{studentIds}) AND return_fee_ = 0
- </update>
- <update id="updateTeacherId">
- UPDATE activity_user_mapper SET teacher_id_ = #{teacherId} WHERE user_id_ = #{userId}
- </update>
- <update id="batchUpdate">
- <foreach collection="useActivityUserMappers" item="entity" separator=";">
- UPDATE activity_user_mapper
- <set>
- <if test="entity.subNoCoursePrice != null">
- sub_no_course_price_ = #{entity.subNoCoursePrice},
- </if>
- <if test="entity.subCourseNum != null">
- sub_course_num_ = #{entity.subCourseNum},
- </if>
- <if test="entity.subGiveCourseNum != null">
- sub_give_course_num_ = #{entity.subGiveCourseNum},
- </if>
- <if test="entity.vipGroupId != null">
- vip_group_id_ = #{entity.vipGroupId},
- </if>
- <if test="entity.giveVipGroupId != null">
- give_vip_group_id_ = #{entity.giveVipGroupId},
- </if>
- <if test="entity.practiceGroupId != null">
- practice_group_id_ = #{entity.practiceGroupId},
- </if>
- <if test="entity.givePracticeGroupId != null">
- give_practice_group_id_ = #{entity.givePracticeGroupId},
- </if>
- <if test="entity.givePracticeFlag != null">
- give_practice_flag_ = #{entity.givePracticeFlag},
- </if>
- <if test="entity.giveVipFlag != null">
- give_vip_flag_ = #{entity.giveVipFlag},
- </if>
- <if test="entity.vipFlag != null">
- vip_flag_ = #{entity.vipFlag},
- </if>
- <if test="entity.practiceFlag != null">
- practice_flag_ = #{entity.practiceFlag},
- </if>
- update_time_ = NOW()
- </set>WHERE id_ = #{entity.id}
- </foreach>
- </update>
- <update id="batchUpdateFree">
- <foreach collection="useActivityUserMappers" item="entity" separator=";">
- UPDATE activity_user_mapper
- <set>
- <if test="entity.subGiveCourseNum != null">
- sub_give_course_num_ = #{entity.subGiveCourseNum},
- </if>
- <if test="entity.giveVipGroupId != null">
- give_vip_group_id_ = #{entity.giveVipGroupId},
- </if>
- <if test="entity.givePracticeGroupId != null">
- give_practice_group_id_ = #{entity.givePracticeGroupId},
- </if>
- <if test="entity.givePracticeFlag != null">
- give_practice_flag_ = #{entity.givePracticeFlag},
- </if>
- <if test="entity.giveVipFlag != null">
- give_vip_flag_ = #{entity.giveVipFlag},
- </if>
- update_time_ = NOW()
- </set>WHERE id_ = #{entity.id}
- </foreach>
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM activity_user_mapper WHERE id_ = #{id}
- </delete>
-
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="ActivityUserMapper" parameterType="map">
- SELECT * FROM activity_user_mapper where tenant_id_ = #{tenantId}
- <if test="userId != null">
- AND user_id_ = #{userId}
- </if>
- <if test="activityId != null">
- AND activity_id_ = #{activityId}
- </if>
- ORDER BY id_ DESC
- <include refid="global.limit"/>
- </select>
-
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM activity_user_mapper where tenant_id_ = #{tenantId}
- <if test="userId != null">
- AND user_id_ = #{userId}
- </if>
- <if test="activityId != null">
- AND activity_id_ = #{activityId}
- </if>
- </select>
- <select id="findByStudentIdList" resultMap="ActivityUserMapper">
- SELECT * FROM activity_user_mapper
- WHERE return_fee_ = 0 AND FIND_IN_SET(user_id_,#{studentIds})
- <if test="activityId != null">
- AND activity_id_ = #{activityId}
- </if>
- <if test="type == 'GIVE_VIP'">
- AND give_vip_flag_ = 1
- </if>
- <if test="type == 'GIVE_PRACTICE'">
- AND give_practice_flag_ = 1
- </if>
- <if test="type == 'VIP'">
- AND vip_flag_ = 1
- </if>
- <if test="type == 'PRACTICE'">
- AND practice_flag_ = 1
- </if>
- GROUP BY user_id_
- </select>
- <select id="countActivityBuyNum" resultType="java.lang.Integer">
- SELECT count(id_) FROM activity_user_mapper
- WHERE activity_id_ = #{activityId} AND user_id_ = #{userId}
- </select>
- <select id="findVipUserMapper" resultMap="ActivityUserMapper">
- SELECT * FROM activity_user_mapper
- WHERE 1 = 1
- <if test="groupType == 'VIP'">
- AND (vip_group_id_ = #{groupId} OR give_vip_group_id_ = #{groupId})
- </if>
- <if test="groupType == 'PRACTICE'">
- AND (practice_group_id_ = #{groupId} OR give_practice_group_id_ = #{groupId})
- </if>
- <if test="studentId != null">
- AND user_id_ = #{studentId}
- </if>
- LIMIT 1
- </select>
- <select id="countActivityUserMapper" resultType="java.lang.Integer">
- SELECT COUNT(DISTINCT aum.user_id_)
- FROM activity_user_mapper aum
- LEFT JOIN sys_user su ON su.id_ = aum.user_id_
- LEFT JOIN organization o ON o.id_ = su.organ_id_
- WHERE aum.return_fee_ = 0 AND aum.activity_id_ = #{activityId}
- <if test="search != null and search != ''">
- AND (aum.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
- </if>
- <if test="organId != null and organId != ''">
- AND FIND_IN_SET(su.organ_id_,#{organId})
- </if>
- </select>
- <resultMap id="ActivityStudentDto" type="com.ym.mec.biz.dal.dto.ActivityStudentDto">
- <result property="userId" column="user_id_"/>
- <result property="username" column="username_"/>
- <result property="organName" column="name_"/>
- <result property="phone" column="phone_"/>
- <result property="totalCourseNum" column="total_course_num_"/>
- <result property="subCourseNum" column="sub_course_num_"/>
- <result property="totalGiveCourseNum" column="total_give_course_num_"/>
- <result property="subGiveCourseNum" column="sub_give_course_num_"/>
- </resultMap>
- <select id="queryActivityUserMapper" resultMap="ActivityStudentDto">
- SELECT o.name_,aum.user_id_,su.username_,su.phone_,
- SUM(aum.total_course_num_) total_course_num_,
- SUM(aum.sub_course_num_) sub_course_num_,
- SUM(aum.total_give_course_num_) total_give_course_num_,
- SUM(aum.sub_give_course_num_) sub_give_course_num_
- FROM activity_user_mapper aum
- LEFT JOIN sys_user su ON su.id_ = aum.user_id_
- LEFT JOIN organization o ON o.id_ = su.organ_id_
- WHERE aum.return_fee_ = 0 AND aum.activity_id_ = #{activityId}
- <if test="search != null and search != ''">
- AND (aum.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
- </if>
- <if test="organId != null and organId != ''">
- AND FIND_IN_SET(su.organ_id_,#{organId})
- </if>
- GROUP BY aum.user_id_
- <include refid="global.limit"/>
- </select>
- <select id="getStudentNoMapperInfo" resultType="Integer">
- SELECT CASE WHEN aum.give_practice_flag_ = 1 THEN vga.give_course_num_ ELSE 0 END total_num_
- FROM activity_user_mapper aum
- LEFT JOIN vip_group_activity vga ON vga.id_ = aum.activity_id_
- WHERE aum.return_fee_ = 0 AND aum.user_id_ = #{userId} AND aum.activity_id_ = #{activityId}
- GROUP BY aum.user_id_
- </select>
-
- <select id="exportStudentSubCourse" resultType="com.ym.mec.biz.dal.dto.ExportStudentSubCourse">
- select
- t.user_id_ as userId,
- su.username_ as username,
- t.activity_id_ as activityId,
- o.name_ as organizationName,
- vga.name_ as activityName,
- sum(if(t.vip_flag_ = 1 || t.practice_flag_ = 1 ,1,0)) as subCourseNum,
- sum(if(t.give_vip_flag_ = 1 || t.give_practice_flag_ = 1,1,0)) as subGiveCourseNum
- from activity_user_mapper t
- left join vip_group_activity vga on t.activity_id_ = vga.id_
- left join sys_user su on t.user_id_ = su.id_
- left join organization o on su.organ_id_ = o.id_
- where t.tenant_id_ = #{tenantId} and t.return_fee_ = 0
- and (t.vip_flag_ = 1 or t.give_vip_flag_ = 1 or t.practice_flag_ = 1 or t.give_practice_flag_ = 1)
- <if test="organId != null">
- AND FIND_IN_SET(su.organ_id_,#{organId})
- </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_"/>
- <result property="studentNum" column="student_num_"/>
- </resultMap>
- <select id="queryWaitCourseCategory" resultMap="CourseFormDto">
- SELECT CASE WHEN vgc.id_ IS NULL THEN '网管课' ELSE vgc.name_ END name_,
- CASE WHEN vgc.id_ IS NULL THEN 0 ELSE vgc.id_ END id_,COUNT(DISTINCT aum.user_id_) num_,
- CASE WHEN vgc.id_ IS NULL THEN 1 ELSE vgc.student_num_ END student_num_
- FROM (select category_id_,user_id_,teacher_id_ from activity_user_mapper aum WHERE aum.sub_course_num_ > 0 AND aum.return_fee_ = 0
- UNION ALL
- select give_category_id_ category_id_,user_id_,teacher_id_ from activity_user_mapper aum
- WHERE aum.sub_give_course_num_ > 0 AND aum.return_fee_ = 0) aum
- LEFT JOIN vip_group_category vgc ON aum.category_id_ = vgc.id_
- <if test="organIds != null and organIds != ''">
- LEFT JOIN sys_user su ON su.id_ = aum.user_id_
- </if>
- <where>
- <if test="userId != null">
- AND aum.teacher_id_ = #{userId}
- </if>
- <if test="organIds != null and organIds != ''">
- AND FIND_IN_SET(su.organ_id_,#{organIds})
- </if>
- </where>
- 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="phone" column="phone_"/>
- <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_,su.phone_,sj.name_ subject_name_,SUM(aum.sub_course_num_) sub_course_num_
- FROM (SELECT aum.id_,aum.user_id_,aum.sub_course_num_,
- aum.single_course_time_,aum.teacher_id_ from activity_user_mapper aum
- WHERE aum.sub_course_num_ > 0 AND aum.return_fee_ = 0
- <if test="queryInfo.categoryId != null">
- AND aum.category_id_ = #{queryInfo.categoryId}
- </if>
- <if test="queryInfo.categoryId == null">
- AND aum.category_id_ IS NULL
- </if>
- UNION ALL
- SELECT aum.id_,aum.user_id_,aum.sub_give_course_num_ sub_course_num_,
- aum.give_single_course_time_ single_course_time_,aum.teacher_id_ from activity_user_mapper aum
- WHERE aum.sub_give_course_num_ > 0 AND aum.return_fee_ = 0
- <if test="queryInfo.categoryId != null">
- AND aum.give_category_id_ = #{queryInfo.categoryId}
- </if>
- <if test="queryInfo.categoryId == null">
- AND aum.give_category_id_ IS NULL
- </if>
- ) 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>
- <if test="queryInfo.search != null and queryInfo.search != ''">
- AND (su.id_ = #{queryInfo.search}
- OR su.username_ LIKE CONCAT('%',#{queryInfo.search},'%')
- OR su.phone_ LIKE CONCAT('%',#{queryInfo.search},'%'))
- </if>
- <if test="queryInfo.singleCourseTime != null">
- AND aum.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 aum.teacher_id_ = #{queryInfo.teacherId}
- </if>
- <if test="queryInfo.studentIds != null and queryInfo.studentIds.size > 0">
- AND aum.user_id_ IN
- <foreach collection="queryInfo.studentIds" item="studentId" open="(" separator="," close=")">
- #{studentId}
- </foreach>
- </if>
- </where>
- GROUP BY aum.user_id_
- ORDER BY sj.id_ DESC,sub_course_num_ DESC
- </select>
- <select id="queryActivityCourseTimeList" resultType="java.lang.Integer">
- select distinct aum.single_course_time_ from activity_user_mapper aum
- left join sys_user su on su.id_ = aum.user_id_
- where aum.return_fee_ = 0 and aum.total_course_num_ > 0
- <if test="queryInfo.categoryId != null">
- AND aum.category_id_ = #{queryInfo.categoryId}
- </if>
- <if test="queryInfo.categoryId == null">
- AND aum.category_id_ IS NULL
- </if>
- <if test="queryInfo.teacherId != null">
- AND aum.teacher_id_ = #{queryInfo.teacherId}
- </if>
- <if test="queryInfo.organIds != null and queryInfo.organIds != ''">
- AND FIND_IN_SET(su.organ_id_,#{queryInfo.organIds})
- </if>
- union
- select distinct aum.give_single_course_time_ from activity_user_mapper aum
- left join sys_user su on su.id_ = aum.user_id_
- where aum.return_fee_ = 0 and aum.sub_give_course_num_ > 0
- <if test="queryInfo.categoryId != null">
- AND aum.give_category_id_ = #{queryInfo.categoryId}
- </if>
- <if test="queryInfo.categoryId == null">
- AND aum.give_category_id_ IS NULL
- </if>
- <if test="queryInfo.teacherId != null">
- AND aum.teacher_id_ = #{queryInfo.teacherId}
- </if>
- <if test="queryInfo.organIds != null and queryInfo.organIds != ''">
- AND FIND_IN_SET(su.organ_id_,#{queryInfo.organIds})
- </if>
- </select>
- <select id="findTotalByStudents" resultMap="ActivityUserMapper">
- select aum.id_, category_id_,user_id_,sub_course_num_,vip_group_id_, give_vip_group_id_, practice_group_id_,
- give_practice_group_id_,actual_price_,sub_no_course_price_
- from activity_user_mapper aum
- WHERE aum.user_id_ IN
- <foreach collection="studentIdList" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- and aum.single_course_time_ = #{classMinutes} and return_fee_ = 0 and aum.sub_course_num_ > 0
- <if test="categoryId != null">
- AND aum.category_id_ = #{categoryId}
- </if>
- <if test="categoryId == null">
- AND aum.category_id_ IS NULL
- </if>
- UNION ALL
- select aum.id_,give_category_id_ category_id_, user_id_,sub_give_course_num_ sub_course_num_,vip_group_id_, give_vip_group_id_, practice_group_id_, give_practice_group_id_,0 actual_price_,0 sub_no_course_price_
- from activity_user_mapper aum
- WHERE aum.user_id_ IN
- <foreach collection="studentIdList" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- and aum.give_single_course_time_ = #{classMinutes} and return_fee_ = 0 and aum.sub_give_course_num_ > 0
- <if test="categoryId != null">
- AND aum.give_category_id_ = #{categoryId}
- </if>
- <if test="categoryId == null">
- AND aum.give_category_id_ IS NULL
- </if>
- </select>
- <select id="findByStudents" resultMap="ActivityUserMapper">
- select * from activity_user_mapper aum
- WHERE aum.user_id_ IN
- <foreach collection="studentIdList" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- and aum.single_course_time_ = #{classMinutes} and return_fee_ = 0 and aum.sub_course_num_ > 0
- <if test="categoryId != null">
- AND aum.category_id_ = #{categoryId}
- </if>
- <if test="categoryId == null">
- AND aum.category_id_ IS NULL
- </if>
- </select>
- <select id="findByStudents1" resultMap="ActivityUserMapper">
- select * from activity_user_mapper aum
- WHERE aum.user_id_ IN
- <foreach collection="studentIdList" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- and aum.give_single_course_time_ = #{classMinutes} and return_fee_ = 0 and aum.sub_give_course_num_ > 0
- <if test="categoryId != null">
- AND aum.give_category_id_ = #{categoryId}
- </if>
- <if test="categoryId == null">
- AND aum.give_category_id_ IS NULL
- </if>
- </select>
- <select id="findByIds" resultMap="ActivityUserMapper">
- SELECT * FROM activity_user_mapper aum WHERE FIND_IN_SET(aum.id_,#{activityUserMapperIds})
- </select>
- </mapper>
|