Browse Source

getOrgByCode

deason 1 year ago
parent
commit
1e6ec77b72

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

@@ -1657,4 +1657,17 @@ public class OrgController extends ControllerSupport {
         return url;
     }
 
+    @ApiOperation(value = "按code查询子机构", notes = "code查询")
+    @GetMapping("byCode")
+    public OrgEntity getOrgByCode(@RequestParam Long rootOrgId, @RequestParam String code) {
+        validateRootOrgIsolation(rootOrgId);
+
+        OrgEntity org = orgRepo.findByRootIdAndCode(rootOrgId, code);
+        if (null == org) {
+            throw new StatusException("540001", "机构不存在");
+        }
+
+        return org;
+    }
+
 }