zoukankan      html  css  js  c++  java
  • sql.xml 循环插入与修改写法

     // 插入 (交互一次数据库)
    <insert id="insertClient"> insert into m_linknodeclient (LinkClientID, LinkID, UnitID, DevID, DevNodeID, f_Param1, f_Param2, f_Param3, ClientScreenID, i_Flag, vc_Memo) values <foreach collection="clientList" item="list" separator=","> (#{list.linkClientId,jdbcType=VARCHAR}, #{list.linkId,jdbcType=VARCHAR}, #{list.unitId,jdbcType=VARCHAR}, #{list.devId,jdbcType=VARCHAR}, #{list.devNodeId,jdbcType=VARCHAR}, #{list.fParam1,jdbcType=REAL}, #{list.fParam2,jdbcType=REAL}, #{list.fParam3,jdbcType=REAL}, #{list.clientScreenId,jdbcType=INTEGER}, #{list.iFlag,jdbcType=INTEGER}, #{list.vcMemo,jdbcType=VARCHAR}) </foreach> </insert>


     // 修改  (交互多次数据库)
        <update id="updateClient" >
            <foreach collection="clientList" item="list" index="index" open="" close="" separator=";">
            update m_linknodeclient
            <set>
                <if test="list.linkId != null">
                    LinkID = #{list.linkId,jdbcType=VARCHAR},
                </if>
                <if test="list.unitId != null">
                    UnitID = #{list.unitId,jdbcType=VARCHAR},
                </if>
                <if test="list.devId != null">
                    DevID = #{list.devId,jdbcType=VARCHAR},
                </if>
                <if test="list.devNodeId != null">
                    DevNodeID = #{list.devNodeId,jdbcType=VARCHAR},
                </if>
                <if test="list.fParam1 != null">
                    f_Param1 = #{list.fParam1,jdbcType=REAL},
                </if>
                <if test="list.fParam2 != null">
                    f_Param2 = #{list.fParam2,jdbcType=REAL},
                </if>
                <if test="list.fParam3 != null">
                    f_Param3 = #{list.fParam3,jdbcType=REAL},
                </if>
                <if test="list.clientScreenId != null">
                    ClientScreenID = #{list.clientScreenId,jdbcType=INTEGER},
                </if>
                <if test="list.iFlag != null">
                    i_Flag = #{list.iFlag,jdbcType=INTEGER},
                </if>
                <if test="list.vcMemo != null">
                    vc_Memo = #{list.vcMemo,jdbcType=VARCHAR},
                </if>
            </set>
            where LinkClientID = #{list.linkClientId,jdbcType=VARCHAR}
            </foreach>
        </update>
  • 相关阅读:
    win8应用的编码UI测试
    什么是Peer Review
    Android开发环境的搭建
    运用int.parse()判断闰年代码实现
    等价类划分方法的应用之EditBox(二)
    等价类划分方法的应用之EditBox
    集成测试
    数据可视化简介
    关于processing
    白盒测试VS黑盒测试
  • 原文地址:https://www.cnblogs.com/MagicAsa/p/11052673.html
Copyright © 2011-2022 走看看