|
@@ -468,8 +468,8 @@
|
|
|
<if test="map.serviceType != null and map.serviceType != '' and map.serviceType!='S999'">
|
|
|
and t4.correct_type=#{map.serviceType}
|
|
|
</if>
|
|
|
- <if test="map.vipIds != null and map.vipIds != '' ">
|
|
|
- where t2.id in
|
|
|
+ <if test="map.vipIds != null and map.vipIds.size >0 ">
|
|
|
+ and t2.id in
|
|
|
<foreach collection="map.vipIds" open="(" item="type" separator="," close=")">
|
|
|
#{type}
|
|
|
</foreach>
|
|
@@ -581,43 +581,99 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="searchHomeworkAllTop" resultType="java.util.Map">
|
|
|
- SELECT sum(totolCount) as totolCount,a.lib_id,b.league_name from (
|
|
|
- select count(1) as totolCount,t1.lib_id
|
|
|
- from scon_homework_picture t
|
|
|
- left join tb_lib_vip t1 on t.vip_id = t1.id
|
|
|
- where is_delete = 0 and t1.lib_id is not null
|
|
|
- <if test="startDate != null and startDate != '' ">
|
|
|
- and t.create_time >= #{startDate}
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != '' ">
|
|
|
- and #{endDate} >= t.create_time
|
|
|
- </if>
|
|
|
- <if test="subject != null and subject != '' ">
|
|
|
- and t.subject = #{subject}
|
|
|
- </if>
|
|
|
- group by t1.lib_id
|
|
|
- order by totolCount desc)a join tb_lib_join b on a.lib_id = b.id
|
|
|
- GROUP BY a.lib_id
|
|
|
- order by totolCount desc
|
|
|
+ SELECT * from (
|
|
|
+ SELECT
|
|
|
+ b.id as lib_id,
|
|
|
+ b.league_name,
|
|
|
+ (
|
|
|
+ select count(1)
|
|
|
+ from
|
|
|
+ scon_homework_picture t
|
|
|
+ JOIN tb_lib_vip_service t1 ON t.vip_id = t1.vip_id
|
|
|
+ where species = 'S003'
|
|
|
+ <if test="startDate != null and startDate != '' ">
|
|
|
+ and t.create_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and #{endDate} >= t.create_time
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != '' ">
|
|
|
+ and t1.end_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and #{endDate} >= t1.start_time
|
|
|
+ </if>
|
|
|
+ <if test="subject != null and subject != '' ">
|
|
|
+ and t.subject = #{subject}
|
|
|
+ </if>
|
|
|
+ and t1.lib_id = b.id
|
|
|
+ ) as totolCount
|
|
|
+ FROM
|
|
|
+ tb_lib_join b
|
|
|
+ ) a where a.totolCount>0
|
|
|
+ order by a.totolCount desc
|
|
|
</select>
|
|
|
<select id="searchActiveTop" resultType="java.util.Map">
|
|
|
- SELECT a.lib_id,a.league_name,sum(active_count) as active_count,a.all_vips,a.sign_type,sum(100*a.active_count/all_vips) as percent from (
|
|
|
- select t2.league_name,t1.lib_id ,
|
|
|
- (select count(1) from tb_lib_vip a where a.lib_id = t1.lib_id) as all_vips,
|
|
|
- count(distinct t.vip_id) as active_count,case when t2.sign_type=0 then '旧' else '新' end sign_type
|
|
|
- from scon_homework t
|
|
|
- left join tb_lib_vip t1 on t.vip_id = t1.id
|
|
|
- join tb_lib_join t2 on t1.lib_id = t2.id
|
|
|
- where 1=1
|
|
|
- <if test="startDate != null and startDate != '' ">
|
|
|
- and t.create_time >= #{startDate}
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != '' ">
|
|
|
- and #{endDate} >= t.create_time
|
|
|
- </if>
|
|
|
- group by t1.lib_id
|
|
|
- )a GROUP BY a.lib_id
|
|
|
- order by percent desc,a.lib_id
|
|
|
+ SELECT
|
|
|
+ a.lib_id,
|
|
|
+ a.league_name,
|
|
|
+ count1 as active_count,
|
|
|
+ a.all_vips,
|
|
|
+ a.sign_type,
|
|
|
+ count1*100 / all_vips AS percent
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+
|
|
|
+ SELECT j.league_name,j.id as lib_id,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count( DISTINCT a.vip_id )
|
|
|
+ FROM
|
|
|
+ tb_lib_vip_service a
|
|
|
+ WHERE
|
|
|
+ species = 'S003'
|
|
|
+ <if test="startDate != null and startDate != '' ">
|
|
|
+ and a.end_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and #{endDate} >= a.start_time
|
|
|
+ </if>
|
|
|
+ and a.lib_id=j.id
|
|
|
+ ) AS all_vips,
|
|
|
+ (
|
|
|
+ select count(DISTINCT t.vip_id)
|
|
|
+ from
|
|
|
+ scon_homework t
|
|
|
+ JOIN tb_lib_vip_service t1 ON t.vip_id = t1.vip_id
|
|
|
+ where species = 'S003'
|
|
|
+
|
|
|
+ <if test="startDate != null and startDate != '' ">
|
|
|
+ and t.create_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and #{endDate} >= t.create_time
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != '' ">
|
|
|
+ and t1.end_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and #{endDate} >= t1.start_time
|
|
|
+ </if>
|
|
|
+
|
|
|
+ and t1.lib_id = j.id
|
|
|
+ ) as count1,
|
|
|
+ CASE
|
|
|
+ WHEN j.sign_type = 0 THEN
|
|
|
+ '旧' ELSE '新'
|
|
|
+ END sign_type
|
|
|
+ from tb_lib_join j
|
|
|
+ )a
|
|
|
+ where a.count1>0
|
|
|
+ GROUP BY
|
|
|
+ a.lib_id
|
|
|
+ ORDER BY
|
|
|
+ percent DESC,
|
|
|
+ a.lib_id
|
|
|
</select>
|
|
|
<select id="selectCountByLibId" resultType="java.lang.Long">
|
|
|
select count(1) from tb_lib_vip where lib_id=#{libId}
|