一、设置自增id
- 在navicat设计表里面把主键id设为自动递增
mapper.xml在insert的语句加useGeneratedKeys=”true” keyProperty=”id”这两个属性
<insert id="insertErrorLog" parameterType="ErrorLog" useGeneratedKeys="true" keyProperty="id">insert into sys_log(method,url,params,create_date,create_by)values (#{method},#{url},#{params},#{createDate},#{createBy})</insert>
二、数据查询映射
如果符合驼峰命名原则,可以使用在application.properties里加上
mybatis.configuration.map-underscore-to-camel-case: true
就不用写别名了
三、新版本idea没有xml文件
在Settings->Editor->File and Code Templates里增加xml文件
