use of cn.exrick.manager.pojo.TbThanksExample in project xmall by Exrick.
the class ThanksServiceImpl method countThanks.
@Override
public Long countThanks() {
TbThanksExample example = new TbThanksExample();
Long result = tbThanksMapper.countByExample(example);
if (result == null) {
throw new XmallException("统计捐赠数目失败");
}
return result;
}
use of cn.exrick.manager.pojo.TbThanksExample in project xmall by Exrick.
the class ThanksServiceImpl method getThanksList.
@Override
public DataTablesResult getThanksList() {
DataTablesResult result = new DataTablesResult();
TbThanksExample example = new TbThanksExample();
List<TbThanks> list = tbThanksMapper.selectByExample(example);
if (list == null) {
throw new XmallException("获取捐赠列表失败");
}
result.setSuccess(true);
result.setData(list);
return result;
}
use of cn.exrick.manager.pojo.TbThanksExample 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