k.e.book.ddh.service.CcNewsService 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.CcNewsDO;
import k.e.book.ddh.entity.CcNewsQueryDTO;
import k.e.book.ddh.mapper.CcNewsMapper;
import org.springframework.stereotype.Service;
/**
* @author kk
* @date 2023-05-21 11:04
*/
@Service
public class CcNewsService extends ServiceImpl {
public IPage selectProductPage(CcNewsQueryDTO dto) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
if(dto.getId() != null){
qr.eq(CcNewsDO::getId, dto.getId());
}
if(dto.getSubject() != null){
qr.eq(CcNewsDO::getSubject, dto.getSubject());
}
if(dto.getCategoryIds() != null){
qr.eq(CcNewsDO::getCategoryIds, dto.getCategoryIds());
}
if(dto.getImage() != null){
qr.eq(CcNewsDO::getImage, dto.getImage());
}
if(dto.getContent() != null){
qr.eq(CcNewsDO::getContent, dto.getContent());
}
if(dto.getViews() != null){
qr.eq(CcNewsDO::getViews, dto.getViews());
}
if(dto.getCreatetime() != null){
qr.eq(CcNewsDO::getCreatetime, dto.getCreatetime());
}
if(dto.getUpdatetime() != null){
qr.eq(CcNewsDO::getUpdatetime, dto.getUpdatetime());
}
if(dto.getStatus() != null){
qr.eq(CcNewsDO::getStatus, dto.getStatus());
}
if(dto.getFlag() != null){
qr.eq(CcNewsDO::getFlag, dto.getFlag());
}
if(dto.getWeigh() != null){
qr.eq(CcNewsDO::getWeigh, dto.getWeigh());
}
if(dto.getIsPush() != null){
qr.eq(CcNewsDO::getIsPush, dto.getIsPush());
}
if(dto.getMinContent() != null){
qr.eq(CcNewsDO::getMinContent, dto.getMinContent());
}
if(dto.getPushTags() != null){
qr.eq(CcNewsDO::getPushTags, dto.getPushTags());
}
if(dto.getUpdatedAt() != null){
qr.eq(CcNewsDO::getUpdatedAt, dto.getUpdatedAt());
}
qr.orderByDesc(CcNewsDO::getId);
IPage page = new Page<>();
page.setCurrent(dto.getPage());
page.setSize(dto.getLimit());
return baseMapper.selectPage(page, qr);
}
}