Java mybatis Mapper Bulk INSERT data, insert/update/mapping property fields

Source: Internet
Author: User
Tags bulk insert
 @MapperEngine Public interface Bbinbetslstmapper {public void Replacebbinbet (list<bbinbet> List);} m Apper.xml file 
<resultmap id= "Baseresultmap" type= "Com.ig.game.syssetting.domain.BBINbet" > <id "column=" id "jdbctype=" BIGINT "property=" id "/> <result column=" Wagersid "jdbctype=" VARCHAR "property=" Wagersid "/> <result" Colum " N= "UserName" jdbctype= "VARCHAR property=" UserName "/> <result column=" gametype "jdbctype=" VARCHAR "property=" GameType "/> <result column= exchangerate" jdbctype= "VARCHAR" property= "exchangerate"/> <result column= "R Esult "jdbctype=" VARCHAR "property=" result "/> <result column=" Betamount "jdbctype=" DOUBLE "property=" Betamount "/> <result column=" commissionable "jdbctype=" DOUBLE "property=" commissionable "/>" <result column= "Payoff" "Jdbctype=" VARCHAR "property=" payoff "/> <result column=" wagersdate "jdbctype=" TIMESTAMP "property=" wagersdate "/> <result column=" Currency "jdbctype=" VARCHAR "property=" Currency "/>" <result column= "Origin" jdbctype= "VARCHAR" property= "Origin"/> <resUlt column= "Gamecode" jdbctype= "VARCHAR" property= "Gamecode"/> "<result" column= "Roundno" jdbctype= "VARCHAR" property= "Roundno"/> <result column= "Resulttype" jdbctype= "VARCHAR" property= "Resulttype"/> <result mn= "card" jdbctype= "VARCHAR" property= "card"/> <result column= "serialid" jdbctype= "VARCHAR" property= "Serialid" "/> <result column=" hallid jdbctype= BIGINT "property=" Hallid "/> <result column=" userId "jdbctype=" BIGI NT "property=" UserId "/> <result column=" Gamekind "jdbctype=" VARCHAR "property=" Gamekind "/> <result N= "Ispaid" jdbctype= "VARCHAR" property= "Ispaid"/> </resultMap> <sql id= "Base_column_list" > IDs, Wagersid, UserName, GameType, exchangerate, result, Betamount, commissionable, Payoff, Wagersdate, Currency, Origin, Ga Mecode, Roundno, Resulttype, card, Serialid, Hallid, Userid,gamekind,ispaid </sql> <select id= "selectbyprimary Key "parametertype=" Java.lang.Long "resultmap= "Baseresultmap" > select <include refid= "Base_column_list"/> from bi_bbin_lst where id = #{id,jdbcty Pe=bigint} </select>
 
<insert id= "Replacebbinbet" usegeneratedkeys= "true" parametertype= "Com.ig.gapi.result.bbin.BBINbet" > REPLACE  Into the Bi_bbin_lst (Wagersid, UserName, GameType, exchangerate, result, Betamount, commissionable, payoff, Wagersdate, Currency, Origin, Gamecode, Roundno, Resulttype, card, Serialid, Hallid, Userid,gamekind,ispaid) VALUES <for Each collection= "list" index= "index" item= "record" separator= "," > (#{record. Wagersid,jdbctype=varchar}, #{record. Username,jdbctype=varchar}, #{record. Gametype,jdbctype=varchar}, #{record. Exchangerate,jdbctype=varchar}, #{record. Result,jdbctype=varchar}, #{record. Betamount,jdbctype=double}, #{record.commissionable,jdbctype=double}, #{record. Payoff,jdbctype=varchar}, #{record. Wagersdate,jdbctype=timestamp}, #{record. Currency,jdbctype=varchar}, #{record. Origin,jdbctype=varchar}, #{record. Gamecode,jdbctype=varchar}, #{record. Roundno,jdbctype=varchar}, #{record. Resulttype,jdbctype=varchar}, #{record. Card,jdbctYpe=varchar}, #{record. Serialid,jdbctype=varchar}, #{record.hallid,jdbctype=bigint}, #{record.userid,jdbctype=bigint},#{record. Gamekind,jdbctype=varchar},#{record.
 Ispaid,jdbctype=varchar}) </foreach> </insert>
