|
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.RecStatus;
|
|
|
+import com.fdkankan.common.constant.SceneConstant;
|
|
|
import com.fdkankan.common.constant.TbStatus;
|
|
|
+import com.fdkankan.common.response.ResultData;
|
|
|
import com.fdkankan.common.util.DateExtUtil;
|
|
|
import com.fdkankan.scene.entity.Folder;
|
|
|
import com.fdkankan.scene.entity.FolderScene;
|
|
@@ -17,6 +19,7 @@ import com.fdkankan.scene.service.IFolderSceneService;
|
|
|
import com.fdkankan.scene.service.IFolderService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.scene.service.ISceneProService;
|
|
|
+import com.fdkankan.scene.vo.FolderParamVO;
|
|
|
import com.fdkankan.scene.vo.FolderVO;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
@@ -204,6 +207,31 @@ public class FolderServiceImpl extends ServiceImpl<IFolderMapper, Folder> implem
|
|
|
return responseFolders;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResultData save(FolderParamVO param) {
|
|
|
+
|
|
|
+ LambdaQueryWrapper<Folder> wrapper = new LambdaQueryWrapper<Folder>()
|
|
|
+ .eq(Folder::getFolderName, param.getName()).eq(Folder::getUserId, param.getUserId());
|
|
|
+ if(Objects.isNull(param.getParentId())){
|
|
|
+ wrapper.isNull(Folder::getParentId);
|
|
|
+ }else{
|
|
|
+ wrapper.eq(Folder::getParentId, param.getParentId());
|
|
|
+ }
|
|
|
+ long count = this.count(wrapper);
|
|
|
+ if(count > 0){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5030);
|
|
|
+ }
|
|
|
+
|
|
|
+ Folder folder = new Folder();
|
|
|
+ BeanUtils.copyProperties(param, folder);
|
|
|
+ folder.setFolderName(param.getName());
|
|
|
+ folder.setFolderType(param.getType());
|
|
|
+
|
|
|
+ this.save(folder);
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
//根据文件夹,递归获取该文件夹中所有文件夹的场景数量之和
|
|
|
public int folderChildrenSceneNum(Long parentId, Integer sceneNum){
|
|
|
List<Folder> byParentId = this.findByParentId(parentId);
|