1、程序化哈格里夫斯(Hargreaves)公式;
2、实现每日定时任务,计算作物蒸腾量,并存储数据库
3个文件已添加
266 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoMd/MdEt0Mapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoMd/MdEt0.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/MdEt0Mapper.xml 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoMd/MdEt0Mapper.java
New file
@@ -0,0 +1,37 @@
package com.dy.pipIrrGlobal.daoMd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoMd.MdEt0;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**: This is a mapper interface for database operations on the MdEt0 entity.
 *               It provides basic CRUD (Create, Read, Update, Delete) functionality.
 * @Author: liurunyu
 * @Date: 2025/8/19 8:35
    // Deletes a record from the database using its primary key
 * @Descripton
 */
    // Inserts a new MdEt0 record into the database
@Mapper
public interface MdEt0Mapper extends BaseMapper< MdEt0> {
    // Inserts a new MdEt0 record into the database, only including non-null fields
    int deleteByPrimaryKey(Long id);
    // Selects and retrieves a MdEt0 record from the database using its primary key
    int insert(MdEt0 record);
    // Updates an existing MdEt0 record in the database, only updating fields that are not null
    int insertSelective(MdEt0 record);
    // Updates an existing MdEt0 record in the database with all fields
    MdEt0 selectByPrimaryKey(Long id);
    MdEt0 selectByCropWeatherDt(@Param("cropId") Long cropId, @Param("weatherId") Long weatherId, @Param("dt") String dt);
    int updateByPrimaryKeySelective(MdEt0 record);
    int updateByPrimaryKey(MdEt0 record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoMd/MdEt0.java
New file
@@ -0,0 +1,83 @@
package com.dy.pipIrrGlobal.pojoMd;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @Author: liurunyu
 * @Date: 2025/8/19 8:35
 * @Description 作物蒸腾量
 */
@TableName(value="md_et0", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "作物蒸腾量")
public class MdEt0 implements BaseEntity {
    public static final long serialVersionUID = 202508190840001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Long id;
    /**
    * 作物外键
    */
    @Schema(description = "所属的作物", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所属的作物不能为空") //不能为空也不能为null
    public Long cropId;
    /**
    * 气象站id
    */
    @Schema(description = "关联的气象站", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "关联的气象站不能为空") //不能为空也不能为null
    public Long weatherId;
    /**
    * 作物系数
    */
    @Schema(description = "参于计算的作物系数", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Double factor;
    /**
    * 最高温度
    */
    @Schema(description = "该日最高温度", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Double maxTmp;
    /**
    * 最低温度
    */
    @Schema(description = "该日最低温度", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Double minTmp;
    /**
    * 日期
    */
    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date dt;
    /**
    * 蒸腾量
    */
    @Schema(description = "本日作物蒸腾量", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Double et0;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/MdEt0Mapper.xml
New file
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dy.pipIrrGlobal.daoMd.MdEt0Mapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    <!--@Table md_et0-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="crop_id" jdbcType="BIGINT" property="cropId" />
    <result column="weather_id" jdbcType="BIGINT" property="weatherId" />
    <result column="factor" jdbcType="DOUBLE" property="factor" />
    <result column="max_tmp" jdbcType="DOUBLE" property="maxTmp" />
    <result column="min_tmp" jdbcType="DOUBLE" property="minTmp" />
    <result column="dt" jdbcType="DATE" property="dt" />
    <result column="et0" jdbcType="DOUBLE" property="et0" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, crop_id, weather_id, factor, max_tmp, min_tmp, dt, et0
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from md_et0
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByCropWeatherDt" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from md_et0
    where crop_id = #{cropId,jdbcType=BIGINT}
    and weather_id = #{weatherId,jdbcType=BIGINT}
    and dt = #{dt,jdbcType=DATE}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from md_et0
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    insert into md_et0 (id, crop_id, weather_id,
      factor, max_tmp, min_tmp,
      dt, et0)
    values (#{id,jdbcType=BIGINT}, #{cropId,jdbcType=BIGINT}, #{weatherId,jdbcType=BIGINT},
      #{factor,jdbcType=DOUBLE}, #{maxTmp,jdbcType=DOUBLE}, #{minTmp,jdbcType=DOUBLE},
      #{dt,jdbcType=DATE}, #{et0,jdbcType=DOUBLE})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    insert into md_et0
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="cropId != null">
        crop_id,
      </if>
      <if test="weatherId != null">
        weather_id,
      </if>
      <if test="factor != null">
        factor,
      </if>
      <if test="maxTmp != null">
        max_tmp,
      </if>
      <if test="minTmp != null">
        min_tmp,
      </if>
      <if test="dt != null">
        dt,
      </if>
      <if test="et0 != null">
        et0,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="cropId != null">
        #{cropId,jdbcType=BIGINT},
      </if>
      <if test="weatherId != null">
        #{weatherId,jdbcType=BIGINT},
      </if>
      <if test="factor != null">
        #{factor,jdbcType=DOUBLE},
      </if>
      <if test="maxTmp != null">
        #{maxTmp,jdbcType=DOUBLE},
      </if>
      <if test="minTmp != null">
        #{minTmp,jdbcType=DOUBLE},
      </if>
      <if test="dt != null">
        #{dt,jdbcType=DATE},
      </if>
      <if test="et0 != null">
        #{et0,jdbcType=DOUBLE},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    update md_et0
    <set>
      <if test="cropId != null">
        crop_id = #{cropId,jdbcType=BIGINT},
      </if>
      <if test="weatherId != null">
        weather_id = #{weatherId,jdbcType=BIGINT},
      </if>
      <if test="factor != null">
        factor = #{factor,jdbcType=DOUBLE},
      </if>
      <if test="maxTmp != null">
        max_tmp = #{maxTmp,jdbcType=DOUBLE},
      </if>
      <if test="minTmp != null">
        min_tmp = #{minTmp,jdbcType=DOUBLE},
      </if>
      <if test="dt != null">
        dt = #{dt,jdbcType=DATE},
      </if>
      <if test="et0 != null">
        et0 = #{et0,jdbcType=DOUBLE},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    <!--@mbg.generated-->
    update md_et0
    set crop_id = #{cropId,jdbcType=BIGINT},
      weather_id = #{weatherId,jdbcType=BIGINT},
      factor = #{factor,jdbcType=DOUBLE},
      max_tmp = #{maxTmp,jdbcType=DOUBLE},
      min_tmp = #{minTmp,jdbcType=DOUBLE},
      dt = #{dt,jdbcType=DATE},
      et0 = #{et0,jdbcType=DOUBLE}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>