panlinlin
2021-04-14 cb5849d8a14f55241c44bdf6724b18de7950564d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
    }
 
    @Override
    public User getUserByUsername(String username) {
        return userMapper.getUserByUsername(username);
    }
}