1、增加查询所有作物昨日蒸腾量功能;
2、增加查询一个作物一段时间内容所有蒸腾量功能。
3个文件已修改
3个文件已添加
232 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoMd/MdEt0Mapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoMd/MdEt0.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/MdEt0Mapper.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/vapor/VaporCtrl.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/vapor/VaporQo.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/vapor/VaporSv.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoMd/MdEt0Mapper.java
@@ -2,10 +2,13 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoMd.MdEt0;
import com.dy.pipIrrGlobal.voRm.VoManure;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**: This is a mapper interface for database operations on the MdEt0 entity.
 *               It provides basic CRUD (Create, Read, Update, Delete) functionality.
@@ -34,4 +37,9 @@
    int updateByPrimaryKeySelective(MdEt0 record);
    int updateByPrimaryKey(MdEt0 record);
    List<MdEt0> selectEt0ByDt(@Param("ymd")String ymd) ;
    List<MdEt0> selectEt0ByCropAndDt(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoMd/MdEt0.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
@@ -80,4 +81,12 @@
    @Schema(description = "本日作物蒸腾量", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Double et0;
    /**
     * 非数据库表属性
     * 关联的 作物名称
     */
    @Schema(description = "关联的作物名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @TableField(exist = false)
    public String cropName;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/MdEt0Mapper.xml
@@ -17,6 +17,12 @@
    <!--@mbg.generated-->
    id, crop_id, weather_id, factor, max_tmp, min_tmp, dt, et0
  </sql>
  <sql id="Base_Column_List_with_alias">
    <!--@mbg.generated-->
    ${alias}.id, ${alias}.crop_id, ${alias}.weather_id,
    ${alias}.factor, ${alias}.max_tmp, ${alias}.min_tmp,
    ${alias}.dt, ${alias}.et0
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
@@ -33,6 +39,37 @@
    and weather_id = #{weatherId,jdbcType=BIGINT}
    and dt = #{dt,jdbcType=DATE}
  </select>
  <select id="selectEt0ByDt" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List_with_alias" >
      <property name="alias" value="et"/>
    </include>,
    mc.name as cropName
    from md_et0 et
    inner join md_crops mc on et.crop_id = mc.id
    where mc.stopped != 1 and et.dt = #{ymd,jdbcType=DATE}
  </select>
  <!--根据指定条件查询记录-->
  <select id="selectEt0ByCropAndDt" resultType="com.dy.pipIrrGlobal.pojoMd.MdEt0">
    SELECT
    <include refid="Base_Column_List_with_alias" >
      <property name="alias" value="htb"/>
    </include>,
    mc.name as cropName
    from md_et0 et
    inner join md_crops mc on et.crop_id = mc.id
    <where>
      <if test="cropId != null">
        AND et.crop_id = #{cropId}
      </if>
      <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''">
        AND et.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
    ORDER BY et.id ASC
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from md_et0
pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/vapor/VaporCtrl.java
New file
@@ -0,0 +1,95 @@
package com.dy.pipIrrModel.vapor;
import com.dy.common.aop.SsoAop;
import com.dy.common.util.DateTime;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoMd.MdEt0;
import com.dy.pipIrrGlobal.voRm.VoManure;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2025/8/19 16:21
 * @Description
 */
@Slf4j
@Tag(name = "作物日蒸腾量", description = "作物日蒸腾量查询等操作")
@RestController
@RequestMapping(path = "mdVapor")
public class VaporCtrl {
    private VaporSv sv;
    @Autowired
    private void setSv(VaporSv sv) { this.sv = sv; }
    /**
     * 客户端请求得到所有作物的昨日蒸腾量
     * @return 所有所有作物的昨日蒸腾量
     */
    @Operation(summary = "获得作物的昨日蒸腾量", description = "返回所有作物的昨日蒸腾量数据")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回作物的昨日蒸腾量数据(BaseResponse.content:QueryResultVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = MdEt0.class))}
            )
    })
    @GetMapping(path = "allYesterday")
    @SsoAop()
    public BaseResponse<List<MdEt0>> allYesterday(){
        try {
            String ymd = DateTime.yesterday_yyyy_MM_dd(
                    Integer.parseInt(DateTime.yyyy()),
                    Integer.parseInt(DateTime.MM()),
                    Integer.parseInt(DateTime.dd())) ;
            List<MdEt0> res = this.sv.selectEt0(ymd) ;
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询所有作物的昨日蒸腾量异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 根据指定条件作物查询一段时间内的蒸腾量
     * @param qo
     * @return
     */
    @GetMapping(path = "oneCropsSomeEt0")
    @SsoAop()
    public BaseResponse<List<VoManure>> oneCropsSomeEt0(VaporQo qo){
        try {
            if(qo.cropId == null){
                return BaseResponseUtils.buildFail("作物id不能为空") ;
            }
            if(qo.timeStop == null || qo.timeStop.trim().equals("")){
                qo.timeStop = DateTime.yyyy_MM_dd() ;
            }
            if(qo.timeStart == null || qo.timeStart.trim().equals("")){
                qo.timeStart = DateTime.lastXDay_yyyy_MM_dd(qo.timeStop, 10);
            }
            return BaseResponseUtils.buildSuccess(sv.oneCropsSomeEt0(qo));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/vapor/VaporQo.java
New file
@@ -0,0 +1,38 @@
package com.dy.pipIrrModel.vapor;
import com.dy.common.webUtil.QueryConditionVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
 * @Author: liurunyu
 * @Date: 2025/8/19 16:21
 * @Description
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Schema(name = "作物日蒸腾查询条件")
public class VaporQo extends QueryConditionVo {
    /**
     * 作物ID
     */
    @Schema(description = "作物ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Long cropId;
    /**
     * 查询开始日期
     */
    @Schema(description = "查询开始日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public String timeStart;
    /**
     * 查询结束日期
     */
    @Schema(description = "查询结束日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public String timeStop;
}
pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/vapor/VaporSv.java
New file
@@ -0,0 +1,45 @@
package com.dy.pipIrrModel.vapor;
import com.dy.common.util.DateTime;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoMd.MdEt0Mapper;
import com.dy.pipIrrGlobal.pojoMd.MdEt0;
import com.dy.pipIrrGlobal.voRm.VoManure;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * @Author: liurunyu
 * @Date: 2025/8/19 16:21
 * @Description
 */
@Slf4j
@Service
public class VaporSv {
    private MdEt0Mapper mdEt0Dao;
    @Autowired
    private void setDao( MdEt0Mapper mdEt0Dao) {
        this.mdEt0Dao = mdEt0Dao;
    }
    public List<MdEt0> selectEt0(String ymd){
       return mdEt0Dao.selectEt0ByDt(ymd);
    }
    public List<MdEt0> oneCropsSomeEt0(VaporQo qo){
       Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo);
       return mdEt0Dao.selectEt0ByCropAndDt(params);
    }
}