实体类插入数据库,持久层下横杠_自动匹配驼峰命名方法

[复制链接]
admin 发表于 2025-9-13 16:33:29 | 显示全部楼层 |阅读模式
实体类插入数据库,持久层下横杠_自动匹配驼峰命名方法

代码:
  1. @Insert("insert into employee (username, name, password, phone, sex, id_number, status, create_time, update_time, create_user, update_user) " +
  2.             "values (#{username}, #{name}, #{password}, #{phone}, #{sex}, #{idNumber}, #{status}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
  3.     void insert(Employee employee);
复制代码

记得配置文件yml:
  1. mybatis:
  2.   #mapper配置文件
  3.   mapper-locations: classpath:mapper/*.xml
  4.   type-aliases-package: com.sky.entity
  5.   configuration:
  6.     #开启驼峰命名
  7.     map-underscore-to-camel-case: true
复制代码

网站建设,公众号小程序开发,多商户单商户小程序制作,高端系统定制开发,App软件开发联系我们【手机/微信:17817817816
微信扫码

网站建设,公众号小程序开发,商城小程序,系统定制开发,App软件开发等

粤ICP备2024252464号

在本版发帖
微信扫码
QQ客服返回顶部
快速回复 返回顶部 返回列表