liding
2026-01-30 cd4fcbc4243ef3e4824f8ea4ac43f02a8902fae9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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);
    }
 
}