auth登录接口

pull/3/head
chenbingxuan 2024-01-09 22:34:01 +08:00 committed by zmyYYDS
parent 08c2dacb77
commit b37198b733
24 changed files with 645 additions and 43 deletions

View File

@ -8,7 +8,7 @@
<version>3.6.3</version> <version>3.6.3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>doctor-api-system</artifactId> <artifactId>doctor-api-system</artifactId>
<description> <description>
@ -16,13 +16,13 @@
</description> </description>
<dependencies> <dependencies>
<!-- RuoYi Common Core--> <!-- RuoYi Common Core-->
<dependency> <dependency>
<groupId>doctor</groupId> <groupId>doctor</groupId>
<artifactId>doctor-common-core</artifactId> <artifactId>doctor-common-core</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,16 @@
package doctor.system.api;
import doctor.common.core.constant.ServiceNameConstants;
import doctor.common.core.domain.R;
import doctor.system.api.factory.RemoteDoctorFallbackFactory;
import doctor.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallback = RemoteDoctorFallbackFactory.class)
public interface RemoteDoctorService {
@PostMapping("/doctor/getUser")
R<LoginUser> getDoctorUserInfo(@RequestParam("email") String email);
}

View File

@ -1,11 +1,7 @@
package doctor.system.api; package doctor.system.api;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import doctor.common.core.constant.SecurityConstants; import doctor.common.core.constant.SecurityConstants;
import doctor.common.core.constant.ServiceNameConstants; import doctor.common.core.constant.ServiceNameConstants;
import doctor.common.core.domain.R; import doctor.common.core.domain.R;
@ -15,7 +11,7 @@ import doctor.system.api.model.LoginUser;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) @FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)

View File

@ -0,0 +1,15 @@
package doctor.system.api.factory;
import doctor.common.core.domain.R;
import doctor.system.api.RemoteDoctorService;
import doctor.system.api.model.LoginUser;
import org.springframework.stereotype.Component;
@Component
public class RemoteDoctorFallbackFactory implements RemoteDoctorService {
@Override
public R<LoginUser> getDoctorUserInfo(String email) {
return R.fail("登录超时");
}
}

View File

@ -11,7 +11,7 @@ import doctor.system.api.model.LoginUser;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Component @Component

View File

