package com.hotwj.platform.securityManagement.securityMeeting.controller;

import com.hotwj.platform.securityManagement.securityMeeting.domain.bo.HotSecurityMeetingBo;
import com.hotwj.platform.securityManagement.securityMeeting.domain.vo.HotSecurityMeetingVo;
import com.hotwj.platform.securityManagement.securityMeeting.service.IHotSecurityMeetingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 安全会议管理
 *
 * @author shihongwei
 * @date 2025-12-17
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/securityManagement/securityMeeting")
@Tag(name = "安全会议管理", description = "安全会议管理")
public class HotSecurityMeetingController extends BaseController {

    private final IHotSecurityMeetingService hotSecurityMeetingService;

    /**
     * 查询安全会议管理列表
     */
    //@SaCheckPermission("securityManagement:securityMeeting:list")
    @GetMapping("/list")
    @Operation(summary = "查询安全会议管理列表")
    public TableDataInfo<HotSecurityMeetingVo> list(HotSecurityMeetingBo bo, PageQuery pageQuery) {
        return hotSecurityMeetingService.queryPageList(bo, pageQuery);
    }

    /**
     * 导出安全会议管理列表
     */
    //@SaCheckPermission("securityManagement:securityMeeting:export")
    @Log(title = "安全会议管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @Operation(summary = "导出安全会议管理列表")
    public void export(HotSecurityMeetingBo bo, HttpServletResponse response) {
        List<HotSecurityMeetingVo> list = hotSecurityMeetingService.queryList(bo);
        ExcelUtil.exportExcel(list, "安全会议管理", HotSecurityMeetingVo.class, response);
    }

    /**
     * 获取安全会议管理详细信息
     *
     * @param id 主键
     */
    //@SaCheckPermission("securityManagement:securityMeeting:query")
    @GetMapping("/{id}")
    @Operation(summary = "获取安全会议管理详细信息")
    public R<HotSecurityMeetingVo> getInfo(@NotNull(message = "主键不能为空")
                                           @PathVariable Long id) {
        return R.ok(hotSecurityMeetingService.queryById(id));
    }

    /**
     * 新增安全会议管理
     */
    //@SaCheckPermission("securityManagement:securityMeeting:add")
    @Log(title = "安全会议管理", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping()
    @Operation(summary = "新增安全会议管理")
    public R<Void> add(@Validated(AddGroup.class) @RequestBody HotSecurityMeetingBo bo) {
        return toAjax(hotSecurityMeetingService.insertByBo(bo));
    }

    /**
     * 修改安全会议管理
     */
    //@SaCheckPermission("securityManagement:securityMeeting:edit")
    @Log(title = "安全会议管理", businessType = BusinessType.UPDATE)
    @RepeatSubmit()
    @PutMapping()
    @Operation(summary = "修改安全会议管理")
    public R<Void> edit(@Validated(EditGroup.class) @RequestBody HotSecurityMeetingBo bo) {
        return toAjax(hotSecurityMeetingService.updateByBo(bo));
    }

    /**
     * 删除安全会议管理
     *
     * @param ids 主键串
     */
    //@SaCheckPermission("securityManagement:securityMeeting:remove")
    @Log(title = "安全会议管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @Operation(summary = "删除安全会议管理")
    public R<Void> remove(@NotEmpty(message = "主键不能为空")
                          @PathVariable Long[] ids) {
        return toAjax(hotSecurityMeetingService.deleteWithValidByIds(List.of(ids), true));
    }
}
