Commit 8bb4f978 authored by liuyang's avatar liuyang

fixed bug:如果讲师有关联的课程,则不可被删除

parent f40d5ef7
......@@ -123,6 +123,10 @@ public class TeacherService extends ServiceImpl<TeacherMapper, TeacherPO> {
@Transactional
public void removeTeachers(List<Long> ids) {
for (Long id : ids){
int count = courseService.countByTeacher(id);
if (count > 0){
throw new BusinessException("该讲师已有关联课程,不可删除");
}
TeacherPO teacherPO = getById(id);
removeById(id);
//删除讲师帐号
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment