1
wangbin
2024-07-08 5a01014dc116813fd4ea05b61e1eb6eec669f95d
WebAPI/Controllers/²Ö´æ¹ÜÀí/ίÍâÓÃÁÏ/WW_PPBomBillController.cs
@@ -1,4 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@@ -26,6 +28,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();  //定义声明变量 ï¼ŒæŠŠé€šè¿‡ new List<object>()创建的 å®žä¾‹ï¼Œèµ‹å€¼ç»™å˜é‡
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("WW_PPBomBill_Query", 1, false, user))
                {
@@ -37,20 +40,29 @@
                }
                ds = WW_PPBomBillList(sWhere);
                if (ds == null)
                if (ds.Tables[0].Rows.Count != 0 || ds != null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询数据异常,请与管理员联系!";
                    objJsonResult.data = null;
                    foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用
                    {
                        Type dataType = col.DataType; //获取当前数据类型传入 è‡ªå®šä¹‰å˜é‡datadataType
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接         // å°†åˆ—名和数据类型信息拼接成一个JSON格式的字符串
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性
                    objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无数据";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
@@ -76,8 +88,11 @@
                string sql = sql1 + sWhere + " order by hmainid desc";
                return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_WW_PPBomBillList");
            }
        }
        #endregion
    }
        }
                }
    #endregion
}