添加版本信息
This commit is contained in:
@@ -24,5 +24,8 @@ public class AppVersionParam implements Serializable {
|
||||
@ApiModelProperty("整改内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("版本类型 APP WEB")
|
||||
@NotNull(message = "版本类型不能为空")
|
||||
private String versionType;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.cssystem.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -44,6 +43,11 @@ public class AppVersion extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private Integer sev;
|
||||
|
||||
/**
|
||||
* 版本类型 APP Web
|
||||
*/
|
||||
private String versionType;
|
||||
|
||||
/**
|
||||
* 修改内容
|
||||
*/
|
||||
|
||||
@@ -22,5 +22,4 @@ public class AppVersionVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("严重度(0:优化 1:bug调整)")
|
||||
private Integer sev;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
import com.njcn.cssystem.service.IAppVersionService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -16,10 +17,9 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/appVersion")
|
||||
@Api(tags = "app版本信息")
|
||||
@Api(tags = "版本信息")
|
||||
@AllArgsConstructor
|
||||
public class AppVersionController extends BaseController {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class AppVersionController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增app版本信息")
|
||||
@ApiOperation("新增版本信息")
|
||||
@ApiImplicitParam(name = "param", value = "app版本信息", required = true)
|
||||
public HttpResult<String> add(@RequestBody @Validated AppVersionParam param){
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
@@ -54,12 +54,23 @@ public class AppVersionController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLastData")
|
||||
@ApiOperation("查询app最新版本信息")
|
||||
public HttpResult<AppVersionVo> getLastData(){
|
||||
@ApiOperation("查询最新版本信息")
|
||||
@ApiImplicitParam(name = "versionType", value = "版本类型(APP WEB)", required = true)
|
||||
public HttpResult<AppVersionVo> getLastData(@RequestParam("versionType") String versionType){
|
||||
String methodDescribe = getMethodDescribe("getLastData");
|
||||
AppVersionVo vo = appVersionService.getLastData();
|
||||
AppVersionVo vo = appVersionService.getLastData(versionType);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAllData")
|
||||
@ApiOperation("查询所有版本信息")
|
||||
@ApiImplicitParam(name = "versionType", value = "版本类型(APP WEB)")
|
||||
public HttpResult< List<AppVersion>> getAllData(@RequestParam(value = "versionType",required = false) String versionType){
|
||||
String methodDescribe = getMethodDescribe("getAllData");
|
||||
List<AppVersion> list = appVersionService.getAllData(versionType);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@@ -17,5 +19,7 @@ public interface IAppVersionService extends IService<AppVersion> {
|
||||
|
||||
boolean add(AppVersionParam param);
|
||||
|
||||
AppVersionVo getLastData();
|
||||
AppVersionVo getLastData(String versionType);
|
||||
|
||||
List<AppVersion> getAllData(String versionType);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -30,14 +32,16 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVers
|
||||
appVersion.setVersionName(param.getAppVersion());
|
||||
appVersion.setPublishTime(LocalDateTime.now());
|
||||
appVersion.setSev(param.getSev());
|
||||
appVersion.setVersionType(param.getVersionType());
|
||||
appVersion.setContent(param.getContent());
|
||||
return this.save(appVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppVersionVo getLastData() {
|
||||
public AppVersionVo getLastData(String versionType) {
|
||||
AppVersionVo vo = new AppVersionVo();
|
||||
LambdaQueryWrapper<AppVersion> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AppVersion::getVersionType, versionType);
|
||||
queryWrapper.orderByDesc(AppVersion::getPublishTime).last("limit 1");
|
||||
AppVersion appVersion = this.getOne(queryWrapper);
|
||||
if (Objects.nonNull(appVersion)) {
|
||||
@@ -45,4 +49,14 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVers
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppVersion> getAllData(String versionType) {
|
||||
LambdaQueryWrapper<AppVersion> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (Objects.nonNull(versionType)) {
|
||||
queryWrapper.eq(AppVersion::getVersionType, versionType);
|
||||
}
|
||||
queryWrapper.orderByDesc(AppVersion::getPublishTime);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user