浏览代码

Merge branch 'feature/1101-appversion' into online

yuanliang 1 年之前
父节点
当前提交
4df02eb431
共有 13 个文件被更改,包括 428 次插入1 次删除
  1. 50 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenAppVersionInfoController.java
  2. 50 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/open/OpenAppVersionInfoController.java
  3. 50 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/open/OpenAppVersionInfoController.java
  4. 50 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenAppVersionInfoController.java
  5. 50 0
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenAppVersionInfoController.java
  6. 1 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/AppVersionInfoDao.java
  7. 4 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/queryInfo/AppVersionInfoQueryInfo.java
  8. 2 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/AppVersionInfoService.java
  9. 5 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/AppVersionInfoServiceImpl.java
  10. 16 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/AppVersionInfoMapper.xml
  11. 50 0
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/open/OpenAppVersionInfoController.java
  12. 50 0
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/open/OpenAppVersionInfoController.java
  13. 50 0
      cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenAppVersionInfoController.java

+ 50 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.admin.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.admin:}/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}

+ 50 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.student.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.student:}/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}

+ 50 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.teacher.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.teacher:}/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}

+ 50 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.tenant.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.tenant:}/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}

+ 50 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.admin.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/AppVersionInfoDao.java

@@ -25,4 +25,5 @@ public interface AppVersionInfoDao extends BaseDAO<Long, AppVersionInfo> {
 	 */
 	AppVersionInfo selectAppVersionInfo(@Param("platform") String platform, @Param("version") String version);
 
+	List<AppVersionInfo> queryLatestByPlatform(@Param("platform") String platform, @Param("status") String status);
 }

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/queryInfo/AppVersionInfoQueryInfo.java

@@ -1,9 +1,13 @@
 package com.yonge.cooleshow.biz.dal.queryInfo;
 
 import com.yonge.toolset.base.page.QueryInfo;
+import lombok.Data;
 
+@Data
 public class AppVersionInfoQueryInfo extends QueryInfo {
 
+	private String keyword;
+
 	private String version;
 	
 	private String platform;

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/AppVersionInfoService.java

@@ -31,4 +31,6 @@ public interface AppVersionInfoService extends BaseService<Long, AppVersionInfo>
 	 * @return
 	 */
 	YesOrNoEnum getAppAuditVersion(String platform, String version);
+
+    List<AppVersionInfo> queryLatestByPlatform(String platform, String appStatus);
 }

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/AppVersionInfoServiceImpl.java

@@ -73,4 +73,9 @@ public class AppVersionInfoServiceImpl extends BaseServiceImpl<Long, AppVersionI
 			return YesOrNoEnum.NO;
 		}
 	}
+
+    @Override
+    public List<AppVersionInfo> queryLatestByPlatform(String platform, String appStatus) {
+		return appVersionInfoDao.queryLatestByPlatform(platform, appStatus);
+	}
 }

+ 16 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/AppVersionInfoMapper.xml

@@ -91,6 +91,12 @@
 	<select id="queryPage" resultMap="AppVersionInfo" parameterType="map">
 		SELECT * FROM app_version_info
 		<where>
+			<if test="keyword != null and keyword.trim() != ''">
+				and (id_ like concat('%',#{keyword},'%') or
+				version_ like concat('%',#{keyword},'%') or
+				description_ like concat('%',#{keyword},'%')
+				)
+			</if>
 			<if test="version != null and version != ''">
 				and version_ = #{version}
 			</if>
@@ -101,7 +107,7 @@
 				and status_ = #{status}
 			</if>
 		</where>
-		ORDER BY status_ DESC
+		order by version_ desc ,status_='newest' desc , id_ desc
 		<include refid="global.limit" />
 	</select>
 
@@ -126,4 +132,13 @@
 		select avi.status_ from app_version_info avi where avi.platform_ = #{platform} and avi.version_ = #{version}
 
 	</select>
+
+	<select id="queryLatestByPlatform" resultMap="AppVersionInfo">
+		SELECT *
+		FROM app_version_info
+		WHERE platform_ = #{platform}
+		  and find_in_set(status_, #{status})
+		order by version_ desc, status_='newest' desc, id_ desc
+		limit 1
+	</select>
 </mapper>

+ 50 - 0
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.student.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}

+ 50 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.teacher.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}

+ 50 - 0
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenAppVersionInfoController.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.tenant.controller.open;
+
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.yonge.cooleshow.biz.dal.entity.AppVersionInfo;
+import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/open/appVersionInfo")
+@Api(tags = "app版本信息管理")
+public class OpenAppVersionInfoController {
+
+    @Autowired
+    private AppVersionInfoService appVersionInfoService;
+
+
+    @ApiOperation("根据app客户端查询最近的app版本")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path"),
+        @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "String",
+            paramType = "newest/history")
+    })
+    @GetMapping(value = "/queryLatestByPlatform")
+    public R<AppVersionInfo> queryLatestByPlatform(String platform, String status) {
+        String appStatus = Optional.ofNullable(status).orElse("newest");
+        if ("history".equals(appStatus)) {
+            appStatus = "newest,history";
+        }
+        List<AppVersionInfo> list = appVersionInfoService.queryLatestByPlatform(platform, appStatus);
+        if (list.size() > 0) {
+            return R.from(list.get(0));
+        }
+        throw BizException.from("未找到数据");
+    }
+}