|
|
|
@ -403,6 +403,8 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
return Mapper.Map(data).ToANew<List<TEntityDto>>(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#region 新增 |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 写入实体数据 |
|
|
|
|
/// </summary> |
|
|
|
@ -452,6 +454,7 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
}); |
|
|
|
|
return await BaseDal.Add(list); |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 更新实体数据 |
|
|
|
@ -611,6 +614,15 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
return await BaseDal.Update(entities); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 根据表达式,删除实体 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="whereExpression">表达式</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public async Task<bool> Delete(Expression<Func<TEntity, bool>> whereExpression) |
|
|
|
|
{ |
|
|
|
|
return await BaseDal.Delete(whereExpression); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 查询所有数据 |
|
|
|
@ -891,7 +903,7 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 检查表中是否已经存在相同代码的数据 |
|
|
|
|
|
|
|
|
|
public static void CheckOnly(TEntity entity, long? id = null) |
|
|
|
|
{ |
|
|
|
@ -986,6 +998,7 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
} |