Search in sources :

Example 16 with DataTablesResult

use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.

the class MemberServiceImpl method getRemoveMemberCount.

@Override
public DataTablesResult getRemoveMemberCount() {
    DataTablesResult result = new DataTablesResult();
    TbMemberExample example = new TbMemberExample();
    TbMemberExample.Criteria criteria = example.createCriteria();
    criteria.andStateEqualTo(2);
    try {
        result.setRecordsTotal((int) tbMemberMapper.countByExample(example));
    } catch (Exception e) {
        throw new XmallException("统计移除会员数失败");
    }
    return result;
}
Also used : TbMemberExample(cn.exrick.manager.pojo.TbMemberExample) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Example 17 with DataTablesResult

use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.

the class MemberServiceImpl method getMemberCount.

@Override
public DataTablesResult getMemberCount() {
    DataTablesResult result = new DataTablesResult();
    TbMemberExample example = new TbMemberExample();
    TbMemberExample.Criteria criteria = example.createCriteria();
    criteria.andStateNotEqualTo(2);
    try {
        result.setRecordsTotal((int) tbMemberMapper.countByExample(example));
    } catch (Exception e) {
        throw new XmallException("统计会员数失败");
    }
    return result;
}
Also used : TbMemberExample(cn.exrick.manager.pojo.TbMemberExample) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Example 18 with DataTablesResult

use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.

the class MemberServiceImpl method getRemoveMemberList.

@Override
public DataTablesResult getRemoveMemberList(int draw, int start, int length, String search, String minDate, String maxDate, String orderCol, String orderDir) {
    DataTablesResult result = new DataTablesResult();
    try {
        // 分页执行查询返回结果
        PageHelper.startPage(start / length + 1, length);
        List<TbMember> list = tbMemberMapper.selectByRemoveMemberInfo("%" + search + "%", minDate, maxDate, orderCol, orderDir);
        PageInfo<TbMember> pageInfo = new PageInfo<>(list);
        for (TbMember tbMember : list) {
            tbMember.setPassword("");
        }
        result.setRecordsFiltered((int) pageInfo.getTotal());
        result.setRecordsTotal(getRemoveMemberCount().getRecordsTotal());
        result.setDraw(draw);
        result.setData(list);
    } catch (Exception e) {
        throw new XmallException("加载删除用户列表失败");
    }
    return result;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TbMember(cn.exrick.manager.pojo.TbMember) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Example 19 with DataTablesResult

use of cn.exrick.common.pojo.DataTablesResult 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)

Example 20 with DataTablesResult

use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.

the class ThanksServiceImpl method getThanksListByPage.

@Override
public DataTablesResult getThanksListByPage(int page, int size) {
    DataTablesResult result = new DataTablesResult();
    TbThanksExample example = new TbThanksExample();
    if (page <= 0) {
        page = 1;
    }
    PageHelper.startPage(page, size);
    List<TbThanks> list = tbThanksMapper.selectByExample(example);
    if (list == null) {
        throw new XmallException("获取捐赠列表失败");
    }
    PageInfo<TbThanks> pageInfo = new PageInfo<>(list);
    for (TbThanks tbThanks : list) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String date = null;
        try {
            date = dateFormat.format(tbThanks.getDate());
        } catch (Exception e) {
            e.printStackTrace();
        }
        tbThanks.setTime(date);
        tbThanks.setEmail(null);
    }
    result.setSuccess(true);
    result.setRecordsTotal((int) pageInfo.getTotal());
    result.setData(list);
    return result;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TbThanks(cn.exrick.manager.pojo.TbThanks) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) TbThanksExample(cn.exrick.manager.pojo.TbThanksExample) XmallException(cn.exrick.common.exception.XmallException) SimpleDateFormat(java.text.SimpleDateFormat) XmallException(cn.exrick.common.exception.XmallException) ParseException(java.text.ParseException)

Aggregations

DataTablesResult (cn.exrick.common.pojo.DataTablesResult)21 XmallException (cn.exrick.common.exception.XmallException)11 PageInfo (com.github.pagehelper.PageInfo)5 ApiOperation (io.swagger.annotations.ApiOperation)5 TbItem (cn.exrick.manager.pojo.TbItem)2 TbMember (cn.exrick.manager.pojo.TbMember)2 TbMemberExample (cn.exrick.manager.pojo.TbMemberExample)2 TbThanks (cn.exrick.manager.pojo.TbThanks)2 TbThanksExample (cn.exrick.manager.pojo.TbThanksExample)2 ArrayList (java.util.ArrayList)2 ContentDto (cn.exrick.manager.dto.ContentDto)1 ImageDto (cn.exrick.manager.dto.ImageDto)1 RoleDto (cn.exrick.manager.dto.RoleDto)1 TbContentCategory (cn.exrick.manager.pojo.TbContentCategory)1 TbImage (cn.exrick.manager.pojo.TbImage)1 TbImageExample (cn.exrick.manager.pojo.TbImageExample)1 TbItemExample (cn.exrick.manager.pojo.TbItemExample)1 TbShiroFilter (cn.exrick.manager.pojo.TbShiroFilter)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1