!335 修复添加APP版本控制异常

Merge pull request !335 from Lele/dev
This commit is contained in:
Lele 2024-03-21 05:54:53 +00:00 committed by Gitee
commit 19b3225312
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 12 additions and 2 deletions

View File

@ -496,6 +496,9 @@ public enum ResultCode {
WECHAT_MP_MESSAGE_TMPL_ERROR(80306, "未能获取到微信模版消息id"),
WECHAT_ERROR(80307, "微信接口异常"),
APP_VERSION_EXIST(80307, "APP版本已存在"),
APP_VERSION_PARAM_ERROR(80308, "添加APP版本参数异常"),
// 未选择APP类型
APP_VERSION_TYPE_ERROR(80308, "请选择有效的APP类型"),
/**
* IM

View File

@ -2,6 +2,7 @@ package cn.lili.modules.system.serviceimpl;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.utils.StringUtils;
import cn.lili.modules.system.entity.dos.AppVersion;
import cn.lili.modules.system.mapper.AppVersionMapper;
import cn.lili.modules.system.service.AppVersionService;
@ -26,9 +27,16 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVers
@Override
public boolean checkAppVersion(AppVersion appVersion) {
//检测版本是否存在
if (null == appVersion) {
throw new ServiceException(ResultCode.APP_VERSION_PARAM_ERROR);
}
if (StringUtils.isBlank(appVersion.getType())) {
throw new ServiceException(ResultCode.APP_VERSION_TYPE_ERROR);
}
//检测版本是否存在同类型APP下版本不允许重复
if (null != this.getOne(new LambdaQueryWrapper<AppVersion>()
.eq(AppVersion::getVersion, appVersion.getVersion())
.eq(AppVersion::getType, appVersion.getType())
.ne(appVersion.getId() != null, AppVersion::getId, appVersion.getId()))) {
throw new ServiceException(ResultCode.APP_VERSION_EXIST);
}

View File

@ -63,7 +63,6 @@ public class AppVersionManagerController {
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String", paramType = "path")
})
public ResultMessage<Object> edit(@Valid AppVersion appVersion, @PathVariable String id) {
if(this.appVersionService.checkAppVersion(appVersion)){
if(this.appVersionService.updateById(appVersion)){
return ResultUtil.success();