今日份鸡汤:
即使爬到最高的山上,一次也只能脚踏实地地迈一步~
项目中遇到场景:执行一个sql,返回值中有一个Long的list,实现如下:
Bean:
public class TestBean implements Serializable {
private Long id;
private List<Long> treeIdList;
}
resultMap:
<select id="getTestBean" resultMap="getTestBean">
SELECT id, tree_id FROM test
</select>
<resultMap id="getTestBean" type="com.mytest.TestBean">
<id column="id" jdbcType="BIGINT" property="id" />
<collection column="tree_id" property="treeIdList" ofType="long">
<result column="tree_id" />
</collection>
</resultMap>
网友评论