package com.fs.company.controller.patient;

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.patient.domain.FsProjectRedPacketRecord;
import com.fs.patient.service.IFsProjectRedPacketRecordService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 理疗红包记录Controller
 * 
 * @author fs
 * @date 2026-04-23
 */
@RestController
@RequestMapping("/patient/projectRecord")
public class FsProjectRedPacketRecordController extends BaseController
{
    @Autowired
    private IFsProjectRedPacketRecordService fsProjectRedPacketRecordService;

    /**
     * 查询理疗红包记录列表
     */
    @PreAuthorize("@ss.hasPermi('patient:projectRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsProjectRedPacketRecord fsProjectRedPacketRecord)
    {
        startPage();
        List<FsProjectRedPacketRecord> list = fsProjectRedPacketRecordService.selectFsProjectRedPacketRecordList(fsProjectRedPacketRecord);
        return getDataTable(list);
    }

    /**
     * 导出理疗红包记录列表
     */
    @PreAuthorize("@ss.hasPermi('patient:projectRecord:export')")
    @Log(title = "理疗红包记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsProjectRedPacketRecord fsProjectRedPacketRecord)
    {
        List<FsProjectRedPacketRecord> list = fsProjectRedPacketRecordService.selectFsProjectRedPacketRecordList(fsProjectRedPacketRecord);
        ExcelUtil<FsProjectRedPacketRecord> util = new ExcelUtil<FsProjectRedPacketRecord>(FsProjectRedPacketRecord.class);
        return util.exportExcel(list, "理疗红包记录数据");
    }

    /**
     * 获取理疗红包记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('patient:projectRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fsProjectRedPacketRecordService.selectFsProjectRedPacketRecordById(id));
    }

    /**
     * 新增理疗红包记录
     */
    @PreAuthorize("@ss.hasPermi('patient:projectRecord:add')")
    @Log(title = "理疗红包记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsProjectRedPacketRecord fsProjectRedPacketRecord)
    {
        return toAjax(fsProjectRedPacketRecordService.insertFsProjectRedPacketRecord(fsProjectRedPacketRecord));
    }

    /**
     * 修改理疗红包记录
     */
    @PreAuthorize("@ss.hasPermi('patient:projectRecord:edit')")
    @Log(title = "理疗红包记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsProjectRedPacketRecord fsProjectRedPacketRecord)
    {
        return toAjax(fsProjectRedPacketRecordService.updateFsProjectRedPacketRecord(fsProjectRedPacketRecord));
    }

    /**
     * 删除理疗红包记录
     */
    @PreAuthorize("@ss.hasPermi('patient:projectRecord:remove')")
    @Log(title = "理疗红包记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fsProjectRedPacketRecordService.deleteFsProjectRedPacketRecordByIds(ids));
    }
}
