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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations