update if判斷進行動態sql拼接
阿新 • • 發佈:2019-01-31
<update id="updateOption" parameterType="com.model.Option"> update system_option set <if test="url != null and url !=''"> url = #{url}, </if> <if test="description != null and description !=''"> description = #{description}, </if> <if test="name != null and name !=''"> name = #{name }, </if> <if test="parentID != null and parentID !=''"> parentID = #{parentID }, </if> <if test="sequence != null and sequence !=''"> sequence = #{sequence }, </if> uuid=#{uuid} where uuid = #{uuid} </update>