liurunyu
2025-06-27 fa40a38ac0c25ada4bf554e742862fb2200c8a78
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmWeatherHistoryMapper.xml
@@ -20,6 +20,13 @@
    id, weather_id, dt, air_temperature, air_humidity, ultraviolet, light_intensity, 
    rainfall, wind_speed, wind_direction
  </sql>
  <sql id="Base_Column_List_with_alias">
    <!--@mbg.generated-->
    ${alias}.id, ${alias}.weather_id, ${alias}.dt, ${alias}.air_temperature,
    ${alias}.air_humidity, ${alias}.ultraviolet, ${alias}.light_intensity,
    ${alias}.rainfall, ${alias}.wind_speed, ${alias}.wind_direction
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
@@ -27,6 +34,58 @@
    from rm_weather_history
    where id = #{id,jdbcType=BIGINT}
  </select>
  <!--根据指定条件查询历史记录数量-->
  <select id="selectCount" resultType="java.lang.Long">
    SELECT
    COUNT(*) AS recordCount
    FROM rm_weather_history htb
    INNER JOIN pr_st_weather mtb ON mtb.id = htb.weather_id
    <where>
      <if test="weatherId != null">
        AND htb.weather_id = #{weatherId}
      </if>
      <if test = "no != null">
        AND mtb.no = #{no}
      </if>
      <if test = "name != null and name !=''">
        AND mtb.name LIKE CONCAT('%',#{name},'%')
      </if>
      <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''">
        AND htb.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
  </select>
  <!--根据指定条件查询历史记录-->
  <select id="selectSome" resultType="com.dy.pipIrrGlobal.voRm.VoWeather">
    SELECT
    <include refid="Base_Column_List_with_alias" >
      <property name="alias" value="htb"/>
    </include>,
    mtb.`name` AS weatherName
    FROM rm_weather_history htb
    INNER JOIN pr_st_weather mtb ON mtb.id = htb.weather_id
    <where>
      <if test="weatherId != null">
        AND htb.weather_id = #{weatherId}
      </if>
      <if test = "no != null">
        AND mtb.no = #{no}
      </if>
      <if test = "name != null and name !=''">
        AND mtb.name LIKE CONCAT('%',#{name},'%')
      </if>
      <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''">
        AND htb.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
    ORDER BY htb.id DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from rm_weather_history