Esempio n. 1
0
  @Transactional
  public Chat update(int id, String messages) {
    Chat chat = new Chat();
    chat = chatDao.findOne(id);

    chat.setMessages(messages);
    Chat result = chatDao.save(chat);

    return result;
  }
Esempio n. 2
0
  @Transactional
  public Chat postImage(int userId, String picture) {
    Chat result = null;
    Chat chat = new Chat();
    User user = (User) userDao.findOne(userId);
    chat.setUser(user);
    chat.setPicture(picture);
    chat.setSendTime(LocalDateTime.now(ZoneId.of("UTC+8")));
    result = chatDao.save(chat);

    return result;
  }
Esempio n. 3
0
  @Transactional
  public Chat postChat(int userId, String messages, Character showUserInfo) {
    Chat result = null;
    Chat chat = new Chat();
    User user = (User) userDao.findOne(userId);

    chat.setMessages(messages);
    chat.setShowUserInfo(showUserInfo);
    chat.setUser(user);
    chat.setSendTime(LocalDateTime.now(ZoneId.of("UTC+8")));
    result = chatDao.save(chat);

    return result;
  }
Esempio n. 4
0
 @Transactional
 public List<Chat> getLastThreeChats() {
   List<Chat> chats = chatDao.findAllOrderBySendTime();
   return chats;
 }