package com.fs.his.controller;

import java.util.List;
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.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.his.domain.FsProjectCate;
import com.fs.his.service.IFsProjectCateService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 理疗分类Controller
 * 
 * @author fs
 * @date 2026-05-14
 */
@RestController
@RequestMapping("/his/projectCate")
public class FsProjectCateController extends BaseController
{
    @Autowired
    private IFsProjectCateService fsProjectCateService;

    /**
     * 查询理疗分类列表
     */
    @PreAuthorize("@ss.hasPermi('his:projectCate:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsProjectCate fsProjectCate)
    {
        startPage();
        List<FsProjectCate> list = fsProjectCateService.selectFsProjectCateList(fsProjectCate);
        return getDataTable(list);
    }

    /**
     * 导出理疗分类列表
     */
    @PreAuthorize("@ss.hasPermi('his:projectCate:export')")
    @Log(title = "理疗分类", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsProjectCate fsProjectCate)
    {
        List<FsProjectCate> list = fsProjectCateService.selectFsProjectCateList(fsProjectCate);
        ExcelUtil<FsProjectCate> util = new ExcelUtil<FsProjectCate>(FsProjectCate.class);
        return util.exportExcel(list, "理疗分类数据");
    }

    /**
     * 获取理疗分类详细信息
     */
    @PreAuthorize("@ss.hasPermi('his:projectCate:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fsProjectCateService.selectFsProjectCateById(id));
    }

    /**
     * 新增理疗分类
     */
    @PreAuthorize("@ss.hasPermi('his:projectCate:add')")
    @Log(title = "理疗分类", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsProjectCate fsProjectCate)
    {
        return toAjax(fsProjectCateService.insertFsProjectCate(fsProjectCate));
    }

    /**
     * 修改理疗分类
     */
    @PreAuthorize("@ss.hasPermi('his:projectCate:edit')")
    @Log(title = "理疗分类", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsProjectCate fsProjectCate)
    {
        return toAjax(fsProjectCateService.updateFsProjectCate(fsProjectCate));
    }

    /**
     * 删除理疗分类
     */
    @PreAuthorize("@ss.hasPermi('his:projectCate:remove')")
    @Log(title = "理疗分类", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fsProjectCateService.deleteFsProjectCateByIds(ids));
    }

    @GetMapping("/options")
    public AjaxResult selectFsProjectCateListOptions(){
        List<FsProjectCate> list = fsProjectCateService.selectFsProjectCateListOptions();
        return AjaxResult.success(list);
    }
}
