您的位置:首页 > 其它

mybatis 新增判断空

2016-03-09 15:11 405 查看
mybatis 动态新增

<insert id="insertSelective" parameterType="com.yimayhd.snscenter.client.domain.ComentDO" useGeneratedKeys="true" keyProperty="id" >

    insert into com_coment

    <trim prefix="(" suffix=")" suffixOverrides="," >

      domain,

      status,

      <if test="gmtCreated != null" >

        gmt_created,

      </if>

      <if test="gmtModified != null" >

        gmt_modified,

      </if>

    </trim>

    <trim prefix="values (" suffix=")" suffixOverrides="," >

      #{domain,jdbcType=INTEGER},

      #{status,jdbcType=INTEGER},

      <if test="gmtCreated != null" >

        #{gmtCreated,jdbcType=TIMESTAMP},

      </if>

      <if test="gmtModified != null" >

        #{gmtModified,jdbcType=TIMESTAMP},

      </if>

    </trim>

  </insert>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: