|
@@ -83,11 +83,12 @@ public class CrtDramaProjectStoryboardServiceImpl implements CrtDramaProjectStor
|
|
* 创建分集
|
|
* 创建分集
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Map<String, Object> createStoryboard(CrtDramaProject crtDramaProject) {
|
|
|
|
|
|
+ public Map<String, Object> createStoryboard(CrtDramaProjectStoryboard crtDramaProjectStoryboard) {
|
|
|
|
|
|
- Long user_id = crtDramaProject.getUser_id();
|
|
|
|
- Long drama_project_id = crtDramaProject.getDrama_project_id();
|
|
|
|
- Integer episode_num = crtDramaProject.getEpisode_num();
|
|
|
|
|
|
+ Long user_id = crtDramaProjectStoryboard.getUser_id();
|
|
|
|
+ Long drama_project_id = crtDramaProjectStoryboard.getDrama_project_id();
|
|
|
|
+ Integer episode_num = crtDramaProjectStoryboard.getEpisode_num();
|
|
|
|
+ Integer sort = crtDramaProjectStoryboard.getSort() == null ? 1 : crtDramaProjectStoryboard.getSort();
|
|
|
|
|
|
// 判断 项目 是否存在
|
|
// 判断 项目 是否存在
|
|
LambdaQueryWrapper<CrtDramaProject> wrapperDramaProject = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<CrtDramaProject> wrapperDramaProject = new LambdaQueryWrapper<>();
|
|
@@ -95,19 +96,25 @@ public class CrtDramaProjectStoryboardServiceImpl implements CrtDramaProjectStor
|
|
Boolean is_exist_project = crtDramaProjectDao.exists(wrapperDramaProject);
|
|
Boolean is_exist_project = crtDramaProjectDao.exists(wrapperDramaProject);
|
|
if (!is_exist_project) throw new CustException("项目不存在");
|
|
if (!is_exist_project) throw new CustException("项目不存在");
|
|
|
|
|
|
- // 判断 (项目ID + 集数) 是否存在,如果存在则不能创建
|
|
|
|
|
|
+ // 不传 { sort } 即是初始化,初始化需要判断分镜是否存在
|
|
LambdaQueryWrapper<CrtDramaProjectStoryboard> wrapperStoryboard = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<CrtDramaProjectStoryboard> wrapperStoryboard = new LambdaQueryWrapper<>();
|
|
wrapperStoryboard.eq(CrtDramaProjectStoryboard::getDrama_project_id, drama_project_id);
|
|
wrapperStoryboard.eq(CrtDramaProjectStoryboard::getDrama_project_id, drama_project_id);
|
|
wrapperStoryboard.eq(CrtDramaProjectStoryboard::getEpisode_num, episode_num);
|
|
wrapperStoryboard.eq(CrtDramaProjectStoryboard::getEpisode_num, episode_num);
|
|
- Boolean is_exist_storyboard = crtDramaProjectStoryboardDao.exists(wrapperStoryboard);
|
|
|
|
- if (is_exist_storyboard) throw new CustException("该项目集数已存在,请勿重复创建");
|
|
|
|
|
|
+ if (sort == null) {
|
|
|
|
+ Boolean is_exist_storyboard = crtDramaProjectStoryboardDao.exists(wrapperStoryboard);
|
|
|
|
+ if (is_exist_storyboard) throw new CustException("该项目集数已存在,请勿重复创建");
|
|
|
|
+ } else {
|
|
|
|
+ wrapperStoryboard.eq(CrtDramaProjectStoryboard::getSort, sort);
|
|
|
|
+ Boolean is_exist_storyboard = crtDramaProjectStoryboardDao.exists(wrapperStoryboard);
|
|
|
|
+ if (is_exist_storyboard) throw new CustException("该项目集数已存在,请勿重复创建");
|
|
|
|
+ }
|
|
|
|
|
|
// [DB] 创建分镜
|
|
// [DB] 创建分镜
|
|
CrtDramaProjectStoryboard entity = new CrtDramaProjectStoryboard();
|
|
CrtDramaProjectStoryboard entity = new CrtDramaProjectStoryboard();
|
|
entity.setUser_id(user_id);
|
|
entity.setUser_id(user_id);
|
|
entity.setDrama_project_id(drama_project_id);
|
|
entity.setDrama_project_id(drama_project_id);
|
|
entity.setEpisode_num(episode_num);
|
|
entity.setEpisode_num(episode_num);
|
|
- entity.setSort(1);
|
|
|
|
|
|
+ entity.setSort(sort);
|
|
crtDramaProjectStoryboardDao.insert(entity);
|
|
crtDramaProjectStoryboardDao.insert(entity);
|
|
|
|
|
|
return Map.of("id", entity.getId());
|
|
return Map.of("id", entity.getId());
|
|
@@ -142,4 +149,28 @@ public class CrtDramaProjectStoryboardServiceImpl implements CrtDramaProjectStor
|
|
return Map.of("drama_project_storyboard_id", crtDramaProjectStoryboard.getDrama_project_storyboard_id());
|
|
return Map.of("drama_project_storyboard_id", crtDramaProjectStoryboard.getDrama_project_storyboard_id());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 清空分镜
|
|
|
|
+ */
|
|
|
|
+ public Map<String, Object> clearStoryboard(CrtDramaProjectStoryboard crtDramaProjectStoryboard) {
|
|
|
|
+
|
|
|
|
+ Long drama_project_id = crtDramaProjectStoryboard.getDrama_project_id();
|
|
|
|
+ Long drama_project_storyboard_id = crtDramaProjectStoryboard.getDrama_project_storyboard_id();
|
|
|
|
+
|
|
|
|
+// // [DB] 清空分镜
|
|
|
|
+// LambdaQueryWrapper<CrtDramaProjectStoryboard> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+// wrapper.eq(CrtDramaProjectStoryboard::getDrama_project_id, drama_project_id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return Map.of("drama_project_storyboard_id", crtDramaProjectStoryboard.getDrama_project_storyboard_id());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除分集
|
|
|
|
+ */
|
|
|
|
+ public Map<String, Object> deleteStoryboard(CrtDramaProjectStoryboard crtDramaProjectStoryboard) {
|
|
|
|
+ return Map.of("drama_project_storyboard_id", crtDramaProjectStoryboard.getDrama_project_storyboard_id());
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|