<insert id="insertPjCustomAttribute" parameterType="com.devops.server.model.PjCustomAttribute">
INSERT INTO
     `PJ_CUSTOM_ATTRIBUTE`
(PJ_ID,NAME,VALUE,CREATE_TIME)
VALUES
<foreach collection="list" item="listRelation" separator=",">
(#{listRelation.pjId},#{listRelation.name},#{listRelation.value},#{listRelation.createTime})
</foreach>
</insert>

此sql语句,mapper.java中的参数为List<PjCustomAttribute> list,插入时,parameterType是PjCustomAttribute的全路径。

在foreach中,collection是list,item是遍历出来的每个PjCustomAttribute对象,在这儿我起的名字叫listRelation(可随意起名),separator以逗号分隔

#{ }中是对象的属性

mapper.xml文件,sql语句参数为list的更多相关文章

  1. mybatis里的mapper,@Mapper参数,Mapper.xml文件 sql语句Select+where语句

    提示:有不清楚的可以试着看一下我最后的连接,是跟这些内容相关的 Mapper文件,特殊符号: 转义符号 原符号 中文意思 &It; < 小于号 > > 大于号 & & ...

  2. MyBatis绑定Mapper接口参数到Mapper映射文件sql语句参数

    一.设置paramterType 1.类型为基本类型 a.代码示例 映射文件: <select id="findShopCartInfoById" parameterType ...

  3. mybatis的Mapper.xml文件SQL语句BadSqlGrammarException之FUNCTION错误系列

    想必各位在开发过程中一定使用过:统计的功能,用到了很多SQL的函数,于是就直接写在Mapper文件中了: 比如: member_num,MAX(ID) AS newestLoanID,MIN (ID) ...

  4. Mybatis传多个参数(三种解决方案) mapper.xml的sql语句修改!

    第一种 Public User selectUser(String name,String area); 对应的Mapper.xml <select id="selectUser&qu ...

  5. idea 去除xml文件sql语句背景色

    怎么看idea mapper.xml中写sql语句的那种屎黄屎黄背景颜色不好看 去除背景色 把这两项勾选去掉,然后 把这个背景勾选也去掉,最后 把这个勾选也去掉 另一种方式: 也可以使用这种方式 al ...

  6. 如何去掉idea里mybatis的.xml文件 sql 语句背景色

    点击有背景的地方 Alt+Enter选择 un-inject Language/refence 即可去掉

  7. mybatis mapper文件sql语句传入hashmap参数

    1.怎样在mybatis mapper文件sql语句传入hashmap参数? 答:直接这样写map就可以 <select id="selectTeacher" paramet ...

  8. (转)MyBatis框架的学习(四)——Mapper.xml文件中的输入和输出映射以及动态sql

    http://blog.csdn.net/yerenyuan_pku/article/details/71893689 前面对MyBatis框架的学习中,我们对Mapper.xml映射文件多少有些了解 ...

  9. MyBatis的mapper.xml文件的参数问题:org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map

    配置参数类型有两种选择,即:parameterType和parameterMap 不管参数是否是基本数据类型还是map类型,都是使用parameterType. 版权声明:本文为博主原创文章,未经博主 ...

  10. SpringBoot项目里,让TKmybatis支持可以手写sql的Mapper.xml文件

    SpringBoot项目通常配合TKMybatis或MyBatis-Plus来做数据的持久化. 对于单表的增删改查,TKMybatis优雅简洁,无需像传统mybatis那样在mapper.xml文件里 ...

随机推荐

  1. FCC JS基础算法题(4):Title Case a Sentence(句中单词首字母大写)

    题目描述: 确保字符串的每个单词首字母都大写,其余部分小写.像'the'和'of'这样的连接符同理. 算法: function titleCase(str) { // 转小写及分割成数组 var st ...

  2. 根据ip获取地理信息

    function getIPLoc_sina($queryIP){    $url = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?form ...

  3. DG_数据文件转换参数测试

    本篇博客流程图: 一.测试需求及参数说明 二.测试环境进行相关测试 三.问题总结 一.测试需求及参数说明 1.1测试需求说明 DG切换 切换前,数据库版本12.2.0.1,主库rac两节点,备一rac ...

  4. scrapy框架之递归解析和post请求

    递归爬取解析多页页面数据 scrapy核心组件工作流程 scrapy的post请求发送 1.递归爬取解析多页页面数据 - 需求:将糗事百科所有页码的作者和段子内容数据进行爬取切持久化存储 - 需求分析 ...

  5. cocos2dx开发之util类&方法——字符串替换

    /*将originStr字符串中的searchStr替换成replaceStr*/ std::string str_replace(std::string originStr,std::string ...

  6. Linux 系统下使用dd命令备份还原MBR主引导记录

    https://en.wikipedia.org/wiki/Master_boot_recordhttps://www.cyberciti.biz/faq/howto-copy-mbr/https:/ ...

  7. web driver下载地址(selenium-3.141_浏览器版本对应)

    web driver: (Windows环境下) Firefox(上一目录可以找其他浏览器的driver) : 1)http://npm.taobao.org/mirrors/geckodriver/ ...

  8. java服务端的 极光推送

    项目中用到了极光推送  下面写下笔记 首先引入jar包   下载地址https://docs.jiguang.cn/jpush/resources/(非maven项目的下载地址) <depend ...

  9. c#获取汉字首字母拼音

    /* * 由SharpDevelop创建. * 用户: lenovo * 日期: 2013/10/22 * 时间: 20:15 * * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 */ ...

  10. Django项目在linux系统中虚拟环境部署

    1.在linux系统下,安装virtualenv 命令:pip install virtualenv 2.项目部署前的准备 1. Django web project deployment 1.1.  ...