Authored by 张帅

fix

... ... @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticleComment;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -11,9 +12,13 @@ import java.util.List;
@Repository
public interface GrassArticleCommentRepository extends JpaRepository<GrassArticleComment, Integer>{
@Query("select count(comment.id) from GrassArticleComment comment where comment.createTime >=(?1) and comment.createTime<(?2) ")
int countByCreateTimeBetween(Integer startTime, Integer endTime);
@Query("select comment from GrassArticleComment comment where comment.createTime >=(?1) and comment.createTime<(?2) ")
List<GrassArticleComment> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable);
@Query("select comment from GrassArticleComment comment where comment.createTime >=(?1) and comment.createTime<(?2) ")
List<GrassArticleComment> findAllByCreateTimeBetween(Integer startTime, Integer endTime);
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;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticlePraise;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -14,9 +15,12 @@ public interface GrassArticlePraiseRepository extends JpaRepository<GrassArticle
int countByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime);
@Query("select count(praise.id) from GrassArticlePraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ")
int countByCreateTimeBetween(Integer startTime, Integer endTime);
@Query("select praise from GrassArticlePraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ")
List<GrassArticlePraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable);
@Query("select praise from GrassArticlePraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ")
List<GrassArticlePraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime);
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassArticle;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -10,8 +11,12 @@ import java.util.List;
@Repository
public interface GrassArticleRepository extends JpaRepository<GrassArticle, Integer>{
@Query("select count(article.id) from GrassArticle article where article.createTime >=(?1) and article.createTime<(?2) and article.articleType in (?3)" +
"and article.authStatus in (?4)")
int countByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list,List<Integer> statusList);
@Query("select article from GrassArticle article where article.createTime >=(?1) and article.createTime<(?2) and article.articleType in (?3)" +
"and article.authStatus in (?4)")
List<GrassArticle> findAllByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list,
List<Integer> statusList, Pageable pageable);
List<GrassArticle> findAllByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(long startTime, long endTime,List<Integer> list,
... ...
... ... @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassCommentPraise;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -10,9 +11,12 @@ import java.util.List;
@Repository
public interface GrassCommentPraiseRepository extends JpaRepository<GrassCommentPraise, Integer>{
@Query("select count(praise.id) from GrassCommentPraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ")
int countByCreateTimeBetween(Integer startTime, Integer endTime);
@Query("select praise from GrassCommentPraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ")
List<GrassCommentPraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable);
@Query("select praise from GrassCommentPraise praise where praise.createTime >=(?1) and praise.createTime<(?2) ")
List<GrassCommentPraise> findAllByCreateTimeBetween(Integer startTime, Integer endTime);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAchieve;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAttention;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -11,7 +12,9 @@ import java.util.List;
@Repository
public interface GrassUserAchieveRepository extends JpaRepository<GrassUserAchieve, Integer>{
@Query("select count(achieve.id) from GrassUserAchieve achieve where achieve.createTime >=(?1) and achieve.createTime<(?2) ")
int countByCreateTimeBetween(Integer startTime, Integer endTime);
@Query("select achieve from GrassUserAchieve achieve where achieve.createTime >=(?1) and achieve.createTime<(?2) ")
List<GrassUserAchieve> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable);
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAttention;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -10,9 +11,12 @@ import java.util.List;
@Repository
public interface GrassUserAttentionRepository extends JpaRepository<GrassUserAttention, Integer>{
@Query("select count(attention.id) from GrassUserAttention attention where attention.createTime >=(?1) and attention.createTime<(?2) ")
int countByCreateTimeBetween(Integer startTime, Integer endTime);
@Query("select attention from GrassUserAttention attention where attention.createTime >=(?1) and attention.createTime<(?2) ")
List<GrassUserAttention> findAllByCreateTimeBetweenAndCreateTimeAfter(Integer startTime, Integer endTime,Integer beginTime, Pageable pageable);
@Query("select attention from GrassUserAttention attention where attention.createTime >=(?1) and attention.createTime<(?2) ")
List<GrassUserAttention> findAllByCreateTimeBetweenAndCreateTimeAfter(Integer startTime, Integer endTime,Integer beginTime);
}
... ...
package com.yoho.datasync.fullsync.dal.repository.grass;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassUserAchieve;
import com.yoho.datasync.fullsync.dal.repository.grass.model.GrassVirtualUser;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -11,7 +11,9 @@ import java.util.List;
@Repository
public interface GrassVirtualUserRepository extends JpaRepository<GrassVirtualUser, Integer>{
@Query("select count(user.id) from GrassVirtualUser user where user.createTime >=(?1) and user.createTime<(?2) ")
int countByCreateTimeBetween(Integer startTime, Integer endTime);
@Query("select user from GrassVirtualUser user where user.createTime >=(?1) and user.createTime<(?2) ")
List<GrassVirtualUser> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable);
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yoho.datasync.fullsync.dal.repository.grass;
import com.yoho.datasync.fullsync.dal.repository.grass.model.UserFavoriteArticle;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
... ... @@ -12,10 +13,13 @@ public interface UserFavoriteArticleRepository extends JpaRepository<UserFavorit
List<UserFavoriteArticle> findAllByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime);
@Query("select count(userFavorite.id) from UserFavoriteArticle userFavorite where userFavorite.createTime >=(?1) and userFavorite.createTime<(?2) ")
int countByCreateTimeBetween(Integer startTime, Integer endTime);
@Query("select userFavorite from UserFavoriteArticle userFavorite where userFavorite.createTime >=(?1) and userFavorite.createTime<(?2) ")
List<UserFavoriteArticle> findAllByCreateTimeBetween(Integer startTime, Integer endTime, Pageable pageable);
@Query("select userFavorite from UserFavoriteArticle userFavorite where userFavorite.createTime >=(?1) and userFavorite.createTime<(?2) ")
List<UserFavoriteArticle> findAllByCreateTimeBetween(Integer startTime, Integer endTime);
int countByArticleIdInAndCreateTimeAfter(List<Integer> list, Integer createTime);
... ...
... ... @@ -12,13 +12,15 @@ import java.util.List;
@Repository
public interface PublicUserAttentionRepository extends JpaRepository<PublicUserAttention, Integer>{
@Query("select count(attention.id) from PublicUserAttention attention where attention.targetId in (?1) and attention.uid in (?2) " +
"and attention.attentionType = ?3 and attention.srcChannel=?4 and attention.createTime >=(?5) and attention.createTime<(?6) ")
int countByTargetIdInAndUidInAndAttentionTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> targetIds,List<Integer> uids,Integer attentionType,Integer srcChannel, Long startTime,Long endTIme);
@Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.UidAndAttention(uid, count(id))" +
" from PublicUserAttention where createTime > :startTime and create_time <=:endTime and attentionType=1 and status=1 group by uid")
" from PublicUserAttention where createTime >= :startTime and create_time <:endTime and attentionType=1 and status=1 group by uid")
List<UidAndAttention> selectUidAttenCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime);
@Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.UidAndAttention(targetId, count(id),authorType)" +
" from PublicUserAttention where createTime > :startTime and create_time <=:endTime and attentionType=1 and status=1 group by targetId,authorType")
" from PublicUserAttention where createTime >= :startTime and create_time <:endTime and attentionType=1 and status=1 group by targetId,authorType")
List<UidAndAttention> selectUidFansCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime);
}
... ...
... ... @@ -14,6 +14,8 @@ public interface PublicUserCommentRepository extends JpaRepository<PublicUserCom
int countByArticleIdInAndSrcChannelIs(List<Integer> articleIds, Integer src_channel);
@Query("select count(comment.id) from PublicUserComment comment where comment.articleId in (?1) " +
"and comment.srcChannel=?2 and comment.createTime >=(?3) and comment.createTime<(?4) ")
int countByArticleIdInAndSrcChannelIsAndCreateTimeBetween(List<Integer> articleIds, Integer src_channel,Long startTime, Long endTime);
@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
int countByTargetIdInAndFavoriteTypeIsAndSrcChannelIs(List<Integer> ids, Integer favoriteType, Integer srcChannel);
@Query("select count(favorite.id) from PublicUserFavorite favorite where favorite.targetId in (?1) and favorite.favoriteType = ?2 " +
"and favorite.srcChannel=?3 and favorite.createTime >=(?4) and favorite.createTime<(?5) ")
int countByTargetIdInAndFavoriteTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> ids, Integer favoriteType, Integer srcChannel, Long satrtTime, Long endTime);
@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;
import com.yoho.datasync.fullsync.dal.repository.pcms.model.PublicUserHomePage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
public interface PublicUserHomePageRepository extends JpaRepository<PublicUserHomePage, Integer>{
@Query("select count(homePage.id) from PublicUserHomePage homePage where homePage.createTime >=(?1) and homePage.createTime<(?2) ")
int countByCreateTimeBetween(Long startTime, Long endTime);
}
... ...
... ... @@ -13,9 +13,12 @@ import java.util.List;
public interface PublicUserPraiseRepository extends JpaRepository<PublicUserPraise, Integer>{
int countByTargetIdInAndPraiseTypeIsAndSrcChannelIs(List<Integer> ids, Integer type,Integer src_channel);
@Query("select count(praise.id) from PublicUserPraise praise where praise.targetId in (?1) and praise.praiseType = ?2 " +
"and praise.srcChannel=?3 and praise.createTime >=(?4) and praise.createTime<(?5) ")
int countByTargetIdInAndPraiseTypeIsAndSrcChannelIsAndCreateTimeBetween(List<Integer> ids, Integer type,Integer src_channel,Long startTime, Long endTime);
@Query(value = "select new com.yoho.datasync.fullsync.dal.repository.pcms.model.ArticleIdAndCount(targetId, count(id))" +
" from PublicUserPraise where createTime > :startTime and create_time <=:endTime and praiseType=1 and status=1 group by targetId")
" from PublicUserPraise where createTime >= :startTime and create_time <:endTime and praiseType=1 and status=1 group by targetId")
List<ArticleIdAndCount> selectArticlePraiseCount(@Param("startTime")Long startTime, @Param("endTime")Long endTime);
}
... ...
... ... @@ -2,10 +2,12 @@ package com.yoho.datasync.fullsync.dal.repository.pcms;
import com.yoho.datasync.fullsync.dal.repository.pcms.model.PublicVirtualUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
public interface PublicVirtualUserRepository extends JpaRepository<PublicVirtualUser, Integer>{
@Query("select count(user.id) from PublicVirtualUser user where user.createTime >=(?1) and user.createTime<(?2) ")
int countByCreateTimeBetween(Long startTime, Long endTime);
}
... ...