package com.srs.web.controller.stureg;

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.srs.common.annotation.Log;
import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.enums.BusinessType;
import com.srs.stureg.domain.PayMoney;
import com.srs.stureg.service.IPayMoneyService;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.core.page.TableDataInfo;

/**
 * 网上缴费情况Controller
 * 
 * @author 邓
 * @date 2023-05-20
 */
@RestController
@RequestMapping("/stureg/paymoney")
public class PayMoneyController extends BaseController
{
    @Autowired
    private IPayMoneyService payMoneyService;

    /**
     * 查询网上缴费情况列表
     */
//    @PreAuthorize("@ss.hasPermi('stureg:paymoney:list')")
    @GetMapping("/list")
    public TableDataInfo list(PayMoney payMoney)
    {
        startPage();
        List<PayMoney> list = payMoneyService.selectPayMoneyList(payMoney);
        return getDataTable(list);
    }

    /**
     * 导出网上缴费情况列表
     */
//    @PreAuthorize("@ss.hasPermi('stureg:paymoney:export')")
    @Log(title = "网上缴费情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PayMoney payMoney)
    {
        List<PayMoney> list = payMoneyService.selectPayMoneyList(payMoney);
        ExcelUtil<PayMoney> util = new ExcelUtil<PayMoney>(PayMoney.class);
        util.exportExcel(response, list, "网上缴费情况数据");
    }

    /**
     * 获取网上缴费情况详细信息
     */
//    @PreAuthorize("@ss.hasPermi('stureg:paymoney:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(payMoneyService.selectPayMoneyById(id));
    }

    /**
     * 新增网上缴费情况
     */
//    @PreAuthorize("@ss.hasPermi('stureg:paymoney:add')")
    @Log(title = "网上缴费情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PayMoney payMoney)
    {
        return toAjax(payMoneyService.insertPayMoney(payMoney));
    }

    /**
     * 修改网上缴费情况
     */
//    @PreAuthorize("@ss.hasPermi('stureg:paymoney:edit')")
    @Log(title = "网上缴费情况", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody PayMoney payMoney)
    {
        return toAjax(payMoneyService.updatePayMoney(payMoney));
    }

    /**
     * 删除网上缴费情况
     */
//    @PreAuthorize("@ss.hasPermi('stureg:paymoney:remove')")
    @Log(title = "网上缴费情况", businessType = BusinessType.DELETE)
	@PostMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(payMoneyService.deletePayMoneyByIds(ids));
    }
}
