4

Mybatis 可以直接 insert List<Map<String, String>> 数据吗

 1 year ago
source link: https://www.v2ex.com/t/903850
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Java

Mybatis 可以直接 insert List<Map<String, String>> 数据吗

  ubuntuGary · 1 小时 3 分钟前 · 434 次点击

刚接手一个旧项目,有个业务是从 Excle 读取数据插入数据库,读取 Excle 数据的方法已经实现了,返回的是 List<Map<String, String>>类型,数据与 mysql 表是一一对应的,我能直接定义一个数据表的 mapper.xml 将数据 insert 到 Mysql 吗,现在的问题是表结构字段类型存在 int 、float 、datatime 等类型,直接 insert 会不会自动转换到 int 类型( Mysql )?当然更好的做法是先转成 List<Bean>再插入,我只是想偷个懒。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK