package com.ztmap.project.zhny.lotuscbcjl.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.ztmap.framework.aspectj.lang.annotation.Log;
import com.ztmap.framework.aspectj.lang.enums.BusinessType;
import com.ztmap.project.zhny.lotuscbcjl.domain.TLotusCbcjl;
import com.ztmap.project.zhny.lotuscbcjl.service.ITLotusCbcjlService;
import com.ztmap.framework.web.controller.BaseController;
import com.ztmap.framework.web.domain.AjaxResult;
import com.ztmap.common.utils.poi.ExcelUtil;
import com.ztmap.framework.web.page.TableDataInfo;

/**
 * 抄采集率Controller
 * 
 * @author ztmap
 * @date 2023-11-16
 */
@Controller
@RequestMapping("/zhny/lotuscbcjl")
public class TLotusCbcjlController extends BaseController
{
    private String prefix = "zhny/lotuscbcjl";

    @Autowired
    private ITLotusCbcjlService tLotusCbcjlService;

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

    /**
     * 查询抄采集率列表
     */
    @RequiresPermissions("zhny:lotuscbcjl:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TLotusCbcjl tLotusCbcjl)
    {
        startPage();
        List<TLotusCbcjl> list = tLotusCbcjlService.selectTLotusCbcjlList(tLotusCbcjl);
        return getDataTable(list);
    }

    /**
     * 导出抄采集率列表
     */
    @RequiresPermissions("zhny:lotuscbcjl:export")
    @Log(title = "抄采集率", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TLotusCbcjl tLotusCbcjl)
    {
        List<TLotusCbcjl> list = tLotusCbcjlService.selectTLotusCbcjlList(tLotusCbcjl);
        ExcelUtil<TLotusCbcjl> util = new ExcelUtil<TLotusCbcjl>(TLotusCbcjl.class);
        return util.exportExcel(list, "抄采集率数据");
    }

    /**
     * 新增抄采集率
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存抄采集率
     */
    @RequiresPermissions("zhny:lotuscbcjl:add")
    @Log(title = "抄采集率", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TLotusCbcjl tLotusCbcjl)
    {
        return toAjax(tLotusCbcjlService.insertTLotusCbcjl(tLotusCbcjl));
    }

    /**
     * 修改抄采集率
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        TLotusCbcjl tLotusCbcjl = tLotusCbcjlService.selectTLotusCbcjlById(id);
        mmap.put("tLotusCbcjl", tLotusCbcjl);
        return prefix + "/edit";
    }

    /**
     * 修改保存抄采集率
     */
    @RequiresPermissions("zhny:lotuscbcjl:edit")
    @Log(title = "抄采集率", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TLotusCbcjl tLotusCbcjl)
    {
        return toAjax(tLotusCbcjlService.updateTLotusCbcjl(tLotusCbcjl));
    }

    /**
     * 删除抄采集率
     */
    @RequiresPermissions("zhny:lotuscbcjl:remove")
    @Log(title = "抄采集率", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tLotusCbcjlService.deleteTLotusCbcjlByIds(ids));
    }
}
