XML
<resultMap id="getFilmInfoMap" type="com.stylefeng.guns.api.cinema.vo.FilmInfoVO">
<result column="film_id" property="filmId"></result>
<result column="film_name" property="filmName"></result>
<result column="film_length" property="filmLength"></result>
<result column="film_language" property="filmType"></result>
<result column="film_cats" property="filmCats"></result>
<result column="actors" property="actors"></result>
<result column="img_address" property="imgAddress"></result>
<collection property="filmFields" ofType="com.stylefeng.guns.api.cinema.vo.FilmFieldVO">
<result column="UUID" property="fieldId"></result>
<result column="begin_time" property="beginTime"></result>
<result column="end_time" property="endTime"></result>
<result column="film_language" property="language"></result>
<result column="hall_name" property="hallName"></result>
<result column="price" property="price"></result>
</collection>
</resultMap>
<select id="getFilmInfos" parameterType="java.lang.Integer" resultMap="getFilmInfoMap">
SELECT
info.film_id,
info.`film_name`,
info.`film_length`,
info.`film_language`,
info.`film_cats`,
info.`actors`,
info.`img_address`,
f.`UUID`,
f.`begin_time`,
f.`end_time`,
f.`hall_name`,
f.`price`
FROM
mooc_hall_film_info_t info
LEFT JOIN
mooc_field_t f
ON f.`film_id` = info.`film_id`
AND f.`cinema_id` = ${cinemaId}
</select>
Dao
List<FilmInfoVO> getFilmInfos(@Param("cinemaId") int cinemaId);
VO
@Data
public class FilmInfoVO implements Serializable {
private String filmId;
private String filmName;
private String filmLength;
private String filmType;
private String filmCats;
private String actors;
private String imgAddress;
private List<FilmFieldVO> filmFields;
}
@Data
public class FilmFieldVO implements Serializable {
private String fieldId;
private String beginTime;
private String endTime;
private String language;
private String hallName;
private String price;
}