Java Code Examples for com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper#like()
The following examples show how to use
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper#like() .
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: ExampleOrderServiceImpl.java From spring-boot-plus with Apache License 2.0 | 6 votes |
@Override public Paging<ExampleOrder> getExampleOrderPageList(ExampleOrderPageParam exampleOrderPageParam) throws Exception { Page<ExampleOrder> page = new PageInfo<>(exampleOrderPageParam, OrderItem.desc(getLambdaColumn(ExampleOrder::getCreateTime))); LambdaQueryWrapper<ExampleOrder> wrapper = new LambdaQueryWrapper<>(); String keyword = exampleOrderPageParam.getKeyword(); String name = exampleOrderPageParam.getName(); String orderNo = exampleOrderPageParam.getOrderNo(); // keyword模糊查询 if (StringUtils.isNotBlank(keyword)) { wrapper.like(ExampleOrder::getName, keyword).or().like(ExampleOrder::getOrderNo, keyword); } // name模糊查询 if (StringUtils.isNotBlank(name)) { wrapper.like(ExampleOrder::getName, name); } // 订单号模糊查询 if (StringUtils.isNotBlank(orderNo)) { wrapper.like(ExampleOrder::getOrderNo, orderNo); } IPage<ExampleOrder> iPage = exampleOrderMapper.selectPage(page, wrapper); return new Paging<ExampleOrder>(iPage); }
Example 2
Source File: SysRolePermissionServiceImpl.java From Taroco with Apache License 2.0 | 6 votes |
@Override public IPage<SysPermission> rolePermissionsAdded(final PageQuery<SysPermission> pageQuery, final Integer roleId, final Map<String, Object> params) { final Set<Integer> permissionIds = getPermissionIds(roleId); if (CollectionUtils.isEmpty(permissionIds)) { return new Page<>(); } final SysPermission sysPermission = new SysPermission(); sysPermission.setDelFlag(CommonConstant.STATUS_NORMAL); final LambdaQueryWrapper<SysPermission> wrapper = new LambdaQueryWrapper<>(sysPermission); wrapper.in(SysPermission::getId, permissionIds); final String perName = "perName"; if (params.containsKey(perName) && !StringUtils.isEmpty(params.get(perName))) { wrapper.like(SysPermission::getName, params.get(perName)); } return sysPermissionService.page(pageQuery, wrapper); }
Example 3
Source File: SysUserRoleServiceImpl.java From Taroco with Apache License 2.0 | 6 votes |
@Override public IPage<SysUser> roleMembersAdded(final PageQuery<SysUser> pageQuery, final Integer roleId, final Map<String, Object> params) { final Set<Integer> userIds = getUserIds(roleId); if (CollectionUtils.isEmpty(userIds)) { return new Page<>(); } final SysUser sysUser = new SysUser(); sysUser.setDelFlag(CommonConstant.STATUS_NORMAL); final LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>(sysUser); wrapper.in(SysUser::getUserId, userIds); final String username = "username"; if (params.containsKey(username) && !StringUtils.isEmpty(params.get(username))) { wrapper.like(SysUser::getUsername, params.get(username)); } return sysUserService.page(pageQuery, wrapper); }
Example 4
Source File: TagsServiceImpl.java From plumemo with Apache License 2.0 | 6 votes |
@Override public Result<TagsVO> getTagsList(TagsVO tagsVO) { List<TagsVO> tagsList = new ArrayList<>(); if (tagsVO == null || tagsVO.getPage() == null || tagsVO.getSize() == null) { List<Tags> records = this.tagsDao.selectList(new LambdaQueryWrapper<Tags>().orderByDesc(Tags::getId)); if (!CollectionUtils.isEmpty(records)) { records.forEach(tags -> { tagsList.add(new TagsVO().setId(tags.getId()).setName(tags.getName())); }); } return Result.createWithModels(tagsList); } LambdaQueryWrapper<Tags> tagsLambdaQueryWrapper = new LambdaQueryWrapper<Tags>(); if (StringUtils.isNotBlank(tagsVO.getKeywords())){ tagsLambdaQueryWrapper.like(Tags::getName, tagsVO.getKeywords()); } if (StringUtils.isNotBlank(tagsVO.getName())){ tagsLambdaQueryWrapper.eq(Tags::getName, tagsVO.getName()); } Page page = PageUtil.checkAndInitPage(tagsVO); IPage<TagsVO> tagsIPage = this.tagsDao.selectPage(page,tagsLambdaQueryWrapper.orderByDesc(Tags::getId)); return Result.createWithPaging(tagsIPage.getRecords(), PageUtil.initPageInfo(page)); }
Example 5
Source File: CategoryServiceImpl.java From plumemo with Apache License 2.0 | 5 votes |
@Override public Result statisticsList(CategoryVO categoryVO) { Page page = Optional.of(PageUtil.checkAndInitPage(categoryVO)).orElse(PageUtil.initPage()); LambdaQueryWrapper<CategoryVO> categoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(categoryVO.getKeywords())) { categoryLambdaQueryWrapper.like(CategoryVO::getName, categoryVO.getKeywords()); } IPage<CategoryVO> categoryVOList = this.categoryDao.selectStatistics(page,categoryLambdaQueryWrapper); return Result.createWithPaging(categoryVOList.getRecords(), PageUtil.initPageInfo(page)); }
Example 6
Source File: SysUserDepartServiceImpl.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 根据部门code,查询当前部门和下级部门的 用户信息 */ @Override public List<SysUser> queryUserByDepCode(String depCode,String realname) { LambdaQueryWrapper<SysDepart> queryByDepCode = new LambdaQueryWrapper<SysDepart>(); queryByDepCode.likeRight(SysDepart::getOrgCode,depCode); List<SysDepart> sysDepartList = sysDepartService.list(queryByDepCode); List<String> depIds = sysDepartList.stream().map(SysDepart::getId).collect(Collectors.toList()); LambdaQueryWrapper<SysUserDepart> queryUDep = new LambdaQueryWrapper<SysUserDepart>(); queryUDep.in(SysUserDepart::getDepId, depIds); List<String> userIdList = new ArrayList<>(); List<SysUserDepart> uDepList = this.list(queryUDep); if(uDepList != null && uDepList.size() > 0) { for(SysUserDepart uDep : uDepList) { userIdList.add(uDep.getUserId()); } LambdaQueryWrapper<SysUser> queryUser = new LambdaQueryWrapper<SysUser>(); queryUser.in(SysUser::getId,userIdList); if(oConvertUtils.isNotEmpty(realname)){ queryUser.like(SysUser::getRealname,realname.trim()); } List<SysUser> userList = (List<SysUser>) sysUserService.list(queryUser); //update-begin-author:taoyan date:201905047 for:接口调用查询返回结果不能返回密码相关信息 for (SysUser sysUser : userList) { sysUser.setSalt(""); sysUser.setPassword(""); } //update-end-author:taoyan date:201905047 for:接口调用查询返回结果不能返回密码相关信息 return userList; } return new ArrayList<SysUser>(); }
Example 7
Source File: SysRolePermissionServiceImpl.java From Taroco with Apache License 2.0 | 5 votes |
@Override public IPage<SysPermission> rolePermissionsNotin(final PageQuery<SysPermission> pageQuery, final Integer roleId, final Map<String, Object> params) { final Set<Integer> permissionIds = getPermissionIds(roleId); final SysPermission sysPermission = new SysPermission(); sysPermission.setDelFlag(CommonConstant.STATUS_NORMAL); final LambdaQueryWrapper<SysPermission> wrapper = new LambdaQueryWrapper<>(sysPermission); if (!CollectionUtils.isEmpty(permissionIds)) { wrapper.notIn(SysPermission::getId, permissionIds); } final String perName = "perName"; if (params.containsKey(perName) && !StringUtils.isEmpty(params.get(perName))) { wrapper.like(SysPermission::getName, params.get(perName)); } return sysPermissionService.page(pageQuery, wrapper); }
Example 8
Source File: SysUserRoleServiceImpl.java From Taroco with Apache License 2.0 | 5 votes |
@Override public IPage<SysUser> roleMembersNotin(final PageQuery<SysUser> pageQuery, final Integer roleId, final Map<String, Object> params) { final Set<Integer> userIds = getUserIds(roleId); final SysUser sysUser = new SysUser(); sysUser.setDelFlag(CommonConstant.STATUS_NORMAL); final LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>(sysUser); if (!CollectionUtils.isEmpty(userIds)) { wrapper.notIn(SysUser::getUserId, userIds); } final String username = "username"; if (params.containsKey(username) && !StringUtils.isEmpty(params.get(username))) { wrapper.like(SysUser::getUsername, params.get(username)); } return sysUserService.page(pageQuery, wrapper); }
Example 9
Source File: SysRoleServiceImpl.java From pre with GNU General Public License v3.0 | 5 votes |
@Override public List<SysRole> selectRoleList(String roleName) { LambdaQueryWrapper<SysRole> sysRoleLambdaQueryWrapper = Wrappers.<SysRole>lambdaQuery(); if (StrUtil.isNotEmpty(roleName)){ sysRoleLambdaQueryWrapper.like(SysRole::getRoleName,roleName); } List<SysRole> sysRoles = baseMapper.selectList(sysRoleLambdaQueryWrapper); return sysRoles.stream().peek(sysRole -> sysRole.setRoleDepts(roleDeptService.getRoleDeptIds(sysRole.getRoleId()).stream().map(SysRoleDept::getDeptId).collect(Collectors.toList())) ).collect(Collectors.toList()); }
Example 10
Source File: SysLogServiceImpl.java From pre with GNU General Public License v3.0 | 5 votes |
@Override public IPage<SysLog> selectLogList(Integer page, Integer pageSize, Integer type, String userName) { Page<SysLog> logPage = new Page<>(page, pageSize); LambdaQueryWrapper<SysLog> sysLogLambdaQueryWrapper = Wrappers.<SysLog>lambdaQuery().eq(SysLog::getType, type).orderByDesc(SysLog::getStartTime); if (StrUtil.isNotEmpty(userName)) { sysLogLambdaQueryWrapper.like(SysLog::getUserName, userName); } return baseMapper.selectPage(logPage, sysLogLambdaQueryWrapper); }
Example 11
Source File: JobServiceImpl.java From FEBS-Cloud with Apache License 2.0 | 5 votes |
@Override public IPage<Job> findJobs(QueryRequest request, Job job) { LambdaQueryWrapper<Job> queryWrapper = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(job.getBeanName())) { queryWrapper.eq(Job::getBeanName, job.getBeanName()); } if (StringUtils.isNotBlank(job.getMethodName())) { queryWrapper.eq(Job::getMethodName, job.getMethodName()); } if (StringUtils.isNotBlank(job.getParams())) { queryWrapper.like(Job::getParams, job.getParams()); } if (StringUtils.isNotBlank(job.getRemark())) { queryWrapper.like(Job::getRemark, job.getRemark()); } if (StringUtils.isNotBlank(job.getStatus())) { queryWrapper.eq(Job::getStatus, job.getStatus()); } if (StringUtils.isNotBlank(job.getCreateTimeFrom()) && StringUtils.isNotBlank(job.getCreateTimeTo())) { queryWrapper .ge(Job::getCreateTime, job.getCreateTimeFrom()) .le(Job::getCreateTime, job.getCreateTimeTo()); } Page<Job> page = new Page<>(request.getPageNum(), request.getPageSize()); SortUtil.handlePageSort(request, page, "createTime", FebsConstant.ORDER_DESC, true); return this.page(page, queryWrapper); }
Example 12
Source File: FriendshipLinkServiceImpl.java From plumemo with Apache License 2.0 | 5 votes |
public List<FriendshipLinkVO> getFriendshipLinkVOList(FriendshipLinkVO friendshipLinkVO,Page<FriendshipLink> page) { LambdaQueryWrapper<FriendshipLink> objectLambdaQueryWrapper = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(friendshipLinkVO.getKeywords())) { objectLambdaQueryWrapper.and(i -> i.like(FriendshipLink::getName, friendshipLinkVO.getKeywords())); } if (StringUtils.isNotBlank(friendshipLinkVO.getHref())) { objectLambdaQueryWrapper.like(FriendshipLink::getHref,friendshipLinkVO.getHref()); } if (StringUtils.isNotBlank(friendshipLinkVO.getName())) { objectLambdaQueryWrapper.eq(FriendshipLink::getName,friendshipLinkVO.getName()); } List<FriendshipLink> friendshipLinks; if (null==page){ friendshipLinks=friendshipLinkDao.selectList(objectLambdaQueryWrapper.orderByDesc(FriendshipLink::getSort)); }else{ friendshipLinks=friendshipLinkDao.selectPage(page, objectLambdaQueryWrapper.orderByDesc(FriendshipLink::getSort)).getRecords(); } List<FriendshipLinkVO> friendshipLinkVOList = new ArrayList<>(); if (!CollectionUtils.isEmpty(friendshipLinks)) { friendshipLinks.forEach(friendshipLink -> { friendshipLinkVOList.add(new FriendshipLinkVO() .setName(friendshipLink.getName()) .setTitle(friendshipLink.getTitle()) .setDescription(friendshipLink.getDescription()) .setHref(friendshipLink.getHref()) .setLogo(friendshipLink.getLogo()) .setId(friendshipLink.getId()) .setSort(friendshipLink.getSort()) ); }); } return friendshipLinkVOList; }
Example 13
Source File: AuthUserServiceImpl.java From plumemo with Apache License 2.0 | 5 votes |
@Override public Result getUserList(AuthUserVO authUserVO) { Page page = Optional.ofNullable(PageUtil.checkAndInitPage(authUserVO)).orElse(PageUtil.initPage()); LambdaQueryWrapper<AuthUser> authUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(authUserVO.getKeywords())) { authUserLambdaQueryWrapper.like(AuthUser::getName, authUserVO.getKeywords()); } if (StringUtils.isNotBlank(authUserVO.getName())) { authUserLambdaQueryWrapper.eq(AuthUser::getName, authUserVO.getName()); } if (authUserVO.getStatus() != null) { authUserLambdaQueryWrapper.eq(AuthUser::getStatus, authUserVO.getStatus()); } IPage<AuthUser> authUserIPage = authUserDao.selectPage(page, authUserLambdaQueryWrapper.orderByDesc(AuthUser::getRoleId).orderByDesc(AuthUser::getId)); List<AuthUser> records = authUserIPage.getRecords(); List<AuthUserVO> authUserVOList = new ArrayList<>(); if (!CollectionUtils.isEmpty(records)) { records.forEach(authUser -> { authUserVOList.add(new AuthUserVO() .setId(authUser.getId()) .setStatus(authUser.getStatus()) .setName(authUser.getName()) .setRoleId(authUser.getRoleId()) .setIntroduction(authUser.getIntroduction()) .setStatus(authUser.getStatus()) ); }); } return Result.createWithPaging(authUserVOList, PageUtil.initPageInfo(page)); }
Example 14
Source File: SysUserDepartServiceImpl.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 根据部门code,查询当前部门和下级部门的 用户信息 */ @Override public List<SysUser> queryUserByDepCode(String depCode,String realname) { LambdaQueryWrapper<SysDepart> queryByDepCode = new LambdaQueryWrapper<SysDepart>(); queryByDepCode.likeRight(SysDepart::getOrgCode,depCode); List<SysDepart> sysDepartList = sysDepartService.list(queryByDepCode); List<String> depIds = sysDepartList.stream().map(SysDepart::getId).collect(Collectors.toList()); LambdaQueryWrapper<SysUserDepart> queryUDep = new LambdaQueryWrapper<SysUserDepart>(); queryUDep.in(SysUserDepart::getDepId, depIds); List<String> userIdList = new ArrayList<>(); List<SysUserDepart> uDepList = this.list(queryUDep); if(uDepList != null && uDepList.size() > 0) { for(SysUserDepart uDep : uDepList) { userIdList.add(uDep.getUserId()); } LambdaQueryWrapper<SysUser> queryUser = new LambdaQueryWrapper<SysUser>(); queryUser.in(SysUser::getId,userIdList); if(oConvertUtils.isNotEmpty(realname)){ queryUser.like(SysUser::getRealname,realname.trim()); } List<SysUser> userList = (List<SysUser>) sysUserService.list(queryUser); //update-begin-author:taoyan date:201905047 for:接口调用查询返回结果不能返回密码相关信息 for (SysUser sysUser : userList) { sysUser.setSalt(""); sysUser.setPassword(""); } //update-end-author:taoyan date:201905047 for:接口调用查询返回结果不能返回密码相关信息 return userList; } return new ArrayList<SysUser>(); }
Example 15
Source File: SysRoleServiceImpl.java From spring-boot-plus with Apache License 2.0 | 5 votes |
@Override public Paging<SysRole> getSysRolePageList(SysRolePageParam sysRolePageParam) throws Exception { Page<SysRole> page = new PageInfo<>(sysRolePageParam, OrderItem.desc(getLambdaColumn(SysRole::getCreateTime))); // 此处演示单表,使用mybatisplus自带方法进行分页 LambdaQueryWrapper<SysRole> lambdaQueryWrapper = new LambdaQueryWrapper<>(); String keyword = sysRolePageParam.getKeyword(); String name = sysRolePageParam.getName(); String code = sysRolePageParam.getCode(); Integer state = sysRolePageParam.getState(); if (StringUtils.isNotBlank(keyword)) { lambdaQueryWrapper .like(SysRole::getName, keyword) .or() .like(SysRole::getCode, keyword); } if (StringUtils.isNotBlank(name)) { lambdaQueryWrapper.like(SysRole::getName, name); } if (StringUtils.isNotBlank(code)) { lambdaQueryWrapper.like(SysRole::getCode, code); } if (state != null) { lambdaQueryWrapper.eq(SysRole::getState, state); } IPage<SysRole> iPage = sysRoleMapper.selectPage(page, lambdaQueryWrapper); return new Paging<SysRole>(iPage); }
Example 16
Source File: MenuServiceImpl.java From permission with MIT License | 5 votes |
@Override public List<SysMenu> findTree(String userName, int menuType, String name) { List<SysMenu> sysMenus = new ArrayList<>(); boolean isSearch = false; LambdaQueryWrapper<SysMenu> wrapper = new LambdaQueryWrapper<>(); if (!StringUtils.isEmpty(name)) { wrapper.like(SysMenu::getName, name); isSearch = true; } List<SysMenu> menus = findByUser(userName, wrapper); if (isSearch) { // 子节点匹配但父节点没匹配 把父节点加入 Set<SysMenu> menuSet = new HashSet<>(); for (SysMenu menu : menus) { SysMenu tempDept = menu; while (tempDept != null && tempDept.getParentId() != null && tempDept.getParentId() != 0) { SysMenu parent = getById(tempDept.getParentId()); if (parent != null && !menus.contains(parent)) { menuSet.add(parent); } tempDept = parent; } } menus.addAll(menuSet); } for (SysMenu permission : menus) { if (permission.getParentId() == null || permission.getParentId() == 0) { permission.setLevel(0); if (!exists(sysMenus, permission)) { sysMenus.add(permission); } } } sysMenus.sort((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum())); findChildren(sysMenus, menus, menuType); return sysMenus; }
Example 17
Source File: MenuServiceImpl.java From FEBS-Cloud with Apache License 2.0 | 5 votes |
@Override public List<Menu> findMenuList(Menu menu) { LambdaQueryWrapper<Menu> queryWrapper = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(menu.getMenuName())) { queryWrapper.like(Menu::getMenuName, menu.getMenuName()); } queryWrapper.orderByAsc(Menu::getMenuId); return this.baseMapper.selectList(queryWrapper); }