Java Code Examples for com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper#likeRight()

The following examples show how to use com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper#likeRight() . 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: ExchangeServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<ExchangeActivityResponse>> queryPage(ExchangeActivityPageRequest request) {

    LambdaQueryWrapper<ExchangeActivity> qw = new LambdaQueryWrapper<>();

    if (StringUtils.isNotEmpty(request.getActivityName())) {
        qw.likeRight(ExchangeActivity::getActivityName, request.getActivityName());
    }

    if (CollectionUtils.isNotEmpty(request.getTimeRange())) {
        qw.le(ExchangeActivity::getBeginTime, request.getTimeRange().get(0));
        qw.ge(ExchangeActivity::getEndTime, request.getTimeRange().get(1));
    }

    Response<List<ExchangeActivity>> response = this.toPage(request.getPage(), request.getPageSize(), qw);

    return Response.toResponse(Optional.ofNullable(response.getData()).orElse(Collections.emptyList()).stream()
                    .map(this::convert)
                    .collect(Collectors.toList()),
            response.getTotal());
}
 
Example 2
Source File: FormServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<FormResponse>> queryPage(FormPageRequest request) {

    LambdaQueryWrapper<Form> wrapper = new LambdaQueryWrapper<Form>()
            .eq(Form::getDeleteStatus, Boolean.FALSE);

    if (Objects.nonNull(request.getId())) {
        wrapper.eq(Form::getId, request.getId());
    }

    if (StringUtils.isNotBlank(request.getBizType())) {
        wrapper.eq(Form::getBizType, request.getBizType());
    }

    if (StringUtils.isNotBlank(request.getName())) {
        wrapper.likeRight(Form::getName, request.getName());
    }

    Response<List<Form>> page = this.toPage(request.getPage(), request.getPageSize(), wrapper);

    return Response.toResponse(page.getData().stream().map(this::convert).collect(Collectors.toList()),
            page.getTotal());
}
 
Example 3
Source File: GoodsBrandServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<GoodsBrandResponse>> queryPage(GoodsBrandPageRequest request) {
    LambdaQueryWrapper<GoodsBrand> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(GoodsBrand::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(request.getBrandCode())) {
        wrapper.eq(GoodsBrand::getBrandCode, request.getBrandCode());
    }

    if (StringUtils.isNotBlank(request.getBrandName())) {
        wrapper.likeRight(GoodsBrand::getBrandName, request.getBrandName());
    }

    if (!CollectionUtils.isEmpty(request.getDateTimes())) {
        wrapper.ge(GoodsBrand::getCreateTime, request.getDateTimes().get(0));
        wrapper.le(GoodsBrand::getCreateTime, request.getDateTimes().get(1));
    }

    Response<List<GoodsBrand>> page = this.toPage(request.getPage(), request.getPageSize(), wrapper);

    return Response.toResponse(page.getData().stream().map(this::convert).collect(Collectors.toList()), page.getTotal());
}
 
Example 4
Source File: GoodsPropertyServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<GoodsPropertyResponse>> queryPage(GoodsPropertyPageRequest request) {

    LambdaQueryWrapper<GoodsProperty> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(GoodsProperty::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(request.getPropertyName())) {
        wrapper.likeRight(GoodsProperty::getPropertyName, request.getPropertyName());
    }

    if (Objects.nonNull(request.getPropertyGroupId())) {
        wrapper.eq(GoodsProperty::getPropertyGroupId, request.getPropertyGroupId());
    }

    wrapper.orderByDesc(GoodsProperty::getUpdateTime);

    Response<List<GoodsProperty>> page = this.toPage(request.getPage(), request.getPageSize(), wrapper);

    return Response.toResponse(page.getData().stream().map(this::convert).collect(Collectors.toList()), page.getTotal());
}
 
Example 5
Source File: GoodsClassServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<GoodsClassificationResponse>> queryPage(GoodsClassificationPageRequest request) {
    LambdaQueryWrapper<GoodsClass> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(GoodsClass::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(request.getClassName())) {
        wrapper.likeRight(GoodsClass::getClassName, request.getClassName());
    }

    Response<List<GoodsClass>> response = this.toPage(request.getPage(), request.getPageSize(), wrapper);

    return Response.toResponse(Optional.ofNullable(response.getData()).orElse(Collections.emptyList()).stream()
                    .map(this::convert)
                    .collect(Collectors.toList())
            , response.getTotal());
}
 
