0

我在MyBatis中有两个sql,第一个是查询结果,第二个尝试获取第一个的计数。第一个sql:

<select id="getFeedbackEntities" resultType="map" parameterType="map">
        SELECT *  FROM feed_back
        WHERE (DATE(sumit_time) BETWEEN #{startDate} AND #{endDate})
        AND (comment LIKE #{keyword} OR city LIKE #{keyword} OR isp LIKE #{keyword})
    <if test="type > 0">
        AND type = #{type}
    </if>
    <if test="reason > 0">
        AND reason = #{reason}
    </if>
        ORDER BY #{sort} #{order} LIMIT #{offset}, #{limit}
</select>

第二个sql是:

<select id="getFeedbackCount" resultType="int" parameterType="map">
        SELECT COUNT(1) FROM feed_back
        WHERE (DATE(sumit_time) BETWEEN #{startDate} AND #{endDate})
        AND (comment LIKE #{keyword} OR city LIKE #{keyword} OR isp LIKE #{keyword})
    <if test="type > 0">
        AND type = #{type}
    </if>
    <if test="reason > 0">
        AND reason = #{reason}
    </if>
</select>

我用相同的参数调用它们。这两个 sql 在单独的环境中工作正常,而在 webapp 中,第二个得到了错误的结果。我真的很困惑。

4

0 回答 0