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 com.sooka.system.domain.TGuijiNaturalresourcesBdcdjxx;
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.TGuijiNaturalresourcesBdcdjzxx;
import com.sooka.system.service.ITGuijiNaturalresourcesBdcdjzxxService;

/**
 * 不动产登记证信息Controller
 * 
 * @author lei
 * @date 2021-10-29
 */
@Controller
@RequestMapping("/system/bdcdjzxx")
public class TGuijiNaturalresourcesBdcdjzxxController extends BaseController
{
    private String prefix = "system/bdcdjzxx";

    @Autowired
    private ITGuijiNaturalresourcesBdcdjzxxService tGuijiNaturalresourcesBdcdjzxxService;

    //不动产住宅证信息
    @RequiresPermissions("system:bdcqt:view")
    @GetMapping()
    public String bdcdjzxx(ModelMap map) {
        map.put("flag","bdczz");
        return prefix + "/bdcdjzxx";
    }

    //不动产办公
    @RequiresPermissions("system:bdcqt:view")
    @GetMapping("/bdcbg")
    public String bdcbg(ModelMap map) {
        map.put("flag","bdcbg");
        return prefix + "/bdcdjzxx";
    }

    //不动产商业服务
    @RequiresPermissions("system:bdcqt:view")
    @GetMapping("/bdcsyfw")
    public String bdcsyfw(ModelMap map) {
        map.put("flag","bdcsyfw");
        return prefix + "/bdcdjzxx";
    }

    //不动产其他
    @RequiresPermissions("system:bdcqt:view")
    @GetMapping("/bdcqt")
    public String bdcqt(ModelMap map) {
        map.put("flag","bdcqt");
        return prefix + "/bdcdjzxx";
    }

    //不动产住宅
    @RequiresPermissions("system:bdcdjxx:list")
    @PostMapping("/bdczzList")
    @ResponseBody
    public TableDataInfo bdczzList(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {
        startPage();
        tGuijiNaturalresourcesBdcdjzxx.setYt("住宅");
        List<TGuijiNaturalresourcesBdcdjzxx> list = tGuijiNaturalresourcesBdcdjzxxService.selectTGuijiNaturalresourcesBdcdjzxxList(tGuijiNaturalresourcesBdcdjzxx);
        return getDataTable(list);
    }

    //不动产办公
    @RequiresPermissions("system:bdcdjxx:list")
    @PostMapping("/bdcbgList")
    @ResponseBody
    public TableDataInfo bdcbg(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {
        startPage();
        tGuijiNaturalresourcesBdcdjzxx.setYt("办公");
        List<TGuijiNaturalresourcesBdcdjzxx> list = tGuijiNaturalresourcesBdcdjzxxService.selectTGuijiNaturalresourcesBdcdjzxxList(tGuijiNaturalresourcesBdcdjzxx);
        return getDataTable(list);
    }

    //不动产商业服务
    @RequiresPermissions("system:bdcdjxx:list")
    @PostMapping("/bdcsyfwList")
    @ResponseBody
    public TableDataInfo bdcsyfw(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {
        startPage();
        tGuijiNaturalresourcesBdcdjzxx.setYt("商业服务");
        List<TGuijiNaturalresourcesBdcdjzxx> list = tGuijiNaturalresourcesBdcdjzxxService.selectTGuijiNaturalresourcesBdcdjzxxList(tGuijiNaturalresourcesBdcdjzxx);
        return getDataTable(list);
    }

    //不动产其他
    @RequiresPermissions("system:bdcdjxx:list")
    @PostMapping("/bdcqtList")
    @ResponseBody
    public TableDataInfo bdcqt(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {
        startPage();
        List<TGuijiNaturalresourcesBdcdjzxx> list = tGuijiNaturalresourcesBdcdjzxxService.selectTGuijiNaturalresourcesBdcdjxxQtList(tGuijiNaturalresourcesBdcdjzxx);
        return getDataTable(list);
    }

    /**
     * 查询不动产登记证信息列表
     */
    @RequiresPermissions("system:bdcdjzxx:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx)
    {
        startPage();
        List<TGuijiNaturalresourcesBdcdjzxx> list = tGuijiNaturalresourcesBdcdjzxxService.selectTGuijiNaturalresourcesBdcdjzxxList(tGuijiNaturalresourcesBdcdjzxx);
        return getDataTable(list);
    }

    /**
     * 导出不动产登记证信息列表
     */
    @RequiresPermissions("system:bdcdjzxx:export")
    @Log(title = "不动产登记证信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx)
    {
        List<TGuijiNaturalresourcesBdcdjzxx> list = tGuijiNaturalresourcesBdcdjzxxService.selectTGuijiNaturalresourcesBdcdjzxxList(tGuijiNaturalresourcesBdcdjzxx);
        ExcelUtil<TGuijiNaturalresourcesBdcdjzxx> util = new ExcelUtil<TGuijiNaturalresourcesBdcdjzxx>(TGuijiNaturalresourcesBdcdjzxx.class);
        return util.exportExcel(list, "bdcdjzxx");
    }

    /**
     * 新增不动产登记证信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存不动产登记证信息
     */
    @RequiresPermissions("system:bdcdjzxx:add")
    @Log(title = "不动产登记证信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx)
    {
        return toAjax(tGuijiNaturalresourcesBdcdjzxxService.insertTGuijiNaturalresourcesBdcdjzxx(tGuijiNaturalresourcesBdcdjzxx));
    }

    /**
     * 修改不动产登记证信息
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx = tGuijiNaturalresourcesBdcdjzxxService.selectTGuijiNaturalresourcesBdcdjzxxById(id);
        mmap.put("tGuijiNaturalresourcesBdcdjzxx", tGuijiNaturalresourcesBdcdjzxx);
        return prefix + "/edit";
    }

    /**
     * 修改保存不动产登记证信息
     */
    @RequiresPermissions("system:bdcdjzxx:edit")
    @Log(title = "不动产登记证信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx)
    {
        return toAjax(tGuijiNaturalresourcesBdcdjzxxService.updateTGuijiNaturalresourcesBdcdjzxx(tGuijiNaturalresourcesBdcdjzxx));
    }

    /**
     * 删除不动产登记证信息
     */
    @RequiresPermissions("system:bdcdjzxx:remove")
    @Log(title = "不动产登记证信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tGuijiNaturalresourcesBdcdjzxxService.deleteTGuijiNaturalresourcesBdcdjzxxByIds(ids));
    }
}
