mybatis动态sql循环插值和设值

<insert id="insertSelective" parameterType="com.datanew.model.PJbillstock">
  <!--
  @mbggenerated
  -->
  insert into pj_billstock
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="guid != null">
      GUID,
    </if>
    <if test="fRegicode != null">
      F_REGICODE,
    </if>
    <if test="fSubjectno != null">
      F_SUBJECTNO,
    </if>
    <if test="fEnteguid != null">
      F_ENTEGUID,
    </if>
    <if test="fBistguid != null">
      F_BISTGUID,
    </if>
    <if test="userguid != null">
      USERGUID,
    </if>
    <if test="username != null">
      USERNAME,
    </if>
    <if test="fBitycode != null">
      F_BITYCODE,
    </if>
    <if test="startno != null">
      STARTNO,
    </if>
    <if test="endno != null">
      ENDNO,
    </if>
    <if test="sheets != null">
      SHEETS,
    </if>
    <if test="binding != null">
      BINDING,
    </if>
    <if test="copiespersheet != null">
      COPIESPERSHEET,
    </if>
    <if test="sheetsperbook != null">
      SHEETSPERBOOK,
    </if>
    <if test="pressprice != null">
      PRESSPRICE,
    </if>
    <if test="wholesaleprice != null">
      WHOLESALEPRICE,
    </if>
    <if test="retailprice != null">
      RETAILPRICE,
    </if>
    <if test="price != null">
      PRICE,
    </if>
    <if test="permoney != null">
      PERMONEY,
    </if>
    <if test="synFlag != null">
      SYN_FLAG,
    </if>
    <if test="flag != null">
      flag,
    </if>
    <if test="remark != null">
      REMARK,
    </if>
    <if test="entecode != null">
      ENTECODE,
    </if>
    <if test="seal != null">
      SEAL,
    </if>
    <if test="deadline != null">
      DEADLINE,
    </if>
  </trim>
  <trim prefix="values (" suffix=")" suffixOverrides=",">
    <if test="guid != null">
      #{guid,jdbcType=BIGINT},
    </if>
    <if test="fRegicode != null">
      #{fRegicode,jdbcType=VARCHAR},
    </if>
    <if test="fSubjectno != null">
      #{fSubjectno,jdbcType=VARCHAR},
    </if>
    <if test="fEnteguid != null">
      #{fEnteguid,jdbcType=VARCHAR},
    </if>
    <if test="fBistguid != null">
      #{fBistguid,jdbcType=DECIMAL},
    </if>
    <if test="userguid != null">
      #{userguid,jdbcType=DECIMAL},
    </if>
    <if test="username != null">
      #{username,jdbcType=VARCHAR},
    </if>
    <if test="fBitycode != null">
      #{fBitycode,jdbcType=VARCHAR},
    </if>
    <if test="startno != null">
      #{startno,jdbcType=VARCHAR},
    </if>
    <if test="endno != null">
      #{endno,jdbcType=VARCHAR},
    </if>
    <if test="sheets != null">
      #{sheets,jdbcType=DECIMAL},
    </if>
    <if test="binding != null">
      #{binding,jdbcType=CHAR},
    </if>
    <if test="copiespersheet != null">
      #{copiespersheet,jdbcType=DECIMAL},
    </if>
    <if test="sheetsperbook != null">
      #{sheetsperbook,jdbcType=DECIMAL},
    </if>
    <if test="pressprice != null">
      #{pressprice,jdbcType=DECIMAL},
    </if>
    <if test="wholesaleprice != null">
      #{wholesaleprice,jdbcType=DECIMAL},
    </if>
    <if test="retailprice != null">
      #{retailprice,jdbcType=DECIMAL},
    </if>
    <if test="price != null">
      #{price,jdbcType=DECIMAL},
    </if>
    <if test="permoney != null">
      #{permoney,jdbcType=DECIMAL},
    </if>
    <if test="synFlag != null">
      #{synFlag,jdbcType=CHAR},
    </if>
    <if test="flag != null">
      #{flag,jdbcType=CHAR},
    </if>
    <if test="remark != null">
      #{remark,jdbcType=VARCHAR},
    </if>
    <if test="entecode != null">
      #{entecode},
    </if>
    <if test="seal != null">
      #{seal},
    </if>
    <if test="deadline != null">
      #{deadline},
    </if>
  </trim>
</insert>

<update id="updateByPrimaryKeySelective" parameterType="com.datanew.model.PJbillstock">
  <!--
  @mbggenerated
  -->
  update pj_billstock
  <set>
    <if test="fRegicode != null">
      F_REGICODE = #{fRegicode,jdbcType=VARCHAR},
    </if>
    <if test="fSubjectno != null">
      F_SUBJECTNO = #{fSubjectno,jdbcType=VARCHAR},
    </if>
    <if test="fEnteguid != null">
      F_ENTEGUID = #{fEnteguid,jdbcType=VARCHAR},
    </if>
    <if test="fBistguid != null">
      F_BISTGUID = #{fBistguid,jdbcType=DECIMAL},
    </if>
    <if test="userguid != null">
      USERGUID = #{userguid,jdbcType=DECIMAL},
    </if>
    <if test="username != null">
      USERNAME = #{username,jdbcType=VARCHAR},
    </if>
    <if test="fBitycode != null">
      F_BITYCODE = #{fBitycode,jdbcType=VARCHAR},
    </if>
    <if test="startno != null">
      STARTNO = #{startno,jdbcType=VARCHAR},
    </if>
    <if test="endno != null">
      ENDNO = #{endno,jdbcType=VARCHAR},
    </if>
    <if test="sheets != null">
      SHEETS = #{sheets,jdbcType=DECIMAL},
    </if>
    <if test="binding != null">
      BINDING = #{binding,jdbcType=CHAR},
    </if>
    <if test="copiespersheet != null">
      COPIESPERSHEET = #{copiespersheet,jdbcType=DECIMAL},
    </if>
    <if test="sheetsperbook != null">
      SHEETSPERBOOK = #{sheetsperbook,jdbcType=DECIMAL},
    </if>
    <if test="pressprice != null">
      PRESSPRICE = #{pressprice,jdbcType=DECIMAL},
    </if>
    <if test="wholesaleprice != null">
      WHOLESALEPRICE = #{wholesaleprice,jdbcType=DECIMAL},
    </if>
    <if test="retailprice != null">
      RETAILPRICE = #{retailprice,jdbcType=DECIMAL},
    </if>
    <if test="price != null">
      PRICE = #{price,jdbcType=DECIMAL},
    </if>
    <if test="permoney != null">
      PERMONEY = #{permoney,jdbcType=DECIMAL},
    </if>
    <if test="synFlag != null">
      SYN_FLAG = #{synFlag,jdbcType=CHAR},
    </if>
    <if test="flag != null">
      flag = #{flag,jdbcType=CHAR},
    </if>
    <if test="remark != null">
      REMARK = #{remark,jdbcType=VARCHAR},
    </if>
    <if test="entecode != null">
      ENTECODE = #{entecode},
    </if>
    <if test="seal != null">
      SEAL = #{seal},
    </if>
    <if test="deadline != null">
      DEADLINE = #{deadline},
    </if>
      VERSION = VERSION + 1
  </set>
  where GUID = #{guid,jdbcType=BIGINT}
</update>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值