mybatis-plus操作sql各种注意记录

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34495753/article/details/88682451

 

@Param 作为Dao层的注解,作用是用于传递参数,一般在2=<参数数<=5时使用最佳。

注解@Param(“id”)Integer id,@Param("name") String name后在xml中sql不需要parameterType属性直接

<update id="updateFlag">
        update t_tenant_info
          <set>
              <if test="flag != null">
                  name = #{name},
              </if>
          </set>
          where id= #{id}
    </update>

或者通过parameterType = “类”,parameterType=“Map”,取值直接用类名或Map中的Key

<update id="updateFlag" parameterType = "类/Map">
        update t_tenant_info
          <set>
              <if test="flag != null">
                  name = #{name},
              </if>
          </set>
          where id= #{id}
    </update>

猜你喜欢

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