//新增
<insert id="insertSelectiveList" useGeneratedKeys="true" parameterType="java.util.List">
insert into common_user (user_id, user_account, user_name,
password, nick_name, avatar,
salt, mobile, tel,
email, status, isdel, create_time,
last_mod_time, create_user_id, mod_user_id,
open_id, region_code, region_name
)
values
<foreach collection="list" item="item" index="index" separator="," close=";">
(#{item.userId,jdbcType=BIGINT}, #{item.userAccount,jdbcType=VARCHAR}, #{item.userName,jdbcType=VARCHAR},
#{item.password,jdbcType=VARCHAR}, #{item.nickName,jdbcType=VARCHAR}, #{item.avatar,jdbcType=VARCHAR},
#{item.salt,jdbcType=VARCHAR}, #{item.mobile,jdbcType=VARCHAR}, #{item.tel,jdbcType=VARCHAR},
#{item.email,jdbcType=VARCHAR}, #{item.status,jdbcType=CHAR}, #{item.isdel,jdbcType=CHAR}, #{item.createTime,jdbcType=TIMESTAMP},
#{item.lastModTime,jdbcType=TIMESTAMP}, #{item.createUserId,jdbcType=BIGINT}, #{item.modUserId,jdbcType=BIGINT},
#{item.openId,jdbcType=VARCHAR}, #{item.regionCode,jdbcType=VARCHAR}, #{item.regionName,jdbcType=VARCHAR}
)
</foreach>
</insert>
//删除
<delete id="deluserByaccount" parameterType="java.util.ArrayList" >
delete from common_user
<where>
user_account in (
<foreach collection="list" item="code" index="index" separator=",">
#{code}
</foreach>
)
</where>
</delete>
//更新
<update id="updateMemberList" parameterType="java.util.List" >
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update common_party_member
<set >
<if test="name != null" >
name = #{item.name,jdbcType=VARCHAR},
</if>
<if test="sex != null" >
sex = #{item.sex,jdbcType=VARCHAR},
</if>
<if test="provinceCode != null" >
province_code = #{item.provinceCode,jdbcType=VARCHAR},
</if>
<if test="cityCode != null" >
city_code = #{item.cityCode,jdbcType=VARCHAR},
</if>
<if test="areaCode != null" >
area_code = #{item.areaCode,jdbcType=VARCHAR},
</if>

<if test="salt != null" >
salt = #{item.salt,jdbcType=VARCHAR},
</if>
<if test="idNumber != null" >
id_number = #{item.idNumber,jdbcType=VARCHAR},
</if>
<if test="education != null" >
education = #{item.education,jdbcType=VARCHAR},
</if>

<if test="address != null" >
address = #{item.address,jdbcType=VARCHAR},
</if>
<if test="mobile != null" >
mobile = #{item.mobile,jdbcType=VARCHAR},
</if>
<if test="company != null" >
company = #{item.company,jdbcType=VARCHAR},
</if>

<if test="jobTitle != null" >
job_title = #{item.jobTitle,jdbcType=VARCHAR},
</if>

<if test="birthday != null" >
birthday = #{item.birthday,jdbcType=TIMESTAMP},
</if>

<if test="memberProperties != null" >
member_properties = #{item.memberProperties,jdbcType=TINYINT},
</if>

<if test="innerPartyPositon != null" >
inner_party_positon = #{item.innerPartyPositon,jdbcType=VARCHAR},
</if>

<if test="partyTime != null" >
party_time = #{item.partyTime,jdbcType=VARCHAR},
</if>
<if test="partyOrganId != null" >
party_organ_id = #{item.partyOrganId,jdbcType=BIGINT},
</if>
<if test="isPartyAdmin != null" >
is_party_admin = #{item.isPartyAdmin,jdbcType=CHAR},
</if>
<if test="isMemberOnline != null" >
is_member_online = #{item.isMemberOnline,jdbcType=CHAR},
</if>
<if test="isPartyOrganActivity != null" >
is_party_organ_activity = #{item.isPartyOrganActivity,jdbcType=CHAR},
</if>
<if test="isMassOrganization != null" >
is_mass_organization = #{item.isMassOrganization,jdbcType=CHAR},
</if>

<if test="remark != null" >
remark = #{item.remark,jdbcType=VARCHAR},
</if>

<if test="modUserId != null" >
mod_user_id = #{item.modUserId,jdbcType=BIGINT},
</if>
<if test="lastModTime != null" >
last_mod_time = #{item.lastModTime,jdbcType=TIMESTAMP},
</if>

</set>
where id = #{item.id,jdbcType=BIGINT}
</foreach>
</update>

