//新增
<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. 【Go】发送请求

    发送post请求 reqMap := make(map[string]interface{}) reqMap["order_num"] = request.OutTradeNo r ...

  2. Java-根据父级id将List结构转Tree结构

    List的stream public ResultData queryMenuList() { // 获取所有数据List List<MenuVo> list = MenuDao.quer ...

  3. [iOS] iPhone,开发工具的一些杂项

    1.在safari的开发菜单里一直不显示我当前的iPhone,后来机缘巧合在 设置- 开发者 - Clear Trusted Computers ,重新信任电脑之后,就OK了(️)

  4. uni-app配置钉钉小程序步骤

    1.创建项目 2.在项目根目录配置或者新建package.json文件,配置代码 { "uni-app": { "scripts": { "mp-di ...

  5. Python的入门学习Day 10~13——form”夜曲编程“

    Day 10 time:2021.8.7. ​ 今天本来打算学习时发现手机应该拿去充电了,再上完J课程之后发现时间确实只留到了晚上呢 .但幸好,以我多天的敲代码的牢固根基(哈哈哈),我最终还是弥补回来 ...

  6. flutter tabbar指示器indicator宽度高度自定义

    在tabbar中indicator宽度是无法修改的,所以需要咱们去自定义indicator. 下面是自定义的代码,直接拷贝使用,已做好修改. // Copyright 2018 The Chromiu ...

  7. 解决elementplus carousel固定高度问题/ResizeObserverAPI介绍

    "element-plus": "^2.2.26", "@vueuse/components": "^9.7.0", 引 ...

  8. 排查前端接受后端的map产生的字段错误

    报错内容 [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingExce ...

  9. oracle 索引创建

    --查询表里的索引 select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.inde ...

  10. UI基础 - UIAppearance协议

    前言 1 - 在一些 app 中会涉及到更改外观设置的功能,最普遍的就是夜间模式和白天模式的切换,而对于外观的更改必定是一个全局的东西.这在 iOS5 以前想要实现这样的效果是比较困难的,但是 iOS ...