package com.microservices.zone.specialProject.controller;

import com.microservices.common.core.web.controller.BaseController;
import com.microservices.common.core.web.domain.AjaxResult;
import com.microservices.common.core.web.domain.GenericsAjaxResult;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.log.annotation.Log;
import com.microservices.common.log.enums.BusinessType;
import com.microservices.common.security.annotation.RequiresPermissions;
import com.microservices.zone.specialProject.domain.ZoneSpecialProjectReport;
import com.microservices.zone.specialProject.domain.vo.ZoneSpecialProjectReportInputVo;
import com.microservices.zone.specialProject.domain.vo.ZoneSpecialProjectReportSearchVo;
import com.microservices.zone.specialProject.domain.vo.ZoneSpecialProjectReportUpdateVo;
import com.microservices.zone.specialProject.service.IZoneSpecialProjectReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 专项项目会议报告Controller
 *
 * @author otto
 * @date 2024-11-14
 */
@RestController
@RequestMapping("/zoneSpecialProjectReport")
@Api(tags = "特色专区专项项目会议报告接口")
public class ZoneSpecialProjectReportController extends BaseController {
    @Autowired
    private IZoneSpecialProjectReportService zoneSpecialProjectReportService;

    /**
     * 查询专项项目会议报告列表
     */
    @RequiresPermissions("zone:zoneSpecialProjectReport:list")
    @GetMapping("/list")
    @ApiOperation("查询专项项目会议报告列表")
    public GenericsTableDataInfo<ZoneSpecialProjectReport> list(@Validated ZoneSpecialProjectReportSearchVo zoneSpecialProjectReportSearchVo) {
        startPage();
        List<ZoneSpecialProjectReport> list = zoneSpecialProjectReportService.selectZoneSpecialProjectReportList(zoneSpecialProjectReportSearchVo.toZoneSpecialProjectReport());
        return getGenericsDataTable(list);
    }

    /**
     * 获取专项项目会议报告详细信息
     */
    @RequiresPermissions("zone:zoneSpecialProjectReport:query")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取专项项目会议报告详细信息")
    public GenericsAjaxResult<ZoneSpecialProjectReport> getInfo(@PathVariable("id") Long id) {
        return genericsSuccess(zoneSpecialProjectReportService.selectZoneSpecialProjectReportById(id));
    }

    /**
     * 新增专项项目会议报告
     */
    @RequiresPermissions("zone:zoneSpecialProjectReport:add")
    @Log(title = "专项项目会议报告", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增专项项目会议报告")
    public AjaxResult add(@RequestBody @Validated ZoneSpecialProjectReportInputVo zoneSpecialProjectReportInputVo) {
        return toAjax(zoneSpecialProjectReportService.insertZoneSpecialProjectReport(zoneSpecialProjectReportInputVo));
    }

    /**
     * 修改专项项目会议报告
     */
    @RequiresPermissions("zone:zoneSpecialProjectReport:edit")
    @Log(title = "专项项目会议报告", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改专项项目会议报告")
    public AjaxResult edit(@RequestBody @Validated ZoneSpecialProjectReportUpdateVo zoneSpecialProjectReportUpdateVo) {
        return toAjax(zoneSpecialProjectReportService.updateZoneSpecialProjectReport(zoneSpecialProjectReportUpdateVo));
    }

    /**
     * 删除专项项目会议报告
     */
    @RequiresPermissions("zone:zoneSpecialProjectReport:remove")
    @Log(title = "专项项目会议报告", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除专项项目会议报告")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(zoneSpecialProjectReportService.deleteZoneSpecialProjectReportByIds(ids));
    }
}
