UpSoftVerController.java 1.27 KB
package com.xkl.controller.uploadsoft;

import com.wordnik.swagger.annotations.ApiOperation;

import com.xkl.domain.XklUpSoftVersionEntity;
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.List;

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

    @Autowired
    private UpSoftVersionRepository upSoftVersionRepository;


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

}