检测APP版本是否可以添加
This commit is contained in:
@@ -296,7 +296,7 @@ public enum ResultCode {
|
||||
WECHAT_QRCODE_ERROR(80502, "微信二维码生成异常"),
|
||||
WECHAT_MP_MESSAGE_ERROR(80503, "微信小程序小消息订阅异常"),
|
||||
|
||||
|
||||
APP_VERSION_EXIST(80600, "APP版本已存在")
|
||||
;
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
||||
@@ -17,4 +17,11 @@ public interface AppVersionService extends IService<AppVersion> {
|
||||
* @return 最新的APP版本号
|
||||
*/
|
||||
AppVersion getAppVersion(String appType);
|
||||
|
||||
/**
|
||||
* 检测APP版本信息
|
||||
* @param appVersion app版本
|
||||
* @return 是否可添加
|
||||
*/
|
||||
boolean checkAppVersion(AppVersion appVersion);
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package cn.lili.modules.system.serviceimpl;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.system.entity.dos.AppVersion;
|
||||
import cn.lili.modules.system.mapper.AppVersionMapper;
|
||||
import cn.lili.modules.system.service.AppVersionService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -22,4 +25,13 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVers
|
||||
public AppVersion getAppVersion(String appType) {
|
||||
return this.baseMapper.getLatestVersion(appType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAppVersion(AppVersion appVersion) {
|
||||
//检测版本是否存在
|
||||
if(null!=this.getOne(new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getVersion,appVersion))){
|
||||
throw new ServiceException(ResultCode.APP_VERSION_EXIST);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user