Search in sources :

Example 6 with DataTablesResult

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;
}
Also used : DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException)

Example 7 with DataTablesResult

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;
}
Also used : DataTablesResult(cn.exrick.common.pojo.DataTablesResult) ApiOperation(io.swagger.annotations.ApiOperation)

Example 8 with DataTablesResult

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;
}
Also used : TbItemExample(cn.exrick.manager.pojo.TbItemExample) DataTablesResult(cn.exrick.common.pojo.DataTablesResult)

Example 9 with DataTablesResult

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;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) TbItem(cn.exrick.manager.pojo.TbItem)

Example 10 with DataTablesResult

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;
}
Also used : TbImage(cn.exrick.manager.pojo.TbImage) TbContentCategory(cn.exrick.manager.pojo.TbContentCategory) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) ArrayList(java.util.ArrayList) ImageDto(cn.exrick.manager.dto.ImageDto) TbImageExample(cn.exrick.manager.pojo.TbImageExample)

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