use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.
the class UserServiceImpl method getPermissionList.
@Override
public DataTablesResult getPermissionList() {
DataTablesResult result = new DataTablesResult();
TbPermissionExample example = new TbPermissionExample();
List<TbPermission> list = tbPermissionMapper.selectByExample(example);
if (list == null) {
throw new XmallException("获取权限列表失败");
}
result.setSuccess(true);
result.setData(list);
return result;
}
use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.
the class MemberController method getMemberList.
@RequestMapping(value = "/member/list", method = RequestMethod.GET)
@ApiOperation(value = "分页多条件搜索获取会员列表")
public DataTablesResult getMemberList(int draw, int start, int length, String searchKey, String minDate, String maxDate, @RequestParam("search[value]") String search, @RequestParam("order[0][column]") int orderCol, @RequestParam("order[0][dir]") String orderDir) {
// 获取客户端需要排序的列
String[] cols = { "checkbox", "id", "username", "sex", "phone", "email", "address", "created", "updated", "state" };
String orderColumn = cols[orderCol];
// 默认排序列
if (orderColumn == null) {
orderColumn = "created";
}
// 获取排序方式 默认为desc(asc)
if (orderDir == null) {
orderDir = "desc";
}
if (!search.isEmpty()) {
searchKey = search;
}
DataTablesResult result = memberService.getMemberList(draw, start, length, searchKey, minDate, maxDate, orderColumn, orderDir);
return result;
}
use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.
the class ItemServiceImpl method getAllItemCount.
@Override
public DataTablesResult getAllItemCount() {
TbItemExample example = new TbItemExample();
Long count = tbItemMapper.countByExample(example);
DataTablesResult result = new DataTablesResult();
result.setRecordsTotal(Math.toIntExact(count));
return result;
}
use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.
the class ItemServiceImpl method getItemSearchList.
@Override
public DataTablesResult getItemSearchList(int draw, int start, int length, int cid, String search, String minDate, String maxDate, String orderCol, String orderDir) {
DataTablesResult result = new DataTablesResult();
// 分页执行查询返回结果
PageHelper.startPage(start / length + 1, length);
List<TbItem> list = tbItemMapper.selectItemByMultiCondition(cid, "%" + search + "%", minDate, maxDate, orderCol, orderDir);
PageInfo<TbItem> pageInfo = new PageInfo<>(list);
result.setRecordsFiltered((int) pageInfo.getTotal());
result.setRecordsTotal(getAllItemCount().getRecordsTotal());
result.setDraw(draw);
result.setData(list);
return result;
}
use of cn.exrick.common.pojo.DataTablesResult in project xmall by Exrick.
the class ContentImageServiceImpl method getContentImage.
@Override
public DataTablesResult getContentImage() {
DataTablesResult result = new DataTablesResult();
List<ImageDto> list = new ArrayList<>();
TbImageExample example = new TbImageExample();
List<TbImage> listImage = tbImageMapper.selectByExample(example);
for (int i = 0; i < listImage.size(); i++) {
ImageDto imageDto = DtoUtil.TbImage2ImageDto(listImage.get(i));
TbContentCategory tbContentCategory = tbContentCategoryMapper.selectByPrimaryKey(Long.valueOf(listImage.get(i).getCategoryId()));
imageDto.setCategory(tbContentCategory.getName());
list.add(imageDto);
}
result.setData(list);
return result;
}
Aggregations