/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.security.trans.projectBudgetManagement.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;

import org.security.trans.projectBudgetManagement.dto.ProjectContractDTO;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.security.trans.projectBudgetManagement.vo.ProjectContractVO;
import org.security.trans.projectBudgetManagement.service.IProjectContractService;
import org.springblade.core.boot.ctrl.BladeController;

import java.util.List;

/**
 * 项目管理-项目合同 控制器
 *
 * @author BladeX
 * @since 2022-08-05
 */
@RestController
@AllArgsConstructor
@RequestMapping("/projectcontract")
@Api(value = "项目管理-项目合同", tags = "项目管理-项目合同接口")
public class ProjectContractController extends BladeController {

	private final IProjectContractService projectContractService;

	/**
	 * 根据项目id查询对应合同
	 */
	@GetMapping("/{id}")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "详情", notes = "传入id")
	public R<List<ProjectContractVO>> detail(@PathVariable String id) {
		return R.data(projectContractService.getDaya(id));
	}
	/**
	 * 自定义分页 项目管理-项目管理信息主表
	 */
	@GetMapping("/page")
	@ApiOperationSupport(order = 3)
	@ApiOperation(value = "分页", notes = "传入project")
	public R<IPage<ProjectContractVO>> page(ProjectContractDTO projectContractDTO, Query query) {
		IPage<ProjectContractVO> pages = projectContractService.selectProjectContractPage(Condition.getPage(query), projectContractDTO);
		return R.data(pages);
	}
}
