| | |
| | | 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 com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UserServiceImpl implements IUserService { |
| | | |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | |
| | | @Override |
| | | public int addUser(User user) { |
| | | User userByUsername = userMapper.getUserByUsername(user.getUsername()); |
| | | if (userByUsername != null) return 0; |
| | | if (userByUsername != null) { |
| | | return 0; |
| | | } |
| | | return userMapper.add(user); |
| | | } |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean checkPushAuthority(String callId, String sign) { |
| | | if (ObjectUtils.isEmpty(callId)) { |
| | | return userMapper.checkPushAuthorityByCallId(sign).size() > 0; |
| | | }else { |
| | | return userMapper.checkPushAuthorityByCallIdAndSign(callId, sign).size() > 0; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<User> getUsers(int page, int count) { |
| | | PageHelper.startPage(page, count); |
| | | List<User> users = userMapper.getUsers(); |
| | | return new PageInfo<>(users); |
| | | } |
| | | |
| | | @Override |
| | | public int changePushKey(int id, String pushKey) { |
| | | return userMapper.changePushKey(id,pushKey); |
| | | } |
| | | } |