public IList<dynamic> GetFlowAuths(decimal flowId) { using (var ctx = new OAContext()) { var x = new { flow_id = 1m, auth_to = 1m, auth_to_name = "" }; var t = x.GetType(); var re = ctx.SqlDynamic(string.Format(@" select fa.*,nvl(o.org_name,'') || nvl(d.dept_name,'') || nvl(r.role_name,'') as auth_name from t_flow_auth fa left join t_org o on fa.auth_to = o.org_id left join t_dept d on fa.auth_to = d.dept_id left join t_role r on fa.auth_to = r.role_id where fa.flow_id={0}", flowId)); return re; } }
public IList<dynamic> GetFlowStepAuths(decimal flowId) { using (var ctx = new OAContext()) { var re = ctx.SqlDynamic(string.Format(@" select sa.*, (r.role_name || d.dept_name || o.org_name) as auth_to_name from t_step_auth sa inner join t_step s on sa.step_id = s.step_id left join t_role r on sa.auth_to = {1} and sa.auth_to = r.role_id left join t_dept d on sa.auth_to = {2} and sa.auth_to = d.dept_id left join t_org o on sa.auth_to = {3} and sa.auth_to = o.org_id where s.rs = 1 and s.flow_id = {0} ", flowId, Tag.StepTag.StepAuth.AuthRole, Tag.StepTag.StepAuth.AuthDept, Tag.StepTag.StepAuth.AuthOrg)); return re; } }