package com.fs.doctor.controller;

import com.fs.common.annotation.Log;
import com.fs.common.config.LoginContextManager;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.doctor.domain.DoctorLevelData;
import com.fs.doctor.service.IDoctorLevelDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 医生级别Controller
 * 
 * @author fs
 * @date 2026-02-12
 */
@RestController
@RequestMapping("/doctor/data")
public class DoctorLevelDataController extends BaseController
{
    @Autowired
    private IDoctorLevelDataService doctorLevelDataService;

    /**
     * 查询医生级别列表
     */
    @PreAuthorize("@ss.hasPermi('doctor:data:list')")
    @GetMapping("/list")
    public TableDataInfo list(DoctorLevelData doctorLevelData)
    {
        startPage();
        List<DoctorLevelData> list = doctorLevelDataService.selectDoctorLevelDataList(doctorLevelData);
        return getDataTable(list);
    }

    /**
     * 导出医生级别列表
     */
    @PreAuthorize("@ss.hasPermi('doctor:data:export')")
    @Log(title = "医生级别", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(DoctorLevelData doctorLevelData)
    {
        List<DoctorLevelData> list = doctorLevelDataService.selectDoctorLevelDataList(doctorLevelData);
        ExcelUtil<DoctorLevelData> util = new ExcelUtil<DoctorLevelData>(DoctorLevelData.class);
        return util.exportExcel(list, "医生级别数据");
    }

    /**
     * 获取医生级别详细信息
     */
    @PreAuthorize("@ss.hasPermi('doctor:data:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(doctorLevelDataService.selectDoctorLevelDataById(id));
    }

    /**
     * 新增医生级别
     */
    @PreAuthorize("@ss.hasPermi('doctor:data:add')")
    @Log(title = "医生级别", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DoctorLevelData doctorLevelData)
    {
        return toAjax(doctorLevelDataService.insertDoctorLevelData(doctorLevelData));
    }

    /**
     * 修改医生级别
     */
    @PreAuthorize("@ss.hasPermi('doctor:data:edit')")
    @Log(title = "医生级别", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DoctorLevelData doctorLevelData)
    {
        return toAjax(doctorLevelDataService.updateDoctorLevelData(doctorLevelData));
    }

    /**
     * 删除医生级别
     */
    @PreAuthorize("@ss.hasPermi('doctor:data:remove')")
    @Log(title = "医生级别", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(doctorLevelDataService.deleteDoctorLevelDataByIds(ids));
    }
}
