首页 > 数据库 >postgresql批量新增或更新的sql语句(Mapper实现)

postgresql批量新增或更新的sql语句(Mapper实现)

时间:2022-12-27 17:35:21浏览次数:43  
标签:Mapper postgresql name sql selenium water item time ammonia

  1     @Insert({"<script>" +
  2             "<foreach collection=\"list\" item=\"item\" separator=\";\"> " +
  3             "INSERT INTO sc_water_month (\n" +
  4             "id,\n" +
  5             "section_name,\n" +
  6             "section_code,\n" +
  7             "province_name,\n" +
  8             "province_code,\n" +
  9             "city_name,\n" +
 10             "city_code,\n" +
 11             "basin_name,\n" +
 12             "river_name,\n" +
 13             "result,\n" +
 14             "analyse_item,\n" +
 15             "water_quality,\n" +
 16             "water_temperature,\n" +
 17             "ph,\n" +
 18             "dissolved_oxygen,\n" +
 19             "conductivity,\n" +
 20             "turbidity,\n" +
 21             "permanganate_index,\n" +
 22             "cod,\n" +
 23             "five_day_bod,\n" +
 24             "ammonia,\n" +
 25             "total_phosphorus,\n" +
 26             "total_nitrogen,\n" +
 27             "cu,\n" +
 28             "zn,\n" +
 29             "fluoride,\n" +
 30             "selenium,\n" +
 31             "arsenic,\n" +
 32             "hg,\n" +
 33             "cadmium,\n" +
 34             "hexavalent_chrome,\n" +
 35             "pb,\n" +
 36             "cyn,\n" +
 37             "volatile_phenol,\n" +
 38             "petroleum,\n" +
 39             "anion_active_agent,\n" +
 40             "sulphide,\n" +
 41             "data_time,\n" +
 42             "create_time,\n" +
 43             "update_time\n" +
 44             ")\n" +
 45             "VALUES\n" +
 46             "(#{item.id},\n" +
 47             "#{item.sectionName},\n" +
 48             "#{item.sectionCode},\n" +
 49             "#{item.provinceName},\n" +
 50             "#{item.provinceCode},\n" +
 51             "#{item.cityName},\n" +
 52             "#{item.cityCode},\n" +
 53             "#{item.basinName},\n" +
 54             "#{item.riverName},\n" +
 55             "#{item.result},\n" +
 56             "#{item.analyseItem},\n" +
 57             "#{item.waterQuality},\n" +
 58             "#{item.waterTemperature},\n" +
 59             "#{item.ph},\n" +
 60             "#{item.dissolvedOxygen},\n" +
 61             "#{item.conductivity},\n" +
 62             "#{item.turbidity},\n" +
 63             "#{item.permanganateIndex},\n" +
 64             "#{item.cod},\n" +
 65             "#{item.fiveDayBod},\n" +
 66             "#{item.ammonia},\n" +
 67             "#{item.totalPhosphorus},\n" +
 68             "#{item.totalNitrogen},\n" +
 69             "#{item.cu},\n" +
 70             "#{item.zn},\n" +
 71             "#{item.fluoride},\n" +
 72             "#{item.selenium},\n" +
 73             "#{item.arsenic},\n" +
 74             "#{item.hg},\n" +
 75             "#{item.cadmium},\n" +
 76             "#{item.hexavalentChrome},\n" +
 77             "#{item.pb},\n" +
 78             "#{item.cyn},\n" +
 79             "#{item.volatilePhenol},\n" +
 80             "#{item.petroleum},\n" +
 81             "#{item.anionActiveAgent},\n" +
 82             "#{item.sulphide},\n" +
 83             "#{item.dataTime},\n" +
 84             "#{item.createTime},\n" +
 85             "#{item.updateTime}\n" +
 86             " ) ON conflict (section_name, city_name, data_time) DO\n" +
 87             "UPDATE \n" +
 88             "SET \n" +
 89             "water_quality=#{item.waterQuality},\n" +
 90             "water_temperature=#{item.waterTemperature},\n" +
 91             "ph=#{item.ph},\n" +
 92             "dissolved_oxygen=#{item.dissolvedOxygen},\n" +
 93             "conductivity=#{item.conductivity},\n" +
 94             "turbidity=#{item.turbidity},\n" +
 95             "permanganate_index=#{item.permanganateIndex},\n" +
 96             "cod=#{item.cod},\n" +
 97             "five_day_bod=#{item.fiveDayBod},\n"+
 98             "ammonia=#{item.ammonia},\n"+
 99             "total_phosphorus=#{item.totalPhosphorus},\n" +
100             "total_nitrogen=#{item.totalNitrogen},\n"+
101             "cu=#{item.cu},\n"+
102             "zn=#{item.zn},\n"+
103             "fluoride=#{item.fluoride},\n"+
104             "selenium=#{item.selenium},\n"+
105             "arsenic=#{item.arsenic},\n"+
106             "hg=#{item.hg},\n"+
107             "cadmium=#{item.cadmium},\n"+
108             "hexavalent_chrome=#{item.hexavalentChrome},\n"+
109             "pb=#{item.pb},\n"+
110             "cyn=#{item.cyn},\n"+
111             "volatile_phenol=#{item.volatilePhenol},\n"+
112             "petroleum=#{item.petroleum},\n"+
113             "anion_active_agent=#{item.anionActiveAgent},\n"+
114             "sulphide=#{item.sulphide},\n"+
115             "data_time=#{item.dataTime},\n"+
116             "create_time=#{item.createTime},\n"+
117             "update_time=#{item.updateTime}\n"+
118             "</foreach>" +
119             "</script>"})
120     void insertOrUpdateBatch(@Param("list") List<ScWaterDO> list);

 

