insertSql语句中的trim标签的使用

insert into MB_BATCH_DIS_DETAILS
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="batchNo != null">
        BATCH_NO,
      </if>
      <if test="seqNo != null">
        SEQ_NO,
      </if>
      <if test="contractNo != null">
        CONTRACT_NO,
      </if>
      <if test="prodType != null">
        PROD_TYPE,
      </if>
      <if test="discSubType != null">
        DISC_SUB_TYPE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="batchNo != null">
        #{batchNo,jdbcType=VARCHAR},
      </if>
      <if test="seqNo != null">
        #{seqNo,jdbcType=VARCHAR},
      </if>
      <if test="contractNo != null">
        #{contractNo,jdbcType=VARCHAR},
      </if>
      <if test="prodType != null">
        #{prodType,jdbcType=VARCHAR},
      </if>
      <if test="discSubType != null">
        #{discSubType,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

posted @ 2019-05-09 10:23  不死码农  阅读(2634)  评论(0编辑  收藏  举报