From 459af817d6a4f916d2c2d247931452d8618b2d40 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 24 六月 2025 17:53:16 +0800 Subject: [PATCH] 1、水肥机分页查询功能实现; 2、气象站分页查询功能实现; 3、墒情站分页查询功能实现; --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStManureMapper.xml | 49 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureCtrl.java | 33 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStSoilMapper.xml | 47 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStSoilMapper.java | 18 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStWeatherMapper.java | 18 + pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/QueryVo.java | 23 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoSoil.java | 63 +++++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/QueryVo.java | 23 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/QueryVo.java | 23 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherSv.java | 25 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureSv.java | 26 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoWeather.java | 63 +++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoManure.java | 63 +++++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilCtrl.java | 34 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilSv.java | 25 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherCtrl.java | 34 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStManureMapper.java | 20 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStWeatherMapper.xml | 48 ++++ 18 files changed, 620 insertions(+), 15 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStManureMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStManureMapper.java index 62a2163..a36c38c 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStManureMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStManureMapper.java @@ -2,10 +2,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoPr.PrStManure; +import com.dy.pipIrrGlobal.voPr.VoManure; import com.dy.pipIrrGlobal.voPr.VoMqttSimple; +import com.dy.pipIrrGlobal.voPr.VoSoil; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; /** * @Author: liurunyu @@ -31,6 +34,23 @@ List<VoMqttSimple> selectAllSimple() ; + + VoManure selectOne(Long id) ; + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍鎬绘暟 + * @param params + * @return + */ + Long totalCount(Map<?, ?> params); + + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍 + * @param params + * @return + */ + List<VoManure> selectSome(Map<?, ?> params); + + int updateByPrimaryKeySelective(PrStManure record); int updateByPrimaryKey(PrStManure record); diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStSoilMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStSoilMapper.java index 63e744b..9e3dfcf 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStSoilMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStSoilMapper.java @@ -3,9 +3,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoPr.PrStSoil; import com.dy.pipIrrGlobal.voPr.VoMqttSimple; +import com.dy.pipIrrGlobal.voPr.VoSoil; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; /** * @Author: liurunyu @@ -31,6 +33,22 @@ List<VoMqttSimple> selectAllSimple() ; + + VoSoil selectOne(Long id) ; + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍鎬绘暟 + * @param params + * @return + */ + Long totalCount(Map<?, ?> params); + + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍 + * @param params + * @return + */ + List<VoSoil> selectSome(Map<?, ?> params); + int updateByPrimaryKeySelective(PrStSoil record); int updateByPrimaryKey(PrStSoil record); diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStWeatherMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStWeatherMapper.java index 0a66151..385526c 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStWeatherMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrStWeatherMapper.java @@ -3,9 +3,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoPr.PrStWeather; import com.dy.pipIrrGlobal.voPr.VoMqttSimple; +import com.dy.pipIrrGlobal.voPr.VoWeather; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; /** * @Author: liurunyu @@ -29,6 +31,22 @@ PrStWeather selectByPrimaryKey(Long id); + + VoWeather selectOne(Long id) ; + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍鎬绘暟 + * @param params + * @return + */ + Long totalCount(Map<?, ?> params); + + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍 + * @param params + * @return + */ + List<VoWeather> selectSome(Map<?, ?> params); + List<VoMqttSimple> selectAllSimple() ; int updateByPrimaryKeySelective(PrStWeather record); diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoManure.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoManure.java new file mode 100644 index 0000000..3aa6df7 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoManure.java @@ -0,0 +1,63 @@ +package com.dy.pipIrrGlobal.voPr; + +import com.dy.common.po.BaseEntity; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/6/24 17:11 + * @Description + */ +@Data +@JsonPropertyOrder({ "id", "fboxId", "no", "name", "lng", "lat", "remark"}) +@Schema(title = "姘磋偉鏈哄�煎璞�") +public class VoManure implements BaseEntity { + private static final long serialVersionUID = 202506241715001L; + /** + * 涓婚敭 + */ + @JsonSerialize(using = ToStringSerializer.class) + @Schema(title = "姘磋偉鏈篒D") + public Long id; + + /** + * FBox搴忓垪鍙� + */ + @Schema(title = "FBox搴忓垪鍙�") + public String fboxId ; + + /** + * 姘磋偉绔欑紪鍙� + */ + @Schema(title = "缂栧彿") + public Integer no ; + + /** + * 姘磋偉绔欏悕绉� + */ + @Schema(title = "鍚嶇О") + public String name; + + /** + * 缁忓害 + */ + @Schema(title = "缁忓害") + public Double lng; + + /** + * 绾害 + */ + @Schema(title = "绾害") + public Double lat; + + /** + * 澶囨敞 + */ + @Schema(title = "澶囨敞") + public String remark; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoSoil.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoSoil.java new file mode 100644 index 0000000..13b32d9 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoSoil.java @@ -0,0 +1,63 @@ +package com.dy.pipIrrGlobal.voPr; + +import com.dy.common.po.BaseEntity; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/6/24 17:11 + * @Description + */ +@Data +@JsonPropertyOrder({ "id", "fboxId", "no", "name", "lng", "lat", "remark"}) +@Schema(title = "澧掓儏绔欏�煎璞�") +public class VoSoil implements BaseEntity { + private static final long serialVersionUID = 202506241715002L; + /** + * 涓婚敭 + */ + @JsonSerialize(using = ToStringSerializer.class) + @Schema(title = "澧掓儏绔橧D") + public Long id; + + /** + * FBox搴忓垪鍙� + */ + @Schema(title = "FBox搴忓垪鍙�") + public String fboxId ; + + /** + * 姘磋偉绔欑紪鍙� + */ + @Schema(title = "缂栧彿") + public Integer no ; + + /** + * 姘磋偉绔欏悕绉� + */ + @Schema(title = "鍚嶇О") + public String name; + + /** + * 缁忓害 + */ + @Schema(title = "缁忓害") + public Double lng; + + /** + * 绾害 + */ + @Schema(title = "绾害") + public Double lat; + + /** + * 澶囨敞 + */ + @Schema(title = "澶囨敞") + public String remark; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoWeather.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoWeather.java new file mode 100644 index 0000000..8da86b2 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoWeather.java @@ -0,0 +1,63 @@ +package com.dy.pipIrrGlobal.voPr; + +import com.dy.common.po.BaseEntity; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/6/24 17:11 + * @Description + */ +@Data +@JsonPropertyOrder({ "id", "fboxId", "no", "name", "lng", "lat", "remark"}) +@Schema(title = "姘旇薄绔欏�煎璞�") +public class VoWeather implements BaseEntity { + private static final long serialVersionUID = 202506241715003L; + /** + * 涓婚敭 + */ + @JsonSerialize(using = ToStringSerializer.class) + @Schema(title = "姘旇薄绔橧D") + public Long id; + + /** + * FBox搴忓垪鍙� + */ + @Schema(title = "FBox搴忓垪鍙�") + public String fboxId ; + + /** + * 姘磋偉绔欑紪鍙� + */ + @Schema(title = "缂栧彿") + public Integer no ; + + /** + * 姘磋偉绔欏悕绉� + */ + @Schema(title = "鍚嶇О") + public String name; + + /** + * 缁忓害 + */ + @Schema(title = "缁忓害") + public Double lng; + + /** + * 绾害 + */ + @Schema(title = "绾害") + public Double lat; + + /** + * 澶囨敞 + */ + @Schema(title = "澶囨敞") + public String remark; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStManureMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStManureMapper.xml index a70239a..eed8ceb 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStManureMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStManureMapper.xml @@ -39,6 +39,55 @@ from pr_st_manure where deleted != 1 ; </select> + + <select id="selectOne" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voPr.VoManure"> + <!--@mbg.generated--> + SELECT tb.id, + tb.fbox_id AS fboxId, + tb.`no`, + tb.`name`, + tb.lng, + tb.lat, + tb.remark + FROM pr_st_manure tb + where id = #{id,jdbcType=BIGINT} + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ鎬绘暟--> + <select id="totalCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_st_manure tb + <where> + tb.deleted != 1 + <if test="name != null and name != ''"> + AND tb.name LIKE CONCAT('%', #{name}, '%') + </if> + </where> + </select> + <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ--> + <select id="selectSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voPr.VoManure"> + SELECT tb.id, + tb.fbox_id AS fboxId, + tb.`no`, + tb.`name`, + tb.lng, + tb.lat, + tb.remark + FROM pr_st_manure tb + <where> + tb.deleted != 1 + <if test="name != null and name != ''"> + AND tb.name LIKE CONCAT('%', #{name}, '%') + </if> + </where> + ORDER BY tb.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 pr_st_manure diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStSoilMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStSoilMapper.xml index 598436b..f07307c 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStSoilMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStSoilMapper.xml @@ -39,6 +39,53 @@ from pr_st_soil where deleted != 1 ; </select> + + <select id="selectOne" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voPr.VoSoil"> + <!--@mbg.generated--> + SELECT tb.id, + tb.fbox_id AS fboxId, + tb.`no`, + tb.`name`, + tb.lng, + tb.lat, + tb.remark + FROM pr_st_soil tb + where id = #{id,jdbcType=BIGINT} + </select> + <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ鎬绘暟--> + <select id="totalCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_st_soil tb + <where> + tb.deleted != 1 + <if test="name != null and name != ''"> + AND tb.name LIKE CONCAT('%', #{name}, '%') + </if> + </where> + </select> + <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ--> + <select id="selectSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voPr.VoSoil"> + SELECT tb.id, + tb.fbox_id AS fboxId, + tb.`no`, + tb.`name`, + tb.lng, + tb.lat, + tb.remark + FROM pr_st_soil tb + <where> + tb.deleted != 1 + <if test="name != null and name != ''"> + AND tb.name LIKE CONCAT('%', #{name}, '%') + </if> + </where> + ORDER BY tb.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 pr_st_soil diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStWeatherMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStWeatherMapper.xml index ade2d3c..84f86e4 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStWeatherMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrStWeatherMapper.xml @@ -32,6 +32,54 @@ from pr_st_weather where id = #{id,jdbcType=BIGINT} </select> + + + <select id="selectOne" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voPr.VoWeather"> + <!--@mbg.generated--> + SELECT tb.id, + tb.fbox_id AS fboxId, + tb.`no`, + tb.`name`, + tb.lng, + tb.lat, + tb.remark + FROM pr_st_weather tb + where id = #{id,jdbcType=BIGINT} + </select> + <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ鎬绘暟--> + <select id="totalCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM pr_st_weather tb + <where> + tb.deleted != 1 + <if test="name != null and name != ''"> + AND tb.name LIKE CONCAT('%', #{name}, '%') + </if> + </where> + </select> + <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ--> + <select id="selectSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voPr.VoWeather"> + SELECT tb.id, + tb.fbox_id AS fboxId, + tb.`no`, + tb.`name`, + tb.lng, + tb.lat, + tb.remark + FROM pr_st_weather tb + <where> + tb.deleted != 1 + <if test="name != null and name != ''"> + AND tb.name LIKE CONCAT('%', #{name}, '%') + </if> + </where> + ORDER BY tb.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> <select id="selectAllSimple" resultType="com.dy.pipIrrGlobal.voPr.VoMqttSimple"> <!--@mbg.generated--> select diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureCtrl.java index 19dad05..9963af5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureCtrl.java @@ -3,8 +3,10 @@ import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoPr.PrStManure; +import com.dy.pipIrrGlobal.voPr.VoManure; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -19,6 +21,7 @@ import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Objects; /** @@ -39,6 +42,30 @@ this.sv = sv ; } + /** + * 鍒嗛〉鏌ヨ姘磋偉鏈鸿褰� + * @param vo + * @return + */ + @Operation(summary = "鑾峰緱涓�椤垫按鑲ユ満璁板綍", description = "杩斿洖涓�椤垫按鑲ユ満鏁版嵁") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤垫按鑲ユ満鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoManure.class))} + ) + }) + @GetMapping(path = "/some") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoManure>>> some(QueryVo vo){ + try { + return BaseResponseUtils.buildSuccess(this.sv.selectSome(vo)); + } catch (Exception e) { + log.error("鑾峰彇姘磋偉鏈鸿褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } /** * 寰楀埌涓�濂楁按鑲ユ満鏁版嵁 @@ -50,13 +77,13 @@ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "杩斿洖涓�濂楁按鑲ユ満鏁版嵁锛圔aseResponse.content:{}锛�", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = PrStManure.class))} + schema = @Schema(implementation = VoManure.class))} ) }) @GetMapping(path = "one") @SsoAop() - public BaseResponse<PrStManure> one(Long id){ - return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); + public BaseResponse<VoManure> one(Long id){ + return BaseResponseUtils.buildSuccess(this.sv.selectOne(id)); } /** diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureSv.java index afcf207..59040a7 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/ManureSv.java @@ -1,14 +1,18 @@ package com.dy.pipIrrProject.mqtt.manure; +import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoPr.PrStManureMapper; import com.dy.pipIrrGlobal.pojoPr.PrStManure; +import com.dy.pipIrrGlobal.voPr.VoManure; import com.dy.pipIrrGlobal.voPr.VoMqttSimple; 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 org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** * @Author: liurunyu @@ -27,12 +31,30 @@ } /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍 + * + * @param queryVo 鏌ヨ鍊煎璞� + * @return 璁板綍鍒楄〃 + */ + public QueryResultVo<List<VoManure>> selectSome(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = dao.totalCount(params); + + QueryResultVo<List<VoManure>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryVo.pageSize; + rsVo.pageCurr = queryVo.pageCurr; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = dao.selectSome(params); + return rsVo; + } + + /** * 寰楀埌涓�涓疄浣� * @param id 瀹炰綋ID * @return 瀹炰綋 */ - public PrStManure selectById(Long id){ - return this.dao.selectById(id) ; + public VoManure selectOne(Long id){ + return this.dao.selectOne(id) ; } /** * 淇濆瓨锛堟坊鍔狅級瑙嗛鐩戞帶鐐� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/QueryVo.java new file mode 100644 index 0000000..a19e1ec --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/manure/QueryVo.java @@ -0,0 +1,23 @@ +package com.dy.pipIrrProject.mqtt.manure; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * @Author: liurunyu + * @Date: 2025/6/24 17:21 + * @Description + */ + +@Data +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Schema(name = "姘磋偉鏈烘煡璇㈡潯浠�") +public class QueryVo extends QueryConditionVo { + @Schema(description = "姘磋偉鏈哄悕绉�") + public String name; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/QueryVo.java new file mode 100644 index 0000000..19e9145 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/QueryVo.java @@ -0,0 +1,23 @@ +package com.dy.pipIrrProject.mqtt.soil; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * @Author: liurunyu + * @Date: 2025/6/24 17:21 + * @Description + */ + +@Data +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Schema(name = "澧掓儏绔欐煡璇㈡潯浠�") +public class QueryVo extends QueryConditionVo { + @Schema(description = "澧掓儏绔欏悕绉�") + public String name; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilCtrl.java index 7386c4f..0adc5d2 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilCtrl.java @@ -3,8 +3,11 @@ import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoPr.PrStSoil; +import com.dy.pipIrrGlobal.voPr.VoSoil; +import com.dy.pipIrrProject.mqtt.manure.QueryVo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -19,6 +22,7 @@ import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Objects; /** @@ -39,6 +43,30 @@ this.sv = sv ; } + /** + * 鍒嗛〉鏌ヨ澧掓儏绔欒褰� + * @param vo + * @return + */ + @Operation(summary = "鑾峰緱涓�椤靛鎯呯珯璁板綍", description = "杩斿洖涓�椤靛鎯呯珯鏁版嵁") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤靛鎯呯珯鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoSoil.class))} + ) + }) + @GetMapping(path = "/some") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoSoil>>> some(QueryVo vo){ + try { + return BaseResponseUtils.buildSuccess(this.sv.selectSome(vo)); + } catch (Exception e) { + log.error("鑾峰彇澧掓儏绔欒褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } /** * 寰楀埌涓�濂楀鎯呯珯鏁版嵁 @@ -50,13 +78,13 @@ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "杩斿洖涓�濂楀鎯呯珯鏁版嵁锛圔aseResponse.content:{}锛�", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = PrStSoil.class))} + schema = @Schema(implementation = VoSoil.class))} ) }) @GetMapping(path = "one") @SsoAop() - public BaseResponse<PrStSoil> one(Long id){ - return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); + public BaseResponse<VoSoil> one(Long id){ + return BaseResponseUtils.buildSuccess(this.sv.selectOne(id)); } /** diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilSv.java index e0303c6..1cd4277 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/soil/SoilSv.java @@ -1,14 +1,19 @@ package com.dy.pipIrrProject.mqtt.soil; +import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoPr.PrStSoilMapper; import com.dy.pipIrrGlobal.pojoPr.PrStSoil; +import com.dy.pipIrrGlobal.voPr.VoSoil; import com.dy.pipIrrGlobal.voPr.VoMqttSimple; +import com.dy.pipIrrProject.mqtt.manure.QueryVo; 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 org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** * @Author: liurunyu @@ -25,15 +30,31 @@ public List<VoMqttSimple> allSimple(){ return this.dao.selectAllSimple() ; } + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍 + * + * @param queryVo 鏌ヨ鍊煎璞� + * @return 璁板綍鍒楄〃 + */ + public QueryResultVo<List<VoSoil>> selectSome(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = dao.totalCount(params); + QueryResultVo<List<VoSoil>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryVo.pageSize; + rsVo.pageCurr = queryVo.pageCurr; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = dao.selectSome(params); + return rsVo; + } /** * 寰楀埌涓�涓疄浣� * @param id 瀹炰綋ID * @return 瀹炰綋 */ - public PrStSoil selectById(Long id){ - return this.dao.selectById(id) ; + public VoSoil selectOne(Long id){ + return this.dao.selectOne(id) ; } /** * 淇濆瓨锛堟坊鍔狅級瑙嗛鐩戞帶鐐� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/QueryVo.java new file mode 100644 index 0000000..3cf8d3d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/QueryVo.java @@ -0,0 +1,23 @@ +package com.dy.pipIrrProject.mqtt.weather; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * @Author: liurunyu + * @Date: 2025/6/24 17:21 + * @Description + */ + +@Data +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Schema(name = "姘旇薄绔欐煡璇㈡潯浠�") +public class QueryVo extends QueryConditionVo { + @Schema(description = "姘旇薄绔欏悕绉�") + public String name; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherCtrl.java index f40de60..e4c0c3e 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherCtrl.java @@ -3,8 +3,11 @@ import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoPr.PrStWeather; +import com.dy.pipIrrGlobal.voPr.VoWeather; +import com.dy.pipIrrProject.mqtt.manure.QueryVo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -19,6 +22,7 @@ import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Objects; /** @@ -39,6 +43,30 @@ this.sv = sv ; } + /** + * 鍒嗛〉鏌ヨ姘旇薄绔欒褰� + * @param vo + * @return + */ + @Operation(summary = "鑾峰緱涓�椤垫皵璞$珯璁板綍", description = "杩斿洖涓�椤垫皵璞$珯鏁版嵁") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤垫皵璞$珯鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoWeather.class))} + ) + }) + @GetMapping(path = "/some") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoWeather>>> some(QueryVo vo){ + try { + return BaseResponseUtils.buildSuccess(this.sv.selectSome(vo)); + } catch (Exception e) { + log.error("鑾峰彇姘旇薄绔欒褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } /** * 寰楀埌涓�濂楁皵璞$珯鏁版嵁 @@ -50,13 +78,13 @@ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "杩斿洖涓�濂楁皵璞$珯鏁版嵁锛圔aseResponse.content:{}锛�", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = PrStWeather.class))} + schema = @Schema(implementation = VoWeather.class))} ) }) @GetMapping(path = "one") @SsoAop() - public BaseResponse<PrStWeather> one(Long id){ - return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); + public BaseResponse<VoWeather> one(Long id){ + return BaseResponseUtils.buildSuccess(this.sv.selectOne(id)); } /** diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherSv.java index 6b93d7e..bfa8707 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/mqtt/weather/WeatherSv.java @@ -1,14 +1,19 @@ package com.dy.pipIrrProject.mqtt.weather; +import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoPr.PrStWeatherMapper; import com.dy.pipIrrGlobal.pojoPr.PrStWeather; import com.dy.pipIrrGlobal.voPr.VoMqttSimple; +import com.dy.pipIrrGlobal.voPr.VoWeather; +import com.dy.pipIrrProject.mqtt.manure.QueryVo; 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 org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** * @Author: liurunyu @@ -25,15 +30,31 @@ public List<VoMqttSimple> allSimple(){ return this.dao.selectAllSimple() ; } + /** + * 鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍 + * + * @param queryVo 鏌ヨ鍊煎璞� + * @return 璁板綍鍒楄〃 + */ + public QueryResultVo<List<VoWeather>> selectSome(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = dao.totalCount(params); + QueryResultVo<List<VoWeather>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryVo.pageSize; + rsVo.pageCurr = queryVo.pageCurr; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = dao.selectSome(params); + return rsVo; + } /** * 寰楀埌涓�涓疄浣� * @param id 瀹炰綋ID * @return 瀹炰綋 */ - public PrStWeather selectById(Long id){ - return this.dao.selectById(id) ; + public VoWeather selectOne(Long id){ + return this.dao.selectOne(id) ; } /** * 淇濆瓨锛堟坊鍔狅級瑙嗛鐩戞帶鐐� -- Gitblit v1.8.0