package com.ruoyi.model.controller;

import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.model.domain.AppExaminationInstructions;
import com.ruoyi.model.service.IAppExaminationInstructionsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 考核说明配置Controller
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@RestController
@RequestMapping("/model/AppExaminationInstructions")
public class AppExaminationInstructionsController extends BaseController
{
    @Autowired
    private IAppExaminationInstructionsService appExaminationInstructionsService;

    /**
     * 查询考核说明配置列表
     */
    @PreAuthorize("@ss.hasPermi('model:AppExaminationInstructions:list')")
    @GetMapping("/list")
    public TableDataInfo list(AppExaminationInstructions appExaminationInstructions)
    {
        startPage();
        List<AppExaminationInstructions> list = appExaminationInstructionsService.selectAppExaminationInstructionsList(appExaminationInstructions);
        return getDataTable(list);
    }

    /**
     * 导出考核说明配置列表
     */
    @PreAuthorize("@ss.hasPermi('model:AppExaminationInstructions:export')")
    @Log(title = "考核说明配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AppExaminationInstructions appExaminationInstructions) throws IOException {
        List<AppExaminationInstructions> list = appExaminationInstructionsService.selectAppExaminationInstructionsList(appExaminationInstructions);
        ExcelUtil<AppExaminationInstructions> util = new ExcelUtil<AppExaminationInstructions>(AppExaminationInstructions.class);
        util.exportExcel(response, list, "考核说明配置数据");
    }

    /**
     * 获取考核说明配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('model:AppExaminationInstructions:query')")
    @GetMapping(value = "/{examinationInstructionsId}")
    public AjaxResult getInfo(@PathVariable("examinationInstructionsId") Long examinationInstructionsId)
    {
        return success(appExaminationInstructionsService.selectAppExaminationInstructionsByExaminationInstructionsId(examinationInstructionsId));
    }

    /**
     * 新增考核说明配置
     */
    @PreAuthorize("@ss.hasPermi('model:AppExaminationInstructions:add')")
    @Log(title = "考核说明配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AppExaminationInstructions appExaminationInstructions)
    {
        return toAjax(appExaminationInstructionsService.insertAppExaminationInstructions(appExaminationInstructions));
    }

    /**
     * 修改考核说明配置
     */
    @PreAuthorize("@ss.hasPermi('model:AppExaminationInstructions:edit')")
    @Log(title = "考核说明配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AppExaminationInstructions appExaminationInstructions)
    {
        return toAjax(appExaminationInstructionsService.updateAppExaminationInstructions(appExaminationInstructions));
    }

    /**
     * 删除考核说明配置
     */
    @PreAuthorize("@ss.hasPermi('model:AppExaminationInstructions:remove')")
    @Log(title = "考核说明配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{examinationInstructionsIds}")
    public AjaxResult remove(@PathVariable Long[] examinationInstructionsIds)
    {
        return toAjax(appExaminationInstructionsService.deleteAppExaminationInstructionsByExaminationInstructionsIds(examinationInstructionsIds));
    }
}
