package com.sooka.system.controller;

import java.util.List;
import com.sooka.common.annotation.Log;
import com.sooka.common.core.controller.BaseController;
import com.sooka.common.core.domain.AjaxResult;
import com.sooka.common.core.page.TableDataInfo;
import com.sooka.common.enums.BusinessType;
import com.sooka.common.utils.poi.ExcelUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.sooka.system.domain.TGuijiHousingconstructionJfpzxx;
import com.sooka.system.service.ITGuijiHousingconstructionJfpzxxService;

/**
 * 缴费凭证信息Controller
 * 
 * @author lei
 * @date 2021-11-05
 */
@Controller
@RequestMapping("/system/jfpzxx")
public class TGuijiHousingconstructionJfpzxxController extends BaseController
{
    private String prefix = "system/jfpzxx";

    @Autowired
    private ITGuijiHousingconstructionJfpzxxService tGuijiHousingconstructionJfpzxxService;

    @RequiresPermissions("system:jfpzxx:view")
    @GetMapping()
    public String jfpzxx()
    {
        return prefix + "/jfpzxx";
    }

    /**
     * 查询缴费凭证信息列表
     */
    @RequiresPermissions("system:jfpzxx:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TGuijiHousingconstructionJfpzxx tGuijiHousingconstructionJfpzxx)
    {
        startPage();
        List<TGuijiHousingconstructionJfpzxx> list = tGuijiHousingconstructionJfpzxxService.selectTGuijiHousingconstructionJfpzxxList(tGuijiHousingconstructionJfpzxx);
        return getDataTable(list);
    }

    /**
     * 导出缴费凭证信息列表
     */
    @RequiresPermissions("system:jfpzxx:export")
    @Log(title = "缴费凭证信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TGuijiHousingconstructionJfpzxx tGuijiHousingconstructionJfpzxx)
    {
        List<TGuijiHousingconstructionJfpzxx> list = tGuijiHousingconstructionJfpzxxService.selectTGuijiHousingconstructionJfpzxxList(tGuijiHousingconstructionJfpzxx);
        ExcelUtil<TGuijiHousingconstructionJfpzxx> util = new ExcelUtil<TGuijiHousingconstructionJfpzxx>(TGuijiHousingconstructionJfpzxx.class);
        return util.exportExcel(list, "jfpzxx");
    }

    /**
     * 新增缴费凭证信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存缴费凭证信息
     */
    @RequiresPermissions("system:jfpzxx:add")
    @Log(title = "缴费凭证信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TGuijiHousingconstructionJfpzxx tGuijiHousingconstructionJfpzxx)
    {
        return toAjax(tGuijiHousingconstructionJfpzxxService.insertTGuijiHousingconstructionJfpzxx(tGuijiHousingconstructionJfpzxx));
    }

    /**
     * 修改缴费凭证信息
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        TGuijiHousingconstructionJfpzxx tGuijiHousingconstructionJfpzxx = tGuijiHousingconstructionJfpzxxService.selectTGuijiHousingconstructionJfpzxxById(id);
        mmap.put("tGuijiHousingconstructionJfpzxx", tGuijiHousingconstructionJfpzxx);
        return prefix + "/edit";
    }

    /**
     * 修改保存缴费凭证信息
     */
    @RequiresPermissions("system:jfpzxx:edit")
    @Log(title = "缴费凭证信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TGuijiHousingconstructionJfpzxx tGuijiHousingconstructionJfpzxx)
    {
        return toAjax(tGuijiHousingconstructionJfpzxxService.updateTGuijiHousingconstructionJfpzxx(tGuijiHousingconstructionJfpzxx));
    }

    /**
     * 删除缴费凭证信息
     */
    @RequiresPermissions("system:jfpzxx:remove")
    @Log(title = "缴费凭证信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tGuijiHousingconstructionJfpzxxService.deleteTGuijiHousingconstructionJfpzxxByIds(ids));
    }
}
