|
@@ -69,20 +69,37 @@ public class ContentServiceImpl extends ServiceImpl<ContentMapper, ContentEntity
|
|
public Result saveEntity(ContentDto param) {
|
|
public Result saveEntity(ContentDto param) {
|
|
Long id = param.getId();
|
|
Long id = param.getId();
|
|
ContentEntity entity;
|
|
ContentEntity entity;
|
|
|
|
+ boolean isIndex = false;
|
|
|
|
+ Long imgIndexId = param.getImgIndexId();
|
|
if (id == null) {
|
|
if (id == null) {
|
|
entity = new ContentEntity();
|
|
entity = new ContentEntity();
|
|
BeanUtils.copyProperties(param, entity);
|
|
BeanUtils.copyProperties(param, entity);
|
|
entity.setCreatorId(baseService.getUserId());
|
|
entity.setCreatorId(baseService.getUserId());
|
|
this.save(entity);
|
|
this.save(entity);
|
|
|
|
+ if (imgIndexId != null){
|
|
|
|
+ isIndex = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
entity = this.getById(id);
|
|
entity = this.getById(id);
|
|
BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
|
|
BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
|
|
BeanUtils.copyProperties(param, entity);
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
|
+ if (imgIndexId !=null && !imgIndexId.equals(entity.getImgIndexId())){
|
|
|
|
+ isIndex = true;
|
|
|
|
+ }
|
|
this.updateById(entity);
|
|
this.updateById(entity);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ updateImgIndex(imgIndexId, entity.getId());
|
|
|
|
+
|
|
return Result.success(entity);
|
|
return Result.success(entity);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void updateImgIndex(Long imgIndexId, Long modelId) {
|
|
|
|
+ fileService.indexDisable(modelId);
|
|
|
|
+ fileService.indexEnabled(imgIndexId);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Result upload(FileDto param) {
|
|
public Result upload(FileDto param) {
|
|
|
|
|