Newer
Older
bremer / src / main / resources / mapper / mapper.xml
yhornisse on 2 Jul 2023 2 KB add project
<?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="net.piedpiper.bremer">
  <resultMap id="AudioEntity" type="net.piedpiper.bremer.entity.AudioEntity">
    <id property="id" column="id"/>
    <result property="name" column="name"/>
    <result property="slug" column="slug"/>
    <result property="articleId" column="article_id"/>
    <result property="albumId" column="album_id"/>
    <result property="path" column="path"/>
    <association property="album" columnPrefix="album__" resultMap="AlbumEntity"/>
    <association property="artist" columnPrefix="artist__" resultMap="ArtistEntity"/>
  </resultMap>

  <resultMap id="ArtistEntity" type="net.piedpiper.bremer.entity.ArtistEntity">
    <id property="id" column="id"/>
    <result property="name" column="name"/>
  </resultMap>

  <resultMap id="AlbumEntity" type="net.piedpiper.bremer.entity.AlbumEntity">
    <id property="id" column="id"/>
    <result property="name" column="name"/>
  </resultMap>

  <resultMap id="AudioPlayHistoryEntity" type="net.piedpiper.bremer.entity.AudioPlayHistoryEntity">
    <id property="id" column="id"/>
    <result property="audioId" column="audio_id"/>
    <result property="lastPlayedAt" column="last_played_at"
      typeHandler="net.piedpiper.bremer.dao.handler.LocalDateTimeTypeHandler"/>
  </resultMap>

  <resultMap id="PlaylistEntity" type="net.piedpiper.bremer.entity.PlaylistEntity">
    <id property="id" column="id"/>
    <result property="albumId" column="album_id"/>
    <result property="slug" column="slug"/>
    <result property="name" column="name"/>
    <collection property="playlistAudio" columnPrefix="playlist_audio__"
      resultMap="PlaylistAudioEntity"/>
  </resultMap>

  <resultMap id="PlaylistAudioEntity" type="net.piedpiper.bremer.entity.PlaylistAudioEntity">
    <id property="id" column="id"/>
    <result property="playlistId" column="playlist_id"/>
    <result property="sequence" column="sequence"/>
    <result property="audioId" column="audio_id"/>
  </resultMap>

  <resultMap id="UserEntity" type="net.piedpiper.bremer.entity.UserEntity">
    <id property="id" column="id"/>
    <result property="name" column="name"/>
    <result property="secret" column="secret"/>
  </resultMap>
</mapper>