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

k.e.book.ddh.service.CcInviteLogService 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.CcInviteLogDO;
import k.e.book.ddh.entity.CcInviteLogQueryDTO;
import k.e.book.ddh.mapper.CcInviteLogMapper;
import org.springframework.stereotype.Service;

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

    public CcInviteLogDO findByUserId(Long userId) {
        LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
        qr.eq(CcInviteLogDO::getUserId, userId).last("limit 1");

        return this.getOne(qr);
    }

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

        if (dto.getId() != null) {
            qr.eq(CcInviteLogDO::getId, dto.getId());
        }
        if (dto.getUserId() != null) {
            qr.eq(CcInviteLogDO::getUserId, dto.getUserId());
        }
        if (dto.getMobile() != null) {
            qr.eq(CcInviteLogDO::getMobile, dto.getMobile());
        }
        if (dto.getInviteNum() != null) {
            qr.eq(CcInviteLogDO::getInviteNum, dto.getInviteNum());
        }
        if (dto.getInviteRealNum() != null) {
            qr.eq(CcInviteLogDO::getInviteRealNum, dto.getInviteRealNum());
        }
        if (dto.getCreateTime() != null) {
            qr.eq(CcInviteLogDO::getCreateTime, dto.getCreateTime());
        }
        if (dto.getUpdateTime() != null) {
            qr.eq(CcInviteLogDO::getUpdateTime, dto.getUpdateTime());
        }

        qr.orderByDesc(CcInviteLogDO::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