package com.unis.projectManagement.modular.pmBudget.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.unis.common.pojo.CommonResult;
import com.unis.projectManagement.modular.pmBudget.entity.FundPlan;
import com.unis.projectManagement.modular.pmBudget.entity.FundPlanInfo;
import com.unis.projectManagement.modular.pmBudget.param.FundPlanPageParam;
import com.unis.projectManagement.modular.pmBudget.service.FundPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author qingsong.han
 * @description:
 * @create 2024-05-30 11:21
 */
@Api(tags = "项目资金进度监督")
@ApiSupport(author = "UNIS_TEAM", order = 2)
@RestController
@Validated
@RequestMapping("/fundPlanSupervise")
public class FundPlanController {
    @Resource
    private FundPlanService fundPlanService;

    @ApiOperationSupport(order = 1)
    @ApiOperation("分页列表")
    @GetMapping("/getPageList")
    public CommonResult<Page<FundPlan>> getPageList(FundPlanPageParam pageParam) {
        return CommonResult.data(fundPlanService.getPageList(pageParam));
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation("获取项目预算资金详情")
    @GetMapping("/detail/{pmApplicationId}")
    public CommonResult<List<FundPlanInfo>> detailList(@PathVariable("pmApplicationId") String pmApplicationId) {
        return CommonResult.data(fundPlanService.detailList(pmApplicationId));
    }

}
