package com.sooka.system.controller;

import java.util.List;

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.common.annotation.Log;
import com.sooka.system.domain.TgjjDwckzhbdxx;
import com.sooka.system.service.ITgjjDwckzhbdxxService;

/**
 * 单位存款账户变动信息Controller
 * 
 * @author lei
 * @date 2021-11-16
 */
@Controller
@RequestMapping("/system/dwckzhbdxx")
public class TgjjDwckzhbdxxController extends BaseController
{
    private String prefix = "system/dwckzhbdxx";

    @Autowired
    private ITgjjDwckzhbdxxService tgjjDwckzhbdxxService;

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

    /**
     * 查询单位存款账户变动信息列表
     */
    @RequiresPermissions("system:dwckzhbdxx:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TgjjDwckzhbdxx tgjjDwckzhbdxx)
    {
        startPage();
        List<TgjjDwckzhbdxx> list = tgjjDwckzhbdxxService.selectTgjjDwckzhbdxxList(tgjjDwckzhbdxx);
        return getDataTable(list);
    }

    /**
     * 导出单位存款账户变动信息列表
     */
    @RequiresPermissions("system:dwckzhbdxx:export")
    @Log(title = "单位存款账户变动信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TgjjDwckzhbdxx tgjjDwckzhbdxx)
    {
        List<TgjjDwckzhbdxx> list = tgjjDwckzhbdxxService.selectTgjjDwckzhbdxxList(tgjjDwckzhbdxx);
        ExcelUtil<TgjjDwckzhbdxx> util = new ExcelUtil<TgjjDwckzhbdxx>(TgjjDwckzhbdxx.class);
        return util.exportExcel(list, "dwckzhbdxx");
    }

    /**
     * 新增单位存款账户变动信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存单位存款账户变动信息
     */
    @RequiresPermissions("system:dwckzhbdxx:add")
    @Log(title = "单位存款账户变动信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TgjjDwckzhbdxx tgjjDwckzhbdxx)
    {
        return toAjax(tgjjDwckzhbdxxService.insertTgjjDwckzhbdxx(tgjjDwckzhbdxx));
    }

    /**
     * 修改单位存款账户变动信息
     */
    @GetMapping("/edit/{ID}")
    public String edit(@PathVariable("ID") Long ID, ModelMap mmap)
    {
        TgjjDwckzhbdxx tgjjDwckzhbdxx = tgjjDwckzhbdxxService.selectTgjjDwckzhbdxxById(ID);
        mmap.put("tgjjDwckzhbdxx", tgjjDwckzhbdxx);
        return prefix + "/edit";
    }

    /**
     * 修改保存单位存款账户变动信息
     */
    @RequiresPermissions("system:dwckzhbdxx:edit")
    @Log(title = "单位存款账户变动信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TgjjDwckzhbdxx tgjjDwckzhbdxx)
    {
        return toAjax(tgjjDwckzhbdxxService.updateTgjjDwckzhbdxx(tgjjDwckzhbdxx));
    }

    /**
     * 删除单位存款账户变动信息
     */
    @RequiresPermissions("system:dwckzhbdxx:remove")
    @Log(title = "单位存款账户变动信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tgjjDwckzhbdxxService.deleteTgjjDwckzhbdxxByIds(ids));
    }
}
