You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

using Entity.DbModel.Station;
using Entity.Dto.Req;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using Repository.Station;
using SqlSugar;
namespace Service.Station;
[Scope("SingleInstance")]
public class BatteryOpModelDetailService: BaseServices<BatteryOpModelDetail>
{
private BatteryOpModelDetailRepository _batteryOpModelDetailRepository;
public BatteryOpModelDetailService(BatteryOpModelDetailRepository dal)
{
_batteryOpModelDetailRepository = dal;
BaseDal = dal;
}
/// <summary>
/// 电池运营模型详情分页列表 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<PageResult<BatteryOpModelDetail>> Page(PageBatteryOpModelDetailReq input)
{
RefAsync<int> total = 0;
var items = await _batteryOpModelDetailRepository.QueryPageAsync(
entity => true,
false, entity => true,
false, entity => true,
!string.IsNullOrEmpty(input.BatteryType), u => u.BatteryType == input.BatteryType,
u => u.CreatedTime, input.PageNum, input.PageSize, total
);
return new PageResult<BatteryOpModelDetail>()
{
PageNum = input.PageNum,
PageSize = input.PageSize,
ToTal = total,
Rows = items,
};
}
/// <summary>
/// 删除电池运营模型 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<bool> DeleteBatteryOpModelDetail(DeleteBatteryOpModelDetailReq input)
{
var user = await _batteryOpModelDetailRepository.QueryByClauseAsync(u => u.Id == input.Id);
if (user == null)
throw new ArgumentException($"电池运营模型不存在");
return await _batteryOpModelDetailRepository.DeleteAsync(user);
}
}