WANG 6 years ago
parent
commit
e3bf655e4e

+ 7 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/ExamCloudServiceProvider.java

@@ -168,6 +168,8 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 		Long id = req.getId();
 		Long rootOrgId = req.getRootOrgId();
 		String name = req.getName();
+		String code = req.getCode();
+
 		if (null == id && StringUtils.isBlank(name)) {
 			throw new StatusException("002002", "id,name不能都为空");
 		}
@@ -183,6 +185,11 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
 				throw new StatusException("002004", "rootOrgId is null");
 			}
 			exam = examRepo.findByNameAndRootOrgId(name, rootOrgId);
+		} else if (StringUtils.isNotBlank(code)) {
+			if (null == rootOrgId) {
+				throw new StatusException("002004", "rootOrgId is null");
+			}
+			exam = examRepo.findByCodeAndRootOrgId(code, rootOrgId);
 		}
 
 		if (null == exam) {