package com.ruoyi.web.controller.nanjing;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.nanjing.domain.TBdProductinfo;
import com.ruoyi.nanjing.service.ITBdProductinfoService;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.nanjing.domain.TRpProductchangeinfo;
import com.ruoyi.nanjing.service.ITRpProductchangeinfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

import javax.servlet.http.HttpServletRequest;

/**
 * 机种切换管理Controller
 *
 * @author limy
 * @date 2021-01-22
 */
@Controller
@RequestMapping("/nanjing/SelectProductChangeInfo")
public class SelectProductChangeInfoController extends BaseController
{
    private String prefix = "nanjing/ProductChangeInfo";

    @Autowired
    private ITBdProductinfoService tBdProductinfoService;
    @Autowired
    private ITRpProductchangeinfoService tRpProductchangeinfoService;

    @RequiresPermissions("nanjing:SelectProductChangeInfo:view")
    @GetMapping()
    public String ProductChangeInfo(ModelMap map)
    {
        List<TBdProductinfo> tBdProductinfoList = tBdProductinfoService.selectTBdProductinfoList(new TBdProductinfo());
        map.addAttribute("list",tBdProductinfoList);
        return prefix + "/SelectProductChangeInfo";
    }

    /**
     * 查询机种切换管理列表
     */
    @RequiresPermissions("nanjing:SelectProductChangeInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TRpProductchangeinfo tRpProductchangeinfo)
    {
        startPage();
        List<TRpProductchangeinfo> list = tRpProductchangeinfoService.selectChangeInfo(tRpProductchangeinfo);
        return getDataTable(list);
    }

    /**
     * 导出机种切换管理列表
     */
    @RequiresPermissions("nanjing:SelectProductChangeInfo:export")
    @Log(title = "机种切换管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TRpProductchangeinfo tRpProductchangeinfo)
    {
        List<TRpProductchangeinfo> list = tRpProductchangeinfoService.selectChangeInfo(tRpProductchangeinfo);
        ExcelUtil<TRpProductchangeinfo> util = new ExcelUtil<TRpProductchangeinfo>(TRpProductchangeinfo.class);
        return util.exportExcel(list, "SelectProductChangeInfo");
    }

}
