aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/PMQueriesServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/service/PMQueriesServiceImpl.java')
-rw-r--r--src/main/java/com/juick/service/PMQueriesServiceImpl.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/src/main/java/com/juick/service/PMQueriesServiceImpl.java
index c4ffc269..903529fb 100644
--- a/src/main/java/com/juick/service/PMQueriesServiceImpl.java
+++ b/src/main/java/com/juick/service/PMQueriesServiceImpl.java
@@ -17,8 +17,9 @@
package com.juick.service;
-import com.juick.Chat;
-import com.juick.User;
+import com.juick.model.Chat;
+import com.juick.model.User;
+import com.juick.model.Message;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.stereotype.Repository;
@@ -76,7 +77,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
+ "WHERE pm.user_id_to=? "
+ "ORDER BY l.last DESC",
(rs, rowNum) -> {
- com.juick.Chat u = new com.juick.Chat();
+ Chat u = new Chat();
u.setUid(rs.getInt(1));
u.setName(rs.getString(2));
u.setLastMessageTimestamp(rs.getTimestamp(3).toInstant());
@@ -88,7 +89,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
@Transactional
@Override
- public List<com.juick.Message> getPMMessages(final int uid, final int uidTo) {
+ public List<Message> getPMMessages(final int uid, final int uidTo) {
SqlParameterSource sqlParameterSource = new MapSqlParameterSource()
.addValue("uid", uid)
.addValue("uidTo", uidTo);
@@ -98,7 +99,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
+ "OR (user_id_to = :uid AND user_id = :uidTo) ORDER BY ts DESC LIMIT 20",
sqlParameterSource,
(rs, rowNum) -> {
- com.juick.Message msg = new com.juick.Message();
+ Message msg = new Message();
int uuid = rs.getInt(1);
User user = new User();
user.setUid(uuid);
@@ -112,12 +113,12 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
@Transactional(readOnly = true)
@Override
- public List<com.juick.Message> getLastPMInbox(final int uid) {
+ public List<Message> getLastPMInbox(final int uid) {
return getJdbcTemplate().query(
"SELECT pm.user_id, users.nick, pm.txt, pm.ts " +
"FROM pm INNER JOIN users ON pm.user_id=users.id WHERE pm.user_id_to=? ORDER BY pm.ts DESC LIMIT 20",
(rs, num) -> {
- com.juick.Message msg = new com.juick.Message();
+ Message msg = new Message();
msg.setUser(new User());
msg.getUser().setUid(rs.getInt(1));
msg.getUser().setName(rs.getString(2));
@@ -130,13 +131,13 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
@Transactional(readOnly = true)
@Override
- public List<com.juick.Message> getLastPMSent(final int uid) {
+ public List<Message> getLastPMSent(final int uid) {
return getJdbcTemplate().query(
"SELECT pm.user_id_to, users.nick, pm.txt, " +
"pm.ts FROM pm INNER JOIN users ON pm.user_id_to=users.id " +
"WHERE pm.user_id=? ORDER BY pm.ts DESC LIMIT 20",
(rs, num) -> {
- com.juick.Message msg = new com.juick.Message();
+ Message msg = new Message();
msg.setUser(new User());
msg.getUser().setUid(rs.getInt(1));
msg.getUser().setName(rs.getString(2));