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
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public partial class BaseDAL_TreeSorter<T> : BaseDAL_Sorter<T> where T : Entity.BaseEntity,Entity.ITreeSorter,new()
|
{
|
/// <summary>
|
/// 更新树排序码
|
/// </summary>
|
public virtual bool UpdateTreeSortCode(long ID,string ParentIds, int SortCode)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<T>().SetColumns(x => x.SortCode == SortCode).SetColumns(x=>x.ParentIds==ParentIds).Where(x => x.ID == ID).ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 更新树排序
|
/// </summary>
|
public virtual bool UpdateTreeSorter(List<Entity.TreeSorter> 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.ITreeSorter.SortCode),nameof(Entity.ITreeSorter.ParentIds)).ExecuteCommand() > 0;
|
}
|
}
|
}
|
}
|