All Downloads are FREE. Search and download functionalities are using the official Maven repository.

k.e.book.ddh.service.CcUserAddressService Maven / Gradle / Ivy


package k.e.book.ddh.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import k.e.book.ddh.entity.CcUserAddressDO;
import k.e.book.ddh.entity.CcUserAddressQueryDTO;
import k.e.book.ddh.mapper.CcUserAddressMapper;
import org.springframework.stereotype.Service;

/**
 * @author kk
 * @date 2023-05-21 11:04
 */
@Service
public class CcUserAddressService extends ServiceImpl {

    public IPage selectProductPage(CcUserAddressQueryDTO dto) {
        LambdaQueryWrapper qr = new LambdaQueryWrapper<>();

        if(dto.getId() != null){
            qr.eq(CcUserAddressDO::getId, dto.getId());
        }
        if(dto.getUserId() != null){
            qr.eq(CcUserAddressDO::getUserId, dto.getUserId());
        }
        if(dto.getCode() != null){
            qr.eq(CcUserAddressDO::getCode, dto.getCode());
        }
        if(dto.getAddress() != null){
            qr.eq(CcUserAddressDO::getAddress, dto.getAddress());
        }
        if(dto.getName() != null){
            qr.eq(CcUserAddressDO::getName, dto.getName());
        }
        if(dto.getMobile() != null){
            qr.eq(CcUserAddressDO::getMobile, dto.getMobile());
        }
        if(dto.getRemark() != null){
            qr.eq(CcUserAddressDO::getRemark, dto.getRemark());
        }
        if(dto.getCreatetime() != null){
            qr.eq(CcUserAddressDO::getCreatetime, dto.getCreatetime());
        }
        if(dto.getUpdatetime() != null){
            qr.eq(CcUserAddressDO::getUpdatetime, dto.getUpdatetime());
        }
        if(dto.getDeletetime() != null){
            qr.eq(CcUserAddressDO::getDeletetime, dto.getDeletetime());
        }
        if(dto.getIsDefault() != null){
            qr.eq(CcUserAddressDO::getIsDefault, dto.getIsDefault());
        }

        qr.orderByDesc(CcUserAddressDO::getId);
        IPage page = new Page<>();
        page.setCurrent(dto.getPage());
        page.setSize(dto.getLimit());
        return baseMapper.selectPage(page, qr);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy