wangwei 6 년 전
부모
커밋
77a8f3e66e

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

@@ -231,9 +231,25 @@ public class UserController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "按id查询用户", notes = "id查询")
 	@GetMapping("/{id}")
-	public UserEntity getUserById(@PathVariable long id) {
-		UserEntity user = userRepo.findOne(id);
-		return user;
+	public UserDomain getUserById(@PathVariable long id) {
+		UserEntity userEntity = userRepo.findOne(id);
+
+		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.setEnable(userEntity.getEnable());
+		return bean;
 	}
 
 	/**