AppVersionController.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.hssx.cloudmodel.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.hssx.cloudmodel.entity.AppVersion;
  4. import com.hssx.cloudmodel.entity.vo.CompanyVO;
  5. import com.hssx.cloudmodel.service.AppVersionService;
  6. import com.hssx.cloudmodel.util.HttpRespMsg;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Controller;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.bind.annotation.ResponseBody;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import javax.servlet.http.HttpServletRequest;
  15. import javax.servlet.http.HttpServletResponse;
  16. /**
  17. * <p>
  18. * 前端控制器
  19. * </p>
  20. *
  21. * @author 吴涛涛
  22. * @since 2019-09-05
  23. */
  24. @Controller
  25. public class AppVersionController {
  26. @Autowired
  27. private AppVersionService appVersionService;
  28. @ApiOperation("比对版本")
  29. @RequestMapping("/checkVersion")
  30. @ResponseBody
  31. public HttpRespMsg addAndUpdateRole(AppVersion appVersion) {
  32. HttpRespMsg msg = new HttpRespMsg();
  33. AppVersion platform = appVersionService.getOne(new QueryWrapper<AppVersion>().eq("platform", appVersion.getPlatform()));
  34. if(platform == null){
  35. msg.setError("数据不存在");
  36. }else{
  37. int i = appVersion.getVersion().compareTo(platform.getVersion());
  38. if(i<0){
  39. msg.data = platform;
  40. }else{
  41. msg.setError("版本过低");
  42. }
  43. }
  44. return msg;
  45. }
  46. }