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

mybatis begin end

时间:2018-07-31 15:33:25      阅读:1341      评论:0      收藏:0      [点我收藏+]

标签:time   and   pre   map   def   code   set   white   sep   

<delete id="deleteALLByZjxbh">

BEGIN 

DELETE FROM T_JW_ZJXB WHERE ZJXBH=#{zjxbh};

UPDATE JW_SSJH SET XXTBZ = 0 WHERE ZJXBH=#{zjxbh};

DELETE FROM JW_SSJH WHERE ZJXBH=#{zjxbh};

DELETE FROM JW_SSJH_SKXX WHERE ZJXBH=#{zjxbh};

DELETE FROM JW_SSJH_XDDX WHERE ZJXBH=#{zjxbh};

DELETE FROM JW_SSJH_CJQTLRR WHERE ZJXBH=#{zjxbh};

END;

</delete>



<update id="batchUpdate" parameterType="java.util.List">

        begin

        <foreach collection="list" item="item" index="index" separator="" > 

            update T_EMP_1 

            <set>       

                age = #{item.age}+1,name=#{item.name}

            </set>

            where id = #{item.id};

        </foreach>

        end;

    </update>

<insert id="batch2InsertMsgAndEffect" parameterType="Map">

begin 

INSERT INTO sn_price_msg_detail(sid, service_code, op_code, app_code, uid,

authid, prd_code,city_code, store_code, prd_price, down_time,

extense_price1,extense_price2, extense_price3, status, create_time)

VALUES 

<foreach collection="msgs" item="item" index="index" open="" separator=","  close="">  

          (#{item.sid},#{item.ServiceCode},

          #{item.Operation},#{item.AppCode},#{item.UId},

          #{item.AuthId},#{item.salesno},#{item.cityCode},

          #{item.storeCode},#{item.Price},#{item.downTime},

          #{item.Price1},#{item.Price2},#{item.Price3},#{item.status},#{item.createTime})

    </foreach>

    end;

    begin 

    insert into sn_prd_effect (sid,store_code,prd_code,prd_price,extense_price1,extense_price2,extense_price3,down_time) 

values 

<foreach collection="effs" separator="," item="item" index="index"  open="" close="">  

             (#{item.sid} ,#{item.storeCode},#{item.salesno},#{item.Price},#{item.Price1}, #{item.Price2},#{item.Price3},#{item.downTime})  

         </foreach>

         end;

</insert>


mybatis begin end

标签:time   and   pre   map   def   code   set   white   sep   

原文地址:http://blog.51cto.com/xiaok007/2152550

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