k.e.book.ddh.service.CcProductMergeRuleService 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.CcProductMergeRuleDO;
import k.e.book.ddh.entity.CcProductMergeRuleQueryDTO;
import k.e.book.ddh.mapper.CcProductMergeRuleMapper;
import org.springframework.stereotype.Service;
/**
* @author kk
* @date 2023-05-21 11:04
*/
@Service
public class CcProductMergeRuleService extends ServiceImpl {
public IPage selectProductPage(CcProductMergeRuleQueryDTO dto) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
if(dto.getId() != null){
qr.eq(CcProductMergeRuleDO::getId, dto.getId());
}
if(dto.getSubject() != null){
qr.eq(CcProductMergeRuleDO::getSubject, dto.getSubject());
}
if(dto.getMergeId() != null){
qr.eq(CcProductMergeRuleDO::getMergeId, dto.getMergeId());
}
if(dto.getQuantity() != null){
qr.eq(CcProductMergeRuleDO::getQuantity, dto.getQuantity());
}
if(dto.getProductId() != null){
qr.eq(CcProductMergeRuleDO::getProductId, dto.getProductId());
}
if(dto.getBoxId() != null){
qr.eq(CcProductMergeRuleDO::getBoxId, dto.getBoxId());
}
if(dto.getMergetype() != null){
qr.eq(CcProductMergeRuleDO::getMergetype, dto.getMergetype());
}
if(dto.getMergeqty() != null){
qr.eq(CcProductMergeRuleDO::getMergeqty, dto.getMergeqty());
}
if(dto.getMerpercentage() != null){
qr.eq(CcProductMergeRuleDO::getMerpercentage, dto.getMerpercentage());
}
if(dto.getLosequantity() != null){
qr.eq(CcProductMergeRuleDO::getLosequantity, dto.getLosequantity());
}
if(dto.getLogic() != null){
qr.eq(CcProductMergeRuleDO::getLogic, dto.getLogic());
}
if(dto.getCreatetime() != null){
qr.eq(CcProductMergeRuleDO::getCreatetime, dto.getCreatetime());
}
if(dto.getUpdatetime() != null){
qr.eq(CcProductMergeRuleDO::getUpdatetime, dto.getUpdatetime());
}
qr.orderByDesc(CcProductMergeRuleDO::getId);
IPage page = new Page<>();
page.setCurrent(dto.getPage());
page.setSize(dto.getLimit());
return baseMapper.selectPage(page, qr);
}
}