package com.hotent.project.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.common.CrudService;
import com.hotent.project.req.CostProjectNoticePageReq;
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 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.CostNotice;
import com.hotent.project.manager.CostNoticeManager;

/**
 * 通知公告表 前端控制器
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-09-27
 */
@RestController
@RequestMapping("/api/costNotice/v1/")
@Api(tags = "公告表")
@ApiGroup(group = {ApiGroupConsts.GROUP_COST})
public class CostNoticeController extends BaseController<CostNoticeManager, CostNotice> {

	// 创建通用服务实例
	private final CrudService crudService = new CrudService();

	//分页查询
	@PostMapping(value="/pageList")
	@ApiOperation(value="分页查询pageList")
	public CommonResult<IPage<CostNotice>> pageList(@RequestBody CostProjectNoticePageReq req) {
		IPage<CostNotice> costNoticeIPage = baseService.pageList(req);
		return CommonResult.<IPage<CostNotice>>ok().value(costNoticeIPage);
	}

	/**
	 * 根据id获取通知公告表数据详情
	 * @param id
	 * @return
	 * @throws Exception
	 * ModelAndView
	 */
	@GetMapping(value="/getDetail")
	@ApiOperation(value="根据id获取通知公告表数据详情",httpMethod = "GET",notes = "根据id获取通知公告表数据详情")
	public CommonResult<CostNotice> getDetail(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<CostNotice>ok().value(baseService.getDetail(id));
	}


	@GetMapping(value="/read")
	@ApiOperation(value="阅读通知公告表数据",httpMethod = "GET",notes = "阅读通知公告表数据")
	public CommonResult<String> read(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<String>ok().value(baseService.read(id));
	}

}
