|
@@ -146,27 +146,30 @@ namespace GxPress.Repository.Implement
|
|
|
var databaseType = _databaseTypeStr.ToEnum<DatabaseType>(DatabaseType.MySql);
|
|
|
var database = new Database(databaseType, _connectionString);
|
|
|
var connection = database.GetConnection();
|
|
|
- var lastModifiedDate = DateTime.Now.ToString();
|
|
|
- if (middleFirst.Sort < middleSecond.Sort)
|
|
|
- {
|
|
|
- //修改第一个排序
|
|
|
- await _repository.UpdateAsync(Q.Set(nameof(Middle.Sort), middleSecond.Sort)
|
|
|
- .Where(nameof(Middle.Id), request.MiddleIdFirst));
|
|
|
- int sort = middleSecond.Sort;
|
|
|
- var sql =
|
|
|
- $"update tede_middle set Sort=Sort-1,LastModifiedDate='{lastModifiedDate}' where UserId={middleFirst.UserId} and FolderType={middleFirst.FolderType} and Sort<={sort} and Id not in({middleFirst.Id}) and id>0";
|
|
|
- return await connection.ExecuteAsync(sql) > 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //修改第一个排序
|
|
|
- await _repository.UpdateAsync(Q.Set(nameof(Middle.Sort), middleSecond.Sort)
|
|
|
- .Where(nameof(Middle.Id), request.MiddleIdFirst));
|
|
|
- int sort = middleSecond.Sort;
|
|
|
- var sql =
|
|
|
- $"update tede_middle set Sort=Sort+1,LastModifiedDate='{lastModifiedDate}' where UserId={middleFirst.UserId} and FolderType={middleFirst.FolderType} and Sort>={sort} and Id not in({middleFirst.Id}) and id>0";
|
|
|
- return await connection.ExecuteAsync(sql) > 0;
|
|
|
- }
|
|
|
+ var lastModifiedDate = Convert.ToDateTime(middleSecond.LastModifiedDate).AddTicks(1);
|
|
|
+ // if (middleFirst.Sort < middleSecond.Sort)
|
|
|
+ // {
|
|
|
+ // //修改第一个排序
|
|
|
+ // await _repository.UpdateAsync(Q.Set(nameof(Middle.Sort), middleSecond.Sort)
|
|
|
+ // .Where(nameof(Middle.Id), request.MiddleIdFirst));
|
|
|
+ // int sort = middleSecond.Sort;
|
|
|
+ // var sql =
|
|
|
+ // $"update tede_middle set Sort=Sort-1,LastModifiedDate='{lastModifiedDate}' where UserId={middleFirst.UserId} and FolderType={middleFirst.FolderType} and Sort<={sort} and Id not in({middleFirst.Id}) and id>0";
|
|
|
+ // return await connection.ExecuteAsync(sql) > 0;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // //修改第一个排序
|
|
|
+ // await _repository.UpdateAsync(Q.Set(nameof(Middle.Sort), middleSecond.Sort)
|
|
|
+ // .Where(nameof(Middle.Id), request.MiddleIdFirst));
|
|
|
+ // int sort = middleSecond.Sort;
|
|
|
+ // var sql =
|
|
|
+ // $"update tede_middle set Sort=Sort+1,LastModifiedDate='{lastModifiedDate}' where UserId={middleFirst.UserId} and FolderType={middleFirst.FolderType} and Sort>={sort} and Id not in({middleFirst.Id}) and id>0";
|
|
|
+ // return await connection.ExecuteAsync(sql) > 0;
|
|
|
+ // }
|
|
|
+ var sql =
|
|
|
+ $"update tede_middle set LastModifiedDate='{lastModifiedDate.ToString()}' where Id={middleFirst.Id}";
|
|
|
+ return await connection.ExecuteAsync(sql) > 0;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|