yusijie
2024-10-23 a791fe4183fd04c67ed2277303a56fd646583d88
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
using System.Threading.Tasks;
using DLL;
 
namespace WebAPI.Controllers.人事管理.人员履历
{
    public class HR_PersonnelResumeController : ApiController
    {
     
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
 
        #region 人员履历报表
 
        /// <summary>
        /// 人员履历报表
        /// </summary>
        /// <returns></returns>
        [Route("HR_PersonnelResumeController/GetHR_PersonnelResumeList")]
        [HttpGet]
        public object GetHR_PersonnelResumeList(string sWhere)
        {
            try
            {
 
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
 
                string HNumber = dic["HNumber"].ToString();//职员代码
                string HName = dic["HName"].ToString();//职员
 
                ds = oCN.RunProcReturn("exec h_p_HR_PersonnelResumeReport '" + HNumber.ToString() + "','" + HName + "'", "h_p_HR_PersonnelResumeReport");
                List<object> columnNameList = new List<object>();
                // 遍历所有表
                foreach (DataTable table in ds.Tables)
                {
                    List<object> tableColumnList = new List<object>();
 
                    // 添加列名
                    foreach (DataColumn col in table.Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        tableColumnList.Add(JsonConvert.DeserializeObject(ColmString));
                    }
 
                    // 将每个表的列名列表添加到总列名列表
                    columnNameList.Add(new { TableName = table.TableName, Columns = tableColumnList });
                }
 
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功!";
                objJsonResult.data = ds;
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "返回报表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
 
    }
}