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.TUPeoplemarryinfodouble;
import com.sooka.system.service.ITUPeoplemarryinfodoubleService;
/**
 * 国家民政部-婚姻信息（双方）-数据查询接口Controller
 *
 * @author lei
 * @date 2021-07-14
 */
@Controller
@RequestMapping("/system/peoplemarryinfodouble")
public class TUPeoplemarryinfodoubleController extends BaseController
{
    private String prefix = "system/peoplemarryinfodouble";

    @Autowired
    private ITUPeoplemarryinfodoubleService tUPeoplemarryinfodoubleService;

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

    /**
     * 查询国家民政部-婚姻信息（双方）-数据查询接口列表
     */
    @RequiresPermissions("system:peoplemarryinfodouble:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TUPeoplemarryinfodouble tUPeoplemarryinfodouble)
    {
        startPage();
        List<TUPeoplemarryinfodouble> list = tUPeoplemarryinfodoubleService.selectTUPeoplemarryinfodoubleList(tUPeoplemarryinfodouble);
        return getDataTable(list);
    }

    /**
     * 导出国家民政部-婚姻信息（双方）-数据查询接口列表
     */
    @RequiresPermissions("system:peoplemarryinfodouble:export")
    @Log(title = "国家民政部-婚姻信息（双方）-数据查询接口", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TUPeoplemarryinfodouble tUPeoplemarryinfodouble)
    {
        List<TUPeoplemarryinfodouble> list = tUPeoplemarryinfodoubleService.selectTUPeoplemarryinfodoubleList(tUPeoplemarryinfodouble);
        ExcelUtil<TUPeoplemarryinfodouble> util = new ExcelUtil<TUPeoplemarryinfodouble>(TUPeoplemarryinfodouble.class);
        return util.exportExcel(list, "peoplemarryinfodouble");
    }

    /**
     * 新增国家民政部-婚姻信息（双方）-数据查询接口
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存国家民政部-婚姻信息（双方）-数据查询接口
     */
    @RequiresPermissions("system:peoplemarryinfodouble:add")
    @Log(title = "国家民政部-婚姻信息（双方）-数据查询接口", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TUPeoplemarryinfodouble tUPeoplemarryinfodouble)
    {
        return toAjax(tUPeoplemarryinfodoubleService.insertTUPeoplemarryinfodouble(tUPeoplemarryinfodouble));
    }

    /**
     * 修改国家民政部-婚姻信息（双方）-数据查询接口
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        TUPeoplemarryinfodouble tUPeoplemarryinfodouble = tUPeoplemarryinfodoubleService.selectTUPeoplemarryinfodoubleById(id);
        mmap.put("tUPeoplemarryinfodouble", tUPeoplemarryinfodouble);
        return prefix + "/edit";
    }

    /**
     * 修改保存国家民政部-婚姻信息（双方）-数据查询接口
     */
    @RequiresPermissions("system:peoplemarryinfodouble:edit")
    @Log(title = "国家民政部-婚姻信息（双方）-数据查询接口", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TUPeoplemarryinfodouble tUPeoplemarryinfodouble)
    {
        return toAjax(tUPeoplemarryinfodoubleService.updateTUPeoplemarryinfodouble(tUPeoplemarryinfodouble));
    }

    /**
     * 删除国家民政部-婚姻信息（双方）-数据查询接口
     */
    @RequiresPermissions("system:peoplemarryinfodouble:remove")
    @Log(title = "国家民政部-婚姻信息（双方）-数据查询接口", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tUPeoplemarryinfodoubleService.deleteTUPeoplemarryinfodoubleByIds(ids));
    }
}
