use of cn.exrick.manager.dto.ContentDto in project xmall by Exrick.
the class ContentServiceImpl method getContentListByCid.
@Override
public DataTablesResult getContentListByCid(Long cid) {
DataTablesResult result = new DataTablesResult();
List<ContentDto> list = new ArrayList<>();
TbContentExample example = new TbContentExample();
TbContentExample.Criteria criteria = example.createCriteria();
// 条件查询
criteria.andCategoryIdEqualTo(cid);
List<TbContent> listTbContent = tbContentMapper.selectByExample(example);
TbContentCategory tbContentCategory = tbContentCategoryMapper.selectByPrimaryKey(cid);
for (int i = 0; i < listTbContent.size(); i++) {
ContentDto contentDto = DtoUtil.TbContent2ContentDto(listTbContent.get(i));
contentDto.setCategory(tbContentCategory.getName());
list.add(contentDto);
}
result.setData(list);
return result;
}
Aggregations