/* * * ApkInfoController * */ package com.szwl.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.szwl.model.bo.JsonMessage; import com.szwl.model.entity.TApkInfo; import com.szwl.model.entity.TEquipment; import com.szwl.service.TApkInfoService; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; /** * Controller - apk信息 */ @Controller("appApkInfoController") @RequestMapping("api/appApkInfo") public class ApkInfoController { @Autowired TApkInfoService tApkInfoService; /** * 获得最新的更新数据 * * @param model 型号 * @return */ @ResponseBody @RequestMapping(value = "/apkinfo.htm", produces = "text/html;charset=utf-8") public String getApkInfo(String model) { if (StringUtils.isEmpty(model)) { // return JsonMessage.error("没有版本数据"); return "没有版本数据"; } LambdaQueryWrapper query = Wrappers.lambdaQuery(); query.eq(TApkInfo::getModel,model); query.orderByDesc(TApkInfo::getVersion); List list = tApkInfoService.list(query); TApkInfo info = list.get(0); if (info != null) { // return JsonMessage.success(JSONObject.toJSONString(info)); return JSONObject.toJSONString(info); } // return JsonMessage.error("没有版本数据"); return "没有版本数据"; } /** * 获得最新的更新数据 * * @param model 型号 * @return */ @ResponseBody @RequestMapping(value = "/getApkinfoList.htm", produces = "text/html;charset=utf-8") public String getApkInfoList(String model) { if (StringUtils.isEmpty(model)) { // return JsonMessage.error("没有版本数据"); return "没有版本数据"; } LambdaQueryWrapper query = Wrappers.lambdaQuery(); query.eq(TApkInfo::getModel,model); query.orderByDesc(TApkInfo::getVersion); List list = tApkInfoService.list(query); if (list.size()>0) { return JSONObject.toJSONString(list); } return "没有版本数据"; } }