1. 修改電站排序

This commit is contained in:
Kai 2021-09-01 11:04:07 +08:00
parent b4f685c4ae
commit d939a0ebfd
2 changed files with 9 additions and 4 deletions

View File

@ -88,6 +88,7 @@ namespace SolarPower.Repository.Implement
LEFT JOIN city c ON ps.CityId = c.Id
WHERE ps.Id IN @PowerStationIds
GROUP BY ps.CityId
ORDER BY c.Priority
";
result = (await conn.QueryAsync<CapacityDataTable>(sql, new { PowerStationIds = powerStationIds })).ToList();

View File

@ -4448,8 +4448,8 @@ namespace SolarPower.Repository.Implement
{
try
{
var sql = $@"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,city.Name AS CityName FROM {tableName} ps
LEFT JOIN city ON city.Id = ps.CityId";
var sql = $@"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,c.Name AS CityName FROM {tableName} ps
LEFT JOIN city c ON c.Id = ps.CityId";
if (myUser.Role.Layer == 2)
{
@ -4465,6 +4465,8 @@ namespace SolarPower.Repository.Implement
{
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();
}
catch (Exception exception)
@ -4482,14 +4484,16 @@ namespace SolarPower.Repository.Implement
{
try
{
var sql = @$"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,city.Name AS CityName FROM {tableName} ps
LEFT JOIN city ON city.Id = ps.CityId WHERE ps.Deleted = 0";
var sql = @$"SELECT ps.Id AS PowerStationId , ps.`Name` AS PowerStationName,c.Name AS CityName FROM {tableName} ps
LEFT JOIN city c ON c.Id = ps.CityId WHERE ps.Deleted = 0 ";
if (!string.IsNullOrEmpty(filter))
{
sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')";
}
sql += " ORDER BY c.Priority";
result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { Filter = filter })).ToList();
}
catch (Exception exception)