Search in sources :

Example 1 with ContentDto

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;
}
Also used : ContentDto(cn.exrick.manager.dto.ContentDto) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) ArrayList(java.util.ArrayList)

Aggregations

DataTablesResult (cn.exrick.common.pojo.DataTablesResult)1 ContentDto (cn.exrick.manager.dto.ContentDto)1 ArrayList (java.util.ArrayList)1