提交查询案例

This commit is contained in:
Guava
2023-06-22 21:24:07 +08:00
parent a6b8584fef
commit bc255523ce
2 changed files with 28 additions and 5 deletions

View File

@@ -18,8 +18,15 @@ import org.springframework.stereotype.Repository;
@Repository
public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecificationExecutor<Cases> {
@Query(nativeQuery = true, value = "select b.* from boe_cases_recommend_push_record a LEFT JOIN boe_cases b on. a.case_id = b.id and b.deleted=false " +
" where a.deleted=false and a.push_user_id= :#{#condition.userId}" +
@Query(nativeQuery = true, value = "select b.id,b.sys_create_aid,b.sys_create_by,b.sys_create_time,b.deleted,b.sys_update_by,b.sys_update_time,b.sys_version," +
"b.excellent_time,b.excellent,b.case_value,b.readers,b.keyword5,b.keyword4,b.keyword3,b.keyword2,b.keyword1,b.case_theme_description,b.case_theme" +
",b.case_type2,b.case_type1,b.case_type,b.case_owner_org,b.case_specialty_sequence,b.case_other_contributor,b.case_owner_phone,b.case_owner_department" +
",b.case_owner,b.case_flow,b.case_scope,b.is_leadership_plan,b.case_channel,b.email,b.contact_number,b.department,b.drafter,b.end_time,b.drafting_time," +
"b.confidentiality_level,b.approval_number,b.major_type,b.org_domain_parent3,b.org_domain_parent2,b.org_domain_parent,b.org_domain,b.summary,b.cites,b.recommends," +
"b.favorites,b.shares,b.praises,b.comments,b.views,b.status,b.top_time,b.is_top,b.recommend_time,b.bre_commend,b.cover_url,b.author_name,b.author_id,b.file_name" +
",b.file_path,b.content,b.company_id,b.title" +
" from boe_cases_recommend_push_record a LEFT JOIN boe_cases b on a.case_id = b.id and b.deleted=0 " +
" where a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
" and if(:#{#condition.keyWord} is not null,b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.keyword1 like CONCAT('%',:#{#condition.keyWord},'%')" +
@@ -28,10 +35,26 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
" or b.keyword4 like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.keyword5 like CONCAT('%',:#{#condition.keyWord},'%'),1=1)" +
" and if(:#{#condition.years} is not null ,YEAR(b.sys_create_time) in (:#{#condition.years}),1=1 )" +
" and if(:#{#condition.majorType} is nto null ,b.major_type = :#{#condition.majorType},1=1) " +
" and if(:#{#condition.majorType} is not null ,b.major_type = :#{#condition.majorType},1=1) " +
" and if(:#{#condition.org1} is not null,b.org_domain_parent in (:#{#condition.org1}),1=1)" +
" and if(:#{#condition.org2} is not null,b.org_domain_parent2 in (:#{#condition.org2}),1=1)" +
" and if(:#{#condition.org3} is not null,b.org_domain_parent3 in (:#{#condition.org3}),1=1)" +
" group by b.id order by a.sys_create_time DESC")
" group by b.id order by a.sys_create_time DESC",
countQuery = "select count(*)" +
" from boe_cases_recommend_push_record a LEFT JOIN boe_cases b on a.case_id = b.id and b.deleted=0 " +
" where a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
" and if(:#{#condition.keyWord} is not null,b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.keyword1 like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.keyword2 like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.keyword3 like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.keyword4 like CONCAT('%',:#{#condition.keyWord},'%')" +
" or b.keyword5 like CONCAT('%',:#{#condition.keyWord},'%'),1=1)" +
" and if(:#{#condition.years} is not null ,YEAR(b.sys_create_time) in (:#{#condition.years}),1=1 )" +
" and if(:#{#condition.majorType} is not null ,b.major_type = :#{#condition.majorType},1=1) " +
" and if(:#{#condition.org1} is not null,b.org_domain_parent in (:#{#condition.org1}),1=1)" +
" and if(:#{#condition.org2} is not null,b.org_domain_parent2 in (:#{#condition.org2}),1=1)" +
" and if(:#{#condition.org3} is not null,b.org_domain_parent3 in (:#{#condition.org3}),1=1)" +
" group by b.id")
Page<Cases> queryList(Pageable pageable, @Param("condition") CasePageVo casePage);
}

View File

@@ -15,7 +15,7 @@ import javax.persistence.Table;
@Data
@Entity
@EqualsAndHashCode(callSuper = false)
@Table(name = SysConstant.TABLE_PRE + "cases_recommend_launch_import")
@Table(name = SysConstant.TABLE_PRE + "cases_recommend_launch_import_data")
public class CasesRecommendLaunchImportData extends BaseEntity {
/**