@ -2,6 +2,7 @@ package doctor.system.api.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Set; import java.util.Set;
import doctor.system.api.domain.SysUser; import doctor.system.api.domain.SysUser;
/** /**
@ -58,6 +59,7 @@ public class LoginUser implements Serializable
*/ */
private SysUser sysUser; private SysUser sysUser;
public String getToken() public String getToken()
{ {
return token; return token;
@ -143,6 +145,7 @@ public class LoginUser implements Serializable
return sysUser; return sysUser;
} }
public void setSysUser(SysUser sysUser) public void setSysUser(SysUser sysUser)
{ {
this.sysUser = sysUser; this.sysUser = sysUser;

View File

@ -1,3 +1,4 @@
doctor.system.api.factory.RemoteUserFallbackFactory doctor.system.api.factory.RemoteUserFallbackFactory
doctor.system.api.factory.RemoteLogFallbackFactory doctor.system.api.factory.RemoteLogFallbackFactory
doctor.system.api.factory.RemoteFileFallbackFactory doctor.system.api.factory.RemoteFileFallbackFactory
doctor.system.api.factory.RemoteDoctorFallbackFactory

View File

@ -7,53 +7,53 @@
<version>3.6.3</version> <version>3.6.3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>doctor-auth</artifactId> <artifactId>doctor-auth</artifactId>
<description> <description>
doctor-auth认证授权中心 doctor-auth认证授权中心
</description> </description>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos --> <!-- SpringCloud Alibaba Nacos -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<!-- SpringCloud Alibaba Nacos Config --> <!-- SpringCloud Alibaba Nacos Config -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency> </dependency>
<!-- SpringCloud Alibaba Sentinel --> <!-- SpringCloud Alibaba Sentinel -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency> </dependency>
<!-- SpringBoot Web --> <!-- SpringBoot Web -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- SpringBoot Actuator --> <!-- SpringBoot Actuator -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<!-- RuoYi Common Security--> <!-- RuoYi Common Security-->
<dependency> <dependency>
<groupId>doctor</groupId> <groupId>doctor</groupId>
<artifactId>doctor-common-security</artifactId> <artifactId>doctor-common-security</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>
@ -70,5 +70,5 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -1,4 +1,4 @@
package doctor.auth; package doctor;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,13 +1,30 @@
package doctor.auth.controller; package doctor.auth.controller;
import doctor.auth.service.HealthService; import doctor.auth.service.HealthService;
import doctor.auth.vo.DoctorUserVo;
import doctor.common.core.domain.R;
import doctor.common.security.service.TokenService;
import doctor.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController @RestController
@RequestMapping("/doctor/v1")
public class HealthController { public class HealthController {
// @Autowired
// private HealthService healthService; @Autowired
private HealthService healthService;
@PostMapping("/login")
public R<?> login(@RequestParam String email,String pwd) {
DoctorUserVo userInfo = healthService.login(email,pwd);
return R.ok(userInfo);
}
} }

View File

@ -0,0 +1,5 @@
package doctor.auth.form;
public class DoctorUserBody {
}

View File

@ -1,4 +1,47 @@
package doctor.auth.service; package doctor.auth.service;
import doctor.auth.util.RSAUtils;
import doctor.auth.util.RsaKey;
import doctor.auth.vo.DoctorUserVo;
import doctor.common.core.domain.R;
import doctor.common.security.service.TokenService;
import doctor.system.api.RemoteDoctorService;
import doctor.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class HealthService { public class HealthService {
@Autowired
private RemoteDoctorService remoteDoctorService;
@Autowired
private TokenService tokenService;
public DoctorUserVo login(String email, String pwd) {
DoctorUserVo doctorUserVo = new DoctorUserVo();
R<LoginUser> userResult = remoteDoctorService.getDoctorUserInfo(email);
LoginUser data = userResult.getData();
String s="";
try {
s = RSAUtils.rsaDecrypt(pwd, RsaKey.PRIVATE_KEY);
} catch (Exception e) {
throw new RuntimeException(e);
}
Map<String, Object> token = tokenService.createToken(data);
String accessToken = (String) token.get("access_token");
doctorUserVo.setSessionId(accessToken);
doctorUserVo.setEmail(data.getSysUser().getEmail());
doctorUserVo.setUserId(data.getSysUser().getUserId().intValue());
doctorUserVo.setUserName(data.getSysUser().getUserName());
doctorUserVo.setNickName(data.getSysUser().getNickName());
doctorUserVo.setJiGuangPwd(s);
if (data.getSysUser().getSex()=="男"){
doctorUserVo.setSex(0);
}else {
doctorUserVo.setSex(1);
}
return doctorUserVo;
}
} }

View File

@ -0,0 +1,133 @@
package doctor.auth.util;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.*;
/**
* RSA
* @author : WangZhanpeng
* @date : 2024/1/9 15:13
*/
public class RSAUtils {
private static Map<Integer, String> keyMap = new HashMap<Integer, String>();
public static void getKey() throws NoSuchAlgorithmException {
genKeyPair();
System.out.println("公钥===:"+keyMap.get(0));
System.out.println("私钥===:"+keyMap.get(1));
}
/**
*
*
* @throws NoSuchAlgorithmException
*/
public static void genKeyPair() throws NoSuchAlgorithmException {
// KeyPairGenerator类用于生成公钥和私钥对基于RSA算法生成对象
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
// 初始化密钥对生成器密钥大小为96-1024位
keyPairGen.initialize(1024, new SecureRandom());
// 生成一个密钥对保存在keyPair中
KeyPair keyPair = keyPairGen.generateKeyPair();
// 得到私钥
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
// 得到公钥
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
String publicKeyString = new String(Base64.encodeBase64(publicKey.getEncoded()));
// 得到私钥字符串
String privateKeyString = new String(Base64.encodeBase64((privateKey.getEncoded())));
// 将公钥和私钥保存到Map
//0表示公钥
keyMap.put(0, publicKeyString);
//1表示私钥
keyMap.put(1, privateKeyString);
}
/**
* RSA
* @param str
* @param privateKey
* @return
*/
public static String rsaDecrypt(String str, String privateKey) throws Exception {
//base64编码的私钥
byte[] decoded = Base64.decodeBase64(privateKey);
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
//RSA解密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, priKey);
byte[] inputArray = Base64.decodeBase64(str.getBytes("UTF-8"));
int inputLength = inputArray.length;
// 最大加密字节数,超出最大字节数需要分组加密
int MAX_ENCRYPT_BLOCK = 128;
// 标识
int offSet = 0;
byte[] resultBytes = {};
byte[] cache;
while (inputLength - offSet > 0) {
if (inputLength - offSet > MAX_ENCRYPT_BLOCK) {
cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK);
offSet += MAX_ENCRYPT_BLOCK;
} else {
cache = cipher.doFinal(inputArray, offSet, inputLength - offSet);
offSet = inputLength;
}
resultBytes = Arrays.copyOf(resultBytes, resultBytes.length + cache.length);
System.arraycopy(cache, 0, resultBytes, resultBytes.length - cache.length, cache.length);
}
String outStr = new String(resultBytes);
return outStr;
}
/**
* RSA
* @param input
* @param rsaPublicKey
* @return
* @throws Exception
*/
public static List<String> rsaEncrypt(String input, String rsaPublicKey) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
String result = "";
// 将Base64编码后的公钥转换成PublicKey对象
byte[] buffer = Base64.decodeBase64(rsaPublicKey);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
PublicKey publicKey = keyFactory.generatePublic(keySpec);
// 加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] inputArray = input.getBytes();
int inputLength = inputArray.length;
System.out.println("加密字节数:" + inputLength);
// 最大加密字节数,超出最大字节数需要分组加密
int MAX_ENCRYPT_BLOCK = 117;
// 标识
int offSet = 0;
List<String> results=new ArrayList<>();
byte[] cache;
while (inputLength - offSet > 0) {
if (inputLength - offSet > MAX_ENCRYPT_BLOCK) {
cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK);
offSet += MAX_ENCRYPT_BLOCK;
} else {
cache = cipher.doFinal(inputArray, offSet, inputLength - offSet);
offSet = inputLength;
}
results.add(Base64.encodeBase64String(cache));
}
return results;
}
}

