package cn.pluss.platform.controller.deviceOperateInfo;


import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.base.BaseModelController;
import cn.pluss.platform.device.DeviceOperateInfoService;
import cn.pluss.platform.entity.DeviceOperateInfo;
import cn.pluss.platform.util.StringUtil;
import cn.pluss.platform.vo.DeviceOperateInfoVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 设备库存controller
 * </p>
 *
 * @author bzg
 * @since 2020-11-11
 */
@Controller
@RequestMapping("/deviceOperateInfo")
public class DeviceOperateInfoController extends BaseModelController<DeviceOperateInfoService, DeviceOperateInfo> {

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "/index")
    public String index(HttpServletRequest request,String deviceNo) {
        if(StringUtil.isNotEmpty(deviceNo)){
            request.setAttribute("deviceNo",deviceNo);
        }
        return "deviceOperateInfo/list";
    }

    /**
     * 分页查询
     * @param page
     * @param condition
     * @return
     */
    @RequestMapping("pageData")
    @ResponseBody
    public Result<Page<DeviceOperateInfoVO>> page(Page<DeviceOperateInfoVO> page, DeviceOperateInfo condition) {
        page = baseService.pageInfo(page,condition);
        return ResultGenerator.genSuccessResult("获取成功",page);
    }
}
