using Lskj.Core; using Lskj.Model; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; namespace Lskj.Control { public class DataImpl { #region 接口相关操作 public DataTable GetApis(OperateEvent ev, string moduleId, int? dir = null, String msgId = "", string method = "") { string sql = @"select api.*,cfg.formkey,cfg.tablename,cfg.apitabname,cfg.datasql,cfg.synidfields,cfg.moduleid from p_systemApiTab api inner join p_systemApiCfgTab cfg on api.cfgId=cfg.id where 1=1 "; if (ev != default(OperateEvent)) { sql = string.Format("{0} and api.opEvent='{1}'", sql, (int)ev); } if (!string.IsNullOrEmpty(moduleId)) { sql = string.Format("{0} and cfg.moduleId='{1}'", sql, moduleId); } if (dir != null) { sql = string.Format("{0} and api.direction in ({1})", sql, dir == (int)DirType.Receive ? string.Format("{0},{1}", (int)DirType.Receive, (int)DirType.PassivePush) : dir + ""); } if (!string.IsNullOrEmpty(msgId)) { sql = string.Format("{0} and api.msgId='{1}'", sql, msgId); } if (!string.IsNullOrEmpty(method)) { sql = string.Format("{0} and api.method='{1}'", sql, method); } return SqlHelper.ExecuteDataTable(sql); } public DataTable GetApiDetail(int apiId) { string sql = string.Format("select * from p_systemApiDetailTab where itemId='{0}'", apiId); return SqlHelper.ExecuteDataTable(sql); } public DataTable GetApiFields(string formKey) { string sql = string.Format("select * from p_systemApiFieldTab where unionKey='{0}'", formKey); return SqlHelper.ExecuteDataTable(sql); } #endregion } }