YL
2021-11-09 3a9f82bd8410419dc88bcbe621763ee7e494ed7c
WebAPI/Controllers/PublicPageMethodController.cs
@@ -1,10 +1,12 @@
using System;
using DBUtility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.UI.WebControls;
using WebAPI.Models;
namespace WebAPI.Controllers
@@ -122,9 +124,9 @@
        #endregion
        #region 选择用户基础资料
        #region 选择职员基础资料
        #region 条件查询用户列表
        #region 条件查询职员列表
        [Route("PublicPageMethod/UserList")]
        [HttpGet]
        public object UserList(string sWhere)
@@ -161,7 +163,7 @@
        }
        #endregion
        #region  根据树型id查找用户列表
        #region  根据树型id查找职员列表
        [Route("Gy_MaintenanceMode/UserCX")]
        [HttpGet]
        public object UserCX(long HInterID)
@@ -198,7 +200,7 @@
        }
        #endregion
        #region 树型列表用户列表数据
        #region 树型列表职员列表数据
        [Route("Gy_MaintenanceMode/UserLoadTree")]
        [HttpGet]
        public object UserLoadTree(string sWhere)
@@ -1442,13 +1444,13 @@
            {
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_EquipMent where HStopflag=0 Order by HItemID", "Gy_EquipMent");
                    ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain Order by HInterID", "Gy_EquipFileBillMain");
                }
                else
                {
                    string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_EquipMent where 1 = 1 ";
                    string sql1 = "Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 1 = 1 ";
                    string sql = sql1 + sWhere;
                    ds = oCN.RunProcReturn(sql, "Gy_EquipMent");
                    ds = oCN.RunProcReturn(sql, "HEquipFileNumber");
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
@@ -3310,7 +3312,129 @@
        #endregion
        #region 选择用户基础资料
    }
        #region 条件查询用户列表
        [Route("PublicPageMethod/PeopleList")]
        [HttpGet]
        public object PeopleList(string sWhere)
        {
            try
            {
                ds = oCN.RunProcReturn("Select czybm HNumber,czymc HName from h_v_Gy_UserList " + sWhere + " Order by czybm ", "h_v_Gy_UserList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无用户数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region 用户关联权限
        #region 条件查询权限列表
        [Route("PublicPageMethod/PowerList")]
        [HttpGet]
        public object PowerList(string czybm,string sGnbm)
        {
            try
            {
                string sName = "";
                if (sGnbm != "" && sGnbm != null)
                {
                     sName = sGnbm.Substring(1, sGnbm.Length - 1);
                    if (sName == "权限管理-用户")
                    {
                        sName = "";
                    }
                }
                ds = oCN.RunProcReturn("select * from  Gy_Czygl where czybm='" + czybm + "'", "Gy_Czygl");
                string AuthorityID = ClsPub.isStrNull(ds.Tables[0].Rows[0]["AuthorityID"]);
                ds = oCN.RunProcReturn("SELECT id hid,case when id<=" + AuthorityID.Length + " then case when SUBSTRING('" + AuthorityID + "',id,1)=1 then 1 else 0 end else 0 end 是否权限,gnms 功能说明,gnbm hgnbm FROM  xt_xtgnb where useflag=1 and sjgnbm='" + sName + "'  and rightflag=1  order by gnbm", "xt_xtgnb");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无功能列表数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 树型列表功能列表数据
        [Route("Gy_MaintenanceMode/PowerLoadTree")]
        [HttpGet]
        public object PowerLoadTree()
        {
            SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN();
            string sql = string.Format(@"select 'T权限管理-用户' id,'' HNumber,'权限管理--用户' title,'' ParentID, 'true' spread
                                         union all
                                         Select 'T'+gnbm id,gnsy HNumber,gnmc as title,case when sjgnbm<>null then sjgnbm else 'T权限管理-用户' end ParentID, 'true' spread
                                         from Xt_Xtgnb where useflag=1 and rightflag=1 and (gnbm NOT LIKE '99%') and sjgnbm='' and mjbz=0 ");
            ds = oCN.RunProcReturn(sql, "Xt_Xtgnb");
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无功能列表数据!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            else
            {
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        }
}