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

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

    LambdaQueryWrapper<GoodsBrandGroup> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(GoodsBrandGroup::getDeleteStatus, Boolean.FALSE);
    if (StringUtils.isNotBlank(request.getBrandGroupName())) {
        wrapper.likeRight(GoodsBrandGroup::getBrandGroupName, request.getBrandGroupName());
    }

    if (CollectionUtils.isNotEmpty(request.getDateTimes())) {
        wrapper.ge(GoodsBrandGroup::getUpdateTime, request.getDateTimes().get(0));
        wrapper.le(GoodsBrandGroup::getUpdateTime, request.getDateTimes().get(1));
    }

    wrapper.orderByDesc(GoodsBrandGroup::getSequence);

    Response<List<GoodsBrandGroup>> 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 2
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 3
Source File: AssembleServiceImpl.java    From spring-cloud-shop with MIT License 6 votes vote down vote up
@Override
public Response<List<AssembleMemberResponse>> members(AssembleMemberPageRequest request) {

    LambdaQueryWrapper<AssembleActivityMember> qw = new LambdaQueryWrapper<>();
    qw.eq(AssembleActivityMember::getDeleteStatus, Boolean.FALSE);
    qw.eq(AssembleActivityMember::getActivityId, request.getActivityId());

    if (!StringUtils.isEmpty(request.getPhone())) {
        qw.eq(AssembleActivityMember::getPhone, request.getPhone());
    }

    qw.orderByDesc(AssembleActivityMember::getUpdateTime);

    int total = assembleActivityMemberMapper.selectCount(qw);
    List<AssembleMemberResponse> result = Collections.emptyList();
    if (0 < total) {

        List<AssembleActivityMember> records = assembleActivityMemberMapper.selectPage(new Page<>(request.getPage(), request.getPageSize(), false), qw)
                .getRecords();
        result = records.stream().map(this::convert).collect(Collectors.toList());
    }
    return Response.toResponse(result, total);
}
 
Example 4
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 5
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 6
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 7
Source File: SystemConfigServiceImpl.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
@Override
public Response<List<SystemConfig>> queryPage(SystemConfigPageRequest request) {

    LambdaQueryWrapper<SystemConfig> qw = this.toQueryWrapper(request.getConfigName(), request.getConfigType());
    qw.orderByDesc(SystemConfig::getUpdateTime);

    return this.toPage(request.getPage(), request.getPageSize(), qw);
}
 
Example 8
Source File: SysDepartPermissionServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public List<SysPermissionDataRule> getPermRuleListByDeptIdAndPermId(String departId, String permissionId) {
    SysDepartPermission departPermission = this.getOne(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
    if(departPermission != null){
        LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
        query.in(SysPermissionDataRule::getId, Arrays.asList(departPermission.getDataRuleIds().split(",")));
        query.orderByDesc(SysPermissionDataRule::getCreateTime);
        List<SysPermissionDataRule> permRuleList = this.ruleMapper.selectList(query);
        return permRuleList;
    }else{
        return null;
    }
}
 
Example 9
Source File: GoodsBrandGroupServiceImpl.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
@Override
public Response<List<GoodsBrandGroupResponse>> queryList(GoodsBrandGroupOtherRequest request) {
    LambdaQueryWrapper<GoodsBrandGroup> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(GoodsBrandGroup::getDeleteStatus, Boolean.FALSE);
    if (StringUtils.isNotBlank(request.getBrandGroupName())) {
        wrapper.likeRight(GoodsBrandGroup::getBrandGroupName, request.getBrandGroupName());
    }

    wrapper.orderByDesc(GoodsBrandGroup::getSequence);
    List<GoodsBrandGroup> brandGroups = this.baseMapper.selectList(wrapper);
    return Response.toResponse(brandGroups.stream().map(this::convert).collect(Collectors.toList()), 0L);
}
 
Example 10
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 11
Source File: SysPermissionDataRuleImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 根据菜单id查询其对应的权限数据
 */
@Override
public List<SysPermissionDataRule> getPermRuleListByPermId(String permissionId) {
	LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
	query.eq(SysPermissionDataRule::getPermissionId, permissionId);
	query.orderByDesc(SysPermissionDataRule::getCreateTime);
	List<SysPermissionDataRule> permRuleList = this.list(query);
	return permRuleList;
}
 
Example 12
Source File: SysDepartPermissionServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
public List<SysPermissionDataRule> getPermRuleListByDeptIdAndPermId(String departId, String permissionId) {
    SysDepartPermission departPermission = this.getOne(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
    if(departPermission != null){
        LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
        query.in(SysPermissionDataRule::getId, Arrays.asList(departPermission.getDataRuleIds().split(",")));
        query.orderByDesc(SysPermissionDataRule::getCreateTime);
        List<SysPermissionDataRule> permRuleList = this.ruleMapper.selectList(query);
        return permRuleList;
    }else{
        return null;
    }
}
 
Example 13
Source File: SysPermissionDataRuleImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 根据菜单id查询其对应的权限数据
 */
@Override
public List<SysPermissionDataRule> getPermRuleListByPermId(String permissionId) {
	LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
	query.eq(SysPermissionDataRule::getPermissionId, permissionId);
	query.orderByDesc(SysPermissionDataRule::getCreateTime);
	List<SysPermissionDataRule> permRuleList = this.list(query);
	return permRuleList;
}
 
Example 14
Source File: SysDepartPermissionServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public List<SysPermissionDataRule> getPermRuleListByDeptIdAndPermId(String departId, String permissionId) {
    SysDepartPermission departPermission = this.getOne(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
    if(departPermission != null){
        LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
        query.in(SysPermissionDataRule::getId, Arrays.asList(departPermission.getDataRuleIds().split(",")));
        query.orderByDesc(SysPermissionDataRule::getCreateTime);
        List<SysPermissionDataRule> permRuleList = this.ruleMapper.selectList(query);
        return permRuleList;
    }else{
        return null;
    }
}
 
Example 15
Source File: SysPermissionDataRuleImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * 根据菜单id查询其对应的权限数据
 */
@Override
public List<SysPermissionDataRule> getPermRuleListByPermId(String permissionId) {
	LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
	query.eq(SysPermissionDataRule::getPermissionId, permissionId);
	query.orderByDesc(SysPermissionDataRule::getCreateTime);
	List<SysPermissionDataRule> permRuleList = this.list(query);
	return permRuleList;
}
 
Example 16
Source File: SysPermissionDataRuleImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 根据菜单id查询其对应的权限数据
 */
@Override
public List<SysPermissionDataRule> getPermRuleListByPermId(String permissionId) {
	LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
	query.eq(SysPermissionDataRule::getPermissionId, permissionId);
	query.orderByDesc(SysPermissionDataRule::getCreateTime);
	List<SysPermissionDataRule> permRuleList = this.list(query);
	return permRuleList;
}
 
Example 17
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 18
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);
}
 
Example 19
Source File: SystemConfigServiceImpl.java    From spring-cloud-shop with MIT License 4 votes vote down vote up
@Override
public List<SystemConfig> queryList(SystemConfigOtherRequest request) {
    LambdaQueryWrapper<SystemConfig> qw = this.toQueryWrapper(request.getConfigName(), request.getConfigType());
    qw.orderByDesc(SystemConfig::getUpdateTime);
    return this.baseMapper.selectList(qw);
}