com.baomidou.mybatisplus.mapper.Wrapper.orderBy()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(219)

本文整理了Java中com.baomidou.mybatisplus.mapper.Wrapper.orderBy()方法的一些代码示例,展示了Wrapper.orderBy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wrapper.orderBy()方法的具体详情如下:
包路径:com.baomidou.mybatisplus.mapper.Wrapper
类名称:Wrapper
方法名:orderBy

Wrapper.orderBy介绍

暂无

代码示例

代码示例来源:origin: huangjian888/jeeweb-mybatis-springboot

  1. @Override
  2. public Wrapper<T> orderBy(boolean condition, String columns) {
  3. if (columns==null) {
  4. return super.orderBy(condition, columns);
  5. }
  6. String[] columnArr = columns.split(",");
  7. String columnNews = "";
  8. for (String column : columnArr) {
  9. if (!columnNews.isEmpty()) {
  10. columnNews += ",";
  11. }
  12. columnNews += handleColumn(column);
  13. }
  14. return super.orderBy(condition, columnNews);
  15. }

代码示例来源:origin: huangjian888/jeeweb-mybatis-springboot

  1. @Override
  2. public Wrapper<T> orderBy(boolean condition, String columns, boolean isAsc) {
  3. if (columns==null) {
  4. return super.orderBy(condition, columns, isAsc);
  5. }
  6. String[] columnArr = columns.split(",");
  7. String columnNews = "";
  8. for (String column : columnArr) {
  9. if (!columnNews.isEmpty()) {
  10. columnNews += ",";
  11. }
  12. columnNews += handleColumn(column);
  13. }
  14. return super.orderBy(condition, columnNews, isAsc);
  15. }

代码示例来源:origin: huangjian888/jeeweb-mybatis-springboot

  1. @Override
  2. public Wrapper<T> orderBy(String columns) {
  3. if (columns==null) {
  4. return super.orderBy(columns);
  5. }
  6. String[] columnArr = columns.split(",");
  7. String columnNews = "";
  8. for (String column : columnArr) {
  9. if (!columnNews.isEmpty()) {
  10. columnNews += ",";
  11. }
  12. columnNews += handleColumn(column);
  13. }
  14. return super.orderBy(columnNews);
  15. }
  16. }

代码示例来源:origin: huangjian888/jeeweb-mybatis-springboot

  1. public void parseSort(Wrapper<T> wrapper, Queryable queryable) {
  2. cn.jeeweb.core.query.data.Sort sort = queryable.getPageable().getSort();
  3. if (sort != null) {
  4. for (cn.jeeweb.core.query.data.Sort.Order order : sort) {
  5. if (order.getDirection() == cn.jeeweb.core.query.data.Sort.Direction.DESC) {
  6. wrapper.orderBy(order.getProperty(), false);
  7. } else if (order.getDirection() == cn.jeeweb.core.query.data.Sort.Direction.ASC) {
  8. wrapper.orderBy(order.getProperty(), true);
  9. }
  10. }
  11. }
  12. }

代码示例来源:origin: watchdog-framework/watchdog-framework

  1. public void findAllChild(SysResource resource){
  2. EntityWrapper<SysResource> wrapper = new EntityWrapper<>();
  3. wrapper.eq("parent_id",resource.getId()).orderBy("sort");
  4. List<SysResource> resources = this.selectList(wrapper);
  5. resource.setChildren(resources);
  6. if(resources!=null && resources.size()>0){
  7. resources.forEach(this::findAllChild);
  8. }
  9. }

代码示例来源:origin: watchdog-framework/watchdog-framework

  1. @Override
  2. public List<SysResource> list() {
  3. EntityWrapper<SysResource> wrapper = new EntityWrapper<>();
  4. wrapper.eq("parent_id",0)
  5. .or()
  6. .isNull("parent_id")
  7. .orderBy("sort");
  8. List<SysResource> resources = this.selectList(wrapper);
  9. if(resources!=null && resources.size()>0){
  10. resources.forEach(this::findAllChild);
  11. }
  12. return resources;
  13. }

代码示例来源:origin: qq53182347/liugh-parent

  1. /**
  2. * 获取自己的消息列表
  3. * @param pageIndex
  4. * @param pageSize
  5. * @return
  6. * @throws Exception
  7. */
  8. @GetMapping("/infoList")
  9. public ResponseModel<Page<Notice>> findInfoList(@CurrentUser User user, @RequestParam(name = "pageIndex", defaultValue = "1", required = false) Integer pageIndex,
  10. @RequestParam(name = "pageSize", defaultValue = "10", required = false) Integer pageSize) throws Exception{
  11. return ResponseHelper.buildResponseModel(noticeService.selectPage(new Page<>(pageIndex, pageSize),new EntityWrapper<Notice>().
  12. eq("mobile",user.getMobile()).orderBy("create_time",false)));
  13. }

代码示例来源:origin: watchdog-framework/watchdog-framework

  1. @Override
  2. public List<SysResource> findAllResourceByRoleId(String rid) {
  3. List<SysRoleResource> rps = this.selectList(new EntityWrapper<SysRoleResource>().eq("rid",rid));
  4. if(rps!=null){
  5. List<String> pids = new ArrayList<>();
  6. rps.forEach(v->pids.add(v.getPid()));
  7. if(pids.size()==0){
  8. return null;
  9. }
  10. return resourceService.selectList(new EntityWrapper<SysResource>()
  11. .in("id", pids)
  12. .orderBy("sort",true)
  13. );
  14. }
  15. return null;
  16. }
  17. }

相关文章