@Select("SELECT ID, KEY, CREATED, MODIFIED, NAME, DOMAIN, TYPE, DESCRIPTION, OWNER, CUSTOM_1 ,CUSTOM_2 ,CUSTOM_3 ,CUSTOM_4 ,ORG_LEVEL_1 ,ORG_LEVEL_2 ,ORG_LEVEL_3 ,ORG_LEVEL_4 FROM WORKBASKET WHERE ID = #{id}") @Results(value = { @Result(property = "id", column = "ID"), @Result(property = "key", column = "KEY"), @Result(property = "created", column = "CREATED"), @Result(property = "modified", column = "MODIFIED"), @Result(property = "name", column = "NAME"), @Result(property = "domain", column = "DOMAIN"), @Result(property = "type", column = "TYPE"), @Result(property = "description", column = "DESCRIPTION"), @Result(property = "owner", column = "OWNER"), @Result(property = "distributionTargets", column = "ID", javaType = List.class, many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")), @Result(property = "custom1", column = "CUSTOM_1"), @Result(property = "custom2", column = "CUSTOM_2"), @Result(property = "custom3", column = "CUSTOM_3"), @Result(property = "custom4", column = "CUSTOM_4"), @Result(property = "orgLevel1", column = "ORG_LEVEL_1"), @Result(property = "orgLevel2", column = "ORG_LEVEL_2"), @Result(property = "orgLevel3", column = "ORG_LEVEL_3"), @Result(property = "orgLevel4", column = "ORG_LEVEL_4")}) WorkbasketImpl findById(@Param("id") String id);
@Select("SELECT ID, KEY, CREATED, MODIFIED, NAME, DOMAIN, TYPE, DESCRIPTION, OWNER, CUSTOM_1 ,CUSTOM_2 ,CUSTOM_3 ,CUSTOM_4 ,ORG_LEVEL_1 ,ORG_LEVEL_2 ,ORG_LEVEL_3 ,ORG_LEVEL_4 FROM WORKBASKET WHERE KEY = #{key}") @Results(value = { @Result(property = "id", column = "ID"), @Result(property = "key", column = "KEY"), @Result(property = "created", column = "CREATED"), @Result(property = "modified", column = "MODIFIED"), @Result(property = "name", column = "NAME"), @Result(property = "domain", column = "DOMAIN"), @Result(property = "type", column = "TYPE"), @Result(property = "description", column = "DESCRIPTION"), @Result(property = "owner", column = "OWNER"), @Result(property = "distributionTargets", column = "ID", javaType = List.class, many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")), @Result(property = "custom1", column = "CUSTOM_1"), @Result(property = "custom2", column = "CUSTOM_2"), @Result(property = "custom3", column = "CUSTOM_3"), @Result(property = "custom4", column = "CUSTOM_4"), @Result(property = "orgLevel1", column = "ORG_LEVEL_1"), @Result(property = "orgLevel2", column = "ORG_LEVEL_2"), @Result(property = "orgLevel3", column = "ORG_LEVEL_3"), @Result(property = "orgLevel4", column = "ORG_LEVEL_4")}) WorkbasketImpl findByKey(@Param("key") String key);
@Select({ "SELECT *", "FROM blog" }) @Results({ @Result( property = "author", column = "author_id", one = @One(select = "org.apache.ibatis.binding.BoundAuthorMapper.selectAuthor"), many = @Many(select = "selectPostsById")) }) List<Blog> selectWithBothOneAndMany();
/** * Get user with authentication details by username * * @param username * @return */ @Select(value = "select u.id, u.username, u.password from users u where username=#{username}") @Results(value = { @Result(column = "id", property = "id", javaType = Long.class), @Result(column = "id", property = "authorities", javaType = List.class, many = @Many(select = "dev.axt.demo.mapper.UserMapper.getUserRoles")) }) public UserAuth getUserAuthByUsername(@Param("username") String username);