//新增
<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. docker下载java镜像,执行xxx.jar文件

    docker pull java:8u111

  2. windows elasticsearch中文乱码

    一:找到安装目录下的config jvm.options文件 二:修改或增加: -Dfile.encoding=GBK 参考文章地址:https://www.shuzhiduo.com/A/rV57O ...

  3. react toolkit 异步请求之后调取其他函数

    在slice切片文件中,页面dispatch执行action之后,异步请求完成后调取另外一个异步请求,要在异步请求的 第二个参数添加   thunkAPI,调取thunkAPI的dispatch方法即 ...

  4. locust 检查点、集合点、参数化设置。

    1.参数化 方式1:循环取数据,数据可以重复使用. 所有并发虚拟用户共享同一份测试数据,各虚拟用户在数据列表中循环取值. 例如,模拟10个用户并发请求网页,总共有4个URL地址,每个虚拟用户都会依次循 ...

  5. Tomcat启动报A fatal error has been detected by the Java Runtime Environment

    # # A fatal error has been detected by the Java Runtime Environment: # #  SIGSEGV (0xb) at pc=0x0000 ...

  6. 如何进行多平台部署Client和Server详细讲解

    一:signalR把console用做客户端访问服务端方法 1:新建一个控制台应用程序(ClientConsole) 2:用nuget安装SignalR.Client(必须,下面是nuget命令) I ...

  7. Linux-samba共享

    CentOS8 中 Samba环境搭建(满足Linux和Windows系统之间文件共享传输) Samba服务器通信协议(Server Messages Block)就是是为了解决局域网内的文件或打印机 ...

  8. centos/rockylinux/proxmoxve重置root密码 以及 在#bash 下 重启

    在 gurb 模式下,按[e]进入编辑页面 在 第3段 的末尾处添加以下代码,然后[Ctrl+X]即当前配置启动 init=/bin/bash 挂载,并使用命令重置密码 挂载 / mount -rw ...

  9. cpp chrono basic

    // cpp 20 //c++ - Number of seconds since midnight - Stack Overflow //https://stackoverflow.com/ques ...

  10. docker之安装tomcat

    国内Image仓库地址:https://hub.docker.com/search?q=tomcat 安装tomcat docker pull tomcat 查看Image docker images ...