package com.hotent.enterpriseDeclare.controller.material;


import com.hotent.enterpriseDeclare.manager.CostProjectTaskMaterialDataManager;
import com.hotent.enterpriseDeclare.model.CostProjectTaskMaterialData;
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;

/**
 * 项目流程资料数据表 前端控制器
 *
 * @author 超级管理员
 * @since 2025-10-28
 */
@Api(tags = "任务定制-报送资料要求")
@RestController
@RequestMapping("/costProjectTaskMaterialData/v1/")
public class CostProjectTaskMaterialDataController extends BaseController<CostProjectTaskMaterialDataManager, CostProjectTaskMaterialData> {

	/**
	 * 根据id获取项目流程资料数据表数据详情
	 * @param id
	 * @return
	 * @throws Exception
	 * ModelAndView
	 */
	@GetMapping(value="/getDetail")
	@ApiOperation(value="根据id获取项目流程资料数据表数据详情",httpMethod = "GET",notes = "根据id获取项目流程资料数据表数据详情")
	public CommonResult<CostProjectTaskMaterialData> getDetail(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<CostProjectTaskMaterialData>ok().value(baseService.getDetail(id));
	}
    /**
	 * 新增,更新项目流程资料数据表
	 * @param costProjectTaskMaterialData
	 * @throws Exception
	 * @return
	 * @exception
	 */
	@PostMapping(value="/save")
	@ApiOperation(value = "新增,更新项目流程资料数据表数据", httpMethod = "POST", notes = "新增,更新项目流程资料数据表数据")
	public CommonResult<String> save(@ApiParam(name="CostProjectTaskMaterialData",value="项目流程资料数据表对象", required = true)@RequestBody CostProjectTaskMaterialData costProjectTaskMaterialData) throws Exception{
		String msg = StringUtil.isEmpty(costProjectTaskMaterialData.getId()) ? "添加项目流程资料数据表成功" : "更新项目流程资料数据表成功";
		baseService.createOrUpdate(costProjectTaskMaterialData);
		return CommonResult.<String>ok().message(msg);
	}
}
