2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
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
86
87
using iWareCommon.Common.Dao;
using iWareExcel.EXCEL.Entity;
using iWareExcel.ORM;
using System.Collections.Generic;
using System.Linq;
 
namespace iWareExcel.EXCEL.Dao
{
    public class WorkSheetDao : CommonDao<WorkSheetEntity, EXCELWorkSheet>
    {
        private static object Lock = new object();
 
        private WorkSheetDao() { }
 
        private static WorkSheetDao Instance = null;
 
        /// <summary>
        /// 获取单例的方法
        /// </summary>
        /// <returns>角色服务的单例实体</returns>
        public static WorkSheetDao GetInstance()
        {
 
            if (Instance == null)
            {
                lock (Lock)
                {
                    if (Instance == null)
                    {
                        Instance = new WorkSheetDao();
                    }
                }
            }
            return Instance;
        }
 
 
        /// <summary>
        /// 该方法获取在WorkSheetEntity和ORM的EXCELWorkSheet之间字段的对应关系
        /// </summary>
        protected override string GetColumnName(string name)
        {
            return WorkSheetEntity.GetColumnName(name);
        }
 
 
        /// <summary>
        /// 获取WorkSheetEntity中属性名列表
        /// </summary>
        /// <returns>WorkSheetEntity中属性名列表</returns>
        protected override List<string> GetColumnNames()
        {
            return WorkSheetEntity.GetColumnMap().Keys.ToList();
        }
 
 
        /// <summary>
        /// 将orm转为WorkSheetEntity中的实体
        /// </summary>
        /// <param name="t">orm中的EXCELWorkSheet类</param>
        /// <returns>WorkSheetEntity</returns>
        protected override WorkSheetEntity ToEntity(EXCELWorkSheet s)
        {
            return new WorkSheetEntity(s);
        }
 
 
        /// <summary>
        /// 将WorkSheetEntity转为ORM中的EXCELWorkSheet
        /// </summary>
        /// <param name="t">WorkSheetEntity类</param>
        /// <returns>orm中的EXCELWorkSheet类</returns>
        protected override EXCELWorkSheet ToOrm(WorkSheetEntity t)
        {
            return t.ToOrm();
        }
 
 
        /// <summary>
        /// 获取在WorkSheetEntity和ORM中的EXCELWorkSheet之间字段的对应关系
        /// </summary>
        protected override string GetTableName()
        {
            return WorkSheetEntity.GetTableName();
        }
    }
}