Example 6
Source File: ExchangeServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<ExchangeActivityRecordResponse>> record(ExchangeActivityRecordPageRequest request) {
    LambdaQueryWrapper<ExchangeActivityMember> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(ExchangeActivityMember::getDeleteStatus, Boolean.FALSE);
    wrapper.eq(ExchangeActivityMember::getActivityId, request.getActivityId());

    if (StringUtils.isNotBlank(request.getPhone())) {
        wrapper.likeRight(ExchangeActivityMember::getPhone, request.getPhone());
    }

    if (Objects.isNull(request.getRuleId())) {
        wrapper.eq(ExchangeActivityMember::getRuleId, request.getRuleId());
    }

    List<ExchangeActivityRecordResponse> responseList = Collections.emptyList();
    int count = exchangeActivityMembersMapper.selectCount(wrapper);
    if (0 < count) {
        Page<ExchangeActivityMember> page = new Page<>(request.getPage(), request.getPageSize());
        List<ExchangeActivityMember> records = exchangeActivityMembersMapper.selectPage(page, wrapper).getRecords();
        responseList = records.stream().map(this::convert).collect(Collectors.toList());
    }
    return Response.toResponse(responseList, count);
}
 
Example 7
Source File: SysCategoryController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * [列表页面]加载分类字典数据 用于值的替换
 * @param code
 * @return
 */
@RequestMapping(value = "/loadAllData", method = RequestMethod.GET)
public Result<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) {
 Result<List<DictModel>> result = new Result<List<DictModel>>();
 LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>();
 if(oConvertUtils.isNotEmpty(code) && !"0".equals(code)){
	 query.likeRight(SysCategory::getCode,code);
 }
 List<SysCategory> list = this.sysCategoryService.list(query);
 if(list==null || list.size()==0) {
	 result.setMessage("无数据,参数有误.[code]");
	 result.setSuccess(false);
	 return result;
 }
 List<DictModel> rdList = new ArrayList<DictModel>();
 for (SysCategory c : list) {
	 rdList.add(new DictModel(c.getId(),c.getName()));
 }
 result.setSuccess(true);
 result.setResult(rdList);
 return result;
}
 
Example 8
Source File: AssembleServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<AssembleActivityResponse>> queryPage(AssemblePageRequest request) {

    LambdaQueryWrapper<AssembleActivity> wrapper = new LambdaQueryWrapper<>();
    if (StringUtils.isNotBlank(request.getActivityName())) {
        wrapper.likeRight(AssembleActivity::getActivityName, request.getActivityName());
    }

    if (CollectionUtils.isNotEmpty(request.getTimeRange())) {
        wrapper.le(AssembleActivity::getBeginTime, request.getTimeRange().get(0));
        wrapper.ge(AssembleActivity::getEndTime, request.getTimeRange().get(1));
    }

    wrapper.orderByDesc(AssembleActivity::getUpdateTime);

    Response<List<AssembleActivity>> response = this.toPage(request.getPage(), request.getPageSize(), wrapper);

    return Response.toResponse(Optional.ofNullable(response.getData()).orElse(Collections.emptyList()).stream()
                    .map(this::convert)
                    .collect(Collectors.toList()),
            response.getTotal());
}
 
Example 9
Source File: CouponTemplateServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<DiscountCouponTemplate>> queryPage(DiscountCouponTemplatePageRequest request) {

    LambdaQueryWrapper<DiscountCouponTemplate> qw = new LambdaQueryWrapper<>();

    if (!StringUtils.isEmpty(request.getTemplateName())) {
        qw.likeRight(DiscountCouponTemplate::getTemplateName, request.getTemplateName());
    }

    if (null != request.getTemplateType()) {
        qw.eq(DiscountCouponTemplate::getTemplateType, request.getTemplateType());
    }

    qw.orderByDesc(DiscountCouponTemplate::getUpdateTime);

    return this.toPage(request.getPage(), request.getPageSize(), qw);
}
 
