使用数据库用户表代替配置文件

This commit is contained in:
panlinlin
2021-04-13 15:08:09 +08:00
parent a56d8c70d6
commit 123ce171d2
9 changed files with 137 additions and 20 deletions

View File

@@ -0,0 +1,12 @@
package com.genersoft.iot.vmp.service;
import com.genersoft.iot.vmp.storager.dao.dto.User;
public interface IUserService {
User getUser(String username, String password);
boolean changePassword(int id, String password);
}

View File

@@ -0,0 +1,27 @@
package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.service.IUserService;
import com.genersoft.iot.vmp.storager.dao.UserMapper;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UserServiceImpl implements IUserService {
@Autowired
private UserMapper userMapper;
@Override
public User getUser(String username, String password) {
return userMapper.select(username, password);
}
@Override
public boolean changePassword(int id, String password) {
User user = userMapper.selectById(id);
user.setPassword(password);
return userMapper.update(user) > 0;
}
}