mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 19:36:50 +08:00
【需求变更】案例导出推荐次数字段改为实时查询
This commit is contained in:
@@ -198,7 +198,7 @@ public class CasesApi extends ApiBaseController {
|
|||||||
caseExportVo.setTitle(c.getTitle());
|
caseExportVo.setTitle(c.getTitle());
|
||||||
caseExportVo.setConfidentialityLevel(c.getConfidentialityLevel());
|
caseExportVo.setConfidentialityLevel(c.getConfidentialityLevel());
|
||||||
caseExportVo.setViews(c.getViews());
|
caseExportVo.setViews(c.getViews());
|
||||||
caseExportVo.setRecommends(c.getRecommends());
|
caseExportVo.setRecommends(c.getRecommends1());
|
||||||
caseExportVo.setCites(c.getCites());
|
caseExportVo.setCites(c.getCites());
|
||||||
caseExportVo.setPraises(c.getPraises());
|
caseExportVo.setPraises(c.getPraises());
|
||||||
caseExportVo.setComments(c.getComments());
|
caseExportVo.setComments(c.getComments());
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.xboe.common.PageList;
|
|||||||
import com.xboe.core.orm.BaseDao;
|
import com.xboe.core.orm.BaseDao;
|
||||||
import com.xboe.core.orm.FieldFilters;
|
import com.xboe.core.orm.FieldFilters;
|
||||||
import com.xboe.core.orm.IFieldFilter;
|
import com.xboe.core.orm.IFieldFilter;
|
||||||
|
import com.xboe.module.boecase.dto.CaseVo;
|
||||||
import com.xboe.module.boecase.entity.Cases;
|
import com.xboe.module.boecase.entity.Cases;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -33,5 +34,4 @@ public class CasesDao extends BaseDao<Cases> {
|
|||||||
public Cases getByTitle(String title) {
|
public Cases getByTitle(String title) {
|
||||||
return this.getGenericDao().findOne(Cases.class, FieldFilters.eq("title", title));
|
return this.getGenericDao().findOne(Cases.class, FieldFilters.eq("title", title));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.xboe.module.boecase.dao;
|
package com.xboe.module.boecase.dao;
|
||||||
|
|
||||||
import com.xboe.module.boecase.dto.CasePageVo;
|
import com.xboe.module.boecase.dto.CasePageVo;
|
||||||
|
import com.xboe.module.boecase.dto.CaseVo;
|
||||||
import com.xboe.module.boecase.entity.Cases;
|
import com.xboe.module.boecase.entity.Cases;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -10,6 +11,9 @@ import org.springframework.data.jpa.repository.Query;
|
|||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import javax.persistence.SqlResultSetMapping;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : civism
|
* @author : civism
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
@@ -53,4 +57,24 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
|
|||||||
" and if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
" and if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||||
" order by a.sys_create_time DESC, a.read_flag ASC ) as c group by c.id) as d")
|
" 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);
|
Page<Cases> queryList(Pageable pageable, @Param("condition") CasePageVo casePage);
|
||||||
|
|
||||||
|
// @Query(nativeQuery = true, value = "SELECT bc.*, COUNT(bcrpr.case_id) AS recommends1 FROM boe_cases bc LEFT JOIN boe_cases_recommend_push_record bcrpr ON bc.id = bcrpr.case_id" +
|
||||||
|
// " where bc.deleted = 0" +
|
||||||
|
// " and if(IFNULL(:#{#caseVo.keyWord},'')!='',bc.title like CONCAT('%',:#{#caseVo.keyWord},'%'),1=1)" +
|
||||||
|
// " and if(IFNULL(:#{#caseVo.authorName},'')!='',bc.author_name like CONCAT('%',:#{#caseVo.authorName},'%'),1=1)" +
|
||||||
|
// " and if(IFNULL(:#{#caseVo.orgDomain},'') !='' ,bc.org_domain_parent = :#{#caseVo.orgDomain},1=1) " +
|
||||||
|
// " and if(IFNULL(:#{#caseVo.excellent},'') !='' ,bc.excellent = :#{#caseVo.excellent},1=1) " +
|
||||||
|
// " and if(IFNULL(:#{#caseVo.isTop},'') !='' ,bc.is_top = :#{#caseVo.isTop},1=1) " +
|
||||||
|
// " GROUP BY bc.id ORDER BY bc.sys_create_time desc")
|
||||||
|
// List<Cases> exportCase(@Param("caseVo")CaseVo caseVo);
|
||||||
|
|
||||||
|
@Query("SELECT new Cases(bc.title, bc.authorName, bc.comments, bc.views, bc.praises, bc.shares, bc.favorites, COUNT(bcrpr.caseId), bc.cites, bc.confidentialityLevel) FROM Cases bc LEFT JOIN CasesRecommendPushRecord bcrpr ON bc.id = bcrpr.caseId" +
|
||||||
|
" where bc.deleted = false" +
|
||||||
|
" and (:keyWord IS NULL or bc.title LIKE %:keyWord%)" +
|
||||||
|
" and (:authorName IS NULL or bc.authorName LIKE %:authorName%)" +
|
||||||
|
" and (:orgDomain IS NULL or bc.orgDomainParent = :orgDomain)" +
|
||||||
|
" and (:excellent IS NULL or bc.excellent = :excellent)" +
|
||||||
|
" and (:isTop IS NULL or bc.isTop = :isTop)" +
|
||||||
|
" GROUP BY bc.id ORDER BY bc.sysCreateTime desc")
|
||||||
|
List<Cases> exportCase(String keyWord, String authorName,String orgDomain,Boolean excellent,Boolean isTop);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ public class Cases extends BaseEntity {
|
|||||||
private Integer favorites;
|
private Integer favorites;
|
||||||
|
|
||||||
// 推荐量
|
// 推荐量
|
||||||
@Column(name = "recommends", nullable = false)
|
private Long recommends1;
|
||||||
private Integer recommends;
|
|
||||||
|
|
||||||
// 引用量
|
// 引用量
|
||||||
@Column(name = "cites", nullable = false)
|
@Column(name = "cites", nullable = false)
|
||||||
@@ -294,6 +293,15 @@ public class Cases extends BaseEntity {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getRecommends1() {
|
||||||
|
return recommends1;
|
||||||
|
}
|
||||||
|
@Transient
|
||||||
|
public void setRecommends1(Long recommends1) {
|
||||||
|
this.recommends1 = recommends1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Cases() {
|
public Cases() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -365,4 +373,17 @@ public class Cases extends BaseEntity {
|
|||||||
public Cases(String title) {
|
public Cases(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Cases(String title,String authorName, int comments, int views, int praises, int shares, int favorites, Long recommends1, int cites, String confidentialityLevel) {
|
||||||
|
this.title = title;
|
||||||
|
this.views = views;
|
||||||
|
this.praises = praises;
|
||||||
|
this.shares = shares;
|
||||||
|
this.favorites = favorites;
|
||||||
|
this.recommends1 = recommends1;
|
||||||
|
this.cites = cites;
|
||||||
|
this.comments = comments;
|
||||||
|
this.authorName = authorName;
|
||||||
|
this.confidentialityLevel = confidentialityLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -428,38 +428,12 @@ public class CasesServiceImpl implements ICasesService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Cases> exportCase(CaseVo caseVo) {
|
public List<Cases> exportCase(CaseVo caseVo) {
|
||||||
List<IFieldFilter> filters = new ArrayList<>();
|
List<Cases> list = casesRecordDao.exportCase(caseVo.getKeyWord(), caseVo.getAuthorName(), caseVo.getOrgDomain(), caseVo.getExcellent(), caseVo.getIsTop());
|
||||||
filters.add(FieldFilters.eq("deleted", false));
|
|
||||||
if (StringUtils.isNotBlank(caseVo.getKeyWord())) {
|
|
||||||
filters.add(FieldFilters.like("title", LikeMatchMode.ANYWHERE, caseVo.getKeyWord()));
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(caseVo.getOrgDomain())) {
|
|
||||||
filters.add(FieldFilters.eq("orgDomainParent", caseVo.getOrgDomain()));
|
|
||||||
}
|
|
||||||
if (caseVo.getExcellent() != null) {
|
|
||||||
filters.add(FieldFilters.eq("excellent", caseVo.getExcellent()));
|
|
||||||
}
|
|
||||||
if (caseVo.getIsTop() != null) {
|
|
||||||
filters.add(FieldFilters.eq("isTop", caseVo.getIsTop()));
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(caseVo.getAuthorName())) {
|
|
||||||
filters.add(FieldFilters.like("authorName", LikeMatchMode.ANYWHERE, caseVo.getAuthorName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
OrderCondition order = null;
|
|
||||||
if (StringUtils.isNotBlank(caseVo.getOrderField())) {
|
|
||||||
if (caseVo.getOrderAsc() == null || caseVo.getOrderAsc()) {
|
|
||||||
order = OrderCondition.asc(caseVo.getOrderField());
|
|
||||||
} else {
|
|
||||||
order = OrderCondition.desc(caseVo.getOrderField());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
order = OrderCondition.desc("sysCreateTime");
|
|
||||||
}
|
|
||||||
List<Cases> list = casesDao.findListByFilters(order, filters);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Cases> managerCaseTitleList(CaseVo caseVo) {
|
public List<Cases> managerCaseTitleList(CaseVo caseVo) {
|
||||||
QueryBuilder query = QueryBuilder.from(Cases.class);
|
QueryBuilder query = QueryBuilder.from(Cases.class);
|
||||||
@@ -817,7 +791,7 @@ public class CasesServiceImpl implements ICasesService {
|
|||||||
cases.setShares(0);
|
cases.setShares(0);
|
||||||
cases.setFavorites(0);
|
cases.setFavorites(0);
|
||||||
cases.setCites(0);
|
cases.setCites(0);
|
||||||
cases.setRecommends(0);
|
cases.setRecommends1(0L);
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
List<String> majorIds = cases.getMajorIds();
|
List<String> majorIds = cases.getMajorIds();
|
||||||
for (String s : majorIds) {
|
for (String s : majorIds) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class CaseExportVo {
|
|||||||
|
|
||||||
private Integer views;
|
private Integer views;
|
||||||
|
|
||||||
private Integer recommends;
|
private Long recommends;
|
||||||
|
|
||||||
private Integer cites;
|
private Integer cites;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user