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

k.e.book.ddh.service.CcPersonalAccessTokensService 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.CcPersonalAccessTokensDO;
import k.e.book.ddh.entity.CcPersonalAccessTokensQueryDTO;
import k.e.book.ddh.mapper.CcPersonalAccessTokensMapper;
import org.springframework.stereotype.Service;

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

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

        if(dto.getId() != null){
            qr.eq(CcPersonalAccessTokensDO::getId, dto.getId());
        }
        if(dto.getTokenableType() != null){
            qr.eq(CcPersonalAccessTokensDO::getTokenableType, dto.getTokenableType());
        }
        if(dto.getTokenableId() != null){
            qr.eq(CcPersonalAccessTokensDO::getTokenableId, dto.getTokenableId());
        }
        if(dto.getName() != null){
            qr.eq(CcPersonalAccessTokensDO::getName, dto.getName());
        }
        if(dto.getToken() != null){
            qr.eq(CcPersonalAccessTokensDO::getToken, dto.getToken());
        }
        if(dto.getAbilities() != null){
            qr.eq(CcPersonalAccessTokensDO::getAbilities, dto.getAbilities());
        }
        if(dto.getLastUsedAt() != null){
            qr.eq(CcPersonalAccessTokensDO::getLastUsedAt, dto.getLastUsedAt());
        }
        if(dto.getExpiresAt() != null){
            qr.eq(CcPersonalAccessTokensDO::getExpiresAt, dto.getExpiresAt());
        }
        if(dto.getCreatedAt() != null){
            qr.eq(CcPersonalAccessTokensDO::getCreatedAt, dto.getCreatedAt());
        }
        if(dto.getUpdatedAt() != null){
            qr.eq(CcPersonalAccessTokensDO::getUpdatedAt, dto.getUpdatedAt());
        }

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