using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_Core;
|
using WIDESEA_Core.BaseServices;
|
using WIDESEA_Core.Enums;
|
using WIDESEA_Core.Helper;
|
using WIDESEA_DTO.Basic;
|
using WIDESEA_IBasicRepository;
|
using WIDESEA_IBasicService;
|
using WIDESEA_Model.Models;
|
|
namespace WIDESEA_BasicService
|
{
|
public partial class CachePointService : ServiceBase<Dt_CachePoint, ICachePointRepository>, ICachePointService
|
{
|
public CachePointService(ICachePointRepository BaseDal) : base(BaseDal)
|
{
|
}
|
|
public ICachePointRepository Repository => BaseDal;
|
|
public override WebResponseContent AddData(SaveModel saveModel)
|
{
|
Dt_CachePoint cachePoint = saveModel.MainData.DicToModel<Dt_CachePoint>();
|
return base.AddData(cachePoint);
|
}
|
|
public override WebResponseContent UpdateData(SaveModel saveModel)
|
{
|
return base.UpdateData(saveModel);
|
}
|
|
public override WebResponseContent DeleteData(object[] keys)
|
{
|
return base.DeleteData(keys);
|
}
|
|
public WebResponseContent CachePointEnableStatus(int[] keys)
|
{
|
List<Dt_CachePoint> cachePoints = Repository.QueryData(x => keys.Contains(x.Id));
|
cachePoints.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Enable.ObjToInt();
|
});
|
Repository.UpdateData(cachePoints);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent CachePointDisableStatus(int[] keys)
|
{
|
List<Dt_CachePoint> cachePoints = Repository.QueryData(x => keys.Contains(x.Id));
|
cachePoints.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Disable.ObjToInt();
|
});
|
Repository.UpdateData(cachePoints);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent CachePointEnableStatus(int key)
|
{
|
return CachePointEnableStatus(new int[] { key });
|
}
|
|
public WebResponseContent CachePointDisableStatus(int key)
|
{
|
return CachePointDisableStatus(new int[] { key });
|
}
|
}
|
}
|