@@ -125,7 +125,7 @@ private void CheckUpdateMultiTenancy(string ids, string tableKey)
125125 //例如sql,只能(编辑)自己创建的数据:判断数据是不是当前用户创建的
126126 //sql = $" {sql} and createid!={UserContext.Current.UserId}";
127127 object obj = repository . DapperContext . ExecuteScalar ( sql , null ) ;
128- if ( obj == null || obj . GetInt ( ) > 0 )
128+ if ( obj == null || obj . GetInt ( ) == 0 )
129129 {
130130 Response . Error ( "不能编辑此数据" ) ;
131131 }
@@ -143,7 +143,8 @@ private void CheckDelMultiTenancy(string ids, string tableKey)
143143 //例如sql,只能(删除)自己创建的数据:找出不是自己创建的数据
144144 //sql = $" {sql} and createid!={UserContext.Current.UserId}";
145145 object obj = repository . DapperContext . ExecuteScalar ( sql , null ) ;
146- if ( obj == null || obj . GetInt ( ) > 0 )
146+ int idsCount = ids . Split ( "," ) . Distinct ( ) . Count ( ) ;
147+ if ( obj == null || obj . GetInt ( ) != idsCount )
147148 {
148149 Response . Error ( "不能删除此数据" ) ;
149150 }
@@ -425,7 +426,8 @@ public virtual WebResponseContent Import(List<Microsoft.AspNetCore.Http.IFormFil
425426 }
426427 try
427428 {
428- Response = EPPlusHelper . ReadToDataTable < T > ( dicPath , DownLoadTemplateColumns , GetIgnoreTemplate ( ) ) ;
429+ //2022.06.20增加原生excel读取方法(导入时可以自定义读取excel内容)
430+ Response = EPPlusHelper . ReadToDataTable < T > ( dicPath , DownLoadTemplateColumns , GetIgnoreTemplate ( ) , readValue : ImportOnReadCellValue ) ;
429431 }
430432 catch ( Exception ex )
431433 {
@@ -443,15 +445,15 @@ public virtual WebResponseContent Import(List<Microsoft.AspNetCore.Http.IFormFil
443445 if ( HttpContext . Current . Request . Query . ContainsKey ( "table" ) )
444446 {
445447 ImportOnExecuted ? . Invoke ( list ) ;
446- return Response . OK ( "文件上传成功" , list . Serialize ( ) ) ;
448+ return Response . OK ( "文件上传成功" , list . Serialize ( ) ) ;
447449 }
448450 repository . AddRange ( list , true ) ;
449451 if ( ImportOnExecuted != null )
450452 {
451453 Response = ImportOnExecuted . Invoke ( list ) ;
452454 if ( CheckResponseResult ( ) ) return Response ;
453455 }
454- return Response . OK ( "文件上传成功" ) ;
456+ return Response . OK ( "文件上传成功" ) ;
455457 }
456458
457459 /// <summary>
0 commit comments