|
@@ -93,9 +93,6 @@ public class SpaceSdkServiceImpl extends ServiceImpl<ISpaceSdkMapper, SpaceSdk>
|
|
|
log.info("upload url: {}" + url);
|
|
|
|
|
|
SpaceSdk managerSdkEntity = new SpaceSdk();
|
|
|
- if(isTop == 1){
|
|
|
- this.updateTopFBySdkId(platformType.toString());//取消所有置顶
|
|
|
- }
|
|
|
managerSdkEntity.setVersion(version);
|
|
|
managerSdkEntity.setImprintCh(imprintCh);
|
|
|
managerSdkEntity.setImprintEn(imprintEn);
|
|
@@ -104,9 +101,10 @@ public class SpaceSdkServiceImpl extends ServiceImpl<ISpaceSdkMapper, SpaceSdk>
|
|
|
managerSdkEntity.setPlatformType(platformType.toString());
|
|
|
managerSdkEntity.setFileUrl(url);
|
|
|
managerSdkEntity.setFileName(fullFileName);
|
|
|
-
|
|
|
this.save(managerSdkEntity);
|
|
|
-
|
|
|
+ if(isTop == 1){
|
|
|
+ this.updateTopFBySdkId(managerSdkEntity.getId());//取消所有置顶
|
|
|
+ }
|
|
|
// 删除本地文件
|
|
|
FileUtils.deleteFile(filePath);
|
|
|
|
|
@@ -119,7 +117,7 @@ public class SpaceSdkServiceImpl extends ServiceImpl<ISpaceSdkMapper, SpaceSdk>
|
|
|
throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
if(param.getIsTop().equals(1)){
|
|
|
- this.updateTopFBySdkId(param.getPlatformType());//取消所有置顶
|
|
|
+ this.updateTopFBySdkId(param.getId());//取消所有置顶
|
|
|
}
|
|
|
if(!this.updateById(param)){
|
|
|
throw new BusinessException(ErrorCode.ERROR_MSG);
|
|
@@ -148,7 +146,7 @@ public class SpaceSdkServiceImpl extends ServiceImpl<ISpaceSdkMapper, SpaceSdk>
|
|
|
throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
if(param.getIsTop().equals(1)){
|
|
|
- this.updateTopFBySdkId(param.getPlatformType());//取消所有置顶
|
|
|
+ this.updateTopFBySdkId(param.getId());//取消所有置顶
|
|
|
}
|
|
|
LambdaUpdateWrapper<SpaceSdk> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(SpaceSdk::getIsTop,param.getIsTop())
|
|
@@ -165,9 +163,10 @@ public class SpaceSdkServiceImpl extends ServiceImpl<ISpaceSdkMapper, SpaceSdk>
|
|
|
if(StringUtils.isNotEmpty(param.getVersion())){
|
|
|
queryWrapper.like(SpaceSdk::getVersion,param.getVersion());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(param.getPlatformType())){
|
|
|
- queryWrapper.like(SpaceSdk::getPlatformType,param.getPlatformType());
|
|
|
+ if(param.getPlatformType() == null){
|
|
|
+ param.setPlatformType(1);
|
|
|
}
|
|
|
+ queryWrapper.eq(SpaceSdk::getPlatformType,param.getPlatformType());
|
|
|
queryWrapper.orderByDesc(SpaceSdk::getIsTop);
|
|
|
queryWrapper.orderByDesc(SpaceSdk::getPublishTime);
|
|
|
Page<SpaceSdk> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()), queryWrapper);
|
|
@@ -181,11 +180,14 @@ public class SpaceSdkServiceImpl extends ServiceImpl<ISpaceSdkMapper, SpaceSdk>
|
|
|
this.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
- private void updateTopFBySdkId(String platformType) {
|
|
|
- LambdaUpdateWrapper<SpaceSdk> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(SpaceSdk::getIsTop,0)
|
|
|
- .eq(SpaceSdk::getPlatformType,platformType);
|
|
|
- this.update(updateWrapper);
|
|
|
+ private void updateTopFBySdkId(Long sdkId) {
|
|
|
+ SpaceSdk sdk = this.getById(sdkId);
|
|
|
+ if(sdk!=null){
|
|
|
+ LambdaUpdateWrapper<SpaceSdk> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(SpaceSdk::getIsTop,0)
|
|
|
+ .eq(SpaceSdk::getPlatformType,sdk.getPlatformType());
|
|
|
+ this.update(updateWrapper);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void updateBySdkIdPublish(Long id, Integer status) {
|