package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.cs.domain.CsAccountExtensionInfo;
import com.ruoyi.cs.service.ICsAccountExtensionInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 账户延期人员信息Controller
 *
 * @author ruoyi
 * @date 2024-08-09
 */
@RestController
@RequestMapping("/cs/CsAccountExtensionInfo")
public class CsAccountExtensionInfoController extends BaseController
{
    @Autowired
    private ICsAccountExtensionInfoService csAccountExtensionInfoService;

    /**
     * 查询账户延期人员信息列表
     */
    @PreAuthorize("@ss.hasPermi('cs:CsAccountExtensionInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(CsAccountExtensionInfo csAccountExtensionInfo)
    {
        startPage();
        List<CsAccountExtensionInfo> list = csAccountExtensionInfoService.selectCsAccountExtensionInfoList(csAccountExtensionInfo);
        return getDataTable(list);
    }

    /**
     * 导出账户延期人员信息列表
     */
    @PreAuthorize("@ss.hasPermi('cs:CsAccountExtensionInfo:export')")
    @Log(title = "账户延期人员信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CsAccountExtensionInfo csAccountExtensionInfo)
    {
        List<CsAccountExtensionInfo> list = csAccountExtensionInfoService.selectCsAccountExtensionInfoList(csAccountExtensionInfo);
        ExcelUtil<CsAccountExtensionInfo> util = new ExcelUtil<CsAccountExtensionInfo>(CsAccountExtensionInfo.class);
        util.exportExcel(response, list, "账户延期人员信息数据");
    }

    /**
     * 获取账户延期人员信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('cs:CsAccountExtensionInfo:query')")
    @GetMapping(value = "/{accountExtensionInfoId}")
    public AjaxResult getInfo(@PathVariable("accountExtensionInfoId") String accountExtensionInfoId)
    {
        return AjaxResult.success(csAccountExtensionInfoService.selectCsAccountExtensionInfoByAccountExtensionInfoId(accountExtensionInfoId));
    }

    /**
     * 新增账户延期人员信息
     */
    @PreAuthorize("@ss.hasPermi('cs:CsAccountExtensionInfo:add')")
    @Log(title = "账户延期人员信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CsAccountExtensionInfo csAccountExtensionInfo)
    {
        return toAjax(csAccountExtensionInfoService.insertCsAccountExtensionInfo(csAccountExtensionInfo));
    }

    /**
     * 修改账户延期人员信息
     */
    @PreAuthorize("@ss.hasPermi('cs:CsAccountExtensionInfo:edit')")
    @Log(title = "账户延期人员信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CsAccountExtensionInfo csAccountExtensionInfo)
    {
        return toAjax(csAccountExtensionInfoService.updateCsAccountExtensionInfo(csAccountExtensionInfo));
    }

    /**
     * 删除账户延期人员信息
     */
    @PreAuthorize("@ss.hasPermi('cs:CsAccountExtensionInfo:remove')")
    @Log(title = "账户延期人员信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{accountExtensionInfoIds}")
    public AjaxResult remove(@PathVariable String[] accountExtensionInfoIds)
    {
        return toAjax(csAccountExtensionInfoService.deleteCsAccountExtensionInfoByAccountExtensionInfoIds(accountExtensionInfoIds));
    }
}
