@Override public void addAuthority(Authority authority) { int exist = userMapper.getPersonalAuthNum(authority.getUserId(), authority.getName()); if (exist == 0) { userMapper.addAuth(authority); } }
@Override public void addUser(User user) { try { userMapper.addUser(user); } catch (DuplicateKeyException e) { throw new OuterException(Status.CONFLICT, "EMAIL_OR_PHONE_CONFILICT"); } }
@Override public int findUserNumByCondition(User condition) { return userMapper.findUserNumByCondition(condition); }
@Override public List<User> findUserListByCondition(User condition, int page) { int start = (page - 1) * PCpageSize; return userMapper.findUsersByCondition(condition, start, PCpageSize); }
@Override public int findUserNumByPhone(String phone) { return userMapper.findUserNumByPhone(phone); }
@Override public int findUserNumByEmail(String email) { return userMapper.findUserNumByEmail(email); }
@Override public void updateUser(User user) { userMapper.updateUser(user); }
@Override public int addUserByAdmin(User user) { return userMapper.addUserByAdmin(user); }
@Override public User findUserByAccount(String email, String password) { User user = userMapper.findUserByAccount(email, password); return user; }
@Override public int findUserNumByEmail(String email, int userId) { return userMapper.findUserNumByEmailExceptOne(userId, email); }
@Override public int findUserNumByPhone(String phone, int userId) { return userMapper.findUserNumByPhoneExceptOne(userId, phone); }
@Override public int updateUserDetail(User user) { return userMapper.updateUserDetail(user); }
@Override public User getUserDetail(int userId) { return userMapper.getUserDetail(userId); }
@Override public String getPersonalUsername(int userId) { return userMapper.getUserNameById(userId); }
@Override public List<Authority> getPersonalAuths(int userId) { return userMapper.getPersonalAuth(userId); }
@Override public void deleteAuthority(int authId) { userMapper.deleteAuth(authId); }