package com.ruoyi.framework.system.controller;

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.framework.system.domain.DiagnosisUpdates;
import com.ruoyi.framework.system.service.IDiagnosisUpdatesService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 诊断数据更新Controller
 * 
 * @author ruoyi
 * @date 2024-11-13
 */
@RestController
@RequestMapping("/system/DiagnosisUpdates")
public class DiagnosisUpdatesController extends BaseController
{
    @Autowired
    private IDiagnosisUpdatesService diagnosisUpdatesService;

    /**
     * 查询诊断数据更新列表
     */
    @PreAuthorize("@ss.hasPermi('system:DiagnosisUpdates:list')")
    @GetMapping("/list")
    public TableDataInfo list(DiagnosisUpdates diagnosisUpdates)
    {
        startPage();
        List<DiagnosisUpdates> list = diagnosisUpdatesService.selectDiagnosisUpdatesList(diagnosisUpdates);
        return getDataTable(list);
    }

    /**
     * 导出诊断数据更新列表
     */
    @PreAuthorize("@ss.hasPermi('system:DiagnosisUpdates:export')")
    @Log(title = "诊断数据更新", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DiagnosisUpdates diagnosisUpdates)
    {
        List<DiagnosisUpdates> list = diagnosisUpdatesService.selectDiagnosisUpdatesList(diagnosisUpdates);
        ExcelUtil<DiagnosisUpdates> util = new ExcelUtil<DiagnosisUpdates>(DiagnosisUpdates.class);
        util.exportExcel(response, list, "诊断数据更新数据");
    }

    /**
     * 获取诊断数据更新详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:DiagnosisUpdates:query')")
    @GetMapping(value = "/{UpdateID}")
    public AjaxResult getInfo(@PathVariable("UpdateID") Long UpdateID)
    {
        return success(diagnosisUpdatesService.selectDiagnosisUpdatesByUpdateID(UpdateID));
    }

    /**
     * 新增诊断数据更新
     */
    @PreAuthorize("@ss.hasPermi('system:DiagnosisUpdates:add')")
    @Log(title = "诊断数据更新", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DiagnosisUpdates diagnosisUpdates)
    {
        return toAjax(diagnosisUpdatesService.insertDiagnosisUpdates(diagnosisUpdates));
    }

    /**
     * 修改诊断数据更新
     */
    @PreAuthorize("@ss.hasPermi('system:DiagnosisUpdates:edit')")
    @Log(title = "诊断数据更新", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DiagnosisUpdates diagnosisUpdates)
    {
        return toAjax(diagnosisUpdatesService.updateDiagnosisUpdates(diagnosisUpdates));
    }

    /**
     * 删除诊断数据更新
     */
    @PreAuthorize("@ss.hasPermi('system:DiagnosisUpdates:remove')")
    @Log(title = "诊断数据更新", businessType = BusinessType.DELETE)
	@DeleteMapping("/{UpdateIDs}")
    public AjaxResult remove(@PathVariable Long[] UpdateIDs)
    {
        return toAjax(diagnosisUpdatesService.deleteDiagnosisUpdatesByUpdateIDs(UpdateIDs));
    }
}