View File

@ -0,0 +1,20 @@
package doctor.auth.util;
/**
* RSA
* @author : WangZhanpeng
* @date : 2024/1/9 15:49
*/
public class RsaKey {
/**
*
*/
public static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7xkwklONlHn8TGmTH6yyvv7Bv9AcxXgpkAhuPxpOCVHgkpGGJUJVc8JCMOAhmqI4zdJRqTJa1aOk1glcOaOWja28o6lqNzxn3X3fqdkcWoF/L9Znw1MSDK7oFeSsHqubc9wA2GKb4EFt2TWuaFB+dWfPUhFeJ1GoZhpjjgZLO9QIDAQAB";
/**
*
*/
public static final String PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALvGTCSU42UefxMaZMfrLK+/sG/0BzFeCmQCG4/Gk4JUeCSkYYlQlVzwkIw4CGaojjN0lGpMlrVo6TWCVw5o5aNrbyjqWo3PGfdfd+p2RxagX8v1mfDUxIMrugV5Kweq5tz3ADYYpvgQW3ZNa5oUH51Z89SEV4nUahmGmOOBks71AgMBAAECgYAQNJTts0vMtk0RQP3hoxJAOLLpdo4IXK1Y5DWsut6QKOoVf3pLd4DsfHZ9I3jWI0XievU0F1gKX/uAerc4ryTiR6dxHRyKQxhAamLCFqAgTd6GQf6nl7LlKJkHOKZ1/Un0l245zSLoUzNYxzLZhXfOX8lMNfnXpznfZV43nJJMIQJBAPEeKpEzK8/lEJCszBCXgAH75Qcwu+J/LjZFXChsEqx0ubbhg9orgwg+z5Z2uLXVbeScTkBIi+yY6Jd5RUbyhTsCQQDHXUUcylpo0vo9z/xMPTcd5m5UqTm6ZVacdnrkOQtGJJCKOLYTLhWGUPmE0s+cgn9/24H0H8FjOM/ta8tdTPmPAkEAyV5lNICk7WojzH/TqWOtb3q8yqWDtGR85qxEjCm96rNNSpPKt1ExjJhQbBvYpVuK/KshmwQ7f6wwTBjmp5rxcwJAVbJPAggtgr+l16ourmrl5VFm/bdcXDYxW8JGIxIuOXGAPBoSkf4OPJVUHHctzP3/Zmtp2hFIZKlIH6tlWG69GwJAUcnD0XMH8+h9mYUFdwgD0JtaEbeY3ofkO+RymFdcYO//ZjwnVWyGRIhi/lJ5URPiiDzt2MmX5G2a0NJPwP60Lg==";
}

