k.e.book.ddh.service.CcJobsService 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.CcJobsDO;
import k.e.book.ddh.entity.CcJobsQueryDTO;
import k.e.book.ddh.mapper.CcJobsMapper;
import org.springframework.stereotype.Service;
/**
* @author kk
* @date 2023-05-21 11:04
*/
@Service
public class CcJobsService extends ServiceImpl {
public IPage selectProductPage(CcJobsQueryDTO dto) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
if(dto.getId() != null){
qr.eq(CcJobsDO::getId, dto.getId());
}
if(dto.getQueue() != null){
qr.eq(CcJobsDO::getQueue, dto.getQueue());
}
if(dto.getPayload() != null){
qr.eq(CcJobsDO::getPayload, dto.getPayload());
}
if(dto.getAttempts() != null){
qr.eq(CcJobsDO::getAttempts, dto.getAttempts());
}
if(dto.getReservedAt() != null){
qr.eq(CcJobsDO::getReservedAt, dto.getReservedAt());
}
if(dto.getAvailableAt() != null){
qr.eq(CcJobsDO::getAvailableAt, dto.getAvailableAt());
}
if(dto.getCreatedAt() != null){
qr.eq(CcJobsDO::getCreatedAt, dto.getCreatedAt());
}
qr.orderByDesc(CcJobsDO::getId);
IPage page = new Page<>();
page.setCurrent(dto.getPage());
page.setSize(dto.getLimit());
return baseMapper.selectPage(page, qr);
}
}