Java 一次操作多条数据的更多相关文章

  1. 使用JWPL (Java Wikipedia Library)操作维基百科数据

    使用JWPL (Java Wikipedia Library)操作维基百科数据 1. JWPL介绍 JWPL(Java Wikipedia Library)是一个开源的访问wikipeida数据的Ja ...

  2. Java备份约9亿条数据

    需求:有一张表9亿多条数据,数据加索引总数据量61GB.考虑到这张表的大部分数据都不会再被使用并且大数据量可能影响整库的性能,所以决定将表里某一个时刻之前的数据备份到一张新表中,待备份完成后将旧表中已 ...

  3. java向数据库插入N条数据

    为了测试mysql的索引,要向数据库先插入上万条数据,然后再测试.手动插入太麻烦,写了一段代码. 先上代码: package action; import java.sql.Connection; i ...

  4. java 对excel操作导入excel数据到数据库

    加入jar包jxl.jar ===================services层掉用工具类==================================== // 导入 public Lis ...

  5. java 批量插入10万条数据

    for (int i = 0; i < 100000; i++) { dbHelper.insert("INSERT aaa(name) Values ('1')"); } ...

  6. java操作mongodb——更新数据

    Java中可以通过updateOne,updateMany,replaceOne方法进行集合的文档更新.但是 _id 是不能更新的 updateOne只会更新一条数据,即使通过Filters.lt(& ...

  7. SQL语言(二) java怎样连接操作数据库中的数据

    import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.S ...

  8. easyUI dialog打开对话框,显示列表数据,选取一条数据操作后赋值给父窗口 resultMap声明为全局,生成getset方法

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" ...

  9. Java 线程池 +生产者消费者+MySQL读取300 万条数据

    1.1需求 数据库300 万条用户数据 ,遍历获取所有用户, 各种组合关联, 获取到一个新的json ,存到redis 上. 1.2 难点 数据库比较多, 不可能单线程查询所有的数据到内存. 1.3解 ...

  10. Java操作Jxl实现数据交互。三部曲——《第三篇》

    Java操作Jxl实现上传文本文件实现转PDF格式在线预览. 本文实现背景Web项目:前台用的框架是Easyui+Bootstrap结合使用,需要引入相应的Js.Css文件.页面:Jsp.拦截请求:S ...

随机推荐

  1. Java复习篇3---基础概念

    关键字 关键字:被Java赋予了特定含义的英文单词 关键字的字母全是小写 常用的代码编辑器,针对关键字会有特殊的颜色标记,非常直观 例如: class: 用于(创建\定义)一个类,后面紧跟类名. 类是 ...

  2. wireguard 在openwrt中的配置

    按照网上教程正常配置,防火墙通信规则中,选择打开监听端口,目标设备:设备(输入),目标端口:监听端口. 客户端设置:注意路由器的IP地址(段)要填0.0.0.0/0.

  3. HIVE-CREATE TABLE

    (1) create table 表A as select 字段 from 表B; (2) create table 表A stored as parquet as select 字段 from 表B ...

  4. Nextcloud报 PHP zip 模块未安装

    wget https://pecl.php.net/get/zip自动下载最新包 tar xf zip-1.20.0.tgz cd zip-1.20.0/ phpize 报错system libzip ...

  5. 1. mongodb基础:cursor.forEach使用

    mongosh下载地址: https://downloads.mongodb.com/compass/mongodb-mongosh-shared-openssl3-1.6.0.x86_64.rpm? ...

  6. Firefox几个必备的插件

    翻译网页 使用 Google 或 Yandex 实时翻译您的页面. Dualsub 通用字幕渲染器 Gesturefy 具有大量自定义功能的鼠标手势扩展,令浏览和操作更加便捷迅速. AdBlocker ...

  7. 智能插座的制作(esp01,继电器,arduino)

    前言: 现在小学信息技术的教材中已经出现了物联网的内容,比如泰山版小学信息技术教材第六册第二单元第一课就是用手机控制智能插座.就起了自己动手制作一个的心思,通过到网上浏览制作智能插座的文章后,有了基本 ...

  8. centos7.8 安装 redis5.0.2

    1.安装gcc依赖 redis是由C语言开发,因此安装之前必须要确保服务器已经安装了gcc,可以通过如下命令查看机器是否安装: gcc -v 如果没有安装则通过以下命令安装: yum install ...

  9. 关于flex

    flex 是 flex-grow.flex-shrink.flex-basis 的缩写. flex 的默认值是以上三个属性值的组合.假设以上三个属性同样取默认值,则 flex 的默认值是 0 1 au ...

  10. QT4.8.6移植

    sudo apt-get install libx11-dev libxext-dev libxtst-dev 配置: ./configure --prefix=/opt/qt4.8.6 -opens ...