ApkInfoController.java 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. *
  3. * ApkInfoController
  4. *
  5. */
  6. package com.szwl.controller;
  7. import com.alibaba.fastjson.JSONObject;
  8. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  9. import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  10. import com.szwl.model.bo.JsonMessage;
  11. import com.szwl.model.entity.TApkInfo;
  12. import com.szwl.model.entity.TEquipment;
  13. import com.szwl.service.TApkInfoService;
  14. import org.apache.commons.lang.StringUtils;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.stereotype.Controller;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.ResponseBody;
  19. import javax.annotation.Resource;
  20. import java.util.List;
  21. /**
  22. * Controller - apk信息
  23. */
  24. @Controller("appApkInfoController")
  25. @RequestMapping("api/appApkInfo")
  26. public class ApkInfoController {
  27. @Autowired
  28. TApkInfoService tApkInfoService;
  29. /**
  30. * 获得最新的更新数据
  31. *
  32. * @param model 型号
  33. * @return
  34. */
  35. @ResponseBody
  36. @RequestMapping(value = "/apkinfo.htm", produces = "text/html;charset=utf-8")
  37. public String getApkInfo(String model) {
  38. if (StringUtils.isEmpty(model)) {
  39. // return JsonMessage.error("没有版本数据");
  40. return "没有版本数据";
  41. }
  42. LambdaQueryWrapper<TApkInfo> query = Wrappers.lambdaQuery();
  43. query.eq(TApkInfo::getModel,model);
  44. query.orderByDesc(TApkInfo::getVersion);
  45. List<TApkInfo> list = tApkInfoService.list(query);
  46. TApkInfo info = list.get(0);
  47. if (info != null) {
  48. // return JsonMessage.success(JSONObject.toJSONString(info));
  49. return JSONObject.toJSONString(info);
  50. }
  51. // return JsonMessage.error("没有版本数据");
  52. return "没有版本数据";
  53. }
  54. /**
  55. * 获得最新的更新数据
  56. *
  57. * @param model 型号
  58. * @return
  59. */
  60. @ResponseBody
  61. @RequestMapping(value = "/getApkinfoList.htm", produces = "text/html;charset=utf-8")
  62. public String getApkInfoList(String model) {
  63. if (StringUtils.isEmpty(model)) {
  64. // return JsonMessage.error("没有版本数据");
  65. return "没有版本数据";
  66. }
  67. LambdaQueryWrapper<TApkInfo> query = Wrappers.lambdaQuery();
  68. query.eq(TApkInfo::getModel,model);
  69. query.orderByDesc(TApkInfo::getVersion);
  70. List<TApkInfo> list = tApkInfoService.list(query);
  71. if (list.size()>0) {
  72. return JSONObject.toJSONString(list);
  73. }
  74. return "没有版本数据";
  75. }
  76. }