contentDetail

master
ck 5 years ago
parent a408b44076
commit 7737807836

@ -46,4 +46,24 @@ public class CaseContentController {
} }
return ajaxResult; return ajaxResult;
} }
@RequestMapping("/get-content-detail-by-category-id")
public AjaxResult getContentDetailByContentId(@RequestBody AjaxRequest ajaxRequest, HttpServletRequest request) {
AjaxResult ajaxResult = new AjaxResult();
JSONObject data = ajaxRequest.getData();
if (null == data){
ajaxResult.setRetcode(AjaxResult.FAILED);
ajaxResult.setRetmsg("data missing");
}else {
Long contentId = data.getLong("contentId");
if (null == contentId){
ajaxResult.setRetcode(AjaxResult.FAILED);
ajaxResult.setRetmsg("文章id不可为空");
}else {
ajaxResult.setRetcode(AjaxResult.SUCCESS);
ajaxResult.setData(contentService.getContentDetailByContentId(contentId));
}
}
return ajaxResult;
}
} }

@ -0,0 +1,22 @@
package com.bsd.cases.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("case_store")
public class CaseStore extends BaseEntity{
private Long companyId;
private String companyCode;
private String companyName;
private String storeId;
private String storeName;
}

@ -0,0 +1,37 @@
package com.bsd.cases.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("case_users")
public class CaseUsers extends BaseEntity{
private String userName;
private String userNo;
private String openId;
private String mobile;
private String userImage;
private String password;
private Long companyId;
private String companyCode;
private String companyName;
private Long storeId;
private String storeCode;
private String storeName;
private Integer role;
}

@ -0,0 +1,17 @@
package com.bsd.cases.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("case_company")
public class case_company extends BaseEntity{
private Integer areaId;
private String companyId;
private String companyName;
}

@ -1,10 +1,13 @@
package com.bsd.cases.service; package com.bsd.cases.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bsd.cases.vo.CaseContentDetailVo;
import com.bsd.cases.vo.CaseContentVo; import com.bsd.cases.vo.CaseContentVo;
import java.util.List; import java.util.List;
public interface CaseContentService<CaseContent> extends BaseService<CaseContent> { public interface CaseContentService<CaseContent> extends BaseService<CaseContent> {
JSONObject getContentListByCategoryId(Long categoryId, Integer pageNum, Integer pageSize); JSONObject getContentListByCategoryId(Long categoryId, Integer pageNum, Integer pageSize);
CaseContentDetailVo getContentDetailByContentId(Long contentId);
} }

@ -0,0 +1,11 @@
package com.bsd.cases.service;
import com.bsd.cases.model.CaseUsers;
import com.bsd.cases.util.CommonMapper;
import org.springframework.stereotype.Repository;
@Repository
public interface CaseUsersService extends CommonMapper<CaseUsers> {
}

@ -3,12 +3,11 @@ package com.bsd.cases.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bsd.cases.constants.Constants; import com.bsd.cases.constants.Constants;
import com.bsd.cases.mapper.CaseContentMapper; import com.bsd.cases.mapper.*;
import com.bsd.cases.mapper.CaseContentStaticalMapper; import com.bsd.cases.model.*;
import com.bsd.cases.model.CaseContent;
import com.bsd.cases.model.CaseContentStatical;
import com.bsd.cases.service.CaseContentService; import com.bsd.cases.service.CaseContentService;
import com.bsd.cases.util.PageUtils; import com.bsd.cases.util.PageUtils;
import com.bsd.cases.vo.CaseContentDetailVo;
import com.bsd.cases.vo.CaseContentVo; import com.bsd.cases.vo.CaseContentVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -24,6 +23,13 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
private CaseContentMapper caseContentMapper; private CaseContentMapper caseContentMapper;
@Resource @Resource
private CaseContentStaticalMapper caseContentStaticalMapper; private CaseContentStaticalMapper caseContentStaticalMapper;
@Resource
private CaseCategoryMapper caseCategoryMapper;
@Resource
private CaseContentMaterialMapper caseContentMaterialMapper;
@Resource
private CaseContentAttachmentMapper caseContentAttachmentMapper;
@Override @Override
public JSONObject getContentListByCategoryId(Long categoryId,Integer pageNum,Integer pageSize) { public JSONObject getContentListByCategoryId(Long categoryId,Integer pageNum,Integer pageSize) {
@ -60,4 +66,33 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
jsonObject.put("pages",(int) Math.ceil(Double.valueOf(pageJson.getInteger("total")) / Double.valueOf(pageSize))); jsonObject.put("pages",(int) Math.ceil(Double.valueOf(pageJson.getInteger("total")) / Double.valueOf(pageSize)));
return jsonObject; return jsonObject;
} }
@Override
public CaseContentDetailVo getContentDetailByContentId(Long contentId) {
CaseContent caseContent = caseContentMapper.selectByPrimaryKey(contentId);
CaseContentDetailVo caseContentDetailVo = new CaseContentDetailVo();
caseContentDetailVo.setId(contentId);
caseContentDetailVo.setContent(caseContent.getContent());
caseContentDetailVo.setCategoryId(caseContent.getCategoryId());
CaseCategory caseCategory = caseCategoryMapper.selectByPrimaryKey(caseContent.getCategoryId());
caseContentDetailVo.setCategoryName(caseCategory.getName());
caseContentDetailVo.setUrl(caseContent.getUrl());
caseContentDetailVo.setContentTitle(caseContent.getContentTitle());
CaseContentAttachment findCaseContentAttachment = new CaseContentAttachment();
findCaseContentAttachment.setContentId(contentId);
findCaseContentAttachment.setState(Constants.STATE_VALID);
List<CaseContentAttachment> caseContentAttachmentList = caseContentAttachmentMapper.select(findCaseContentAttachment);
caseContentDetailVo.setCaseContentAttachmentList(caseContentAttachmentList);
CaseContentMaterial findCaseContentMaterial = new CaseContentMaterial();
findCaseContentMaterial.setContentId(contentId);
findCaseContentMaterial.setState(Constants.STATE_VALID);
List<CaseContentMaterial> caseContentMaterialList = caseContentMaterialMapper.select(findCaseContentMaterial);
caseContentDetailVo.setCaseContentMaterialList(caseContentMaterialList);
CaseContentStatical findCaseContentStatical = new CaseContentStatical();
findCaseContentStatical.setContentId(contentId);
findCaseContentStatical.setState(Constants.STATE_VALID);
CaseContentStatical caseContentStatical = caseContentStaticalMapper.selectOne(findCaseContentStatical);
caseContentDetailVo.setScore(caseContentStatical.getScore());
return caseContentDetailVo;
}
} }

@ -0,0 +1,31 @@
package com.bsd.cases.vo;
import com.bsd.cases.model.CaseContentAttachment;
import com.bsd.cases.model.CaseContentMaterial;
import lombok.Data;
import java.util.List;
@Data
public class CaseContentDetailVo {
private Long id;
private String contentTitle;
private Double score;
//二级
private Long categoryId;
//二级
private String categoryName;
private String url;
private String content;
private List<CaseContentMaterial> caseContentMaterialList;
private List<CaseContentAttachment> caseContentAttachmentList;
private Boolean isLike;
}
Loading…
Cancel
Save