WANG 6 rokov pred
rodič
commit
00f1736efa

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

@@ -223,6 +223,38 @@ public class UserController extends ControllerSupport {
 		return ret;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value = "查询登陆用户", notes = "")
+	@GetMapping("/{id}")
+	public UserDomain getUserBySession() {
+		User accessUser = getAccessUser();
+		UserEntity userEntity = userRepo.findOne(accessUser.getUserId());
+
+		UserDomain bean = new UserDomain();
+		bean.setId(userEntity.getId());
+		bean.setLoginName(userEntity.getLoginName());
+		bean.setName(userEntity.getName());
+		bean.setRootOrgId(userEntity.getRootOrgId());
+		bean.setUpdateTime(userEntity.getUpdateTime());
+		bean.setCreationTime(userEntity.getCreationTime());
+		bean.setOrgId(userEntity.getOrgId());
+		if (null != bean.getOrgId()) {
+			OrgEntity org = orgRepo.findOne(Long.valueOf(bean.getOrgId()));
+			if (null != org) {
+				bean.setOrgName(org.getName());
+				bean.setOrgCode(org.getCode());
+			}
+		}
+		bean.setEnable(userEntity.getEnable());
+		return bean;
+	}
+
 	/**
 	 * 方法注释
 	 *