| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoRm.RmManureHistory; |
| | | import com.dy.pipIrrGlobal.voRm.VoManure; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | |
| | | RmManureHistory selectByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * 根据指定条件查询记录数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long selectCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件查询记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoManure> selectSome(Map<?, ?> params); |
| | | |
| | | |
| | | int updateByPrimaryKeySelective(RmManureHistory record); |
| | | |
| | | int updateByPrimaryKey(RmManureHistory record); |
| | |
| | | package com.dy.pipIrrGlobal.daoRm; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoRm.RmManureLast; |
| | | import com.dy.pipIrrGlobal.voRm.VoManure; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | |
| | | List<RmManureLast> selectRmManureLast(@Param("stManureId") Long stManureId) ; |
| | | |
| | | /** |
| | | * 根据指定条件查询记录数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long selectCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件查询记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoManure> selectSome(Map<?, ?> params); |
| | | |
| | | int updateByPrimaryKeySelective(RmManureLast record); |
| | | |
| | | int updateByPrimaryKey(RmManureLast record); |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/6/25 16:34 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class VoManure { |
| | | public static final long serialVersionUID = 202506251634001L; |
| | | |
| | | /** |
| | | * 记录ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 水肥机ID |
| | | */ |
| | | @Schema(description = "水肥机ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long manureId; |
| | | |
| | | /** |
| | | * 水肥机名称 |
| | | */ |
| | | @Schema(description = "水肥机名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long manureName; |
| | | |
| | | |
| | | /** |
| | | * 数据上报时间(年月日时分秒) |
| | | */ |
| | | @Schema(description = "数据接收日期时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | public Date dt; |
| | | |
| | | /** |
| | | * 搅拌1运行状态(1运行,0停止) |
| | | */ |
| | | @Schema(description = "搅拌1运行状态(1运行,0停止)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte stirRunning1; |
| | | |
| | | /** |
| | | * 搅拌2运行状态(1运行,0停止) |
| | | */ |
| | | @Schema(description = "搅拌2运行状态(1运行,0停止)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte stirRunning2; |
| | | |
| | | /** |
| | | * 搅拌3运行状态(1运行,0停止) |
| | | */ |
| | | @Schema(description = "搅拌3运行状态(1运行,0停止)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte stirRunning3; |
| | | |
| | | /** |
| | | * 搅拌4运行状态(1运行,0停止) |
| | | */ |
| | | @Schema(description = "搅拌4运行状态(1运行,0停止)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte stirRunning4; |
| | | |
| | | /** |
| | | * 注肥运行状态(1运行,0停止) |
| | | */ |
| | | @Schema(description = "注肥运行状态(1运行,0停止)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte injectRunning; |
| | | |
| | | /** |
| | | * 灌溉运行状态(1运行,0停止) |
| | | */ |
| | | @Schema(description = "灌溉运行状态(1运行,0停止)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte irrRunning; |
| | | |
| | | /** |
| | | * 报警(1:注肥泵有故障,0:注肥泵没有故障) |
| | | */ |
| | | @Schema(description = "报警(1:注肥泵有故障,0:注肥泵没有故障)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte alarm; |
| | | |
| | | /** |
| | | * 肥料流量(升) |
| | | */ |
| | | @Schema(description = "肥料流量(升)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double manureFlow; |
| | | |
| | | /** |
| | | * 注肥经过时间(秒) |
| | | */ |
| | | @Schema(description = "注肥经过时间(秒)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Integer manureTime; |
| | | |
| | | /** |
| | | * 搅拌经过时间(秒) |
| | | */ |
| | | @Schema(description = "搅拌经过时间(秒)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Integer stirTime; |
| | | |
| | | /** |
| | | * 搅拌设定时间(秒) |
| | | */ |
| | | @Schema(description = "搅拌设定时间(秒)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Integer stirDuration; |
| | | |
| | | /** |
| | | * 注肥设定时间(秒) |
| | | */ |
| | | @Schema(description = "注肥设定时间(秒)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Integer injectDuration; |
| | | |
| | | } |
| | |
| | | from rm_manure_history |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <!--根据指定条件查询历史记录数量--> |
| | | <select id="selectCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM rm_manure_history htb |
| | | INNER JOIN pr_st_manure mtb ON mtb.id = htb.manure_id |
| | | <where> |
| | | <if test="manureId != null"> |
| | | AND htb.manure_id = #{manureId} |
| | | </if> |
| | | <if test = "no != null"> |
| | | AND mtb.no = #{no} |
| | | </if> |
| | | <if test = "name != null and name !=''"> |
| | | AND mtb.name LIKE CONCAT('%',#{intakeNum},'%') |
| | | </if> |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND htb.dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件查询历史记录--> |
| | | <select id="selectSome" resultType="com.dy.pipIrrGlobal.voRm.VoManure"> |
| | | SELECT |
| | | <include refid="Base_Column_List" />, |
| | | mtb.`name` AS manureName |
| | | FROM rm_manure_history htb |
| | | INNER JOIN pr_st_manure mtb ON mtb.id = htb.manure_id |
| | | <where> |
| | | <if test="manureId != null"> |
| | | AND htb.manure_id = #{manureId} |
| | | </if> |
| | | <if test = "no != null"> |
| | | AND mtb.no = #{no} |
| | | </if> |
| | | <if test = "name != null and name !=''"> |
| | | AND mtb.name LIKE CONCAT('%',#{intakeNum},'%') |
| | | </if> |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | 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_manure_history |
| | |
| | | </where> |
| | | limit 0,1 |
| | | </select> |
| | | |
| | | |
| | | <!--根据指定条件查询历史记录数量--> |
| | | <select id="selectCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM rm_manure_last ltb |
| | | INNER JOIN pr_st_manure mtb ON mtb.id = ltb.manure_id |
| | | <where> |
| | | <if test="manureId != null"> |
| | | AND ltb.manure_id = #{manureId} |
| | | </if> |
| | | <if test = "no != null"> |
| | | AND mtb.no = #{no} |
| | | </if> |
| | | <if test = "name != null and name !=''"> |
| | | AND mtb.name LIKE CONCAT('%',#{intakeNum},'%') |
| | | </if> |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ltb.dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件查询历史记录--> |
| | | <select id="selectSome" resultType="com.dy.pipIrrGlobal.voRm.VoManure"> |
| | | SELECT |
| | | <include refid="Base_Column_List" />, |
| | | mtb.`name` AS manureName |
| | | FROM rm_manure_last ltb |
| | | INNER JOIN pr_st_manure mtb ON mtb.id = ltb.manure_id |
| | | <where> |
| | | <if test="manureId != null"> |
| | | AND ltb.manure_id = #{manureId} |
| | | </if> |
| | | <if test = "no != null"> |
| | | AND mtb.no = #{no} |
| | | </if> |
| | | <if test = "name != null and name !=''"> |
| | | AND mtb.name LIKE CONCAT('%',#{intakeNum},'%') |
| | | </if> |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ltb.dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ltb.manure_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_manure_last |
New file |
| | |
| | | package com.dy.pipIrrRemote.mqttSd1.manure; |
| | | |
| | | 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.pipIrrGlobal.voRm.VoManure; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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/6/25 16:17 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "水肥数据查询", description = "水肥数据查询") |
| | | @RestController("rmManureCtrl") |
| | | @RequestMapping(path = "manure") |
| | | @RequiredArgsConstructor |
| | | public class ManureCtrl { |
| | | |
| | | private ManureSv sv; |
| | | |
| | | @Autowired |
| | | public void setSv(ManureSv sv){ |
| | | this.sv = sv ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询历史记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "history") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoManure>>> selectHistory(ManureQo qo){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.selectHistory(qo)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询最新记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "last") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoManure>>> selectLast(ManureQo qo){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.selectLast(qo)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.mqttSd1.manure; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/6/25 16:18 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | public class ManureQo extends QueryConditionVo { |
| | | /** |
| | | * 水肥机ID |
| | | */ |
| | | @Schema(description = "水肥机ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long manureId; |
| | | |
| | | /** |
| | | * 水肥站编号 |
| | | */ |
| | | @Schema(description = "水肥站编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Integer no ; |
| | | |
| | | /** |
| | | * 水肥站名称 |
| | | */ |
| | | @Schema(description = "水肥站名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String name; |
| | | /** |
| | | * 查询开始日期 |
| | | */ |
| | | @Schema(description = "查询开始日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String timeStart; |
| | | |
| | | /** |
| | | * 查询结束日期 |
| | | */ |
| | | @Schema(description = "查询结束日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String timeStop; |
| | | |
| | | |
| | | public void completionTime(){ |
| | | if(timeStart != null && !timeStart.trim().equals("")) { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } |
| | | if(timeStop != null && !timeStop.trim().equals("")) { |
| | | timeStop = timeStop + " 23:59:59"; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrRemote.mqttSd1.manure; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoRm.RmManureHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmManureLastMapper; |
| | | import com.dy.pipIrrGlobal.voRm.VoManure; |
| | | import lombok.RequiredArgsConstructor; |
| | | 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/6/25 16:18 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service("rmManureSv") |
| | | @RequiredArgsConstructor |
| | | public class ManureSv { |
| | | |
| | | @Autowired |
| | | private RmManureHistoryMapper rmManureHistoryDao ; |
| | | @Autowired |
| | | private RmManureLastMapper rmManureLastDao ; |
| | | |
| | | /** |
| | | * 根据指定条件查询历史记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoManure>> selectHistory(ManureQo qo) { |
| | | qo.completionTime(); |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); |
| | | Long itemTotal = rmManureHistoryDao.selectCount(params); |
| | | |
| | | QueryResultVo<List<VoManure>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmManureHistoryDao.selectSome(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询最新记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoManure>> selectLast(ManureQo qo) { |
| | | qo.completionTime(); |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); |
| | | Long itemTotal = rmManureLastDao.selectCount(params); |
| | | |
| | | QueryResultVo<List<VoManure>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmManureLastDao.selectSome(params); |
| | | return rsVo ; |
| | | } |
| | | } |