package com.benyun.project.third.byKingdeeConfig.controller;

import java.util.List;
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.benyun.framework.aspectj.lang.annotation.Log;
import com.benyun.framework.aspectj.lang.enums.BusinessType;
import com.benyun.project.third.byKingdeeConfig.domain.ByKingdeeConfig;
import com.benyun.project.third.byKingdeeConfig.service.IByKingdeeConfigService;
import com.benyun.framework.web.controller.BaseController;
import com.benyun.framework.web.domain.AjaxResult;
import com.benyun.common.utils.poi.ExcelUtil;
import com.benyun.framework.web.page.TableDataInfo;

/**
 * 系统账户配置信息Controller
 *
 * @author benyun
 * @date 2024-01-10
 */
@Controller
@RequestMapping("/system/byKingdeeConfig")
public class ByKingdeeConfigController extends BaseController
{
    private String prefix = "system/third/byKingdeeConfig";

    @Autowired
    private IByKingdeeConfigService byKingdeeConfigService;

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

    /**
     * 查询系统账户配置信息列表
     */
    @RequiresPermissions("system:byKingdeeConfig:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ByKingdeeConfig byKingdeeConfig)
    {
        startPage();
        List<ByKingdeeConfig> list = byKingdeeConfigService.selectByKingdeeConfigList(byKingdeeConfig);
        return getDataTable(list);
    }

    /**
     * 导出系统账户配置信息列表
     */
    @RequiresPermissions("system:byKingdeeConfig:export")
    @Log(title = "系统账户配置信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ByKingdeeConfig byKingdeeConfig)
    {
        List<ByKingdeeConfig> list = byKingdeeConfigService.selectByKingdeeConfigList(byKingdeeConfig);
        ExcelUtil<ByKingdeeConfig> util = new ExcelUtil<ByKingdeeConfig>(ByKingdeeConfig.class);
        return util.exportExcel(list, "系统账户配置信息数据");
    }

    /**
     * 新增系统账户配置信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存系统账户配置信息
     */
    @RequiresPermissions("system:byKingdeeConfig:add")
    @Log(title = "系统账户配置信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ByKingdeeConfig byKingdeeConfig)
    {
        return toAjax(byKingdeeConfigService.insertByKingdeeConfig(byKingdeeConfig));
    }

    /**
     * 修改系统账户配置信息
     */
    @RequiresPermissions("system:byKingdeeConfig:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        ByKingdeeConfig byKingdeeConfig = byKingdeeConfigService.selectByKingdeeConfigById(id);
        mmap.put("byKingdeeConfig", byKingdeeConfig);
        return prefix + "/edit";
    }

    /**
     * 修改保存系统账户配置信息
     */
    @RequiresPermissions("system:byKingdeeConfig:edit")
    @Log(title = "系统账户配置信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ByKingdeeConfig byKingdeeConfig)
    {
        return toAjax(byKingdeeConfigService.updateByKingdeeConfig(byKingdeeConfig));
    }

    /**
     * 删除系统账户配置信息
     */
    @RequiresPermissions("system:byKingdeeConfig:remove")
    @Log(title = "系统账户配置信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(byKingdeeConfigService.deleteByKingdeeConfigByIds(ids));
    }
}
