package com.hotent.project.controller;


import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.project.model.CostProjectDocument;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.hotent.base.model.CommonResult;
import com.hotent.base.util.StringUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RestController;
import com.hotent.base.controller.BaseController;
import com.hotent.project.model.CostProjectDocumentFile;
import com.hotent.project.manager.CostProjectDocumentFileManager;

import java.util.List;

/**
 * 监审项目文书内容表 前端控制器
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-10-16
 */
@RestController
@RequestMapping("/costProjectDocumentFile/v1/")
@Api(tags = "监审项目文书内容表")
@ApiGroup(group = {ApiGroupConsts.GROUP_COST})
public class CostProjectDocumentFileController extends BaseController<CostProjectDocumentFileManager, CostProjectDocumentFile> {

	/**
	 * 根据id获取监审项目文书内容表数据详情
	 * @param id
	 * @return
	 * @throws Exception 
	 * ModelAndView
	 */
	@GetMapping(value="/getDetail")
	@ApiOperation(value="根据id获取监审项目文书内容表数据详情",httpMethod = "GET",notes = "根据id获取监审项目文书内容表数据详情")
	public CommonResult<CostProjectDocumentFile> getDetail(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<CostProjectDocumentFile>ok().value(baseService.getDetail(id));
	}


	@GetMapping(value="/getInfo")
	@ApiOperation(value="根据id获取监审项目文书表数据详情",httpMethod = "GET",notes = "根据id获取监审项目文书表数据详情")
	public CommonResult getInfo(@ApiParam(name="id",value="监审项目文书ID", required = true)@RequestParam(required=true) String id) throws Exception{
		List<CostProjectDocumentFile> documentFiles=baseService.getInfo(id);
		return CommonResult.ok().value(documentFiles);
	}
    /**
	 * 新增,更新监审项目文书内容表
	 * @param costProjectDocumentFile
	 * @throws Exception 
	 * @return
	 * @exception 
	 */
	@PostMapping(value="/save")
	@ApiOperation(value = "新增,更新监审项目文书内容表数据", httpMethod = "POST", notes = "新增,更新监审项目文书内容表数据")
	public CommonResult<String> save(@ApiParam(name="CostProjectDocumentFile",value="监审项目文书内容表对象", required = true)@RequestBody CostProjectDocumentFile costProjectDocumentFile) throws Exception{
		String msg = StringUtil.isEmpty(costProjectDocumentFile.getId()) ? "添加监审项目文书内容表成功" : "更新监审项目文书内容表成功";
		baseService.createOrUpdate(costProjectDocumentFile);
		return CommonResult.<String>ok().message(msg);
	}
}
