diff --git a/src/main/java/com/bsd/cases/service/impl/CaseCategoryServiceImpl.java b/src/main/java/com/bsd/cases/service/impl/CaseCategoryServiceImpl.java index 9d353e0..bca8c07 100644 --- a/src/main/java/com/bsd/cases/service/impl/CaseCategoryServiceImpl.java +++ b/src/main/java/com/bsd/cases/service/impl/CaseCategoryServiceImpl.java @@ -5,8 +5,10 @@ import com.alibaba.fastjson.JSONObject; import com.bsd.cases.constants.Constants; import com.bsd.cases.mapper.CaseCategoryMapper; import com.bsd.cases.mapper.CaseContentMapper; +import com.bsd.cases.mapper.CaseContentStaticalMapper; import com.bsd.cases.model.CaseCategory; import com.bsd.cases.model.CaseContent; +import com.bsd.cases.model.CaseContentStatical; import com.bsd.cases.model.CaseUsers; import com.bsd.cases.service.CaseCategoryService; import com.bsd.cases.util.AjaxRequest; @@ -34,6 +36,8 @@ public class CaseCategoryServiceImpl extends BaseServiceImpl caseSearchVoList = caseCategoryMapper.search(name); + for (CaseSearchVo caseSearchVo:caseSearchVoList){ + Integer type = caseSearchVo.getType(); + if (0 == type){ + CaseCategory caseCategory = caseCategoryMapper.selectByPrimaryKey(caseSearchVo.getId()); + CaseCategory parentCategory = caseCategoryMapper.selectByPrimaryKey(caseCategory.getParentId()); + caseSearchVo.setParentName(parentCategory.getName()); + }else { + CaseContentStatical findCaseContentStatical = new CaseContentStatical(); + findCaseContentStatical.setState(Constants.STATE_VALID); + findCaseContentStatical.setContentId(caseSearchVo.getId()); + CaseContentStatical caseContentStatical = caseContentStaticalMapper.selectOne(findCaseContentStatical); + caseSearchVo.setCommentsNum(caseContentStatical.getCommentsNum()); + caseSearchVo.setLikeNum(caseContentStatical.getLikeNum()); + caseSearchVo.setViewNum(caseContentStatical.getViewNum()); + caseSearchVo.setScore(caseContentStatical.getScore()); + } + } JSONObject data = PageUtils.page(caseSearchVoList,pageNum,pageSize); return data; } diff --git a/src/main/java/com/bsd/cases/service/impl/CaseContentServiceImpl.java b/src/main/java/com/bsd/cases/service/impl/CaseContentServiceImpl.java index d29005a..4dac86e 100644 --- a/src/main/java/com/bsd/cases/service/impl/CaseContentServiceImpl.java +++ b/src/main/java/com/bsd/cases/service/impl/CaseContentServiceImpl.java @@ -131,7 +131,10 @@ public class CaseContentServiceImpl extends BaseServiceImpl - AND a.`level2_id` = #{level2Id} + AND a.`level_id2` = #{level2Id} and a.category_id = #{level3Id}