package com.steerinfo.ems.ifmesemsswapfile.controller;

import java.util.Arrays;
import java.util.HashMap;

import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
import com.steerinfo.framework.controller.BaseRESTfulController;
import com.steerinfo.framework.controller.RESTfulResult;
import com.steerinfo.framework.service.pagehelper.PageList;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/${api.version}/ifmesemsswapfile")
public class IfMesEmsSwapfileController extends BaseRESTfulController {

    @Autowired
    IIfMesEmsSwapfileService ifMesEmsSwapfileService;

    @ApiOperation(value="获取列表", notes="分页查询")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("trmunit:view")
    @GetMapping(value = "/")
    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
        PageList<IfMesEmsSwapfile> list = ifMesEmsSwapfileService.queryForPage(parmas, pageNum, pageSize);
        return success(list);
    }
    
    @ApiOperation(value="获取列表", notes="分页模糊查询")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("tpmcaseact:view")
    @GetMapping(value = "/like/")
    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
        PageList<IfMesEmsSwapfile> list = ifMesEmsSwapfileService.queryLikeForPage(parmas, pageNum, pageSize);
        return success(list);
    }
    
    // @ApiOperation(value="创建", notes="根据IfMesEmsSwapfile对象创建")
    // @ApiImplicitParam(name = "IfMesEmsSwapfile", value = "详细实体IfMesEmsSwapfile", required = true, dataType = "IfMesEmsSwapfile")
    // //@RequiresPermissions("trmunit:create")
    // @PostMapping(value = "/")
    // public RESTfulResult add(@ModelAttribute IfMesEmsSwapfile model){
    //     IfMesEmsSwapfile IfMesEmsSwapfile = ifMesEmsSwapfileService.add(model);
    //     return success(IfMesEmsSwapfile);
    // }

    @ApiOperation(value="立即从MES同步数据", notes="从MES同步投入产出数据")
    @PostMapping(value = "/synchronousMesAnEmsData")
    public RESTfulResult synchronousMesAnEmsData(@ModelAttribute IfMesEmsSwapfile model){
        String s = ifMesEmsSwapfileService.synchronousMesAnEmsData();
        return success(s);
    }


}
