| | |
| | | /// <summary> |
| | | /// 通用导入Excel |
| | | /// </summary> |
| | | public class ImportExcel : IImportExcel |
| | | public class ImportExcel : ICommonImportExcel |
| | | { |
| | | /// <summary> |
| | | /// 导入 |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="newEntity"></param> |
| | | /// <param name="jsonStr"></param> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction> Import<T>(T newEntity, string jsonStr) where T : class, new() |
| | | public async Task<ApiAction> Import<T>(T newEntity, ImportInput input) where T : class, new() |
| | | { |
| | | var result = new ApiAction(); |
| | | try |
| | | { |
| | | |
| | | List<T> list = JsonConvert.DeserializeObject<List<T>>(jsonStr); |
| | | List<T> list = JsonConvert.DeserializeObject<List<T>>(input.EntityJson); |
| | | DbClient db = Biz.Db; |
| | | if (list.Any()) |
| | | { |
| | |
| | | /// <param name="newEntity"></param> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<List<T>>> ValidateTableImport<T>(T newEntity, ImportEntityValidate input) { |
| | | public async Task<ApiAction<List<T>>> ValidateTableImport<T>(T newEntity, ImportValidateInput input) { |
| | | var result = new ApiAction<List<T>>(); |
| | | try |
| | | { |
| | | List<T> list = JsonConvert.DeserializeObject<List<T>>(input.EntityJson); |
| | | List<string> chkColumns = JsonConvert.DeserializeObject<List<string>>(input.CheckJson); |
| | | List<string> wheres = JsonConvert.DeserializeObject<List<string>>(input.where); |
| | | List<string> wheres = JsonConvert.DeserializeObject<List<string>>(input.where); //目前只有=,以后可以增加其他的查询条件 |
| | | Type entityType = typeof(T); //T泛型 |
| | | //通过属性名获取属性值 “VALIDATION_TYPE”属性名称 |
| | | PropertyInfo typeInfo = entityType.GetProperty("VALIDATION_TYPE"); |