|
|
@ -14,6 +14,7 @@ class CreateAddDepartmentApplyService < ApplicationService
|
|
|
|
|
|
|
|
|
|
|
|
school = School.find_by(id: params[:school_id])
|
|
|
|
school = School.find_by(id: params[:school_id])
|
|
|
|
raise Error, '学校/单位不存在' if school.blank?
|
|
|
|
raise Error, '学校/单位不存在' if school.blank?
|
|
|
|
|
|
|
|
raise Error, '部门已存在' if school.departments.exists?(name: name)
|
|
|
|
|
|
|
|
|
|
|
|
department = Department.new
|
|
|
|
department = Department.new
|
|
|
|
department.name = name
|
|
|
|
department.name = name
|
|
|
|