<resultMap id="getListItem" type="com.strcpy_s.bean.VO.QuestionListItem">
<!-- <id property="problemId" column="problemId"/>-->
<!-- <result property="name" column="name"/>-->
<!-- <result property="brief" column="brief"/>-->
<collection property="tags" ofType="java.lang.String" column="problemId" javaType="ArrayList"
select="com.strcpy_s.dao.QuestionTagDao.selectTagsByProblemId"/>
</resultMap>
<select id="selectQuestionItems" resultMap="getListItem">
select questions.problemId as problemId, questions.name as name, questions.brief as brief
from questions
where teacherId=#{teacherId}
</select>
java web学习笔记: mybatis <resultMap>应用
最新推荐文章于 2022-08-24 18:03:34 发布
本文详细介绍了MyBatis中resultMap元素的配置,包括如何映射查询结果到Java对象,以及通过collection属性使用select子标签来获取问题的标签集合。内容主要涉及SQL查询、参数绑定以及resultMap的高级用法。
摘要由CSDN通过智能技术生成