问题描述
- Easyui datagrid 实现外键字段转义
-
推荐人,关联的是同一张表的ID,怎么让1显示张,
page = page == null ? 1 : page; rows = rows == null ? 1 : rows; List<TBL_M_SECURITY_STAFF> list = db.TBL_M_SECURITY_STAFF.OrderBy(a => a.Security_Staff_ID).Skip((Convert.ToInt32(page) - 1) * Convert.ToInt32(rows)).Take(Convert.ToInt32(rows)).ToList(); var json = new { total = db.TBL_M_SECURITY_STAFF.Count(), rows = list.Select(a => a) }; return Json(json, JsonRequestBehavior.AllowGet);
解决方案
解决方案二:
sql left join下自身取出推荐人名字
select t1.xx,t1.xxx,t1.xxxxx....,t2.推荐人名字
from yourtable t1
left join yourtable t2 on t2.推荐人id=t1.记录唯一id
时间: 2024-09-08 20:22:23