1. 程式人生 > >使用Mybatis動態sql語句時出現:元素內容必須由格式正確的字元資料或標記組成

使用Mybatis動態sql語句時出現:元素內容必須由格式正確的字元資料或標記組成

    >號用&gt;表示,<號用&lt;表示
@Select("<script> select sum(amount) from user_bills where " +
            " bill_type=#{billType,jdbcType=INTEGER} " +
            "<if test = 'datemin != null'> and gmt_create &gt;=#{datemin,jdbcType=DATE} </if>  " +
            "<if test = 'datemax != null'> and gmt_create &lt;=#{datemax,jdbcType=DATE} </if></script>"
)