1 package net.elgekko.mediacube.integration.amc;
4 import org.apache.ibatis.annotations.Mapper;
5 import org.apache.ibatis.annotations.Result;
6 import org.apache.ibatis.annotations.Results;
7 import org.apache.ibatis.annotations.SelectProvider;
8 import org.apache.ibatis.jdbc.SQL;
9 import org.apache.ibatis.type.JdbcType;
11 import java.text.ParseException;
12 import java.util.List;
15 public interface MediaWithMediaFileMapper {
17 @SelectProvider(type = WebUsersViewProvider.class, method = "get")
19 @Result(property = "media.id", column = "id", jdbcType = JdbcType.BIGINT, id = true),
20 @Result(property = "media.archived", column = "archived", jdbcType = JdbcType.TIMESTAMP),
21 @Result(property = "mediaFile.id", column = "mfid", jdbcType = JdbcType.BIGINT, id = true),
22 @Result(property = "mediaFile.lastmodified", column = "lastmodified", jdbcType = JdbcType.TIMESTAMP)
24 public List<MediaWithMediaFile> get();
26 public class WebUsersViewProvider {
27 public String get() throws ParseException {
29 sql.SELECT("m.id", "m.archived", "mf.id mfid", "mf.lastmodified");
31 sql.LEFT_OUTER_JOIN("mediafile mf ON (mf.mediaId = m.id)");
32 sql.WHERE("m.archived < '2120-09-03 00:00:00'");
33 sql.ORDER_BY("m.archived DESC");
34 return sql.toString();