增加mongo登录模块
This commit is contained in:
parent
3af54c3449
commit
733706b345
@ -0,0 +1,31 @@
|
|||||||
|
package ink.wgink.interfaces.login.mongo;
|
||||||
|
|
||||||
|
import ink.wgink.pojo.pos.user.mongo.MongoUserPO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: IMongoLoginService
|
||||||
|
* @Description: mongo登录
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2022/5/19 11:29
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public interface IMongoLoginService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户详情
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MongoUserPO getPO(String userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户详情
|
||||||
|
*
|
||||||
|
* @param username
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MongoUserPO getPOByUsername(String username);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package ink.wgink.pojo.pos.user.mongo;
|
||||||
|
|
||||||
|
import ink.wgink.pojo.bos.UserInfoBO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: MongoUserPO
|
||||||
|
* @Description: mongo用户
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2022/5/19 11:38
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class MongoUserPO extends UserInfoBO {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1825234228822161126L;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password == null ? "" : password.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
|
sb.append("\"password\":\"")
|
||||||
|
.append(password).append('\"');
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
28
mongo-login/pom.xml
Normal file
28
mongo-login/pom.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>wg-basic</artifactId>
|
||||||
|
<groupId>ink.wgink</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>mongo-login</artifactId>
|
||||||
|
<description>mongo登录模块</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.data</groupId>
|
||||||
|
<artifactId>spring-data-mongodb</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ink.wgink</groupId>
|
||||||
|
<artifactId>common</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,35 @@
|
|||||||
|
package ink.wgink.mongo.login.service.impl;
|
||||||
|
|
||||||
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
|
import ink.wgink.interfaces.login.mongo.IMongoLoginService;
|
||||||
|
import ink.wgink.pojo.pos.user.mongo.MongoUserPO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: MongoLoginServiceImpl
|
||||||
|
* @Description: mongo登录
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2022/5/19 11:31
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MongoLoginServiceImpl extends DefaultBaseService implements IMongoLoginService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MongoUserPO getPO(String userId) {
|
||||||
|
return mongoTemplate.findOne(new Query().addCriteria(Criteria.where("userId").is(userId)), MongoUserPO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MongoUserPO getPOByUsername(String username) {
|
||||||
|
return mongoTemplate.findOne(new Query().addCriteria(Criteria.where("userUsername").is(username)), MongoUserPO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1
pom.xml
1
pom.xml
@ -47,6 +47,7 @@
|
|||||||
<module>module-form</module>
|
<module>module-form</module>
|
||||||
<module>basic-abstract</module>
|
<module>basic-abstract</module>
|
||||||
<module>module-examine</module>
|
<module>module-examine</module>
|
||||||
|
<module>mongo-login</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user