作业多次点击提交报错修复

This commit is contained in:
zhaolongfei
2024-08-02 13:19:08 +08:00
parent 9f30910d04
commit 49aab74463

View File

@@ -41,8 +41,8 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
//完成处理,判断是否已存在
Object obj=scItemDao.findField("id", FieldFilters.eq("studyId", homework.getStudyId()), FieldFilters.eq("contentId", homework.getContentId()));
StudyCourseItem sci=new StudyCourseItem();
if(obj==null) {
StudyCourseItem sci=new StudyCourseItem();
LocalDateTime ldt=LocalDateTime.now();
sci.setStudyId(homework.getStudyId());
sci.setContentId(homework.getContentId());
@@ -68,7 +68,13 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
//dao.save(homework);
//设置id。然后进行悠
homework.setId(obj.toString());
homework.setStudyItemId(sci.getId());
String sql = "select id,content_id,course_id,hw_name,study_id,study_item_id from boe_study_homework where content_id = '"+homework.getContentId()+"' and study_id = '"+homework.getStudyId()+"' and course_id = '"+homework.getCourseId()+"'";;
if (!sql.isEmpty()) {
List<Object[]> list = dao.sqlFindList(sql);
for (Object[] objs : list) {
homework.setStudyItemId(objs[5].toString());
}
}
dao.update(homework);
}
}