Authored by ping

留言排序

... ... @@ -19,6 +19,6 @@ public interface IUserdayLeaveWordsDAO {
int updateByPrimaryKey(UserdayLeaveWords record);
List<UserdayLeaveWords> selectLeaveWordsList(@Param("uid") String uid);
List<UserdayLeaveWords> selectLeaveWordsList(@Param("uid") int uid);
}
\ No newline at end of file
... ...
... ... @@ -92,8 +92,8 @@
</update>
<select id="selectLeaveWordsList" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" /> from userday_leave_words where uid in (${uid}) order by create_time
<select id="selectLeaveWordsList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" /> from userday_leave_words where uid =#{uid} order by create_time desc
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -40,11 +40,13 @@ public class UserdayLeaveWordsServiceImpl implements IUserdayLeaveWordsService {
}
// (2)查询列表
String uidStr = 0 == uid ? String.valueOf(uid) : "0," + uid;
List<UserdayLeaveWords> userdayLeaveWordsList = userdayLeaveWordsDAO.selectLeaveWordsList(uidStr);
if (null == userdayLeaveWordsList || 0 == userdayLeaveWordsList.size()) {
return new ArrayList<>();
//查询自己的留言
List<UserdayLeaveWords> userdayLeaveWordsList = userdayLeaveWordsDAO.selectLeaveWordsList(uid);
if (userdayLeaveWordsList == null) {
userdayLeaveWordsList = new ArrayList<>();
}
//查询公共留言
userdayLeaveWordsList.addAll(userdayLeaveWordsDAO.selectLeaveWordsList(0));
// (3)组装数据并返回
List<String> result = new ArrayList<>();
... ...