View File

@ -0,0 +1,130 @@
package doctor.auth.vo;
public class DoctorUserVo {
private Integer userId;
private String sessionId;
private String nickName;
private String userName;
private String jiGuangPwd;
private String headPic;
private Integer sex;
private Integer age;
private Integer height;
private Integer weight;
private String email;
private Integer whetherBingWeChat;
private String invitationCode;
private Integer faceFlag;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getSessionId() {
return sessionId;
}
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getJiGuangPwd() {
return jiGuangPwd;
}
public void setJiGuangPwd(String jiGuangPwd) {
this.jiGuangPwd = jiGuangPwd;
}
public String getHeadPic() {
return headPic;
}
public void setHeadPic(String headPic) {
this.headPic = headPic;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public Integer getWeight() {
return weight;
}
public void setWeight(Integer weight) {
this.weight = weight;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getWhetherBingWeChat() {
return whetherBingWeChat;
}
public void setWhetherBingWeChat(Integer whetherBingWeChat) {
this.whetherBingWeChat = whetherBingWeChat;
}
public String getInvitationCode() {
return invitationCode;
}
public void setInvitationCode(String invitationCode) {
this.invitationCode = invitationCode;
}
public Integer getFaceFlag() {
return faceFlag;
}
public void setFaceFlag(Integer faceFlag) {
this.faceFlag = faceFlag;
}
}

View File

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>doctor-common-core</artifactId> <artifactId>doctor-common-core</artifactId>
<description> <description>
doctor-common-core核心模块 doctor-common-core核心模块
</description> </description>
@ -22,7 +22,7 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> </dependency>
<!-- SpringCloud Loadbalancer --> <!-- SpringCloud Loadbalancer -->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
@ -113,6 +113,7 @@
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -2,7 +2,7 @@ package doctor.common.core.constant;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class ServiceNameConstants public class ServiceNameConstants
@ -21,4 +21,5 @@ public class ServiceNameConstants
* serviceid * serviceid
*/ */
public static final String FILE_SERVICE = "doctor-file"; public static final String FILE_SERVICE = "doctor-file";
public static final String FILE_DOCTOR = "doctor-health";
} }

View File

@ -0,0 +1,40 @@
package doctor.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
import doctor.common.core.domain.R;
import doctor.domain.entity.DoctorUser;
import doctor.service.IDoctorUserService;
import doctor.system.api.domain.SysUser;
import doctor.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/doctor")
@DS("slave")
public class SysDoctorController {
@Autowired
private IDoctorUserService iDoctorUserService;
@PostMapping("/getUser")
public R<LoginUser> getUser(String email) {
DoctorUser user = iDoctorUserService.getUser(email);
LoginUser loginUser = new LoginUser();
SysUser sysUser = new SysUser();
sysUser.setUserId(Long.valueOf(user.getId()));
sysUser.setNickName(user.getNickName());
sysUser.setUserName(user.getUserName());
sysUser.setPhonenumber(user.getPhone());
sysUser.setPassword(user.getPwd());
if (user.getSex()==0){
sysUser.setSex("男");
}else {
sysUser.setSex("女");
}
loginUser.setSysUser(sysUser);
return R.ok(loginUser);
}
}

View File

