Shuxia Ning
2024-08-28 1a8a81785470302fc7fbd6914a9df5d1094dac2a
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
namespace IStation.DAL.SQLite
{
    /// <summary>
    /// 
    /// </summary>
    public partial class ScheduleRequest : Yw.DAL.SQLite.BaseDAL<Entity.ScheduleRequest>, IScheduleRequest
    {
        /// <summary>
        /// 
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return ConfigHelper.ScheduleConnectionConfig; }
 
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override long Insert(Entity.ScheduleRequest entity)
        {
            if (entity == null)
            {
                return 0L;
            }
 
            using SqlSugarClient sqlSugarClient = new SqlSugarClient(ConnectionConfig);
            if (entity.ID > 0)
            {
                if (sqlSugarClient.Insertable(entity).ExecuteCommand() <= 0)
                {
                    return 0L;
                }
 
                return entity.ID;
            }
 
            return sqlSugarClient.Insertable(entity).ExecuteReturnSnowflakeId();
        }
    }
}