package com.fs.company.controller.qw;

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.qw.domain.BindPhoneRedPacketRecord;
import com.fs.qw.service.IBindPhoneRedPacketRecordService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 绑定手机号红包领取记录Controller
 * 
 * @author fs
 * @date 2026-03-17
 */
@RestController
@RequestMapping("/qw/record")
public class BindPhoneRedPacketRecordController extends BaseController
{
    @Autowired
    private IBindPhoneRedPacketRecordService bindPhoneRedPacketRecordService;

    /**
     * 查询绑定手机号红包领取记录列表
     */
    @PreAuthorize("@ss.hasPermi('qw:record:list')")
    @GetMapping("/list")
    public TableDataInfo list(BindPhoneRedPacketRecord bindPhoneRedPacketRecord)
    {
        startPage();
        List<BindPhoneRedPacketRecord> list = bindPhoneRedPacketRecordService.selectBindPhoneRedPacketRecordList(bindPhoneRedPacketRecord);
        return getDataTable(list);
    }

    /**
     * 导出绑定手机号红包领取记录列表
     */
    @PreAuthorize("@ss.hasPermi('qw:record:export')")
    @Log(title = "绑定手机号红包领取记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BindPhoneRedPacketRecord bindPhoneRedPacketRecord)
    {
        List<BindPhoneRedPacketRecord> list = bindPhoneRedPacketRecordService.selectBindPhoneRedPacketRecordList(bindPhoneRedPacketRecord);
        ExcelUtil<BindPhoneRedPacketRecord> util = new ExcelUtil<BindPhoneRedPacketRecord>(BindPhoneRedPacketRecord.class);
        return util.exportExcel(list, "绑定手机号红包领取记录数据");
    }

    /**
     * 获取绑定手机号红包领取记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:record:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bindPhoneRedPacketRecordService.selectBindPhoneRedPacketRecordById(id));
    }

    /**
     * 新增绑定手机号红包领取记录
     */
    @PreAuthorize("@ss.hasPermi('qw:record:add')")
    @Log(title = "绑定手机号红包领取记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BindPhoneRedPacketRecord bindPhoneRedPacketRecord)
    {
        return toAjax(bindPhoneRedPacketRecordService.insertBindPhoneRedPacketRecord(bindPhoneRedPacketRecord));
    }

    /**
     * 修改绑定手机号红包领取记录
     */
    @PreAuthorize("@ss.hasPermi('qw:record:edit')")
    @Log(title = "绑定手机号红包领取记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BindPhoneRedPacketRecord bindPhoneRedPacketRecord)
    {
        return toAjax(bindPhoneRedPacketRecordService.updateBindPhoneRedPacketRecord(bindPhoneRedPacketRecord));
    }

    /**
     * 删除绑定手机号红包领取记录
     */
    @PreAuthorize("@ss.hasPermi('qw:record:remove')")
    @Log(title = "绑定手机号红包领取记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bindPhoneRedPacketRecordService.deleteBindPhoneRedPacketRecordByIds(ids));
    }
}
