INSERT INTO course_homework (id_,group_type_,course_schedule_id_,attachments_,content_,create_time_,update_time_,music_group_id_,class_group_id_,completed_num_,expect_num_,expiry_date_) VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseScheduleId},#{attachments},#{content},now(),now(),#{musicGroupId},#{classGroupId},#{completedNum},#{expectNum},#{expiryDate}) UPDATE course_homework attachments_ = #{attachments}, id_ = #{id}, class_group_id_ = #{classGroupId}, course_schedule_id_ = #{courseScheduleId}, completed_num_ = #{completedNum}, group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, expect_num_ = #{expectNum}, update_time_ = NOW(), content_ = #{content}, music_group_id_ = #{musicGroupId}, create_time_ = #{createTime}, expiry_date_ = #{expiryDate}, WHERE id_ = #{id} DELETE FROM course_homework WHERE id_ = #{id} DATE_FORMAT(ch.create_time_,"%Y%m%d") = DATE_FORMAT(#{createTime},"%Y%m%d") and ch.music_group_id_ = #{musicGroupId} and ch.class_group_id_ = #{classGroupId} and cs.actual_teacher_id_ = #{userId}