标签:Mapper,postgresql,name,sql,selenium,water,item,time,ammonia
From: https://www.cnblogs.com/Yoona520/p/17008580.html

相关文章

  • mysql的基本操作
    #mysql的基本操作###配置文件```mysql[mysqld]tmpdir=/mysql/tmp/basedir=/mysqldatadir=/mysql/datasymbolic-links=0character_set_server=utf8mb4sql_mode=NO_ENGIN......
  • SQL Server JSON 转行 后转列
    1.使用ParseJsonFuncJSON转行USE[DataIntegration]GOCREATEFUNCTION[dbo].[ParseJsonFunc](@jsonnvarchar(max))RETURNS@hierarchytable(object_idintNOT......
  • SQL Server分割函数
       USE[数据库名]GOcreatefunction[dbo].[f_split](@cvarchar(2000),--需要分割的字符串(例如:1,2,3,4,5我|和|你)@splitvarchar(2)--分隔符(例如,......
  • sqlite3 执行带参数的sql语句
    c=conn.cursor()#获取游标sql1='''insertintocompany(id,name,age,address,salary)values(?,?,?,?,?)'''arg=(None,'王五',32,'天堂',......
  • SQL Server标量函数例子
    SQLServer的函数是非常实用的功能,简单的有自带的Convert等类型转换的函数,如果需要复杂点的功能则需要用户自定义函数。自定义函数又分为表值函数、标量函数等,其中标量函......
  • Mysql的个人总结
    一、Mysql查询语句--查询Mysql所有库中所有表的系统信息SELECT*FROMINFORMATION_SCHEMA.TABLES;--查询Mysql具体表的最新更新时间SELECTUPDATE_TIMEFROM......
  • python mysql操作,更新数据
    importmysql.connectortest_db=mysql.connector.connect(host="localhost",user="root",passwd="123456",database="test")test_cursor=test_db.cursor()将......
  • 第01章_Linux下MySQL的安装与使用
    第01章_Linux下MySQL的安装与使用1.安装前说明1.1Linux系统的准备安装并启动好两台虚拟机:CentOS7安装有Xshell和Xftp等访问CentOS系统的工具CentOS6和CentOS......
  • 找出PostgreSQL schema变更差异
    管理PostgreSQL的例行操作之一是定期更新数据库系统的架构。PostgreSQL在更新schema、添加type、函数、触发器或修改表添加和删除列、更新列数据类型等方面提供了可靠的方......
  • 火山引擎工具技术分享:用 AI 完成数据挖掘,零门槛完成 SQL 撰写
     更多技术交流、求职机会,欢迎关注字节跳动数据平台微信公众号,并进入官方交流群文/DataWind团队封声 在使用BI工具的时候,经常遇到的问题是:“不会SQL怎么......