zoukankan      html  css  js  c++  java
  • mybaits trim用法

    prefix : 给<trim>包裹的sql语句加上前缀.

    suffix : 给<trim>包裹的sql语句加上后缀.

    prefixOverrides: 如果<trim>包裹的sql语句是空语句(经常出现在 if 判断为否的情况下),取消指定的前缀,如where.

    suffixOverrides: 如果<trim>包裹的sql语句是空语句(经常出现在 if 判断为否的情况下),取消指定的后缀,如and | or. 逗号等

    <!-- 新增-->
    <insert id="save" parameterType="com.yp.api.qa.model.QuestionTemplate" keyProperty="id">
    insert into yp_qa.q_question_template
    <trim prefix="(" suffix=")" suffixOverrides="," >
    <if test="cateid != null">
    cateid,
    </if>
    <if test="title != null">
    title,
    </if>
    <if test="author != null">
    author,
    </if>
    <if test="type != null">
    type,
    </if>
    <if test="img != null">
    img,
    </if>
    <if test="video != null">
    video,
    </if>
    <if test="music != null">
    music,
    </if>
    <if test="hydesc != null">
    hydesc,
    </if>
    <if test="uid != null">
    uid,
    </if>
    createtime,
    <if test="tags != null">
    tags,
    </if>
    <if test="accountid != null">
    accountid,
    </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
    <if test="cateid != null">
    #{cateid},
    </if>
    <if test="title != null">
    #{title},
    </if>
    <if test="author != null">
    #{author},
    </if>
    <if test="type != null">
    #{type},
    </if>
    <if test="img != null">
    #{img},
    </if>
    <if test="video != null">
    #{video},
    </if>
    <if test="music != null">
    #{music},
    </if>
    <if test="hydesc != null">
    #{hydesc},
    </if>
    <if test="uid != null">
    #{uid},
    </if>
    now(),
    <if test="tags != null">
    #{tags},
    </if>
    <if test="accountid != null">
    #{accountid},
    </if>
    </trim>
    </insert>
  • 相关阅读:
    用jmeter进行多用户并发压力测试
    Jmeter使用流程及简单分析监控
    检查点--JMeter也有之二“检查点”
    浅谈如何做好Bug回归验证?
    手机APP测试技术-整体测试流程框架
    常用的sql语句
    Jmeter实时性能测试数据的监控
    Jmeter插件之PerfMon监控插件使用说明
    Requests: 让 HTTP 服务人类
    安装mysql数据库图文教程
  • 原文地址:https://www.cnblogs.com/flord/p/6126531.html
Copyright © 2011-2022 走看看