|
|
|
@ -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<CaseCategoryMapper,
|
|
|
|
|
private CaseCategoryMapper caseCategoryMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private CaseContentMapper caseContentMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private CaseContentStaticalMapper caseContentStaticalMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 直接获取所有1级2级分级
|
|
|
|
@ -111,6 +115,22 @@ public class CaseCategoryServiceImpl extends BaseServiceImpl<CaseCategoryMapper,
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject search(String name, Integer pageNum, Integer pageSize) {
|
|
|
|
|
List<CaseSearchVo> 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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
JSONObject data = PageUtils.page(caseSearchVoList,pageNum,pageSize);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|