sql和配置 添加callSettersOnNulls这个属性没起作用
<select id="selectClassIdByUserId" resultType="entity.SysClass" parameterType="java.lang.Long">
select tc.class_id,c.`name` from(
select * from sys_teacher where user_id = #{user_id,jdbcType=BIGINT}) t left join
sys_teacher_class_subject tc on t.id = tc.teacher_id
left join sys_class c ON tc.class_id = c.id
where c.`status` = 1
</select>
<settings>
<setting name="cacheEnabled" value="true" />
<setting name="lazyLoadingEnabled" value="true" />
<setting name="multipleResultSetsEnabled" value="true" />
<setting name="useColumnLabel" value="true" />
<setting name="useGeneratedKeys" value="false" />
<setting name="defaultExecutorType" value="SIMPLE" />
<setting name="callSettersOnNulls" value="true" />
</settings>
返回的LIST
List<SysClass> classList = classs.selectClassIdByUserId(Long.parseLong(uid));结果如下:
[SysClass [id=null, name=小学二年级(1)班, schoolId=null, school=null, gradeId=null, remark=null, academicYear=null, status=null, chargeTeacherId=null, grade=null, chargeTeacher=null, students=null], SysClass [id=null, name=小学二年级(2)班, schoolId=null, school=null, gradeId=null, remark=null, academicYear=null, status=null, chargeTeacherId=null, grade=null, chargeTeacher=null, students=null]]