package com.hotent.project.controller;


import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.common.CrudService;
import com.hotent.project.model.CostProjectMaterial;
import com.hotent.project.req.CostProjectBasePageReq;
import com.hotent.req.PageReq;
import com.hotent.resp.PageResp;
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.CostProjectSurvey;
import com.hotent.project.manager.CostProjectSurveyManager;

import java.util.List;

/**
 * 立项任务成本调查表 前端控制器
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-09-26
 */
@RestController
@RequestMapping("/api/costProjectSurvey/v1/")
@Api(tags = "立项任务成本调查表")
@ApiGroup(group = {ApiGroupConsts.GROUP_COST})
public class CostProjectSurveyController extends BaseController<CostProjectSurveyManager, CostProjectSurvey> {

	// 创建通用服务实例
	private final CrudService crudService = new CrudService();
	/**
	 * 根据id获取立项任务成本调查表数据详情
	 * @param id
	 * @return
	 * @throws Exception 
	 * ModelAndView
	 */
	@GetMapping(value="/getDetail")
	@ApiOperation(value="根据id获取立项任务成本调查表数据详情",httpMethod = "GET",notes = "根据id获取立项任务成本调查表数据详情")
	public CommonResult<CostProjectSurvey> getDetail(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<CostProjectSurvey>ok().value(baseService.getDetail(id));
	}

	@PostMapping(value="/pageList")
	@ApiOperation(value="分页查询pageList",httpMethod = "POST",notes = "分页查询pageList")
	public CommonResult<PageResp<CostProjectSurvey>> pageList(@RequestBody CostProjectBasePageReq req) {
		return CommonResult.<PageResp<CostProjectSurvey>>ok().value(crudService.pageQuery(req, baseService::pageList));
	}


	@PostMapping(value = "list")
	@ApiOperation(value = "查询list", httpMethod = "POST", notes = "查询list")
	public CommonResult<List<CostProjectSurvey>> list() {
		return CommonResult.<List<CostProjectSurvey>>ok().value(baseService.list());
	}

}
