package com.hotent.baseInfo.controller;


import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.base.query.PageList;
import com.hotent.baseInfo.req.CostBaseInfoPageReq;
import com.hotent.baseInfo.resp.CostCatalogInformationPageResp;
import com.hotent.common.CrudService;
import com.hotent.req.IdReq;
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.baseInfo.model.CostCatalogInformation;
import com.hotent.baseInfo.manager.CostCatalogInformationManager;

import java.util.List;

/**
 * 监审目录-政策文件 前端控制器
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-09-29
 */
@RestController
@RequestMapping("/api/costCatalogInformation/v1/")
@ApiGroup(group = {ApiGroupConsts.GROUP_COST})
@Api(tags = "监审目录-政策文件")
public class CostCatalogInformationController extends BaseController<CostCatalogInformationManager, CostCatalogInformation> {

	// 创建通用服务实例
	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<CostCatalogInformation> getDetail(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<CostCatalogInformation>ok().value(baseService.getDetail(id));
	}

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

	//取消关联文件
	@PostMapping(value="/cleanByIds")
	@ApiOperation(value="取消关联文件",httpMethod = "POST",notes = "取消关联文件")
	public CommonResult<String> cleanByIds(@ApiParam(name="ids", value="id集合") @RequestBody IdReq req){
		baseService.removeByIds(req.getIds());
		return CommonResult.<String>ok().message("批量取消关联文件成功");
	}




}