Example 10
Source File: BannerServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
private LambdaQueryWrapper<Banner> toQuery(String title, String bannerType, Boolean bannerStatus) {
    LambdaQueryWrapper<Banner> wrapper = new LambdaQueryWrapper<>();

    if (StringUtils.isNotEmpty(title)) {
        wrapper.likeRight(Banner::getTitle, title);
    }
    if (!StringUtils.isEmpty(bannerType)) {
        wrapper.eq(Banner::getBannerType, bannerType);
    }

    if (Objects.nonNull(bannerStatus)) {
        wrapper.eq(Banner::getBannerStatus, bannerStatus);
    }

    wrapper.orderByDesc(Banner::getUpdateTime);

    return wrapper;
}
 
Example 11
Source File: SystemConfigDetailServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<SystemConfigDetailResponse>> queryList(SystemConfigDetailOtherRequest request) {
    LambdaQueryWrapper<SystemConfigDetail> wrapper = new LambdaQueryWrapper<>();

    wrapper.eq(SystemConfigDetail::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(request.getConfigName())) {
        wrapper.likeRight(SystemConfigDetail::getConfigName, request.getConfigName());
    }
    if (StringUtils.isNotBlank(request.getConfigType())) {
        wrapper.eq(SystemConfigDetail::getConfigType, request.getConfigType());
    }
    if (StringUtils.isNotBlank(request.getConfigKey())) {
        wrapper.eq(SystemConfigDetail::getConfigKey, request.getConfigKey());
    }

    return new Response<>(this.baseMapper.selectList(wrapper).stream().map(this::convert).collect(Collectors.toList()));
}
 
Example 12
Source File: SysCategoryController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * [列表页面]加载分类字典数据 用于值的替换
 * @param code
 * @return
 */
@RequestMapping(value = "/loadAllData", method = RequestMethod.GET)
public Result<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) {
 Result<List<DictModel>> result = new Result<List<DictModel>>();
 LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>();
 if(oConvertUtils.isNotEmpty(code) && !"0".equals(code)){
	 query.likeRight(SysCategory::getCode,code);
 }
 List<SysCategory> list = this.sysCategoryService.list(query);
 if(list==null || list.size()==0) {
	 result.setMessage("无数据,参数有误.[code]");
	 result.setSuccess(false);
	 return result;
 }
 List<DictModel> rdList = new ArrayList<DictModel>();
 for (SysCategory c : list) {
	 rdList.add(new DictModel(c.getId(),c.getName()));
 }
 result.setSuccess(true);
 result.setResult(rdList);
 return result;
}
 
Example 13
Source File: SysUserDepartServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 根据部门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 14
Source File: MenuServiceImpl.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
@Override
public Response<List<MenuResponse>> queryList(MenuOtherParam param) {

    LambdaQueryWrapper<Menu> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(Menu::getDeleteStatus, Boolean.FALSE);
    if (StringUtils.isNotBlank(param.getName())) {
        wrapper.likeRight(Menu::getName, param.getName());
    }
    if (Objects.nonNull(param.getMenuType())) {
        wrapper.eq(Menu::getMenuType, param.getMenuType());
    }
    wrapper.orderByAsc(Menu::getSequence);
    List<Menu> menus = this.baseMapper.selectList(wrapper);
    List<MenuResponse> parentResp = Optional.ofNullable(menus).orElse(Collections.emptyList()).stream()
            .filter(item -> Objects.isNull(item.getParentId()))
            .map(this::conv)
            .collect(Collectors.toList());
    Map<Long, List<MenuResponse>> childrenMap = Optional.ofNullable(menus).orElse(Collections.emptyList()).stream()
            .filter(item -> Objects.nonNull(item.getParentId()))
            .map(this::conv)
            .collect(Collectors.groupingBy(MenuResponse::getParentId, Collectors.toList()));

    // 数据转换
    toTree(parentResp, childrenMap);

    return Response.toResponse(parentResp, 0L);
}
 
