0换成1
This commit is contained in:
parent
e13559115a
commit
f1ebaa68c7
|
|
@ -415,10 +415,10 @@ namespace LY.App.Service
|
||||||
GROUP BY batch_id ORDER BY batch_id desc LIMIT {1},{2}
|
GROUP BY batch_id ORDER BY batch_id desc LIMIT {1},{2}
|
||||||
) AS CountTable ";
|
) AS CountTable ";
|
||||||
|
|
||||||
string tablesql = string.Join(" UNION ALL ", tables.Select(item => $"SELECT batch_id FROM {item.TableName} "));
|
string tablesql = string.Join(" UNION ALL ", tables.Select(item => $"SELECT batch_id FROM {item.TableName} GROUP BY batch_id"));
|
||||||
if (!string.IsNullOrEmpty(input.sn))
|
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}%' "));
|
tablesql = string.Join(" UNION ALL ", tables.Select(item => $"SELECT batch_id FROM {item.TableName} where serial_number like '%{input.sn}%' GROUP BY batch_id"));
|
||||||
}
|
}
|
||||||
var pageitem = await _db.Ado.SqlQueryAsync<int, long>(string.Format(coutsql, tablesql) + 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));
|
||||||
|
|
||||||
|
|
@ -432,7 +432,7 @@ namespace LY.App.Service
|
||||||
endTime = SqlFunc.AggregateMax(st.CreateTime),
|
endTime = SqlFunc.AggregateMax(st.CreateTime),
|
||||||
sn = st.serial_number,
|
sn = st.serial_number,
|
||||||
Frequency = SqlFunc.AggregateMax(st.freq),
|
Frequency = SqlFunc.AggregateMax(st.freq),
|
||||||
duration = (SqlFunc.AggregateMax(st.CreateTime) - SqlFunc.AggregateMin(st.CreateTime)).TotalSeconds,
|
duration = (SqlFunc.AggregateMax(st.CreateTime) - SqlFunc.AggregateMin(st.CreateTime)).TotalSeconds == 0 ? 1 : (SqlFunc.AggregateMax(st.CreateTime) - SqlFunc.AggregateMin(st.CreateTime)).TotalSeconds,
|
||||||
model = st.device_type,
|
model = st.device_type,
|
||||||
IsWhitelist = SqlFunc.AggregateMax(st.IsWhitelist)
|
IsWhitelist = SqlFunc.AggregateMax(st.IsWhitelist)
|
||||||
}).OrderByDescending(s => s.batchId).ToListAsync();
|
}).OrderByDescending(s => s.batchId).ToListAsync();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
"log2db": true, //是否记录
|
"log2db": true, //是否记录
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "server=114.66.57.139;port=33306;database=lyapp;user=root;password=dklymysql;Pooling=true;"
|
"DefaultConnection": "server=114.66.59.70;port=33306;database=lyapp;user=root;password=dklymysql;Pooling=true;"
|
||||||
},
|
},
|
||||||
"Token": {
|
"Token": {
|
||||||
"SecretKey": "HWLSNPM+OhlFe4wwEV/teSWsxGjrWbxKnHonxW5Z+mFlQq3zonv5",
|
"SecretKey": "HWLSNPM+OhlFe4wwEV/teSWsxGjrWbxKnHonxW5Z+mFlQq3zonv5",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue