mybatis定义sql语句标签之update标签

发布时间 2023-04-27 21:47:52作者: 红尘过客2022

这个标签比较简单,真实业务更新是非常常用的,并且update还用来做删除。
真实业务基本都是软删除,修改删除标志。0->1

属性说明

id:和其它标签一样是唯一标志

简单示例

<update id="updateNodeById" parameterType="com.wht.demo.dao.vo.AgentVo">
   update t_node_agent t 
    set 
  <trim  suffixOverrides="," > 
		<if test='appId !=null and appId != "" '>
			t.app_id= #{appId},  
		</if>
		<if test='osType!=null and osType!= "" '>
			t.os_type= #{osType},
		</if>
  </trim> 
  where node_id=#{nodeId}
 </update>