1. 修改電站排序
This commit is contained in:
parent
b4f685c4ae
commit
d939a0ebfd
@ -88,6 +88,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
LEFT JOIN city c ON ps.CityId = c.Id
|
LEFT JOIN city c ON ps.CityId = c.Id
|
||||||
WHERE ps.Id IN @PowerStationIds
|
WHERE ps.Id IN @PowerStationIds
|
||||||
GROUP BY ps.CityId
|
GROUP BY ps.CityId
|
||||||
|
ORDER BY c.Priority
|
||||||
";
|
";
|
||||||
|
|
||||||
result = (await conn.QueryAsync<CapacityDataTable>(sql, new { PowerStationIds = powerStationIds })).ToList();
|
result = (await conn.QueryAsync<CapacityDataTable>(sql, new { PowerStationIds = powerStationIds })).ToList();
|
||||||
|
|||||||
@ -4448,8 +4448,8 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sql = $@"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,city.Name AS CityName FROM {tableName} ps
|
var sql = $@"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,c.Name AS CityName FROM {tableName} ps
|
||||||
LEFT JOIN city ON city.Id = ps.CityId";
|
LEFT JOIN city c ON c.Id = ps.CityId";
|
||||||
|
|
||||||
if (myUser.Role.Layer == 2)
|
if (myUser.Role.Layer == 2)
|
||||||
{
|
{
|
||||||
@ -4465,6 +4465,8 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')";
|
sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sql += " ORDER BY c.Priority";
|
||||||
result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { CompanyId = myUser.CompanyId, UserId = myUser.Id, Filter = filter })).ToList();
|
result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { CompanyId = myUser.CompanyId, UserId = myUser.Id, Filter = filter })).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@ -4482,14 +4484,16 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sql = @$"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,city.Name AS CityName FROM {tableName} ps
|
var sql = @$"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,c.Name AS CityName FROM {tableName} ps
|
||||||
LEFT JOIN city ON city.Id = ps.CityId WHERE ps.Deleted = 0";
|
LEFT JOIN city c ON c.Id = ps.CityId WHERE ps.Deleted = 0 ";
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filter))
|
if (!string.IsNullOrEmpty(filter))
|
||||||
{
|
{
|
||||||
sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')";
|
sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sql += " ORDER BY c.Priority";
|
||||||
result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { Filter = filter })).ToList();
|
result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { Filter = filter })).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user