1. 程式人生 > >Mybitse-中新增資料返新增資料的ID

Mybitse-中新增資料返新增資料的ID

 <!-- 新增活動資訊 返回ID 用於獎項的新增--> <insert id="addInteractActivity" parameterType="com.wmall.framework.db.model.InteractActivity" useGeneratedKeys="true" keyProperty="act_id"> <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="actid"> SELECT LAST_INSERT_ID()
</selectKey> INSERT INTO ss_interact_activity( act_name,game_id,act_brief,act_desc, start_time,end_time,draw_cnt,drow_plan,need_reply, reply_info,is_finished,update_time ) VALUES (#{actname},#{gameid}, <choose> <when test="actbrief == null or actbrief ==''">
'', </when> <otherwise> #{actbrief}, </otherwise> </choose> <choose> <when test="actdesc == null or actdesc ==''"> '', </when> <otherwise> #{actdesc}, </otherwise>
</choose> <choose> <when test="starttime == null or starttime ==''"> '', </when> <otherwise> #{starttime}, </otherwise> </choose> <choose> <when test="endtime == null or endtime ==''"> '', </when> <otherwise> #{endtime}, </otherwise> </choose> <choose> <when test="drawcnt == null or drawcnt ==''"> '', </when> <otherwise> #{drawcnt}, </otherwise> </choose> <choose> <when test="drowplan == null or drowplan ==''"> '', </when> <otherwise> #{drowplan}, </otherwise> </choose> #{needreply}, <choose> <when test="replyinfo == null or replyinfo ==''"> '', </when> <otherwise> #{replyinfo}, </otherwise> </choose> #{isfinished}, #{updatetime} ) </insert> <!-- 新增獎項,獎品資訊 --> <insert id="addInteractPrize" parameterType="com.wmall.framework.db.model.InteractPrize" useGeneratedKeys="true" keyProperty="prize_id"> INSERT INTO ss_interact_prize( prize_id,act_id,prize_level,prize_name,prize_type, prize_num,prize_img_url,sort_order,update_time ) VALUES (#{prizeid}, #{actid},#{prizelevel}, <choose> <when test="prizename == null or prizename ==''"> '', </when> <otherwise> #{prizename}, </otherwise> </choose> <choose> <when test="prizetype == null or prizetype ==''"> '', </when> <otherwise> #{prizetype}, </otherwise> </choose> #{prizenum}, #{prizeimgurl}, <choose> <when test="sortorder == null or sortorder ==''"> '0', </when> <otherwise> #{sortorder}, </otherwise> </choose> #{updatetime} ) </insert>