|
@@ -2,6 +2,7 @@ package com.tzld.piaoquan.recommend.server.repository;
|
|
|
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
import org.springframework.data.jpa.repository.Query;
|
|
|
+import org.springframework.data.repository.query.Param;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -11,12 +12,7 @@ public interface DouHotVideoPortraitDataRepository extends JpaRepository<DouHotV
|
|
|
|
|
|
List<DouHotVideoPortraitData> findAllByVidInAndType(List<String> videoIds, Integer type);
|
|
|
|
|
|
- // @Query(value = "SELECT vid, name, option, " +
|
|
|
- // "SUM(CASE WHEN type = 1 THEN value ELSE 0 END) AS rate, " +
|
|
|
- // "SUM(CASE WHEN type = 2 THEN value ELSE 0 END) AS tgi " +
|
|
|
- // "FROM douhot_video_portrait_data " +
|
|
|
- // "WHERE option = 4 " +
|
|
|
- // "GROUP BY vid, name, option " +
|
|
|
- // "HAVING SUM(CASE WHEN type = 2 THEN value ELSE 0 END) >= 100")
|
|
|
- // List<DouHotVideoProvince> findRecordTGIGe100AndRateDesc(List<String> videos);
|
|
|
+ @Query(value = "select vid, name, `option`, sum(if(type = 1, value, 0)) as rate, sum(if(type = 2, value, 0)) as tgi from douhot_video_portrait_data where `option` = 4 and vid IN (:videos) group by vid, name, `option` having tgi >= 100",
|
|
|
+ nativeQuery = true)
|
|
|
+ List<DouHotVideoProvince> findRecordTGIGe100AndRateDesc(@Param("videos") List<String> videos);
|
|
|
}
|