package com.ruoyi.fakeWarehousing.service.impl;
|
|
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 com.ruoyi.fakeWarehousing.mapper.FakeCarrierContractMapper;
|
import com.ruoyi.fakeWarehousing.pojo.FakeCarrierContract;
|
import com.ruoyi.fakeWarehousing.service.IFakeCarrierContractService;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.stereotype.Service;
|
|
import java.time.LocalDateTime;
|
import java.time.LocalTime;
|
|
/**
|
* 承运合同管理Service实现类
|
*/
|
@Service
|
@RequiredArgsConstructor
|
public class FakeCarrierContractServiceImpl extends ServiceImpl<FakeCarrierContractMapper, FakeCarrierContract> implements IFakeCarrierContractService {
|
|
private final FakeCarrierContractMapper fakeCarrierContractMapper;
|
|
@Override
|
public IPage<FakeCarrierContract> selectAll(Page<FakeCarrierContract> page, FakeCarrierContract contract) {
|
LambdaQueryWrapper<FakeCarrierContract> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
if (contract.getContractCode() != null && !contract.getContractCode().trim().isEmpty()) {
|
lambdaQueryWrapper.like(FakeCarrierContract::getContractCode, contract.getContractCode());
|
}
|
|
if (contract.getCarrierName() != null && !contract.getCarrierName().trim().isEmpty()) {
|
lambdaQueryWrapper.like(FakeCarrierContract::getCarrierName, contract.getCarrierName());
|
}
|
|
if (contract.getContractStatus() != null) {
|
lambdaQueryWrapper.eq(FakeCarrierContract::getContractStatus, contract.getContractStatus());
|
}
|
|
if (contract.getStartTime() != null) {
|
lambdaQueryWrapper.ge(FakeCarrierContract::getStartTime, contract.getStartTime());
|
}
|
|
if (contract.getEndTime() != null) {
|
LocalDateTime endTimeWithSecond = contract.getEndTime().with(LocalTime.MAX);
|
lambdaQueryWrapper.le(FakeCarrierContract::getEndTime, endTimeWithSecond);
|
}
|
|
lambdaQueryWrapper.orderByDesc(FakeCarrierContract::getCreateTime);
|
|
return fakeCarrierContractMapper.selectPage(page, lambdaQueryWrapper);
|
}
|
|
}
|