mybatis----簡單介紹和使用
阿新 • • 發佈:2019-02-20
<insert id="betchInsert" parameterType="list"> insert into settlement_detail (id, begin_date, charge_date, settlement_amount, merchant_id, merchant_name, merchant_style, contact_people, phonenum, state, is_deleted, bank_number, order_amount, total_coupons, total_score, platform_commission, total_back, total_commission_back, total_score_back, total_coupons_back, create_by, create_time, update_by, update_time ) values <foreach collection="list" item="item" separator=","> <choose> <when test="item.id != null" > ( #{item.id}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.begin_date != null" > #{item.begin_date}, </when> <otherwise> now(), </otherwise> </choose> <choose> <when test="item.charge_date != null" > #{item.charge_date}, </when> <otherwise> now(), </otherwise> </choose> <choose> <when test="item.settlement_amount != null" > #{item.settlement_amount}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.merchant_id != null" > #{item.merchant_id}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.merchant_name != null" > #{item.merchant_name}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.merchant_style != null" > #{item.merchant_style}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.contact_people != null" > #{item.contact_people}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.phonenum != null" > #{item.phonenum}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.state != null" > #{item.state}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.is_deleted != null" > #{item.is_deleted}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.bank_number != null" > #{item.bank_number}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.order_amount != null" > #{item.order_amount}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.total_coupons != null" > #{item.total_coupons}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.total_score != null" > #{item.total_score}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.platform_commission != null" > #{item.platform_commission}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.total_back != null" > #{item.total_back}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.total_commission_back != null" > #{item.total_commission_back}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.total_score_back != null" > #{item.total_score_back}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.total_coupons_back != null" > #{item.total_coupons_back}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.create_by != null" > #{item.create_by}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.create_time != null" > #{item.create_time}, </when> <otherwise> now(), </otherwise> </choose> <choose> <when test="item.update_by != null" > #{item.update_by}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.update_time != null" > #{item.update_time}, </when> <otherwise> now()) </otherwise> </choose> </foreach> </insert>
對應的介面類: