Browse Source

添加一个用户查询接口

pull/1/head
caoyizhong 1 year ago
parent
commit
f886c3d197
  1. 11
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/feign/IUserClient.java
  2. 2
      blade-service/blade-system/src/main/java/org/springblade/system/SystemApplication.java
  3. 12
      blade-service/blade-system/src/main/java/org/springblade/system/feign/UserClient.java

11
blade-service-api/blade-user-api/src/main/java/org/springblade/system/feign/IUserClient.java

@ -22,6 +22,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.system.entity.User;
import org.springblade.system.entity.UserInfo;
import org.springblade.system.entity.UserOauth;
import org.springblade.system.vo.UserVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -42,6 +43,7 @@ public interface IUserClient {
String USER_INFO = API_PREFIX + "/user-info";
String USER_INFO_BY_TYPE = API_PREFIX + "/user-info-by-type";
String USER_INFO_BY_ID = API_PREFIX + "/user-info-by-id";
String USER_INFO_BY_ID_OWN = API_PREFIX + "/user-info-by-id-own";
String USER_INFO_BY_ACCOUNT = API_PREFIX + "/user-info-by-account";
String USER_AUTH_INFO = API_PREFIX + "/user-auth-info";
String SAVE_USER = API_PREFIX + "/save-user";
@ -56,6 +58,15 @@ public interface IUserClient {
@GetMapping(USER_INFO_BY_ID)
R<User> userInfoById(@RequestParam("userId") Long userId);
/**
* 获取用户信息
*
* @param userId 用户id
* @return
*/
@GetMapping(USER_INFO_BY_ID_OWN)
R<UserVO> userInfoByIdOwn(@RequestParam("userId") Long userId);
/**
* 根据账号获取用户信息

2
blade-service/blade-system/src/main/java/org/springblade/system/SystemApplication.java

@ -28,7 +28,7 @@ import org.springblade.core.launch.constant.AppConstant;
public class SystemApplication {
public static void main(String[] args) {
BladeApplication.run(AppConstant.APPLICATION_SYSTEM_NAME, SystemApplication.class, args);
BladeApplication.run(AppConstant.APPLICATION_SYSTEM_NAME.concat("-cyz"), SystemApplication.class, args);
}
}

12
blade-service/blade-system/src/main/java/org/springblade/system/feign/UserClient.java

@ -18,6 +18,7 @@ package org.springblade.system.feign;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
@ -26,6 +27,8 @@ import org.springblade.system.entity.UserInfo;
import org.springblade.system.entity.UserOauth;
import org.springblade.system.enums.UserEnum;
import org.springblade.system.service.IUserService;
import org.springblade.system.vo.UserVO;
import org.springblade.system.wrapper.UserWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -51,6 +54,15 @@ public class UserClient implements IUserClient {
return R.data(service.getById(userId));
}
@Override
@GetMapping(USER_INFO_BY_ID_OWN)
public R<UserVO> userInfoByIdOwn(Long userId) {
User user = new User();
user.setId(userId);
User detail = service.getOne(Condition.getQueryWrapper(user));
return R.data(UserWrapper.build().entityVO(detail));
}
@Override
@GetMapping(USER_INFO_BY_ACCOUNT)
public R<User> userByAccount(String tenantId, String account) {

Loading…
Cancel
Save