|
@@ -8,8 +8,8 @@
|
|
|
<result column="order_no_" property="orderNo" />
|
|
|
<result column="sub_order_no_" property="subOrderNo" />
|
|
|
<result column="create_time_" property="createTime" />
|
|
|
- </resultMap>
|
|
|
-
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<!-- 表字段 -->
|
|
|
<sql id="baseColumns">
|
|
|
t.id_ as id
|
|
@@ -18,18 +18,81 @@
|
|
|
, t.order_no_ as orderNo
|
|
|
, t.sub_order_no_ as subOrderNo
|
|
|
, t.create_time_ as createTime
|
|
|
- </sql>
|
|
|
-
|
|
|
+ </sql>
|
|
|
+
|
|
|
<select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRegistrationVo">
|
|
|
SELECT
|
|
|
<include refid="baseColumns"/>
|
|
|
FROM activity_registration t
|
|
|
where t.id_ = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.ActivityRegistrationVo">
|
|
|
- SELECT
|
|
|
- <include refid="baseColumns" />
|
|
|
+ SELECT
|
|
|
+ <include refid="baseColumns" />,
|
|
|
+ u.id_ as studentId,u.username_ as username,u.phone_ as phone,
|
|
|
+ <if test="param.activityType != null and param.activityType.code == 'EVALUATION'">
|
|
|
+ b.music_sheet_name_ as musicSheetName,b.max_score_ as maxScore,b.num_ as num,
|
|
|
+ </if>
|
|
|
+ if(a.num>0, true, false) as rewardFlag
|
|
|
FROM activity_registration t
|
|
|
+ left join sys_user u on t.user_id_ = u.id_
|
|
|
+ left join (
|
|
|
+ select
|
|
|
+ aur.activity_id_,aur.user_id_,count(1) as num
|
|
|
+ from activity_user_reward aur
|
|
|
+ <where>
|
|
|
+ <if test="param.activityId != null">
|
|
|
+ and aur.activity_id_ = #{param.activityId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by aur.activity_id_,aur.user_id_
|
|
|
+ ) a on t.activity_id_ = a.activity_id_ and t.user_id_ = a.user_id_
|
|
|
+ <if test="param.activityType != null and param.activityType.code == 'EVALUATION'">
|
|
|
+ left join (
|
|
|
+ select
|
|
|
+ ar.activity_id_,aer.user_id_,
|
|
|
+ group_concat(ms.music_sheet_name_) as music_sheet_name_,
|
|
|
+ count(aer.id_) as num_,
|
|
|
+ max(aer.score_) as max_score_
|
|
|
+ from activity_registration ar
|
|
|
+ left join activity_evaluation_record aer on ar.activity_id_ = aer.activity_id_ and ar.user_id_ = aer.user_id_
|
|
|
+ left join activity_evaluation ae on aer.evaluation_id_ = ae.id_
|
|
|
+ left join music_sheet ms on ae.music_sheet_id_ = ms.id_
|
|
|
+ <where>
|
|
|
+ <if test="param.activityId != null">
|
|
|
+ and aer.activity_id_ = #{param.activityId}
|
|
|
+ </if>
|
|
|
+ <if test="param.musicSheetIds != null and param.musicSheetIds.size()>0">
|
|
|
+ and ae.music_sheet_id_ IN
|
|
|
+ <foreach collection="param.musicSheetIds" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by ar.activity_id_,aer.user_id_
|
|
|
+ ) b on t.activity_id_ = b.activity_id_ and t.user_id_ = b.user_id_
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="param.activityType != null and param.activityType.code == 'EVALUATION'">
|
|
|
+ and b.activity_id_ is not null
|
|
|
+ </if>
|
|
|
+ <if test="param.activityId != null">
|
|
|
+ and t.activity_id_ = #{param.activityId}
|
|
|
+ </if>
|
|
|
+ <if test="null != param.search and '' != param.search">
|
|
|
+ AND (
|
|
|
+ t.user_id_ LIKE CONCAT('%', #{param.search}, '%') or
|
|
|
+ u.username_ LIKE CONCAT('%', #{param.search}, '%') or
|
|
|
+ u.phone_ LIKE CONCAT('%', #{param.search}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="null != param.rewardFlag and param.rewardFlag.code == 0">
|
|
|
+ and (a.num is null or a.num = 0)
|
|
|
+ </if>
|
|
|
+ <if test="null != param.rewardFlag and param.rewardFlag.code == 1">
|
|
|
+ and a.num > 0
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
</mapper>
|