WANG 6 ani în urmă
părinte
comite
b8fbd9a131

+ 17 - 5
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java

@@ -581,12 +581,24 @@ public class OrgController extends ControllerSupport {
 	}
 
 	@ApiOperation(value = "查询机构单个属性(不鉴权)")
-	@GetMapping("propertyNoSession/{orgId}/{key}")
-	public String getOrgPropertyNoSession(@PathVariable Long orgId, @PathVariable String key) {
-		OrgEntity orgEntity = orgRepo.findOne(orgId);
-		if (null == orgEntity) {
-			throw new StatusException("B-001250", "orgId is wrong");
+	@GetMapping("propertyNoSession/{key}")
+	public String getOrgPropertyNoSession(@RequestParam(required = false) Long orgId,
+			@RequestParam(required = false) String domainName, @PathVariable String key) {
+		OrgEntity orgEntity = null;
+		if (null != orgId) {
+			orgEntity = orgRepo.findOne(orgId);
+			if (null == orgEntity) {
+				throw new StatusException("B-001250", "orgId is wrong");
+			}
+		} else if (StringUtils.isNotBlank(domainName)) {
+			orgEntity = orgRepo.findByParentIdIsNullAndDomainName(domainName);
+			if (null == orgEntity) {
+				throw new StatusException("B-001252", "domainName is wrong");
+			}
+		} else {
+			throw new StatusException("B-001253", "orgId and domainName are all null");
 		}
+
 		DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
 		DynamicEnum de = manager.getByName(key);
 		OrgPropertyEntity one = orgPropertyRepo.findByOrgIdAndKeyId(orgId, de.getId());