package com.hotent.project.controller;


import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
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.CostProjectTaskLog;
import com.hotent.project.manager.CostProjectTaskLogManager;

/**
 * 项目任务日志表 前端控制器
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-10-03
 */
@RestController
@RequestMapping("/api/costProjectTaskLog/v1/")
@Api(tags = "项目任务日志表")
@ApiGroup(group = {ApiGroupConsts.GROUP_COST})
public class CostProjectTaskLogController extends BaseController<CostProjectTaskLogManager, CostProjectTaskLog> {

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