From用SQL Join连表的写法(多个字段)

2017-04-27 10:00:35  访问(1469) 赞(0) 踩(0)

/*

select 
tu.ID, tu.TheName, tu.TheCode, 
tu.UserName, tu.PingYin, tu.CallName, 
tu.ItemSeq, tu.EmUserTypeV, tu.EmGenderV, 
tu.Dep_Id, tu.DepName, tu.Position_Id, 
tu.PositionName, tu.Category_Id, tu.CategoryName, 
tu.Rank_Id, tu.RankName, tu.RankTitlle, 
tu.Birthday, tu.Education_Id, tu.SchoolName, 
tu.MajorName, tu.StartTime, tu.Email, 
tu.TheTel, tu.EmUserSyncTypeV, tu.TBZD, 
tu.TB_Time, tu.Remark, tu.InputUserId, 
tu.CreateTime, tu.LastUpdateUserId, tu.UpdateTime
from UTB_SZDF_HR_ZZGL t left join 
UTB_SZDF_HR_USER_ITEM tu 
on t.User_Item_Id = tu.ID and 
t.InputUserId = tu.InputUserId

*/

 eKing.SzdfLib.Business.HR.UTB_SZDF_HR_ZZGL
                bll = eKing.SzdfLib.Business.HR.UTB_SZDF_HR_ZZGL.instance;

            eKing.SzdfLib.Entity.HR.UTB_SZDF_HR_ZZGL
                entity
                =
                new eKing.SzdfLib.Entity.HR.UTB_SZDF_HR_ZZGL();

            eKing.SzdfLib.Entity.HR.UTB_SZDF_HR_USER_ITEM
                userEntity
                =
                new eKing.SzdfLib.Entity.HR.UTB_SZDF_HR_USER_ITEM();

            IFromTableDriver ifrom = entity;
            ISelectDriver iselect = entity;

            string leftName = entity._User_Item_Id._Name+"|"+entity._InputUserId._Name;
            string rightName = userEntity._ID._Name + "|" + userEntity._InputUserId._Name;

            ifrom.AddIFromTableItemWithBaseEntity4More
                (
                    "tu", 
                    userEntity, SlowX.Core.Enums.SqlJoin.EmSqlJoin.LeftJoin,
                    leftName,
                    rightName
                );

            DBInvokeParameter dbInvoke = bll.BuildDBInvokeParameterList(entity, xdbHelper);

            if (dbInvoke == null)
                return OperResult.ToSucc("null");
            else
                return OperResult.ToSucc(dbInvoke.SQL);


标签:From用SQL Join连表的写法(多个字段) 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)