using IStation.Entity;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IStation.DAL
{
///
///
///
public partial class BaseTraceDAL_TreeSorter : BaseTraceDAL_Sorter where T : Entity.BaseTraceEntity, Entity.ITreeSorter, new()
{
///
/// 更新树排序码
///
public virtual bool UpdateTreeSortCode(long ID, string ParentIds, int SortCode,long UpdateUserID,DateTime UpdateTime)
{
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
{
return db.Updateable()
.SetColumns(x => x.SortCode == SortCode)
.SetColumns(x => x.ParentIds == ParentIds)
.SetColumns(x => x.UpdateTime == UpdateTime)
.SetColumns(x => x.UpdateUserID==UpdateUserID)
.Where(x => x.ID == ID)
.ExecuteCommandHasChange();
}
}
///
/// 更新树排序
///
public virtual bool UpdateTreeSorter(List 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(Sorters)
.UpdateColumns(nameof(Entity.ITreeSorter.SortCode), nameof(Entity.ITreeSorter.ParentIds),nameof(Entity.TraceTreeSorter.UpdateUserID),nameof(Entity.TraceTreeSorter.UpdateTime))
.ExecuteCommandHasChange();
}
}
}
}