package com.fs.his.controller;

import java.util.List;

import com.fs.his.vo.FsStoreExtractVO;
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.FsStoreExtract;
import com.fs.his.service.IFsStoreExtractService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 店铺提现管理Controller
 *
 * @author fs
 * @date 2023-06-25
 */
@RestController
@RequestMapping("/his/storeExtract")
public class FsStoreExtractController extends BaseController
{
    @Autowired
    private IFsStoreExtractService fsStoreExtractService;

    /**
     * 查询店铺提现管理列表
     */
    @PreAuthorize("@ss.hasPermi('his:storeExtract:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsStoreExtract fsStoreExtract)
    {
        startPage();
        List<FsStoreExtractVO> list = fsStoreExtractService.selectFsStoreExtractListVO(fsStoreExtract);
        return getDataTable(list);
    }

    /**
     * 导出店铺提现管理列表
     */
    @PreAuthorize("@ss.hasPermi('his:storeExtract:export')")
    @Log(title = "店铺提现管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsStoreExtract fsStoreExtract)
    {
        List<FsStoreExtract> list = fsStoreExtractService.selectFsStoreExtractList(fsStoreExtract);
        ExcelUtil<FsStoreExtract> util = new ExcelUtil<FsStoreExtract>(FsStoreExtract.class);
        return util.exportExcel(list, "店铺提现管理数据");
    }

    /**
     * 获取店铺提现管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('his:storeExtract:query')")
    @GetMapping(value = "/{extractId}")
    public AjaxResult getInfo(@PathVariable("extractId") String extractId)
    {
        return AjaxResult.success(fsStoreExtractService.selectFsStoreExtractByExtractId(extractId));
    }

    /**
     * 新增店铺提现管理
     */
    @PreAuthorize("@ss.hasPermi('his:storeExtract:add')")
    @Log(title = "店铺提现管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsStoreExtract fsStoreExtract)
    {
        return toAjax(fsStoreExtractService.insertFsStoreExtract(fsStoreExtract));
    }

    /**
     * 审核
     */
    @PreAuthorize("@ss.hasPermi('his:storeExtract:edit')")
    @Log(title = "审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsStoreExtract fsStoreExtract)
    {
        return toAjax(fsStoreExtractService.updateFsStoreExtract(fsStoreExtract));
    }

    /**
     * 删除店铺提现管理
     */
    @PreAuthorize("@ss.hasPermi('his:storeExtract:remove')")
    @Log(title = "店铺提现管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{extractIds}")
    public AjaxResult remove(@PathVariable String[] extractIds)
    {
        return toAjax(fsStoreExtractService.deleteFsStoreExtractByExtractIds(extractIds));
    }
}
