ajax,jquery,json

来源:互联网 发布:php object to xml 编辑:程序博客网 时间:2024/06/09 14:28

一种拼接的方法,在sql语句中拼接原本的where条件换为形式,添加if条件判断

<mapper namespace="com.neuedu.ssm.dao.ItemDao">    <select id="getItem" parameterType="Item" resultType="Item">        select*from item        <where>            <if test="itemname!=null and itemname!=''">                and itemname=#{itemname}            </if>            <if test="itemprice!=null and itemprice!=''">                and itemprice=#{itemprice}            </if>            <if test="itemdesc!=null and itemdesc!=''">                and itemdesc=#{itemdesc}            </if>        </where>    </select></mapper>