<insert id= "Insert" parametertype= "Com.ig.game.syssetting.domain.BBINbet" > INSERT into Bi_bbin_lst (WAGERSID, 
    UserName, GameType, exchangerate, result, Betamount, commissionable, Payoff, Wagersdate, Currency, Origin, Gamecode, Roundno, Resulttype, card, Serialid, Hallid, Userid,gamekind,ispaid) VALUES (#{wagersid,jdbctype =varchar}, #{username,jdbctype=varchar}, #{gametype,jdbctype=varchar}, #{exchangerate,jdbctype=varchar}, #{Result, Jdbctype=varchar}, #{betamount,jdbctype=double}, #{commissionable,jdbctype=double}, #{Payoff,jdbcType=VARCHAR}, #{ Wagersdate,jdbctype=timestamp}, #{currency,jdbctype=varchar}, #{origin,jdbctype=varchar}, #{GameCode,jdbcType= VARCHAR}, #{roundno,jdbctype=varchar}, #{resulttype,jdbctype=varchar}, #{card,jdbctype=varchar}, #{SerialID, Jdbctype=varchar}, #{hallid,jdbctype=bigint}, #{userid,jdbctype=bigint},#{gamekind,jdbctype=varchar},#{ispaid, Jdbctype=varchar}) </insert> <insert id= "InserTselective "parametertype=" Com.ig.game.syssetting.domain.BBINbet "> INSERT INTO Bi_bbin_lst <trim prefix=" ("Suf fix= ")" suffixoverrides= "," > <if test= ID!= null "> ID, </if> <if test=" Wagersid!= nu ll "> Wagersid, </if> <if test=" UserName!= null "> UserName, </if> <if 
    test= "gametype!= null" > GameType, </if> <if test= "exchangerate!= null" > ExchangeRate, </if> <if test= "result!= null" > result, </if> <if test= "Betamount!= null"
      ; Betamount, </if> <if test= "commissionable!= null" > commissionable, </if> <if t est= "payoff!= null" > Payoff, </if> <if test= "wagersdate!= null" > Wagersdate, <
      /if> <if test= "Currency!= null" > Currency, </if> <if test= "Origin!= null" > Origin, </if> <if test= "gamecode!= null" > Gamecode, </if> <if test= "Roundno!= null" > Roundno, </if> <if test= "resulttype!= null" > Resulttype, </if> <if test= "card  != NULL "> Card, </if> <if test=" serialid!= null "> Serialid, </if> <if test= "hallid!= null" > Hallid, </if> <if test= "userId!= null" > UserId, </if&gt
    ;
    <if test= "gamekind!= null" > Gamekind, </if> <if test= "ispaid!= null" > Ispaid, </if> </trim> <trim prefix= "VALUES (" suffix= ")" suffixoverrides= "," > <if test= "id!= null" &G
      T #{id,jdbctype=bigint}, </if> <if test= "wagersid!= null" > #{wagersid,jdbctype=varchar}, < /if> <if test= "UserName!= null" > #{username,jdbctype=varchar}, </if> <if test= "gamety PE!= NULL "> #{gametype,jdbctype=varchar}, </if> <if test=" exchangerate!= null "> #{exchangerate 
    , Jdbctype=varchar}, </if> <if test= "result!= null" > #{result,jdbctype=varchar}, </if> <if test= "Betamount!= null" > #{betamount,jdbctype=double}, </if> <if test= "Commissionab Le!= null "> #{commissionable,jdbctype=double}, </if> <if test=" payoff!= null "> #{payo
    Ff,jdbctype=varchar}, </if> <if test= "wagersdate!= null" > #{wagersdate,jdbctype=timestamp}, </if> <if test= "Currency!= null" > #{currency,jdbctype=varchar}, </if> <if test= "O Rigin!= null "> #{origin,jdbctype=varchar}, </if> <if test=" gamecode!= null "> #{gameco De,jdbctype=varchar}, </if> <if test= "Roundno!= null" > #{roundno,jdbctype=varchar}, </if > <if test= "ReSulttype!= null "> #{resulttype,jdbctype=varchar}, </if> <if test=" card!= null "> #{car D,jdbctype=varchar}, </if> <if test= "serialid!= null" > #{serialid,jdbctype=varchar}, </i f> <if test= "hallid!= null" > #{hallid,jdbctype=bigint}, </if> <if test= "UserId!= nul L "> #{userid,jdbctype=bigint}, </if> <if test=" gamekind!= null "> #{gamekind,jdbctype=v Archar}, </if> <if test= "ispaid!= null" > #{ispaid,jdbctype=varchar}, </if> </tri m> </insert> <update id= "updatebyprimarykeyselective" parametertype= "
      Com.ig.game.syssetting.domain.BBINbet "> Update bi_bbin_lst <set> <if test=" wagersid!= null "> Wagersid = #{wagersid,jdbctype=varchar}, </if> <if test= "UserName!= null" > UserName = #{userna Me,jdbctype=varchar}, </if> <if test= "GameType!= NULL "> gametype = #{gametype,jdbctype=varchar}, </if> <if test=" exchangerate!= null "> exchangerate = #{exchangerate,jdbctype=varchar}, </if> <if test= ' result!= null ' > result = #{r Esult,jdbctype=varchar}, </if> <if test= "betamount!= null" > Betamount = #{betamount,jdbctype=do Uble}, </if> <if test= "commissionable!= null" > commissionable = #{commissionable,jdbctype=doubl E}, </if> <if test= "payoff!= null" > Payoff = #{payoff,jdbctype=varchar}, </if> &L T;if test= "wagersdate!= null" > Wagersdate = #{wagersdate,jdbctype=timestamp}, </if> <if test= "C
      Urrency!= Null "> Currency = #{currency,jdbctype=varchar}, </if> <if test=" Origin!= null ">
       Origin = #{origin,jdbctype=varchar}, </if> <if test= "gamecode!= null" >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.