use of ruangong.root.bean.TemplateTransfer in project RG by ADrWondertainment.
the class TemplateServiceImpl method getTemplatesInPages.
@Override
public Result getTemplatesInPages(Integer id, Integer pageNum, Integer size) {
IPage<Template> page = new Page(pageNum, size);
QueryWrapper<Template> query = Wrappers.query();
query.eq("uid", id);
IPage<Template> templateIPage = templateMapper.selectPage(page, query);
if (templateIPage == null) {
throw new BackException(ErrorCode.TEMPLATE_SELECT_FAILURE, "分页数据查询失败");
}
List<Template> records = templateIPage.getRecords();
List<TemplateTransfer> transfers = new ArrayList<>();
for (Template t : records) {
TemplateTransfer temp = new TemplateTransfer();
temp.setId(t.getId());
temp.setUid(t.getUid());
temp.setName(t.getName());
temp.setTime(t.getTime());
temp.setLength(t.getLength());
temp.setDescription(t.getDescription());
temp.setData(JSONUtil.parseObj(t.getData()));
transfers.add(temp);
}
JSONArray jsonArray = JSONUtil.parseArray(transfers);
ResultUtil.quickSet(result, ErrorCode.ALL_SET, "查询成功", JSONUtil.toJsonPrettyStr(jsonArray));
return result;
}
Aggregations