@ -0,0 +1,133 @@
package doctor.domain.entity;
import java.security.Timestamp;
public class DoctorUser {
private int id;
private String phone;
private String pwd;
private String email;
private String nickName;
private String userName;
private String headPic;
private int sex;
private int age;
private int height;
private int weight;
private String invitationCode;
private Timestamp updateTime;
private Timestamp createTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getHeadPic() {
return headPic;
}
public void setHeadPic(String headPic) {
this.headPic = headPic;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public String getInvitationCode() {
return invitationCode;
}
public void setInvitationCode(String invitationCode) {
this.invitationCode = invitationCode;
}
public Timestamp getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Timestamp updateTime) {
this.updateTime = updateTime;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,10 @@
package doctor.mapper;
import doctor.domain.entity.DoctorUser;
import org.apache.ibatis.annotations.Param;
import org.mybatis.spring.annotation.MapperScan;
@MapperScan
public interface IDoctorUserMapper {
DoctorUser selectDoctorUserByEmail(@Param("email") String email);
}

View File

@ -0,0 +1,8 @@
package doctor.service;
import doctor.domain.entity.DoctorUser;
import doctor.system.api.model.LoginUser;
public interface IDoctorUserService {
DoctorUser getUser(String email);
}

View File

@ -0,0 +1,19 @@
package doctor.service.impl;
import doctor.mapper.IDoctorUserMapper;
import doctor.domain.entity.DoctorUser;
import doctor.service.IDoctorUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class IDoctorUserServiceImpl implements IDoctorUserService {
@Autowired
private IDoctorUserMapper iDoctorUserMapper;
@Override
public DoctorUser getUser(String email) {
DoctorUser doctorUser = iDoctorUserMapper.selectDoctorUserByEmail(email);
return doctorUser;
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doctor.mapper.IDoctorUserMapper">
<select id="selectDoctorUserByEmail" resultType="doctor.domain.entity.DoctorUser">
select * from user where email = #{email}
</select>
</mapper>

View File

@ -8,70 +8,70 @@
<version>3.6.3</version> <version>3.6.3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>doctor-modules-system</artifactId> <artifactId>doctor-modules-system</artifactId>
<description> <description>
doctor-modules-system系统模块 doctor-modules-system系统模块
</description> </description>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos --> <!-- SpringCloud Alibaba Nacos -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<!-- SpringCloud Alibaba Nacos Config --> <!-- SpringCloud Alibaba Nacos Config -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency> </dependency>
<!-- SpringCloud Alibaba Sentinel --> <!-- SpringCloud Alibaba Sentinel -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency> </dependency>
<!-- SpringBoot Actuator --> <!-- SpringBoot Actuator -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<!-- Swagger UI --> <!-- Swagger UI -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version> <version>${swagger.fox.version}</version>
</dependency> </dependency>
<!-- Mysql Connector --> <!-- Mysql Connector -->
<dependency> <dependency>
<groupId>com.mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId> <artifactId>mysql-connector-j</artifactId>
</dependency> </dependency>
<!-- RuoYi Common DataSource --> <!-- RuoYi Common DataSource -->
<dependency> <dependency>
<groupId>doctor</groupId> <groupId>doctor</groupId>
<artifactId>doctor-common-datasource</artifactId> <artifactId>doctor-common-datasource</artifactId>
</dependency> </dependency>
<!-- RuoYi Common DataScope --> <!-- RuoYi Common DataScope -->
<dependency> <dependency>
<groupId>doctor</groupId> <groupId>doctor</groupId>
<artifactId>doctor-common-datascope</artifactId> <artifactId>doctor-common-datascope</artifactId>
</dependency> </dependency>
<!-- RuoYi Common Log --> <!-- RuoYi Common Log -->
<dependency> <dependency>
<groupId>doctor</groupId> <groupId>doctor</groupId>
<artifactId>doctor-common-log</artifactId> <artifactId>doctor-common-log</artifactId>
</dependency> </dependency>
<!-- RuoYi Common Swagger --> <!-- RuoYi Common Swagger -->
<dependency> <dependency>
<groupId>doctor</groupId> <groupId>doctor</groupId>
@ -96,5 +96,5 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>