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.TGuijiHealthcommissionYyryxx;
import com.sooka.system.service.ITGuijiHealthcommissionYyryxxService;

/**
 * 预约人员信息Controller
 * 
 * @author lei
 * @date 2021-11-09
 */
@Controller
@RequestMapping("/system/yyryxx")
public class TGuijiHealthcommissionYyryxxController extends BaseController
{
    private String prefix = "system/yyryxx";

    @Autowired
    private ITGuijiHealthcommissionYyryxxService tGuijiHealthcommissionYyryxxService;

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

    /**
     * 查询预约人员信息列表
     */
    @RequiresPermissions("system:yyryxx:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TGuijiHealthcommissionYyryxx tGuijiHealthcommissionYyryxx)
    {
        startPage();
        List<TGuijiHealthcommissionYyryxx> list = tGuijiHealthcommissionYyryxxService.selectTGuijiHealthcommissionYyryxxList(tGuijiHealthcommissionYyryxx);
        return getDataTable(list);
    }

    /**
     * 导出预约人员信息列表
     */
    @RequiresPermissions("system:yyryxx:export")
    @Log(title = "预约人员信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TGuijiHealthcommissionYyryxx tGuijiHealthcommissionYyryxx)
    {
        List<TGuijiHealthcommissionYyryxx> list = tGuijiHealthcommissionYyryxxService.selectTGuijiHealthcommissionYyryxxList(tGuijiHealthcommissionYyryxx);
        ExcelUtil<TGuijiHealthcommissionYyryxx> util = new ExcelUtil<TGuijiHealthcommissionYyryxx>(TGuijiHealthcommissionYyryxx.class);
        return util.exportExcel(list, "yyryxx");
    }

    /**
     * 新增预约人员信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存预约人员信息
     */
    @RequiresPermissions("system:yyryxx:add")
    @Log(title = "预约人员信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TGuijiHealthcommissionYyryxx tGuijiHealthcommissionYyryxx)
    {
        return toAjax(tGuijiHealthcommissionYyryxxService.insertTGuijiHealthcommissionYyryxx(tGuijiHealthcommissionYyryxx));
    }

    /**
     * 修改预约人员信息
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        TGuijiHealthcommissionYyryxx tGuijiHealthcommissionYyryxx = tGuijiHealthcommissionYyryxxService.selectTGuijiHealthcommissionYyryxxById(id);
        mmap.put("tGuijiHealthcommissionYyryxx", tGuijiHealthcommissionYyryxx);
        return prefix + "/edit";
    }

    /**
     * 修改保存预约人员信息
     */
    @RequiresPermissions("system:yyryxx:edit")
    @Log(title = "预约人员信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TGuijiHealthcommissionYyryxx tGuijiHealthcommissionYyryxx)
    {
        return toAjax(tGuijiHealthcommissionYyryxxService.updateTGuijiHealthcommissionYyryxx(tGuijiHealthcommissionYyryxx));
    }

    /**
     * 删除预约人员信息
     */
    @RequiresPermissions("system:yyryxx:remove")
    @Log(title = "预约人员信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tGuijiHealthcommissionYyryxxService.deleteTGuijiHealthcommissionYyryxxByIds(ids));
    }
}
