Java Code Examples for com.baomidou.mybatisplus.core.conditions.query.QueryWrapper#orderByAsc()

The following examples show how to use com.baomidou.mybatisplus.core.conditions.query.QueryWrapper#orderByAsc() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryGenerator.java    From teaching with Apache License 2.0 6 votes vote down vote up
public static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
	String column=null,order=null;
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_COLUMN)) {
		column = parameterMap.get(ORDER_COLUMN)[0];
	}
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
		order = parameterMap.get(ORDER_TYPE)[0];
	}
	log.debug("排序规则>>列:"+column+",排序方式:"+order);
	if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		//字典字段,去掉字典翻译文本后缀
		if(column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) {
			column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX));
		}
		//SQL注入check
		SqlInjectionUtil.filterContent(column); 
		
		if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		} else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
}
 
Example 2
Source File: DictService.java    From Guns with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 查询分页数据,Specification模式
 *
 * @author stylefeng
 * @Date 2019-03-13
 */
public LayuiPageInfo findPageBySpec(DictParam param) {
    QueryWrapper<Dict> objectQueryWrapper = new QueryWrapper<>();
    objectQueryWrapper.eq("dict_type_id", param.getDictTypeId());

    if (ToolUtil.isNotEmpty(param.getCondition())) {
        objectQueryWrapper.and(i -> i.eq("code", param.getCondition()).or().eq("name", param.getCondition()));
    }

    objectQueryWrapper.orderByAsc("sort");

    List<Dict> list = this.list(objectQueryWrapper);

    //创建根节点
    Dict dict = new Dict();
    dict.setName("根节点");
    dict.setDictId(0L);
    dict.setParentId(-999L);
    list.add(dict);

    LayuiPageInfo result = new LayuiPageInfo();
    result.setData(list);

    return result;
}
 
Example 3
Source File: RestDictService.java    From Guns with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 查询分页数据,Specification模式
 *
 * @author stylefeng
 * @Date 2019-03-13
 */
public LayuiPageInfo findPageBySpec(DictParam param) {
    QueryWrapper<RestDict> objectQueryWrapper = new QueryWrapper<>();
    objectQueryWrapper.eq("dict_type_id", param.getDictTypeId());

    if (ToolUtil.isNotEmpty(param.getCondition())) {
        objectQueryWrapper.and(i -> i.eq("code", param.getCondition()).or().eq("name", param.getCondition()));
    }

    objectQueryWrapper.orderByAsc("sort");

    List<RestDict> list = this.list(objectQueryWrapper);

    //创建根节点
    RestDict dict = new RestDict();
    dict.setName("根节点");
    dict.setDictId(0L);
    dict.setParentId(-999L);
    list.add(dict);

    LayuiPageInfo result = new LayuiPageInfo();
    result.setData(list);

    return result;
}
 
Example 4
Source File: QueryGenerator.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
public static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
	String column=null,order=null;
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_COLUMN)) {
		column = parameterMap.get(ORDER_COLUMN)[0];
	}
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
		order = parameterMap.get(ORDER_TYPE)[0];
	}
	log.debug("排序规则>>列:"+column+",排序方式:"+order);
	if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		//字典字段,去掉字典翻译文本后缀
		if(column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) {
			column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX));
		}
		//SQL注入check
		SqlInjectionUtil.filterContent(column); 
		
		if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		} else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
}
 
Example 5
Source File: SortUtil.java    From FEBS-Cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 处理排序 for mybatis-plus
 *
 * @param request           QueryRequest
 * @param wrapper           wrapper
 * @param defaultSort       默认排序的字段
 * @param defaultOrder      默认排序规则
 * @param camelToUnderscore 是否开启驼峰转下划线
 */
