您的位置:首页 > 移动开发

java mybatis mapper批量插入数据,insert/update/映射属性字段

2016-11-19 14:39 543 查看
@MapperEngine
public interface BBINBetsLstMapper {

public void replaceBBinBet (List<BBINbet> list);
}
mapper.xml文件
<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 column="UserName" jdbcType="VARCHAR" property="UserName" />
<result column="GameType" jdbcType="VARCHAR" property="GameType" />
<result column="ExchangeRate" jdbcType="VARCHAR" property="ExchangeRate" />
<result column="Result" 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 column="Card" jdbcType="VARCHAR" property="Card" />
<result column="SerialID" jdbcType="VARCHAR" property="SerialID" />
<result column="hallId" jdbcType="BIGINT" property="hallId" />
<result column="userId" jdbcType="BIGINT" property="userId" />
<result column="GameKind" jdbcType="VARCHAR" property="GameKind" />
<result column="IsPaid" jdbcType="VARCHAR" property="IsPaid" />
</resultMap>
<sql id="Base_Column_List">
id, WagersID, UserName, GameType, ExchangeRate, Result, BetAmount, Commissionable,
Payoff, WagersDate, Currency, Origin, GameCode, RoundNo, ResultType, Card, SerialID,
hallId, userId,GameKind,IsPaid
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from bi_bbin_lst
where id = #{id,jdbcType=BIGINT}
</select>
 
<insert id="replaceBBinBet" useGeneratedKeys="true" parameterType="com.ig.gapi.result.bbin.BBINbet">
REPLACE 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
<foreach 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="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="WagersID != null">
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 test="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>
<if test="GameKind != null">
GameKind,
</if>
<if test="IsPaid != null">
IsPaid,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="WagersID != null">
#{WagersID,jdbcType=VARCHAR},
</if>
<if test="UserName != null">
#{UserName,jdbcType=VARCHAR},
</if>
<if test="GameType != 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="Commissionable != null">
#{Commissionable,jdbcType=DOUBLE},
</if>
<if test="Payoff != null">
#{Payoff,jdbcType=VARCHAR},
</if>
<if test="WagersDate != null">
#{WagersDate,jdbcType=TIMESTAMP},
</if>
<if test="Currency != null">
#{Currency,jdbcType=VARCHAR},
</if>
<if test="Origin != null">
#{Origin,jdbcType=VARCHAR},
</if>
<if test="GameCode != null">
#{GameCode,jdbcType=VARCHAR},
</if>
<if test="RoundNo != null">
#{RoundNo,jdbcType=VARCHAR},
</if>
<if test="ResultType != null">
#{ResultType,jdbcType=VARCHAR},
</if>
<if test="Card != null">
#{Card,jdbcType=VARCHAR},
</if>
<if test="SerialID != null">
#{SerialID,jdbcType=VARCHAR},
</if>
<if test="hallId != null">
#{hallId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="GameKind != null">
#{GameKind,jdbcType=VARCHAR},
</if>
<if test="IsPaid != null">
#{IsPaid,jdbcType=VARCHAR},
</if>
</trim>
</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 = #{UserName,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 = #{Result,jdbcType=VARCHAR},
</if>
<if test="BetAmount != null">
BetAmount = #{BetAmount,jdbcType=DOUBLE},
</if>
<if test="Commissionable != null">
Commissionable = #{Commissionable,jdbcType=DOUBLE},
</if>
<if test="Payoff != null">
Payoff = #{Payoff,jdbcType=VARCHAR},
</if>
<if test="WagersDate != null">
WagersDate = #{WagersDate,jdbcType=TIMESTAMP},
</if>
<if test="Currency != null">
Currency = #{Currency,jdbcType=VARCHAR},
</if>
<if test="Origin != null">
Origin = #{Origin,jdbcType=VARCHAR},
</if>
<if test="GameCode != null">
GameCode = #{GameCode,jdbcType=VARCHAR},
</if>
<if test="RoundNo != null">
RoundNo = #{RoundNo,jdbcType=VARCHAR},
</if>
<if test="ResultType != null">
ResultType = #{ResultType,jdbcType=VARCHAR},
</if>
<if test="Card != null">
Card = #{Card,jdbcType=VARCHAR},
</if>
<if test="SerialID != null">
SerialID = #{SerialID,jdbcType=VARCHAR},
</if>
<if test="hallId != null">
hallId = #{hallId,jdbcType=BIGINT},
</if>
<if test="userId != null">
userId = #{userId,jdbcType=BIGINT},
</if>
<if test="GameKind != null">
#{GameKind,jdbcType=VARCHAR},
</if>
<if test="IsPaid != null">
#{IsPaid,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ig.game.syssetting.domain.BBINbet">
update bi_bbin_lst
set WagersID = #{WagersID,jdbcType=VARCHAR},
UserName = #{UserName,jdbcType=VARCHAR},
GameType = #{GameType,jdbcType=VARCHAR},
ExchangeRate = #{ExchangeRate,jdbcType=VARCHAR},
Result = #{Result,jdbcType=VARCHAR},
BetAmount = #{BetAmount,jdbcType=DOUBLE},
Commissionable = #{Commissionable,jdbcType=DOUBLE},
Payoff = #{Payoff,jdbcType=VARCHAR},
WagersDate = #{WagersDate,jdbcType=TIMESTAMP},
Currency = #{Currency,jdbcType=VARCHAR},
Origin = #{Origin,jdbcType=VARCHAR},
GameCode = #{GameCode,jdbcType=VARCHAR},
RoundNo = #{RoundNo,jdbcType=VARCHAR},
ResultType = #{ResultType,jdbcType=VARCHAR},
Card = #{Card,jdbcType=VARCHAR},
SerialID = #{SerialID,jdbcType=VARCHAR},
hallId = #{hallId,jdbcType=BIGINT},
userId = #{userId,jdbcType=BIGINT},
GameKind = #{GameKind,jdbcType=VARCHAR},
IsPaid = #{IsPaid,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