<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="dao.FileTypeIDao">
<resultMap id="fileTypeMapper" type="entity.FilmType">
<result property="typeId" column="typeid"></result>
<result property="typeName" column="typeName"></result>
<collection property="flims" javaType="entity.FilmInfo" column="fitypeid">
<result property="flimId" column="flimid"></result>
<result property="filmName" column="flimname"></result>
<result property="actor" column="actor"></result>
<result property="direCtor" column="director"></result>
<result property="ticketPrice" column="ticketprice"></result>
<result property="typeId" column="fitypeid"></result>
</collection>
</resultMap>
<select id="getFilmType" resultMap="fileTypeMapper">
<!-- 这里的SQL结尾不能加分号,否则报"ORA-00911错误" -->
select fi.typeid as fitypeid ,ft.typeid as fttypeid , fi.* , ft.* from filminfo fi, filmtype ft where fi.typeid=ft.typeid
</select>
</mapper>
myBatis一对多
最新推荐文章于 2022-05-22 01:02:37 发布