public static void handleWrapperSort(QueryRequest request, QueryWrapper<?> wrapper, String defaultSort, String defaultOrder, boolean camelToUnderscore) {
    String sortField = request.getField();
    if (camelToUnderscore) {
        sortField = FebsUtil.camelToUnderscore(sortField);
        defaultSort = FebsUtil.camelToUnderscore(defaultSort);
    }
    if (StringUtils.isNotBlank(request.getField())
            && StringUtils.isNotBlank(request.getOrder())
            && !StringUtils.equalsIgnoreCase(request.getField(), "null")
            && !StringUtils.equalsIgnoreCase(request.getOrder(), "null")) {
        if (StringUtils.equals(request.getOrder(), FebsConstant.ORDER_DESC)) {
            wrapper.orderByDesc(sortField);
        } else {
            wrapper.orderByAsc(sortField);
        }
    } else {
        if (StringUtils.isNotBlank(defaultSort)) {
            if (StringUtils.equals(defaultOrder, FebsConstant.ORDER_DESC)) {
                wrapper.orderByDesc(defaultSort);
            } else {
                wrapper.orderByAsc(defaultSort);
            }
        }
    }
}
 
Example 6
Source File: QueryGenerator.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
public static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
	String column=null,order=null;
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_COLUMN)) {
		column = parameterMap.get(ORDER_COLUMN)[0];
	}
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
		order = parameterMap.get(ORDER_TYPE)[0];
	}
	log.debug("排序规则>>列:"+column+",排序方式:"+order);
	if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		//字典字段,去掉字典翻译文本后缀
		if(column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) {
			column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX));
		}
		//SQL注入check
		SqlInjectionUtil.filterContent(column); 
		
		if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		} else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
}
 
Example 7
Source File: QueryGenerator.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
public static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
	String column=null,order=null;
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_COLUMN)) {
		column = parameterMap.get(ORDER_COLUMN)[0];
	}
	if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
		order = parameterMap.get(ORDER_TYPE)[0];
	}
	log.debug("排序规则>>列:"+column+",排序方式:"+order);
	if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		//字典字段,去掉字典翻译文本后缀
		if(column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) {
			column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX));
		}
		//SQL注入check
		SqlInjectionUtil.filterContent(column); 
		
		if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		} else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
}
 
