首页 > 其他 > 详细

IBatis一对多查询

时间:2016-05-27 20:23:25      阅读:229      评论:0      收藏:0      [点我收藏+]
namespace IBatis { public class User { public int UserId { get; set; } public string UserName { get; set; } } public class UserRight { public int UserRightId { get; set; } public int UserId { get; set; } public int RightId { get; set; } public string RightName { get; set; } } public class UserRightJoin { public int UserId { get; set; } public string UserName { get; set; } public IList UserRights { get; set; } } } 在Mapper的UserRight.xml中 在 sqlmap.config 然后是 DAO public class BaseDao { public static ISqlMapper _sqlMap = null; static BaseDao() { _sqlMap = Mapper.Instance(); } } public class UserDao : BaseDao { public IList GetList() { ISqlMapper mapper = _sqlMap; IList ListPerson = mapper.QueryForList("selectAllUserRight", null); //这个"selectAllUserRight"就是xml映射文件的Id return ListPerson; } } 最后是调用 static void Main(string[] args) { UserDao ud=new UserDao(); var lst= ud.GetList(); }

IBatis一对多查询

原文:http://www.cnblogs.com/zhshlimi/p/5535788.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!