Mybtis中xml文件里if,else怎么写?

简单明了

传统java中

if(1==1){
    
    
	zzz
}else{
    
    
	zzz
}

mybatis xml 文件中

 <choose>
 	<when test = "1 != 1">
	 	zzz
 	</when>
 	<otherwise>
 		zzz
 	</otherwise>
 </choose>

if else 在mybatisxml 文件中 要用 choose 标签包裹 , when 就代表if , otherwise 代表else
这种动态sql 还是很实用的 ^^_

第一次发CSDN 希望能和大家相互交流 .

猜你喜欢

转载自blog.csdn.net/weixin_44562387/article/details/115092725