推荐案例按照发布时间,未读优先排序

This commit is contained in:
buerjun
2023-06-30 20:36:24 +08:00
parent 70f988fb8f
commit 81fd4210fc
2 changed files with 5 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecificationExecutor<Cases> {
@Query(nativeQuery = true, value = "select b.*" +
@Query(nativeQuery = true, value = "select c.* from ( select b.*" +
" from boe_cases_recommend_push_record a INNER JOIN boe_cases b on a.case_id = b.id" +
" where b.deleted=0 and a.push_status = 3 and a.push_user_id= :#{#condition.userId}" +
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
@@ -33,8 +33,8 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
" and if(:#{#condition.org1Empty}, 1=1, b.org_domain_parent in (:#{#condition.org1}))" +
" and if(:#{#condition.org2Empty}, 1=1, b.org_domain_parent2 in (:#{#condition.org2}))" +
" and if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
" group by b.id order by a.sys_create_time DESC",
countQuery = "select count(*) FROM (select b.*" +
" order by a.sys_create_time DESC, a.read_flag ASC) as c group by c.id",
countQuery = "select count(*) FROM (select c.* from ( select b.*" +
" from boe_cases_recommend_push_record a INNER JOIN boe_cases b on a.case_id = b.id " +
" where b.deleted=0 and a.push_status = 3 and a.push_user_id= :#{#condition.userId}" +
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
@@ -49,6 +49,6 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
" and if(:#{#condition.org1Empty}, 1=1, b.org_domain_parent in (:#{#condition.org1}))" +
" and if(:#{#condition.org2Empty}, 1=1, b.org_domain_parent2 in (:#{#condition.org2}))" +
" and if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
" group by b.id) as b")
" order by a.sys_create_time DESC, a.read_flag ASC ) as c group by c.id) as d")
Page<Cases> queryList(Pageable pageable, @Param("condition") CasePageVo casePage);
}

View File

@@ -887,7 +887,7 @@ public class CasesServiceImpl implements ICasesService {
String accountId = current.getAccountId();
List<Cases> result = new ArrayList<>();
try {
String hql = "select a.caseId FROM CasesRecommendPushRecord a left join Cases b ON a.caseId = b.id WHERE a.pushUserId=?1 and a.pushStatus=4 and b.deleted = false group by a.caseId ORDER By a.pushTime DESC";
String hql = "select a.caseId FROM CasesRecommendPushRecord a left join Cases b ON a.caseId = b.id WHERE a.pushUserId=?1 and a.pushStatus=3 and b.deleted = false group by a.caseId ORDER By a.pushTime DESC";
List<String> listFields = casesRecommendDao.findListFields(hql, CASE_LEN, ListUtil.toList(accountId));
List<String> caseIds = new ArrayList<>();
if (CollUtil.isNotEmpty(listFields)) {