ningshuxia
2023-06-27 d5a533d045422407c1b7edfdde9fd19740e478d1
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
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.DAL
{
    /// <summary>
    /// 
    /// </summary>
    public partial class CorpTraceDAL_Sorter<T> : CorpTraceDAL<T> where T : Entity.CorpTraceEntity, Entity.ISorter, new()
    {
        /// <summary>
        /// 更新排序
        /// </summary>
        public virtual bool UpdateSortCode(long CorpID, long ID, int SortCode,long UpdateUserID,DateTime UpdateTime)
        {
            using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Updateable<T>()
                    .SetColumns(x => x.SortCode == SortCode)
                    .SetColumns(x => x.UpdateUserID == UpdateUserID)
                    .SetColumns(x => x.UpdateTime == UpdateTime)
                    .Where(x => x.CorpID == CorpID && x.ID == ID)
                    .ExecuteCommandHasChange();
            }
        }
 
        /// <summary>
        /// 更新排序
        /// </summary>
        public virtual bool UpdateSorter(long CorpID, List<Entity.TraceSorter> Sorters)
        {
            if (Sorters == null || Sorters.Count() < 1)
                return default;
            if (Sorters.Exists(x => x.ID < 1))
                return default;
            using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Updateable<T>(Sorters)
                    .UpdateColumns(nameof(Entity.ISorter.SortCode),nameof(Entity.TraceSorter.UpdateUserID),nameof(Entity.TraceSorter.UpdateTime))
                    .Where(x => x.CorpID == CorpID)
                    .ExecuteCommandHasChange();
            }
        }
 
    }
}