::: hljs-right DATE: November 7, 2024 :::
Entity中的属性命名不能有下划线,
@TableId
private Long classid;
private String classname;
private Long teacherid;
private Long registrationcode;
public void setTeacherid(Long teacherid) {
this.teacherid = teacherid;
}
如果sql中列是有下划线的,在`.xml`中映射即可,
```xml
<resultMap type="com.entity.ClassEntity" id="classesMap">
<result property="classid" column="class_id"/>
<result property="classname" column="class_name"/>
<result property="teacherid" column="teacher_id"/>
<result property="registrationcode" column="registration_code"/>
</resultMap>
感谢coder_wccc: https://blog.csdn.net/qq_36428437/article/details/75309227?spm=1001.2014.3001.5502