修改了point_height以支持可选值

This commit is contained in:
2025-10-18 10:21:59 +08:00
parent edf6200acd
commit a99fb905ec
3 changed files with 8 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ pub async fn insert_weather_data(pool: &PgPool, weather_data: &WeatherData) -> R
user_id, title, date, hour, min, longitude, latitude, daysincejanfirst, user_id, title, date, hour, min, longitude, latitude, daysincejanfirst,
theta, solardeclination, sunaltitude, overallcloudiness, lowcloudiness, theta, solardeclination, sunaltitude, overallcloudiness, lowcloudiness,
cloudindex, solarradiationlevel, hasmeasuredwindspeed, measuredwindspeed, cloudindex, solarradiationlevel, hasmeasuredwindspeed, measuredwindspeed,
convertedwindspeed, measurementheight, areatype, pointwindspeed, convertedwindspeed, pointheight, areatype, pointwindspeed,
atmosphericstability, suitabilitydegree, winddirection, averagewinddirection, atmosphericstability, suitabilitydegree, winddirection, averagewinddirection,
winddirectionstandarddeviation, windspeed, averagewindspeed, windspeedsuitability, winddirectionstandarddeviation, windspeed, averagewindspeed, windspeedsuitability,
winddirectionsuitability, overallsuitability, inspectiontype, assignmentnumber, winddirectionsuitability, overallsuitability, inspectiontype, assignmentnumber,
@@ -59,7 +59,7 @@ pub async fn insert_weather_data(pool: &PgPool, weather_data: &WeatherData) -> R
.bind(weather_data.has_measured_wind_speed) .bind(weather_data.has_measured_wind_speed)
.bind(weather_data.measured_wind_speed) // <-- 修改: 直接绑定 Option<f64> .bind(weather_data.measured_wind_speed) // <-- 修改: 直接绑定 Option<f64>
.bind(weather_data.converted_wind_speed) // <-- 修改: 直接绑定 Option<i32>,并移除 `as i32` .bind(weather_data.converted_wind_speed) // <-- 修改: 直接绑定 Option<i32>,并移除 `as i32`
.bind(weather_data.measurement_height) // <-- 修改: 直接绑定 Option<f64> .bind(weather_data.point_height) // <-- 修改: 直接绑定 Option<f64>
.bind(&weather_data.area_type) .bind(&weather_data.area_type)
.bind(weather_data.point_wind_speed) // <-- 修改: 直接绑定 Option<f64> .bind(weather_data.point_wind_speed) // <-- 修改: 直接绑定 Option<f64>
.bind(&weather_data.atmospheric_stability) .bind(&weather_data.atmospheric_stability)
@@ -127,7 +127,7 @@ pub async fn get_weather_details(pool: &PgPool, weather_id: i32) -> Result<Weath
wd.daysincejanfirst, wd.theta, wd.solardeclination, wd.daysincejanfirst, wd.theta, wd.solardeclination,
wd.sunaltitude, wd.overallcloudiness, wd.lowcloudiness, wd.sunaltitude, wd.overallcloudiness, wd.lowcloudiness,
wd.cloudindex, wd.solarradiationlevel, wd.hasmeasuredwindspeed, wd.cloudindex, wd.solarradiationlevel, wd.hasmeasuredwindspeed,
wd.measuredwindspeed, wd.convertedwindspeed, wd.measurementheight, wd.measuredwindspeed, wd.convertedwindspeed, wd.pointheight,
wd.areatype, wd.pointwindspeed, wd.atmosphericstability, wd.areatype, wd.pointwindspeed, wd.atmosphericstability,
wd.suitabilitydegree, wd.winddirection, wd.averagewinddirection, wd.suitabilitydegree, wd.winddirection, wd.averagewinddirection,
wd.winddirectionstandarddeviation, wd.windspeed, wd.averagewindspeed, wd.winddirectionstandarddeviation, wd.windspeed, wd.averagewindspeed,

View File

@@ -204,11 +204,11 @@ pub struct WeatherData {
#[serde(rename = "measuredWindSpeed")] #[serde(rename = "measuredWindSpeed")]
#[sqlx(rename = "measuredwindspeed")] #[sqlx(rename = "measuredwindspeed")]
pub measured_wind_speed: Option<f64>, // <-- 修改: f64 -> Option<f64> pub measured_wind_speed: Option<f64>,
#[serde(rename = "measurementHeight")] #[serde(rename = "pointHeight")]
#[sqlx(rename = "measurementheight")] #[sqlx(rename = "pointheight")]
pub measurement_height: Option<f64>, // <-- 修改: f64 -> Option<f64> pub point_height: Option<f64>,
#[serde(rename = "min")] #[serde(rename = "min")]
#[sqlx(rename = "min")] #[sqlx(rename = "min")]

View File

@@ -305,7 +305,7 @@ ${data.hasSpotCheckWindSpeed ? `
</div> </div>
<div class="data-row"> <div class="data-row">
<div class="data-label">测点高度:</div> <div class="data-label">测点高度:</div>
<div class="data-value">${data.measurementHeight} m</div> <div class="data-value">${data.pointHeight} m</div>
</div> </div>
<div class="data-row"> <div class="data-row">
<div class="data-label">点位风速:</div> <div class="data-label">点位风速:</div>