mybatis注解sql判断是否为空

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34495753/article/details/83383894
@Options(useGeneratedKeys=true,keyProperty = "id",keyColumn = "id")
    @Update("<script> update "+Gather.TABLE_NAME+" set status = #{status} <if test='remark!=null'> , remark = #{remark} </if> where id = #{id} </script>")
    int updateStatus(@Param("id")Integer id, @Param("status")Integer status,@Param("remark")String remark);

@Param("id")别名,对应sql中的#{id}

猜你喜欢

转载自blog.csdn.net/qq_34495753/article/details/83383894