SoftVersionController.java 1.22 KB
package com.xkl.controller.uploadsoft;

import com.wordnik.swagger.annotations.ApiOperation;

import com.xkl.domain.UpSoftVersion;
import com.xkl.model.ResultModel;

import com.xkl.repository.UpSoftVersionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * AMP报告上传软件客户端获取最新软件版本。
 */
@RestController
@RequestMapping("/version")
public class SoftVersionController {

    @Autowired
    private UpSoftVersionRepository upSoftVersionRepository;


    @RequestMapping(method = RequestMethod.GET)
    @ApiOperation(value = "获取最新软件版本信息")
    public ResponseEntity<ResultModel> getVersionInfo() {
        List<UpSoftVersion> versionList = upSoftVersionRepository.findAllVersion();
        UpSoftVersion version = versionList.get(versionList.size() - 1);
        return new ResponseEntity<>(ResultModel.ok(version), HttpStatus.OK);
    }

}