Example 8
Source File: SysAnnouncementController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncement
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysAnnouncement>> queryPageList(SysAnnouncement sysAnnouncement,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncement>> result = new Result<IPage<SysAnnouncement>>();
	sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
	QueryWrapper<SysAnnouncement> queryWrapper = new QueryWrapper<SysAnnouncement>(sysAnnouncement);
	Page<SysAnnouncement> page = new Page<SysAnnouncement>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 9
Source File: SysDictItemController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 10
Source File: SysAnnouncementSendController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncementSend
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<IPage<SysAnnouncementSend>> queryPageList(SysAnnouncementSend sysAnnouncementSend,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncementSend>> result = new Result<IPage<SysAnnouncementSend>>();
	QueryWrapper<SysAnnouncementSend> queryWrapper = new QueryWrapper<SysAnnouncementSend>(sysAnnouncementSend);
	Page<SysAnnouncementSend> page = new Page<SysAnnouncementSend>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncementSend> pageList = sysAnnouncementSendService.page(page, queryWrapper);
	//log.info("查询当前页:"+pageList.getCurrent());
	//log.info("查询当前页数量:"+pageList.getSize());
	//log.info("查询结果数量:"+pageList.getRecords().size());
	//log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 11
Source File: SysAnnouncementSendController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncementSend
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<IPage<SysAnnouncementSend>> queryPageList(SysAnnouncementSend sysAnnouncementSend,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncementSend>> result = new Result<IPage<SysAnnouncementSend>>();
	QueryWrapper<SysAnnouncementSend> queryWrapper = new QueryWrapper<SysAnnouncementSend>(sysAnnouncementSend);
	Page<SysAnnouncementSend> page = new Page<SysAnnouncementSend>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncementSend> pageList = sysAnnouncementSendService.page(page, queryWrapper);
	//log.info("查询当前页:"+pageList.getCurrent());
	//log.info("查询当前页数量:"+pageList.getSize());
	//log.info("查询结果数量:"+pageList.getRecords().size());
	//log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 12
Source File: SysAnnouncementController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncement
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysAnnouncement>> queryPageList(SysAnnouncement sysAnnouncement,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncement>> result = new Result<IPage<SysAnnouncement>>();
	sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
	QueryWrapper<SysAnnouncement> queryWrapper = new QueryWrapper<SysAnnouncement>(sysAnnouncement);
	Page<SysAnnouncement> page = new Page<SysAnnouncement>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 13
Source File: SysDictItemController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 14
Source File: SysAnnouncementSendController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncementSend
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<IPage<SysAnnouncementSend>> queryPageList(SysAnnouncementSend sysAnnouncementSend,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncementSend>> result = new Result<IPage<SysAnnouncementSend>>();
	QueryWrapper<SysAnnouncementSend> queryWrapper = new QueryWrapper<SysAnnouncementSend>(sysAnnouncementSend);
	Page<SysAnnouncementSend> page = new Page<SysAnnouncementSend>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncementSend> pageList = sysAnnouncementSendService.page(page, queryWrapper);
	//log.info("查询当前页:"+pageList.getCurrent());
	//log.info("查询当前页数量:"+pageList.getSize());
	//log.info("查询结果数量:"+pageList.getRecords().size());
	//log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 15
Source File: SysDictItemController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 16
Source File: SysAnnouncementController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncement
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysAnnouncement>> queryPageList(SysAnnouncement sysAnnouncement,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncement>> result = new Result<IPage<SysAnnouncement>>();
	sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
	QueryWrapper<SysAnnouncement> queryWrapper = new QueryWrapper<SysAnnouncement>(sysAnnouncement);
	Page<SysAnnouncement> page = new Page<SysAnnouncement>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 17
Source File: SysDictItemController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 18
Source File: SysAnnouncementSendController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncementSend
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<IPage<SysAnnouncementSend>> queryPageList(SysAnnouncementSend sysAnnouncementSend,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncementSend>> result = new Result<IPage<SysAnnouncementSend>>();
	QueryWrapper<SysAnnouncementSend> queryWrapper = new QueryWrapper<SysAnnouncementSend>(sysAnnouncementSend);
	Page<SysAnnouncementSend> page = new Page<SysAnnouncementSend>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncementSend> pageList = sysAnnouncementSendService.page(page, queryWrapper);
	//log.info("查询当前页:"+pageList.getCurrent());
	//log.info("查询当前页数量:"+pageList.getSize());
	//log.info("查询结果数量:"+pageList.getRecords().size());
	//log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 19
Source File: SysAnnouncementController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
  * 分页列表查询
 * @param sysAnnouncement
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysAnnouncement>> queryPageList(SysAnnouncement sysAnnouncement,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<SysAnnouncement>> result = new Result<IPage<SysAnnouncement>>();
	sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
	QueryWrapper<SysAnnouncement> queryWrapper = new QueryWrapper<SysAnnouncement>(sysAnnouncement);
	Page<SysAnnouncement> page = new Page<SysAnnouncement>(pageNo,pageSize);
	//排序逻辑 处理
	String column = req.getParameter("column");
	String order = req.getParameter("order");
	if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
		if("asc".equals(order)) {
			queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
		}else {
			queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
		}
	}
	IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 20
Source File: PictureServiceImpl.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
@Override
public Picture getTopOne() {
    QueryWrapper<Picture> queryWrapper = new QueryWrapper<>();
    queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE);
    queryWrapper.orderByAsc(SQLConf.CREATE_TIME);
    queryWrapper.last(SysConf.LIMIT_ONE);
    Picture picture = pictureService.getOne(queryWrapper);
    return picture;
}