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.TGuijiHousingconstructionYsljc;
import com.sooka.system.service.ITGuijiHousingconstructionYsljcService;

/**
 * 调度系统-用水量检测Controller
 * 
 * @author lei
 * @date 2021-10-30
 */
@Controller
@RequestMapping("/system/ysljc")
public class TGuijiHousingconstructionYsljcController extends BaseController
{
    private String prefix = "system/ysljc";

    @Autowired
    private ITGuijiHousingconstructionYsljcService tGuijiHousingconstructionYsljcService;

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

    /**
     * 查询调度系统-用水量检测列表
     */
    @RequiresPermissions("system:ysljc:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TGuijiHousingconstructionYsljc tGuijiHousingconstructionYsljc)
    {
        startPage();
        List<TGuijiHousingconstructionYsljc> list = tGuijiHousingconstructionYsljcService.selectTGuijiHousingconstructionYsljcList(tGuijiHousingconstructionYsljc);
        return getDataTable(list);
    }

    /**
     * 导出调度系统-用水量检测列表
     */
    @RequiresPermissions("system:ysljc:export")
    @Log(title = "调度系统-用水量检测", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TGuijiHousingconstructionYsljc tGuijiHousingconstructionYsljc)
    {
        List<TGuijiHousingconstructionYsljc> list = tGuijiHousingconstructionYsljcService.selectTGuijiHousingconstructionYsljcList(tGuijiHousingconstructionYsljc);
        ExcelUtil<TGuijiHousingconstructionYsljc> util = new ExcelUtil<TGuijiHousingconstructionYsljc>(TGuijiHousingconstructionYsljc.class);
        return util.exportExcel(list, "ysljc");
    }

    /**
     * 新增调度系统-用水量检测
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存调度系统-用水量检测
     */
    @RequiresPermissions("system:ysljc:add")
    @Log(title = "调度系统-用水量检测", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TGuijiHousingconstructionYsljc tGuijiHousingconstructionYsljc)
    {
        return toAjax(tGuijiHousingconstructionYsljcService.insertTGuijiHousingconstructionYsljc(tGuijiHousingconstructionYsljc));
    }

    /**
     * 修改调度系统-用水量检测
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        TGuijiHousingconstructionYsljc tGuijiHousingconstructionYsljc = tGuijiHousingconstructionYsljcService.selectTGuijiHousingconstructionYsljcById(id);
        mmap.put("tGuijiHousingconstructionYsljc", tGuijiHousingconstructionYsljc);
        return prefix + "/edit";
    }

    /**
     * 修改保存调度系统-用水量检测
     */
    @RequiresPermissions("system:ysljc:edit")
    @Log(title = "调度系统-用水量检测", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TGuijiHousingconstructionYsljc tGuijiHousingconstructionYsljc)
    {
        return toAjax(tGuijiHousingconstructionYsljcService.updateTGuijiHousingconstructionYsljc(tGuijiHousingconstructionYsljc));
    }

    /**
     * 删除调度系统-用水量检测
     */
    @RequiresPermissions("system:ysljc:remove")
    @Log(title = "调度系统-用水量检测", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tGuijiHousingconstructionYsljcService.deleteTGuijiHousingconstructionYsljcByIds(ids));
    }
}
