Authored by ping

留言排序

@@ -19,6 +19,6 @@ public interface IUserdayLeaveWordsDAO { @@ -19,6 +19,6 @@ public interface IUserdayLeaveWordsDAO {
19 19
20 int updateByPrimaryKey(UserdayLeaveWords record); 20 int updateByPrimaryKey(UserdayLeaveWords record);
21 21
22 - List<UserdayLeaveWords> selectLeaveWordsList(@Param("uid") String uid); 22 + List<UserdayLeaveWords> selectLeaveWordsList(@Param("uid") int uid);
23 23
24 } 24 }
@@ -92,8 +92,8 @@ @@ -92,8 +92,8 @@
92 </update> 92 </update>
93 93
94 94
95 - <select id="selectLeaveWordsList" resultMap="BaseResultMap" parameterType="java.lang.String">  
96 - select <include refid="Base_Column_List" /> from userday_leave_words where uid in (${uid}) order by create_time 95 + <select id="selectLeaveWordsList" resultMap="BaseResultMap">
  96 + select <include refid="Base_Column_List" /> from userday_leave_words where uid =#{uid} order by create_time desc
97 </select> 97 </select>
98 98
99 </mapper> 99 </mapper>
@@ -40,11 +40,13 @@ public class UserdayLeaveWordsServiceImpl implements IUserdayLeaveWordsService { @@ -40,11 +40,13 @@ public class UserdayLeaveWordsServiceImpl implements IUserdayLeaveWordsService {
40 } 40 }
41 41
42 // (2)查询列表 42 // (2)查询列表
43 - String uidStr = 0 == uid ? String.valueOf(uid) : "0," + uid;  
44 - List<UserdayLeaveWords> userdayLeaveWordsList = userdayLeaveWordsDAO.selectLeaveWordsList(uidStr);  
45 - if (null == userdayLeaveWordsList || 0 == userdayLeaveWordsList.size()) {  
46 - return new ArrayList<>(); 43 + //查询自己的留言
  44 + List<UserdayLeaveWords> userdayLeaveWordsList = userdayLeaveWordsDAO.selectLeaveWordsList(uid);
  45 + if (userdayLeaveWordsList == null) {
  46 + userdayLeaveWordsList = new ArrayList<>();
47 } 47 }
  48 + //查询公共留言
  49 + userdayLeaveWordsList.addAll(userdayLeaveWordsDAO.selectLeaveWordsList(0));
48 50
49 // (3)组装数据并返回 51 // (3)组装数据并返回
50 List<String> result = new ArrayList<>(); 52 List<String> result = new ArrayList<>();