package com.unis.base.server.controller;

import com.unis.base.common.vo.TyLskcxxHisVO;
import com.unis.base.common.vo.TyLskcxxVO;
import com.unis.base.server.service.TyLskcxxHisService;
import com.unis.common.utils.ResponseWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author zhengbodang
 * @version 1.0
 * @Title DAjxxsjyController
 * @ProjectName 粮食库存信息历史 Controller
 * @Description
 * @date 2019/07/22 17点26分
 */
@RestController
@Api(value = "粮食库存信息历史 ", tags = "粮食库存信息历史 维护")
@Slf4j
public class FoodStocksHisController {

	@Autowired
	private TyLskcxxHisService hisService;

	@ApiOperation(value = "粮食库存历史列表", notes = "参数：")
	@GetMapping(value = "/foodStocksHisList/{pageNum}/{pageSize}")
	public ResponseWrapper getTyLskcxxHisList(@PathVariable(value = "pageNum") Integer pageNum,
											  @PathVariable(value = "pageSize") Integer pageSize){
		try {
			Map<String, Object> map = hisService.getTyLskcxxHisList(pageNum,pageSize);
			return ResponseWrapper.success(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), map);
		} catch (Exception e) {
			log.error(e.getMessage());
			return ResponseWrapper.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(),"服务错误，请联系管理员");
		}
	}

}
