码迷,mamicode.com
首页 > 其他好文 > 详细

Mybatis trim 标签使用--insert

时间:2018-08-28 20:09:49      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:test   自己   type   col   内容   mode   time   null   param   

trim元素的主要功能是可以在自己包含的内容前加上某些前缀,也可以在其后加上某些后缀,与之对应的属性是prefix和suffix;可以把包含内容的首部某些内容覆盖,即忽略,也可以把尾部的某些内容覆盖,对应的属性是prefixOverrides和suffixOverrides;

<insert id="operatorLog" parameterType="com.oa.model.wxlog.WxLog">
        INSERT INTO sdb_oa_operator_log
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="open_id!=‘‘ and open_id != null">
            open_id,
            </if>
                <if test="operatortime!=‘‘ and operatortime != null">
            operatortime,
            </if>
                <if test="operatortype!=‘‘ and operatortype != null">
            operatortype,
            </if>
                <if test="operatorcont!=‘‘ and operatorcont != null">
            operatorcont,
            </if>
                <if test="ip!=‘‘ and ip != null">
            ip,
            </if>
        </trim>
        <trim prefix="values(" suffix=")" suffixOverrides="," >
            <if test="open_id!=‘‘ and open_id != null">
            #{open_id},
            </if>
                <if test="operatortime!=‘‘ and operatortime != null">
            #{operatortime},
            </if>
                <if test="operatortype!=‘‘ and operatortype != null">
            #{operatortype},
            </if>
                <if test="operatorcont!=‘‘ and operatorcont != null">
            #{operatorcont},
            </if>
                <if test="ip!=‘‘ and ip != null">
            #{ip},
            </if>
        </trim>
    </insert>

 

Mybatis trim 标签使用--insert

标签:test   自己   type   col   内容   mode   time   null   param   

原文地址:https://www.cnblogs.com/iscys/p/9550222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!