Showing
14 changed files
with
48 additions
and
4 deletions
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/grass/GrassArticleCommentRepository.java
@@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | ||
3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticleComment; | 3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticleComment; |
4 | import org.springframework.data.domain.Pageable; | 4 | import org.springframework.data.domain.Pageable; |
5 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
6 | +import org.springframework.data.jpa.repository.Query; | ||
6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
@@ -11,9 +12,13 @@ import java.util.List; | @@ -11,9 +12,13 @@ import java.util.List; | ||
11 | @Repository | 12 | @Repository |
12 | public interface GrassArticleCommentRepository extends JpaRepository<GrassArticleComment, Integer>{ | 13 | public interface GrassArticleCommentRepository extends JpaRepository<GrassArticleComment, Integer>{ |
13 | 14 | ||
15 | + @Query("select count(comment.id) from GrassArticleComment comment where comment.createTime >=(?1) and comment.createTime<(?2) ") | ||
14 | int countByCreateTimeBetween(Integer startTime, Integer endTime); | 16 | int countByCreateTimeBetween(Integer startTime, Integer endTime); |
15 | 17 | ||
18 | + @Query("select comment from GrassArticleComment comment where comment.createTime >=(?1) and comment.createTime<(?2) ") | ||
16 | List<GrassArticleComment> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); | 19 | List<GrassArticleComment> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); |
20 | + | ||
21 | + @Query("select comment from GrassArticleComment comment where comment.createTime >=(?1) and comment.createTime<(?2) ") | ||
17 | List<GrassArticleComment> findAllByCreateTimeBetween(Integer startTime, Integer endTime); | 22 | List<GrassArticleComment> findAllByCreateTimeBetween(Integer startTime, Integer endTime); |
18 | 23 | ||
19 | List<GrassArticleComment> findAllByDestIdInAndArticleTypeInAndStatusIsNotAndParentIdIsNullAndCreateTimeAfter(List<Integer> articleIds, List<Integer> articleTypes,Integer status,Integer beginTime); | 24 | List<GrassArticleComment> findAllByDestIdInAndArticleTypeInAndStatusIsNotAndParentIdIsNullAndCreateTimeAfter(List<Integer> articleIds, List<Integer> articleTypes,Integer status,Integer beginTime); |
@@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | ||
3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticlePraise; | 3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticlePraise; |
4 | import org.springframework.data.domain.Pageable; | 4 | import org.springframework.data.domain.Pageable; |
5 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
6 | +import org.springframework.data.jpa.repository.Query; | ||
6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
@@ -14,9 +15,12 @@ public interface GrassArticlePraiseRepository extends JpaRepository<GrassArticle | @@ -14,9 +15,12 @@ public interface GrassArticlePraiseRepository extends JpaRepository<GrassArticle | ||
14 | 15 | ||
15 | int countByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime); | 16 | int countByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime); |
16 | 17 | ||
18 | + @Query("select count(praise.id) from GrassArticlePraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ") | ||
17 | int countByCreateTimeBetween(Integer startTime, Integer endTime); | 19 | int countByCreateTimeBetween(Integer startTime, Integer endTime); |
18 | 20 | ||
21 | + @Query("select praise from GrassArticlePraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ") | ||
19 | List<GrassArticlePraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); | 22 | List<GrassArticlePraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); |
20 | 23 | ||
24 | + @Query("select praise from GrassArticlePraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ") | ||
21 | List<GrassArticlePraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime); | 25 | List<GrassArticlePraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime); |
22 | } | 26 | } |
@@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | ||
3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticle; | 3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticle; |
4 | import org.springframework.data.domain.Pageable; | 4 | import org.springframework.data.domain.Pageable; |
5 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
6 | +import org.springframework.data.jpa.repository.Query; | ||
6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
@@ -10,8 +11,12 @@ import java.util.List; | @@ -10,8 +11,12 @@ import java.util.List; | ||
10 | @Repository | 11 | @Repository |
11 | public interface GrassArticleRepository extends JpaRepository<GrassArticle, Integer>{ | 12 | public interface GrassArticleRepository extends JpaRepository<GrassArticle, Integer>{ |
12 | 13 | ||
14 | + @Query("select count(article.id) from GrassArticle article where article.createTime >=(?1) and article.createTime<(?2) and article.articleType in (?3)" + | ||
15 | + "and article.authStatus in (?4)") | ||
13 | int countByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list,List<Integer> statusList); | 16 | int countByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list,List<Integer> statusList); |
14 | 17 | ||
18 | + @Query("select article from GrassArticle article where article.createTime >=(?1) and article.createTime<(?2) and article.articleType in (?3)" + | ||
19 | + "and article.authStatus in (?4)") | ||
15 | List<GrassArticle> findAllByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list, | 20 | List<GrassArticle> findAllByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list, |
16 | List<Integer> statusList, Pageable pageable); | 21 | List<Integer> statusList, Pageable pageable); |
17 | List<GrassArticle> findAllByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list, | 22 | List<GrassArticle> findAllByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list, |
@@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | ||
3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassCommentPraise; | 3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassCommentPraise; |
4 | import org.springframework.data.domain.Pageable; | 4 | import org.springframework.data.domain.Pageable; |
5 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
6 | +import org.springframework.data.jpa.repository.Query; | ||
6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
@@ -10,9 +11,12 @@ import java.util.List; | @@ -10,9 +11,12 @@ import java.util.List; | ||
10 | @Repository | 11 | @Repository |
11 | public interface GrassCommentPraiseRepository extends JpaRepository<GrassCommentPraise, Integer>{ | 12 | public interface GrassCommentPraiseRepository extends JpaRepository<GrassCommentPraise, Integer>{ |
12 | 13 | ||
14 | + @Query("select count(praise.id) from GrassCommentPraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ") | ||
13 | int countByCreateTimeBetween(Integer startTime, Integer endTime); | 15 | int countByCreateTimeBetween(Integer startTime, Integer endTime); |
14 | 16 | ||
17 | + @Query("select praise from GrassCommentPraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ") | ||
15 | List<GrassCommentPraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); | 18 | List<GrassCommentPraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); |
16 | 19 | ||
20 | + @Query("select praise from GrassCommentPraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ") | ||
17 | List<GrassCommentPraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime); | 21 | List<GrassCommentPraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime); |
18 | } | 22 | } |
@@ -4,6 +4,7 @@ import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAchieve; | @@ -4,6 +4,7 @@ import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAchieve; | ||
4 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAttention; | 4 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAttention; |
5 | import org.springframework.data.domain.Pageable; | 5 | import org.springframework.data.domain.Pageable; |
6 | import org.springframework.data.jpa.repository.JpaRepository; | 6 | import org.springframework.data.jpa.repository.JpaRepository; |
7 | +import org.springframework.data.jpa.repository.Query; | ||
7 | import org.springframework.stereotype.Repository; | 8 | import org.springframework.stereotype.Repository; |
8 | 9 | ||
9 | import java.util.List; | 10 | import java.util.List; |
@@ -11,7 +12,9 @@ import java.util.List; | @@ -11,7 +12,9 @@ import java.util.List; | ||
11 | @Repository | 12 | @Repository |
12 | public interface GrassUserAchieveRepository extends JpaRepository<GrassUserAchieve, Integer>{ | 13 | public interface GrassUserAchieveRepository extends JpaRepository<GrassUserAchieve, Integer>{ |
13 | 14 | ||
15 | + @Query("select count(achieve.id) from GrassUserAchieve achieve where achieve.createTime >=(?1) and achieve.createTime<(?2) ") | ||
14 | int countByCreateTimeBetween(Integer startTime, Integer endTime); | 16 | int countByCreateTimeBetween(Integer startTime, Integer endTime); |
15 | 17 | ||
18 | + @Query("select achieve from GrassUserAchieve achieve where achieve.createTime >=(?1) and achieve.createTime<(?2) ") | ||
16 | List<GrassUserAchieve> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); | 19 | List<GrassUserAchieve> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); |
17 | } | 20 | } |
@@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | ||
3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAttention; | 3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAttention; |
4 | import org.springframework.data.domain.Pageable; | 4 | import org.springframework.data.domain.Pageable; |
5 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
6 | +import org.springframework.data.jpa.repository.Query; | ||
6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
@@ -10,9 +11,12 @@ import java.util.List; | @@ -10,9 +11,12 @@ import java.util.List; | ||
10 | @Repository | 11 | @Repository |
11 | public interface GrassUserAttentionRepository extends JpaRepository<GrassUserAttention, Integer>{ | 12 | public interface GrassUserAttentionRepository extends JpaRepository<GrassUserAttention, Integer>{ |
12 | 13 | ||
14 | + @Query("select count(attention.id) from GrassUserAttention attention where attention.createTime >=(?1) and attention.createTime<(?2) ") | ||
13 | int countByCreateTimeBetween(Integer startTime, Integer endTime); | 15 | int countByCreateTimeBetween(Integer startTime, Integer endTime); |
14 | 16 | ||
17 | + @Query("select attention from GrassUserAttention attention where attention.createTime >=(?1) and attention.createTime<(?2) ") | ||
15 | List<GrassUserAttention> findAllByCreateTimeBetweenAndCreateTimeAfter(Integer startTime, Integer endTime,Integer beginTime, Pageable pageable); | 18 | List<GrassUserAttention> findAllByCreateTimeBetweenAndCreateTimeAfter(Integer startTime, Integer endTime,Integer beginTime, Pageable pageable); |
16 | 19 | ||
20 | + @Query("select attention from GrassUserAttention attention where attention.createTime >=(?1) and attention.createTime<(?2) ") | ||
17 | List<GrassUserAttention> findAllByCreateTimeBetweenAndCreateTimeAfter(Integer startTime, Integer endTime,Integer beginTime); | 21 | List<GrassUserAttention> findAllByCreateTimeBetweenAndCreateTimeAfter(Integer startTime, Integer endTime,Integer beginTime); |
18 | } | 22 | } |
1 | package com.yoho.datasync.fullsync.dal.repository.grass; | 1 | package com.yoho.datasync.fullsync.dal.repository.grass; |
2 | 2 | ||
3 | -import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAchieve; | ||
4 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassVirtualUser; | 3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassVirtualUser; |
5 | import org.springframework.data.domain.Pageable; | 4 | import org.springframework.data.domain.Pageable; |
6 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
6 | +import org.springframework.data.jpa.repository.Query; | ||
7 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
8 | 8 | ||
9 | import java.util.List; | 9 | import java.util.List; |
@@ -11,7 +11,9 @@ import java.util.List; | @@ -11,7 +11,9 @@ import java.util.List; | ||
11 | @Repository | 11 | @Repository |
12 | public interface GrassVirtualUserRepository extends JpaRepository<GrassVirtualUser, Integer>{ | 12 | public interface GrassVirtualUserRepository extends JpaRepository<GrassVirtualUser, Integer>{ |
13 | 13 | ||
14 | + @Query("select count(user.id) from GrassVirtualUser user where user.createTime >=(?1) and user.createTime<(?2) ") | ||
14 | int countByCreateTimeBetween(Integer startTime, Integer endTime); | 15 | int countByCreateTimeBetween(Integer startTime, Integer endTime); |
15 | 16 | ||
17 | + @Query("select user from GrassVirtualUser user where user.createTime >=(?1) and user.createTime<(?2) ") | ||
16 | List<GrassVirtualUser> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); | 18 | List<GrassVirtualUser> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); |
17 | } | 19 | } |
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/grass/UserFavoriteArticleRepository.java
@@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass; | ||
3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.UserFavoriteArticle; | 3 | import com.yoho.datasync.fullsync.dal.repository.grass.model.UserFavoriteArticle; |
4 | import org.springframework.data.domain.Pageable; | 4 | import org.springframework.data.domain.Pageable; |
5 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
6 | +import org.springframework.data.jpa.repository.Query; | ||
6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
@@ -12,10 +13,13 @@ public interface UserFavoriteArticleRepository extends JpaRepository<UserFavorit | @@ -12,10 +13,13 @@ public interface UserFavoriteArticleRepository extends JpaRepository<UserFavorit | ||
12 | 13 | ||
13 | List<UserFavoriteArticle> findAllByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime); | 14 | List<UserFavoriteArticle> findAllByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime); |
14 | 15 | ||
16 | + @Query("select count(userFavorite.id) from UserFavoriteArticle userFavorite where userFavorite.createTime >=(?1) and userFavorite.createTime<(?2) ") | ||
15 | int countByCreateTimeBetween(Integer startTime, Integer endTime); | 17 | int countByCreateTimeBetween(Integer startTime, Integer endTime); |
16 | 18 | ||
19 | + @Query("select userFavorite from UserFavoriteArticle userFavorite where userFavorite.createTime >=(?1) and userFavorite.createTime<(?2) ") | ||
17 | List<UserFavoriteArticle> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); | 20 | List<UserFavoriteArticle> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable); |
18 | 21 | ||
22 | + @Query("select userFavorite from UserFavoriteArticle userFavorite where userFavorite.createTime >=(?1) and userFavorite.createTime<(?2) ") | ||
19 | List<UserFavoriteArticle> findAllByCreateTimeBetween(Integer startTime, Integer endTime); | 23 | List<UserFavoriteArticle> findAllByCreateTimeBetween(Integer startTime, Integer endTime); |
20 | 24 | ||
21 | int countByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime); | 25 | int countByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime); |
@@ -12,13 +12,15 @@ import java.util.List; | @@ -12,13 +12,15 @@ import java.util.List; | ||
12 | @Repository | 12 | @Repository |
13 | public interface PublicUserAttentionRepository extends JpaRepository<PublicUserAttention, Integer>{ | 13 | public interface PublicUserAttentionRepository extends JpaRepository<PublicUserAttention, Integer>{ |
14 | 14 | ||
15 | + @Query("select count(attention.id) from PublicUserAttention attention where attention.targetId in (?1) and attention.uid in (?2) " + | ||
16 | + "and attention.attentionType = ?3 and attention.srcChannel=?4 and attention.createTime >=(?5) and attention.createTime<(?6) ") | ||
15 | int countByTargetIdInAndUidInAndAttentionTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> targetIds,List<Integer> uids,Integer attentionType,Integer srcChannel, Long startTime,Long endTIme); | 17 | int countByTargetIdInAndUidInAndAttentionTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> targetIds,List<Integer> uids,Integer attentionType,Integer srcChannel, Long startTime,Long endTIme); |
16 | 18 | ||
17 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.UidAndAttention(uid, count(id))" + | 19 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.UidAndAttention(uid, count(id))" + |
18 | - " from PublicUserAttention where createTime > :startTime and create_time <=:endTime and attentionType=1 and status=1 group by uid") | 20 | + " from PublicUserAttention where createTime >= :startTime and create_time <:endTime and attentionType=1 and status=1 group by uid") |
19 | List<UidAndAttention> selectUidAttenCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime); | 21 | List<UidAndAttention> selectUidAttenCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime); |
20 | 22 | ||
21 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.UidAndAttention(targetId, count(id),authorType)" + | 23 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.UidAndAttention(targetId, count(id),authorType)" + |
22 | - " from PublicUserAttention where createTime > :startTime and create_time <=:endTime and attentionType=1 and status=1 group by targetId,authorType") | 24 | + " from PublicUserAttention where createTime >= :startTime and create_time <:endTime and attentionType=1 and status=1 group by targetId,authorType") |
23 | List<UidAndAttention> selectUidFansCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime); | 25 | List<UidAndAttention> selectUidFansCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime); |
24 | } | 26 | } |
@@ -14,6 +14,8 @@ public interface PublicUserCommentRepository extends JpaRepository<PublicUserCom | @@ -14,6 +14,8 @@ public interface PublicUserCommentRepository extends JpaRepository<PublicUserCom | ||
14 | 14 | ||
15 | int countByArticleIdInAndSrcChannelIs(List<Integer> articleIds, Integer src_channel); | 15 | int countByArticleIdInAndSrcChannelIs(List<Integer> articleIds, Integer src_channel); |
16 | 16 | ||
17 | + @Query("select count(comment.id) from PublicUserComment comment where comment.articleId in (?1) " + | ||
18 | + "and comment.srcChannel=?2 and comment.createTime >=(?3) and comment.createTime<(?4) ") | ||
17 | int countByArticleIdInAndSrcChannelIsAndCreateTimeBetween(List<Integer> articleIds, Integer src_channel,Long startTime, Long endTime); | 19 | int countByArticleIdInAndSrcChannelIsAndCreateTimeBetween(List<Integer> articleIds, Integer src_channel,Long startTime, Long endTime); |
18 | 20 | ||
19 | @Query(nativeQuery = true,value = "select * from public_user_comment where relate_id in ?1 and src_channel = ?2") | 21 | @Query(nativeQuery = true,value = "select * from public_user_comment where relate_id in ?1 and src_channel = ?2") |
@@ -14,6 +14,8 @@ public interface PublicUserFavoriteRepository extends JpaRepository<PublicUserFa | @@ -14,6 +14,8 @@ public interface PublicUserFavoriteRepository extends JpaRepository<PublicUserFa | ||
14 | 14 | ||
15 | int countByTargetIdInAndFavoriteTypeIsAndSrcChannelIs(List<Integer> ids, Integer favoriteType, Integer srcChannel); | 15 | int countByTargetIdInAndFavoriteTypeIsAndSrcChannelIs(List<Integer> ids, Integer favoriteType, Integer srcChannel); |
16 | 16 | ||
17 | + @Query("select count(favorite.id) from PublicUserFavorite favorite where favorite.targetId in (?1) and favorite.favoriteType = ?2 " + | ||
18 | + "and favorite.srcChannel=?3 and favorite.createTime >=(?4) and favorite.createTime<(?5) ") | ||
17 | int countByTargetIdInAndFavoriteTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> ids, Integer favoriteType, Integer srcChannel, Long satrtTime, Long endTime); | 19 | int countByTargetIdInAndFavoriteTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> ids, Integer favoriteType, Integer srcChannel, Long satrtTime, Long endTime); |
18 | 20 | ||
19 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.ArticleIdAndCount(targetId, count(id))" + | 21 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.ArticleIdAndCount(targetId, count(id))" + |
@@ -2,11 +2,13 @@ package com.yoho.datasync.fullsync.dal.repository.pcms; | @@ -2,11 +2,13 @@ package com.yoho.datasync.fullsync.dal.repository.pcms; | ||
2 | 2 | ||
3 | import com.yoho.datasync.fullsync.dal.repository.pcms.model.PublicUserHomePage; | 3 | import com.yoho.datasync.fullsync.dal.repository.pcms.model.PublicUserHomePage; |
4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
5 | +import org.springframework.data.jpa.repository.Query; | ||
5 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
6 | 7 | ||
7 | @Repository | 8 | @Repository |
8 | public interface PublicUserHomePageRepository extends JpaRepository<PublicUserHomePage, Integer>{ | 9 | public interface PublicUserHomePageRepository extends JpaRepository<PublicUserHomePage, Integer>{ |
9 | 10 | ||
10 | 11 | ||
12 | + @Query("select count(homePage.id) from PublicUserHomePage homePage where homePage.createTime >=(?1) and homePage.createTime<(?2) ") | ||
11 | int countByCreateTimeBetween(Long startTime, Long endTime); | 13 | int countByCreateTimeBetween(Long startTime, Long endTime); |
12 | } | 14 | } |
@@ -13,9 +13,12 @@ import java.util.List; | @@ -13,9 +13,12 @@ import java.util.List; | ||
13 | public interface PublicUserPraiseRepository extends JpaRepository<PublicUserPraise, Integer>{ | 13 | public interface PublicUserPraiseRepository extends JpaRepository<PublicUserPraise, Integer>{ |
14 | 14 | ||
15 | int countByTargetIdInAndPraiseTypeIsAndSrcChannelIs(List<Integer> ids, Integer type,Integer src_channel); | 15 | int countByTargetIdInAndPraiseTypeIsAndSrcChannelIs(List<Integer> ids, Integer type,Integer src_channel); |
16 | + | ||
17 | + @Query("select count(praise.id) from PublicUserPraise praise where praise.targetId in (?1) and praise.praiseType = ?2 " + | ||
18 | + "and praise.srcChannel=?3 and praise.createTime >=(?4) and praise.createTime<(?5) ") | ||
16 | int countByTargetIdInAndPraiseTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> ids, Integer type,Integer src_channel,Long startTime, Long endTime); | 19 | int countByTargetIdInAndPraiseTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> ids, Integer type,Integer src_channel,Long startTime, Long endTime); |
17 | 20 | ||
18 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.ArticleIdAndCount(targetId, count(id))" + | 21 | @Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.ArticleIdAndCount(targetId, count(id))" + |
19 | - " from PublicUserPraise where createTime > :startTime and create_time <=:endTime and praiseType=1 and status=1 group by targetId") | 22 | + " from PublicUserPraise where createTime >= :startTime and create_time <:endTime and praiseType=1 and status=1 group by targetId") |
20 | List<ArticleIdAndCount> selectArticlePraiseCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime); | 23 | List<ArticleIdAndCount> selectArticlePraiseCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime); |
21 | } | 24 | } |
@@ -2,10 +2,12 @@ package com.yoho.datasync.fullsync.dal.repository.pcms; | @@ -2,10 +2,12 @@ package com.yoho.datasync.fullsync.dal.repository.pcms; | ||
2 | 2 | ||
3 | import com.yoho.datasync.fullsync.dal.repository.pcms.model.PublicVirtualUser; | 3 | import com.yoho.datasync.fullsync.dal.repository.pcms.model.PublicVirtualUser; |
4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
5 | +import org.springframework.data.jpa.repository.Query; | ||
5 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
6 | 7 | ||
7 | @Repository | 8 | @Repository |
8 | public interface PublicVirtualUserRepository extends JpaRepository<PublicVirtualUser, Integer>{ | 9 | public interface PublicVirtualUserRepository extends JpaRepository<PublicVirtualUser, Integer>{ |
9 | 10 | ||
11 | + @Query("select count(user.id) from PublicVirtualUser user where user.createTime >=(?1) and user.createTime<(?2) ") | ||
10 | int countByCreateTimeBetween(Long startTime, Long endTime); | 12 | int countByCreateTimeBetween(Long startTime, Long endTime); |
11 | } | 13 | } |
-
Please register or login to post a comment