package com.fastbee.data.controller.userRecharge;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.fastbee.common.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.enums.BusinessType;
import com.fastbee.rechargecard.domain.NgInformationVillageKeeper;
import com.fastbee.rechargecard.service.INgInformationVillageKeeperService;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.common.core.page.TableDataInfo;

/**
 * 村官员信息Controller
 *
 * @author kerwincui
 * @date 2024-12-19
 */
@RestController
@RequestMapping("/rechargecard/keeper")
@Api(tags = "村官员信息")
public class NgInformationVillageKeeperController extends BaseController
{
    @Autowired
    private INgInformationVillageKeeperService ngInformationVillageKeeperService;

/**
 * 查询村官员信息列表
 */
//@PreAuthorize("@ss.hasPermi('rechargecard:keeper:list')")
@GetMapping("/list")
@ApiOperation("查询村官员信息列表")
    public TableDataInfo list(NgInformationVillageKeeper ngInformationVillageKeeper)
    {
        startPage();
        List<NgInformationVillageKeeper> list = ngInformationVillageKeeperService.selectNgInformationVillageKeeperList(ngInformationVillageKeeper);
        return getDataTable(list);
    }

    /**
     * 导出村官员信息列表
     */
    @ApiOperation("导出村官员信息列表")
//    @PreAuthorize("@ss.hasPermi('rechargecard:keeper:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, NgInformationVillageKeeper ngInformationVillageKeeper)
    {
        List<NgInformationVillageKeeper> list = ngInformationVillageKeeperService.selectNgInformationVillageKeeperList(ngInformationVillageKeeper);
        ExcelUtil<NgInformationVillageKeeper> util = new ExcelUtil<NgInformationVillageKeeper>(NgInformationVillageKeeper.class);
        util.exportExcel(response, list, "村官员信息数据");
    }

    /**
     * 获取村官员信息详细信息
     */
//    @PreAuthorize("@ss.hasPermi('rechargecard:keeper:query')")
    @GetMapping(value = "/{villageKeeperId}")
    @ApiOperation("获取村官员信息详细信息")
    public AjaxResult getInfo(@PathVariable("villageKeeperId") Long villageKeeperId)
    {
        return success(ngInformationVillageKeeperService.selectNgInformationVillageKeeperByVillageKeeperId(villageKeeperId));
    }

    /**
     * 新增村官员信息
     */
//    @PreAuthorize("@ss.hasPermi('rechargecard:keeper:add')")
    @PostMapping
    @ApiOperation("新增村官员信息")
    public AjaxResult add(@RequestBody NgInformationVillageKeeper ngInformationVillageKeeper)
    {
        return toAjax(ngInformationVillageKeeperService.insertNgInformationVillageKeeper(ngInformationVillageKeeper));
    }

    /**
     * 修改村官员信息
     */
//    @PreAuthorize("@ss.hasPermi('rechargecard:keeper:edit')")
    @PutMapping
    @ApiOperation("修改村官员信息")
    public AjaxResult edit(@RequestBody NgInformationVillageKeeper ngInformationVillageKeeper)
    {
        return toAjax(ngInformationVillageKeeperService.updateNgInformationVillageKeeper(ngInformationVillageKeeper));
    }

    /**
     * 删除村官员信息
     */
//    @PreAuthorize("@ss.hasPermi('rechargecard:keeper:remove')")
    @DeleteMapping("/{villageKeeperIds}")
    @ApiOperation("删除村官员信息")
    public AjaxResult remove(@PathVariable Long[] villageKeeperIds)
    {
        return toAjax(ngInformationVillageKeeperService.deleteNgInformationVillageKeeperByVillageKeeperIds(villageKeeperIds));
    }
}
