|
@@ -166,23 +166,76 @@ public class OrgController extends ControllerSupport {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "新增机构", notes = "新增")
|
|
|
- @PostMapping
|
|
|
- public Org addOrg(@RequestBody Org org, HttpServletRequest request) {
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param org
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "新增顶级机构", notes = "新增")
|
|
|
+ @PostMapping("addRootOrg")
|
|
|
+ public Org addRootOrg(@RequestBody Org org, HttpServletRequest request) {
|
|
|
+ org.setCreateTime(new Date());
|
|
|
+ org.setParentId(null);
|
|
|
+ org.setRootId(null);
|
|
|
+ Org saved = orgService.save(org);
|
|
|
+ saved.setRootId(saved.getId());
|
|
|
+ saved = orgService.save(org);
|
|
|
+ return saved;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param org
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "更新顶级机构", notes = "更新")
|
|
|
+ @PutMapping("updateRootOrg")
|
|
|
+ public Org updateRootOrg(@RequestBody Org org, HttpServletRequest request) {
|
|
|
+ org.setParentId(null);
|
|
|
+ org.setRootId(org.getId());
|
|
|
+ Org updated = orgService.update(org.getId(), org);
|
|
|
+ return updated;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param org
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "新增子机构", notes = "新增")
|
|
|
+ @PostMapping("addSubOrg")
|
|
|
+ public Org addSubOrg(@RequestBody Org org, HttpServletRequest request) {
|
|
|
org.setCreateTime(new Date());
|
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
org.setParentId(accessUser.getRootOrgId());
|
|
|
- org.setRootId(accessUser.getOrgId());
|
|
|
+ org.setRootId(accessUser.getRootOrgId());
|
|
|
Org saved = orgService.save(org);
|
|
|
return saved;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "更新机构", notes = "更新")
|
|
|
- @PutMapping
|
|
|
- public Org updateOrg(@RequestBody Org org, HttpServletRequest request) {
|
|
|
+ /**
|
|
|
+ * 方法注释
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param org
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "更新子机构", notes = "更新")
|
|
|
+ @PutMapping("updateSubOrg")
|
|
|
+ public Org updateSubOrg(@RequestBody Org org, HttpServletRequest request) {
|
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
|
|
|
- org.setParentId(accessUser.getOrgId());
|
|
|
+ org.setParentId(accessUser.getRootOrgId());
|
|
|
org.setRootId(accessUser.getRootOrgId());
|
|
|
Org updated = orgService.update(org.getId(), org);
|
|
|
return updated;
|