shiyunteng
8 天以前 fb9fca375c78c5b79acf6db990357816f86100fb
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
56
57
58
59
60
61
package com.by4cloud.platformx.business.controller;
 
/**
 * 合同管理
 *
 * @author syt
 * @date 2026-04-29 16:46:26
 */
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.business.entity.Contract;
import com.by4cloud.platformx.business.service.ContractService;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.mybatis.BaseModel;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequiredArgsConstructor
@RequestMapping("/contractBilling" )
@Tag(description = "contractBilling" , name = "合同开票管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ContractBillingController {
 
    private final ContractService contractService;
 
    /**
     * 分页查询
     * @param page 分页对象
     * @param contract 合同管理
     * @return
     */
    @Operation(summary = "分页查询" , description = "分页查询" )
    @GetMapping("/page" )
    public R getContractPage(@ParameterObject Page page, @ParameterObject Contract contract) {
        LambdaQueryWrapper<Contract> wrapper = Wrappers.lambdaQuery();
        wrapper.like(StringUtils.isNotBlank(contract.getContractName()),Contract::getContractName,contract.getContractName());
        wrapper.like(StringUtils.isNotBlank(contract.getPartyA()),Contract::getPartyA,contract.getPartyA());
        wrapper.eq(Contract::getBillingStatus,contract.getBillingStatus());
        if (StrUtil.equals(contract.getBillingStatus(),"1")){
            wrapper.orderByDesc(BaseModel::getCreateTime);
        }else {
            wrapper.orderByAsc(BaseModel::getCreateTime);
        }
 
        return R.ok(contractService.pageByScope(page, wrapper));
    }
 
}