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 BaseDAL_Sorter : BaseDAL where T : Entity.BaseEntity,ISorter, new()
{
///
/// 更新排序码
///
public virtual bool UpdateSortCode(long ID, int SortCode)
{
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
{
return db.Updateable()
.SetColumns(x => x.SortCode == SortCode).Where(x => x.ID == ID).ExecuteCommand() > 0;
}
}
///
/// 更新排序
///
public virtual bool UpdateSorter(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.ISorter.SortCode)).ExecuteCommand()>0;
}
}
}
}