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 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)); } }