Пример #1
0
        public string  GetUserList(string keywords, int page, int num)
        {
            var dbContext = DBHelperPool.Instance.GetDbHelper();

            if (dbContext == null)
            {
                return(JsonHelper.SerializeObject(ToolResult.Failure("数据连接异常!")));
            }

            var sql = @"
                    select a.*,c.Name as POSITIONNAME,b.ROLENAME as LEADERName,d.NAME as DEPARTMENTName   from PRIVS_USER  a
                left join PRIVS_DEPARTMENT d on a.DEPARTMENTID=d.id
                left join PRIVS_LEADER b on a.ID=b.USERID
                left join PRIVS_POSITION c on a.POSITIONID=c.ID  where 1=1 ";
            var sqlstringbuilder = new StringBuilder(sql);

            if (!string.IsNullOrEmpty(keywords))
            {
                sqlstringbuilder.AppendFormat("  and( a.REALNAME   like '%{0}%' or  a.NAME like '%{0}%' or b.ROLENAME like '%{0}%' or d.NAME like '%{0}%' and c.Name LIKE '%{0}%')", keywords);
            }
            sqlstringbuilder.AppendFormat(" order by CJSJ desc");
            var busness   = new CommonBaseBusiness();
            var pageModel = busness.Select(sqlstringbuilder.ToString(), (page - 1) * num, num);

            return(JsonHelper.SerializeObject(pageModel));
        }
Пример #2
0
        public string GetRoleList(string keyword, int page, int num)
        {
            var dbContext = DBHelperPool.Instance.GetDbHelper();

            if (dbContext == null)
            {
                return(JsonHelper.SerializeObject(ToolResult.Failure("数据连接异常!")));
            }
            var sql = "select * from PRIVS_ROLE where 1=1 ";
            var sqlstringbuilder = new StringBuilder(sql);

            if (!string.IsNullOrEmpty(keyword))
            {
                sqlstringbuilder.AppendFormat(" and (NAME like '%{0}%' or  ALIASNAME like '%{0}%') ", keyword);
            }

            sqlstringbuilder.AppendFormat(" order by  CJSJ desc");
            var busness   = new CommonBaseBusiness();
            var pageModel = busness.Select(sqlstringbuilder.ToString(), (page - 1) * num, num);

            return(JsonHelper.SerializeObject(pageModel));
        }
Пример #3
0
        public string GetDepartmentList(string keywords, int page, int num)
        {
            var dbContext = DBHelperPool.Instance.GetDbHelper();

            if (dbContext == null)
            {
                return(JsonHelper.SerializeObject(ToolResult.Failure("数据连接异常!")));
            }
            var sqlstringbuilder = new StringBuilder(@"select b.Name as PARENTNANE,a.* from PRIVS_DEPARTMENT a
left join PRIVS_DEPARTMENT b on a.PARENTID=b.ID  where 1=1");

            if (!string.IsNullOrEmpty(keywords))
            {
                sqlstringbuilder.AppendFormat(" and (a.NAME like '%{0}%' or a.ALIASNAME like '%{0}%') ", keywords);
            }

            sqlstringbuilder.AppendFormat(" order by a.CJSJ desc");
            var busness   = new CommonBaseBusiness();
            var pageModel = busness.Select(sqlstringbuilder.ToString(), (page - 1) * num, num);

            return(JsonHelper.SerializeObject(pageModel));
        }