use of com.junliang.spring.pojo.entity.User in project spring-boot by Linda-Tan.
the class HelloWorldApplicationTests method test.
@Test
public void test() throws Exception {
User user = new User();
user.setName("admin");
user.setPassword("password");
userRepository.save(user);
// userRepository.save(new User());
// userRepository.save(new User());
// userMapper.insert(new com.junliang.spring.pojo.domain.User());
// userMapper.insert(new com.junliang.spring.pojo.domain.User());
}
use of com.junliang.spring.pojo.entity.User in project spring-boot by Linda-Tan.
the class UserService method login.
@DataSource(name = "readDataSource")
public String login(String username, String password) {
User user = userRepository.findByName(username);
if (user == null)
throw new BaseException(4001, "用户名不存在");
if (!user.getPassword().equals(password))
throw new BaseException(4002, "用户密码错误");
UserInfo userInfo = new UserInfo();
BeanCopierUtils.copyProperties(user, userInfo);
return generateToken(userInfo);
}
use of com.junliang.spring.pojo.entity.User in project spring-boot by Linda-Tan.
the class UserService method test1.
@DataSource
public void test1() {
User user = new User();
user.setName("userRepository");
user.setPassword("userRepository");
userRepository.save(user);
}
Aggregations