|
@@ -1,5 +1,6 @@
|
|
|
package com.xuqm.server.appmanager.controller.releases;
|
|
|
|
|
|
+import com.xuqm.server.appmanager.common.CommonHelper;
|
|
|
import com.xuqm.server.appmanager.common.JWTHelper;
|
|
|
import com.xuqm.server.appmanager.controller.releases.data.ReleaseAddData;
|
|
|
import com.xuqm.server.appmanager.controller.releases.data.ReleaseListData;
|
|
@@ -15,6 +16,9 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+/**
|
|
|
+ * 应用版本管理
|
|
|
+ */
|
|
|
@RestController
|
|
|
@RequestMapping("release/v1")
|
|
|
public class ReleaseV1Controller {
|
|
@@ -24,6 +28,12 @@ public class ReleaseV1Controller {
|
|
|
@Autowired
|
|
|
private ReleaseRepository releaseRepository;
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加版本
|
|
|
+ * @param data 版本信息
|
|
|
+ * @return 状态
|
|
|
+ * @throws Exception 异常
|
|
|
+ */
|
|
|
@PostMapping("/add")
|
|
|
public HttpResult<String> ReleaseAdd(@RequestBody ReleaseAddData data, @RequestHeader(name = "token") String token) throws Exception {
|
|
|
UserInfo userInfo = JWTHelper.getUser(token);
|
|
@@ -38,6 +48,7 @@ public class ReleaseV1Controller {
|
|
|
ReleaseEntity release = releaseRepository.findFirstByAppIdAndTenantNoAndVersionCodeGreaterThanEqual(data.getAppId(), userInfo.getTenantNo(), data.getVersionCode());
|
|
|
if (null != release) return new HttpResult<>(201, "存在更高版本", null);
|
|
|
release = new ReleaseEntity();
|
|
|
+ release.setReleaseId(CommonHelper.getRandomId());
|
|
|
release.setAppId(data.getAppId());
|
|
|
release.setTenantNo(userInfo.getTenantNo());
|
|
|
release.setUrl(data.getUrl());
|