查询页面有下拉框选中条件作为查询,查询的结果都是下拉框最后一个值的数据,导致数据错误

查询页面有下拉框选中条件作为查询,查询的结果都是下拉框最后一个值的数据,导致数据错误
<if test="tpStatus != null and tpStatus != ''">and jtp.tp_status = #{tpStatus}</if>
        <if test="tpStatuslist != null and tpStatuslist.size > 0 ">and jtp.tp_status in
            <foreach item="tpStatust" collection="tpStatuslist" open="(" separator="," close=")">
                #{tpStatust}
            </foreach> </if>


错误原因是:
 遍历的集合,变量不能与上面的tpStatus重复。
如果重复,会导致获取上面的tpStatus获取的是集合的最后一个值。

猜你喜欢

转载自blog.csdn.net/qq_40680190/article/details/80525145
今日推荐