|
@ -335,22 +335,26 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
|
|
|
//根据分类查询文章
|
|
|
public MixEnvelop findArticleByCategoryAndName(String categoryFirst, String categorySecond, String keyWords, Integer page, Integer pageSize){
|
|
|
MixEnvelop objEnvelop = new MixEnvelop();
|
|
|
String sql = "select t.id as \"id\",t.title as \"title\", " +
|
|
|
String sql = "select t.id as \"id\",t.title as \"title\",t.read_count as \"readCount\"," +
|
|
|
"t.collection as \"collection\",t.fabulous as \"fabulous\",t.is_share as \"share\"," +
|
|
|
" t.intro as \"intro\",t.category_first_name as \"categoryFirstName\"," +
|
|
|
" t.category_second_name as \"categorySecondName\" ," +
|
|
|
"t.content as \"content\",t.image as \"image\",t.create_user_name as \"createUserName\"," +
|
|
|
"b.job_title_name as \"jobTitleName\",b.visit_hospital_name as \"visitHospitalName\" from wlyy_knowledge_article t left join wlyy_knowledge_article_dept a " +
|
|
|
" on a.article_id = t.id left join base_doctor b on b.id = t.create_user where 1=1";
|
|
|
"t.content as \"content\",t.image as \"image\",t.create_user_name as \"createUserName\",c.job_title_name as \"jobTitleName\"," +
|
|
|
"b.dept_name as \"deptName\",b.org_name as \"hospitalName\" from wlyy_knowledge_article t left join wlyy_knowledge_article_dept a " +
|
|
|
" on a.article_id = t.id left join base_doctor_hospital b on b.doctor_code = t.create_user" +
|
|
|
" left join base_doctor c on c.id = t.create_user where 1=1 and t.del = 1";
|
|
|
if (StringUtils.isNotBlank(categoryFirst)&&StringUtils.isNotBlank(categorySecond)){
|
|
|
sql+=" and t.category_first = '"+categoryFirst+"' and t.category_second ='"+categorySecond+"'";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(keyWords)){
|
|
|
sql+=" and (t.create_user_name like '%"+keyWords+"%' or t.title like '%"+keyWords+"%' or t.content like '%"+keyWords+"%' or a.dept_name like '%"+keyWords+"%' )";
|
|
|
}
|
|
|
sql+=" group by t.id ,t.title ,t.intro,t.category_first_name ,t.category_second_name ,t.content ,t.image ,t.create_user_name ,b.job_title_name ,b.visit_hospital_name";
|
|
|
sql+=" group by t.id ,t.title ,t.intro,t.category_first_name ,t.category_second_name ,c.job_title_name," +
|
|
|
"t.read_count,t.collection,t.fabulous,t.is_share,t.content ,t.image ,t.create_user_name ,b.dept_name ,b.org_name order by t.create_time desc";
|
|
|
List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
List<Map<String,Object>> countList = hibenateUtils.createSQLQuery(sql);
|
|
|
objEnvelop.setObj(result);
|
|
|
objEnvelop.setTotalCount(result.size());
|
|
|
objEnvelop.setTotalCount(countList.size());
|
|
|
objEnvelop.setPageSize(pageSize);
|
|
|
objEnvelop.setCurrPage(page);
|
|
|
return objEnvelop;
|