@@ -11,4 +11,5 @@ import java.util.List;
public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleEvaluate> {
+ CourseScheduleEvaluate findByClassGroupId(@Param("classGroupId") Integer classGroupId);
}
@@ -34,6 +34,10 @@ public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, Cou
if(classGroup==null){
throw new BizException("课程不存在!");
+ CourseScheduleEvaluate hasOne = courseScheduleEvaluateDao.findByClassGroupId(courseScheduleEvaluate.getClassGroupId());
+ if(hasOne != null){
+ throw new BizException("报告已添加,请勿重复提交");
+ }
courseScheduleEvaluate.setMusicGroupId(classGroup.getMusicGroupId());
courseScheduleEvaluate.setCreateTime(new Date());
long num = courseScheduleEvaluateDao.insert(courseScheduleEvaluate);
@@ -20,4 +20,8 @@
#{teacherId,jdbcType=INTEGER}, #{item,jdbcType=VARCHAR}, #{comment,jdbcType=LONGVARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
+
+ <select id="findByClassGroupId" resultMap="CourseScheduleEvaluate">
+ SELECT * FROM course_schedule_evaluate WHERE class_group_id_ = #{classGroupId}
+ </select>
</mapper>