Example 15
Source File: GoodsSkuServiceImpl.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
@Override
public Response<List<GoodsSkuResponse>> queryPage(GoodsSkuPageRequest request) {
    LambdaQueryWrapper<GoodsSku> qw = new LambdaQueryWrapper<>();
    qw.eq(GoodsSku::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(request.getSkuName())) {
        qw.likeRight(GoodsSku::getSkuName, request.getSkuName());
    }

    if (StringUtils.isNotBlank(request.getSkuCode())) {
        qw.eq(GoodsSku::getSkuCode, request.getSkuCode());
    }

    if (Objects.nonNull(request.getInventory())) {
        qw.eq(GoodsSku::getInventory, request.getInventory());
    }

    if (Objects.nonNull(request.getDefaultSku())) {
        qw.eq(GoodsSku::getDefaultSku, request.getDefaultSku());
    }

    qw.orderByDesc(GoodsSku::getUpdateTime);

    Response<List<GoodsSku>> page = this.toPage(request.getPage(), request.getPageSize(), qw);
    return Response.toResponse(page.getData().stream().map(this::convert).collect(Collectors.toList())
            , page.getTotal());
}
 
Example 16
Source File: RoleServiceImpl.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
@Override
public Response<List<RoleResponse>> queryPage(RolePageParam param) {
    LambdaQueryWrapper<Role> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(Role::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(param.getRoleName())) {
        wrapper.likeRight(Role::getRoleName, param.getRoleName());
    }

    Response<List<Role>> response = this.toPage(param.getPage(), param.getPageSize(), wrapper);

    return Response.toResponse(Optional.ofNullable(response.getData()).orElse(Collections.emptyList()).stream()
                    .map(item -> BeanCopier.create(item, new RoleResponse()).copy()).collect(Collectors.toList())
            , response.getTotal());
}
 
Example 17
Source File: SystemConfigServiceImpl.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
/**
 * 组织查询
 *
 * @param configName 配置项名称
 * @param configType 配置类型
 */
private LambdaQueryWrapper<SystemConfig> toQueryWrapper(String configName, String configType) {
    LambdaQueryWrapper<SystemConfig> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(SystemConfig::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(configName)) {
        wrapper.likeRight(SystemConfig::getConfigName, configName);
    }
    if (StringUtils.isNotBlank(configType)) {
        wrapper.eq(SystemConfig::getConfigType, configType);
    }
    return wrapper;
}
 
Example 18
Source File: SysUserDepartServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 根据部门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 19
Source File: GoodsPropertyGroupServiceImpl.java    From spring-cloud-shop with MIT License 4 votes vote down vote up
@Override
public Response<List<GoodsPropertyGroupResponse>> queryPage(GoodsPropertyGroupPageRequest request) {

    LambdaQueryWrapper<GoodsPropertyGroup> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(GoodsPropertyGroup::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(request.getPropertyGroupName())) {
        wrapper.likeRight(GoodsPropertyGroup::getPropertyGroupName, request.getPropertyGroupName());
    }

    wrapper.orderByDesc(GoodsPropertyGroup::getUpdateTime);

    Response<List<GoodsPropertyGroup>> page = this.toPage(request.getPage(), request.getPageSize(), wrapper);

    return Response.toResponse(page.getData().stream().map(this::convert).collect(Collectors.toList()), page.getTotal());
}
 
Example 20
Source File: GoodsPropertyGroupServiceImpl.java    From spring-cloud-shop with MIT License 4 votes vote down vote up
@Override
public Response<List<GoodsPropertyGroupResponse>> queryList(GoodsPropertyGroupOtherRequest request) {

    LambdaQueryWrapper<GoodsPropertyGroup> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(GoodsPropertyGroup::getDeleteStatus, Boolean.FALSE);

    if (StringUtils.isNotBlank(request.getPropertyGroupName())) {
        wrapper.likeRight(GoodsPropertyGroup::getPropertyGroupName, request.getPropertyGroupName());
    }

    wrapper.orderByDesc(GoodsPropertyGroup::getUpdateTime);

    List<GoodsPropertyGroup> goodsPropertyGroups = this.baseMapper.selectList(wrapper);

    return Response.toResponse(goodsPropertyGroups.stream().map(this::convert).collect(Collectors.toList()), 0L);
}