org.apache.ibatis.annotations.One Java Examples

The following examples show how to use org.apache.ibatis.annotations.One. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubmissionMapper.java    From voj with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 通过评测记录唯一标识符获取试题对象.
 * @param submissionId - 评测记录的唯一标识符
 * @return 一个评测记录对象
 */
@Select("SELECT * FROM voj_submissions WHERE submission_id = #{submissionId}")
@Options(useCache = true)
@Results({
	@Result(property = "submissionId", column = "submission_id"),
	@Result(property = "problem", column = "problem_id", javaType = Problem.class, one = @One(select="org.verwandlung.voj.judger.mapper.ProblemMapper.getProblem")),
	@Result(property = "uid", column = "uid"),
	@Result(property = "language", column = "language_id", javaType=Language.class, one = @One(select="org.verwandlung.voj.judger.mapper.LanguageMapper.getLanguageUsingId")),
	@Result(property = "submitTime", column = "submission_submit_time"),
	@Result(property = "executeTime", column = "submission_execute_time"),
	@Result(property = "usedTime", column = "submission_used_time"),
	@Result(property = "usedMemory", column = "submission_used_memory"),
	@Result(property = "judgeResultSlug", column = "submission_judge_result"),
	@Result(property = "judgeScore", column = "submission_judge_score"),
	@Result(property = "judgeLog", column = "submission_judge_log"),
	@Result(property = "code", column = "submission_code"),
})
Submission getSubmission(@Param("submissionId") long submissionId);
 
Example #2
Source File: AccountMapper.java    From code with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @return
 */
@Select("select * from account")
@Results(id="accountMap",
        value= {
                @Result(id=true,column="id",property="id"),
                @Result(column="uid",property="uid"),
                @Result(column="money",property="money"),
                @Result(column="uid",
                        property="user",
                        one=@One(select="cn.lastwhisper.mybatis.annotation.manytable.dao.UserMapper.findById",
                                fetchType= FetchType.LAZY)
                )
        })
List<Account> findAll();
 
Example #3
Source File: MapperWithOneAndMany.java    From mybaties with Apache License 2.0 5 votes vote down vote up
@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();
 
Example #4
Source File: UserMapper.java    From voj with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 通过用户名获取用户对象.
 * @param username - 用户名
 * @return 预期的用户对象或空引用
 */
@Select("SELECT * FROM voj_users WHERE username = #{username}")
@Options(useCache = false)
@Results(value = {
	@Result(property = "userGroup", column = "user_group_id", javaType = UserGroup.class, one = @One(select="org.verwandlung.voj.judger.mapper.UserGroupMapper.getUserGroupUsingId")),
	@Result(property = "preferLanguage", column = "prefer_language_id", javaType = Language.class, one = @One(select="org.verwandlung.voj.judger.mapper.LanguageMapper.getLanguageUsingId"))
})
User getUserUsingUsername(@Param("username") String username);
 
Example #5
Source File: MapperWithOneAndMany.java    From mybatis with Apache License 2.0 5 votes vote down vote up
@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();