<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nowcoder.dao.FeedDAO">
<sql id="table">feed</sql>
<sql id="selectFields">id, user_id,created_date,data,type
</sql>
<select id="selectUserFeeds" resultType="com.nowcoder.model.Feed">
SELECT
<include refid="selectFields"/>
FROM
<include refid="table"/>
where id < #{maxId}
<if test="userIds.size() != 0">
AND user_id in
<foreach collection="userIds" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
ORDER BY id DESC
LIMIT #{count}
</select>
</mapper>
网友评论