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

k.e.book.ddh.service.CcAlbumService 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.CcAlbumDO;
import k.e.book.ddh.entity.CcAlbumQueryDTO;
import k.e.book.ddh.mapper.CcAlbumMapper;
import org.springframework.stereotype.Service;

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

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

        if(dto.getId() != null){
            qr.eq(CcAlbumDO::getId, dto.getId());
        }
        if(dto.getAuthorId() != null){
            qr.eq(CcAlbumDO::getAuthorId, dto.getAuthorId());
        }
        if(dto.getCategoryIds() != null){
            qr.eq(CcAlbumDO::getCategoryIds, dto.getCategoryIds());
        }
        if(dto.getName() != null){
            qr.eq(CcAlbumDO::getName, dto.getName());
        }
        if(dto.getImage() != null){
            qr.eq(CcAlbumDO::getImage, dto.getImage());
        }
        if(dto.getPublishtime() != null){
            qr.eq(CcAlbumDO::getPublishtime, dto.getPublishtime());
        }
        if(dto.getStatus() != null){
            qr.eq(CcAlbumDO::getStatus, dto.getStatus());
        }
        if(dto.getCreatetime() != null){
            qr.eq(CcAlbumDO::getCreatetime, dto.getCreatetime());
        }
        if(dto.getUpdatetime() != null){
            qr.eq(CcAlbumDO::getUpdatetime, dto.getUpdatetime());
        }

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