细节调整

This commit is contained in:
yanghongwei 2025-07-21 17:33:13 +08:00
parent 965f987086
commit b389dcbf30
1 changed files with 7 additions and 12 deletions

View File

@ -388,24 +388,19 @@ namespace LY.App.Service
) AS CountTable;";
string page = @" SELECT *
FROM (
SELECT batch_id
FROM (
{0}
) AS unionTable
GROUP BY batch_id ORDER BY batch_id desc LIMIT {1},{2}
) AS CountTable ";
FROM (
SELECT batch_id
FROM (
{0}
) AS unionTable
GROUP BY batch_id ORDER BY batch_id desc LIMIT {1},{2}
) AS CountTable ";
string tablesql = string.Join(" UNION ALL ", tables.Select(item => $"SELECT batch_id FROM {item.TableName} "));
if (!string.IsNullOrEmpty(input.sn))
{
tablesql = string.Join(" UNION ALL ", tables.Select(item => $"SELECT batch_id FROM {item.TableName} where serial_number like '%{input.sn}%' "));
}
//var total = _db.Ado.GetInt(string.Format(coutsql, tablesql));
//var ids = _db.Ado.SqlQuery<long>(string.Format(page, tablesql, (input.pageNum - 1) * input.pageSize, input.pageSize));
var pageitem = await _db.Ado.SqlQueryAsync<int, long>(string.Format(coutsql, tablesql) + string.Format(page, tablesql, (input.pageNum - 1) * input.pageSize, input.pageSize));
var query = await _db.Queryable<Alarm>()