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

mybatis框架,执行插入语句的时候,如果没有字段传过来就赋值为空 进行判断

时间:2020-06-09 16:39:36      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:rda   upd   tin   赋值   div   ble   date   style   col   

<insert id="insert" parameterType="com.picc.hmbms.outinterface.scoreDetail.po.ScoreSettlePo">
        insert into t_score_settel
        (score_settel_id,
        member_code,
        order_no,
        product_code,
        product_name,
        pay_way,
        payable_amount,
        payable_score,
        consumer_date,
        consumer_org,
        sys_no,
        settel_type,
        remark,
        insert_time,
        insert_oper,
        update_time,
        update_oper)
        values
        (
        cast(#{scoreSettelId} as NUMERIC),
        #{memberCode},
        #{orderNo},
        #{productCode},
        #{productName},
        #{payWay},
        <choose>
            <when test="payableAmount != null and payableAmount != ‘‘">
                cast(#{payableAmount} as NUMERIC),
            </when>
            <otherwise>
                null,
            </otherwise>
        </choose>

        <choose>
            <when test="payableScore != null and payableScore != ‘‘">
                cast(#{payableScore} as NUMERIC),
            </when>
            <otherwise>
                null,
            </otherwise>
        </choose>
        #{consumerDate},
        #{consumerOrg},
        #{sysNo},
        #{settelType},
        #{remark},
        #{insertTime},
        #{insertOper},
        #{updateTime},
        #{updateOper})
    </insert>

 

mybatis框架,执行插入语句的时候,如果没有字段传过来就赋值为空 进行判断

标签:rda   upd   tin   赋值   div   ble   date   style   col   

原文地址:https://www.cnblogs.com/dongyaotou/p/13073028.html

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