myibatis判断为空更新 小试牛刀

myibatis判断为空更新

<update id="UpdateOne" parameterType="User">  
     <![CDATA[  	
		 update User
	 ]]>
		<set>
			<if test="user_age!=null">
					user_age=#{userAge},
			</if>
			<if test="user_name!=null">
					userName=#{userName},
			</if>			
		</set>
		<![CDATA[ 
		 	where user_id= #{userId}
		]]>	
 	
    </update>    

简单的例子。。

猜你喜欢

转载自chanmao.iteye.com/blog/1707391
今日推荐