/*
 *      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.springblade.business.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.business.entity.ContractLog;
import org.springblade.business.vo.ContractLogVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.manager.feign.WbsTreeContractClient;
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
import org.springframework.web.bind.annotation.*;
import org.springblade.business.service.IContractLogService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;

/**
 * 日志通用表 控制器
 *
 * @author BladeX
 * @since 2022-06-15
 */
@RestController
@AllArgsConstructor
@RequestMapping("/contractLog")
@Api(value = "日志通用表", tags = "日志通用表接口")
public class ContractLogController extends BladeController {

	private final IContractLogService contractLogService;

	private final WbsTreeContractClient wbsTreeContractClient;

	/**
	 * 施工日志分页
	 * @param logVo 查询条件
	 * @return 结果
	 */
	@GetMapping("/constructionLogPage")
	@ApiOperationSupport(order = 2)
	@ApiOperation(value = "施工日志分页")
	public R<IPage<ContractLogVO>> constructionLogPage(@RequestBody ContractLogVO logVo){
		return R.data(this.contractLogService.constructionLogPage(logVo));
	}

	/**
	 * 获取当前合同段下的日志类型
	 * @param contractId 合同段ID
	 * @return 结果
	 */
	@GetMapping("/queryCurrentContractLogList")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "获取当前合同段下的日志类型")
	@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
	public R<List<WbsTreeContractTreeVOS>> queryCurrentContractLogList(@RequestParam String contractId){
		return R.data(this.wbsTreeContractClient.queryCurrentContractLogList(contractId));
	}
	
}
