1.数据库重构

2.修改User注册登录接口
This commit is contained in:
freeebird
2018-11-12 10:44:54 +08:00
parent 643ef18f0a
commit 3ef7a1b88d
30 changed files with 1765 additions and 311 deletions

View File

@@ -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);
}

View File

@@ -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);
}