mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-11-02 21:44:50 +08:00
1.数据库重构
2.修改User注册登录接口
This commit is contained in:
@@ -3,6 +3,8 @@ package cn.mafangui.hotel.service;
|
||||
|
||||
import cn.mafangui.hotel.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
User selectById(int id);
|
||||
@@ -13,5 +15,10 @@ public interface UserService {
|
||||
|
||||
User selectByUserName(String userName);
|
||||
|
||||
int count();
|
||||
|
||||
List<User> findAll();
|
||||
|
||||
int updateProfile(User user);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package cn.mafangui.hotel.service.impl;
|
||||
|
||||
import cn.mafangui.hotel.entity.User;
|
||||
|
||||
import cn.mafangui.hotel.mapper.UserMapper;
|
||||
import cn.mafangui.hotel.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@@ -23,21 +26,28 @@ public class UserServiceImpl implements UserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public User login(String userName, String password) {
|
||||
User user = new User();
|
||||
user.setUserName(userName);
|
||||
user.setPassword(password);
|
||||
return userMapper.selectByUserNameAndPassword(user);
|
||||
public User login(String username, String password) {
|
||||
return userMapper.selectByUsernameAndPassword(username,password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User selectByUserName(String userName) {
|
||||
return userMapper.selectByUserName(userName);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count() {
|
||||
return userMapper.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> findAll() {
|
||||
return userMapper.selectAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateProfile(User user) {
|
||||
return userMapper.updateByUserNameSelective(user);
|
||||
return userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user