From f4d1e8f5e01e12a90050d94e50571b9cb1ebe109 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期五, 21 二月 2025 09:01:14 +0800 Subject: [PATCH] 灌溉模块4个接口 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml | 8 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java | 57 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml | 137 +++++ pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java | 60 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitSimple.java | 36 + pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java | 62 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java | 9 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java | 14 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java | 24 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java | 89 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java | 17 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java | 2 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java | 83 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java | 26 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java | 10 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml | 11 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java | 74 ++ pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java | 70 ++ /dev/null | 32 - pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml | 227 ++++---- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java | 27 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java | 26 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml | 151 ++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java | 78 +++ pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoClient.java | 21 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml | 28 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml | 91 +++ 27 files changed, 1,325 insertions(+), 145 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java index fbe5f1c..5682430 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java @@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -29,11 +30,18 @@ int updateByPrimaryKey(IrGroupClient record); /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� - * @param clientId + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勬暟閲� + * @param params * @return */ - List<VoGroupSimple> getGroupsByClientId(Long clientId); + Long getGroupCountByClientId(Map<?, ?> params); + + /** + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� + * @param params + * @return + */ + List<VoGroupSimple> getGroupsByClientId(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java index 744862d..af2b58a 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java @@ -2,11 +2,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup; -import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit; import com.dy.pipIrrGlobal.voIr.VoGroup; import com.dy.pipIrrGlobal.voIr.VoGroupOne; -import com.dy.pipIrrGlobal.voIr.VoUnit; -import com.dy.pipIrrGlobal.voIr.VoUnitOne; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -47,4 +44,11 @@ * @return */ List<VoGroup> getIrrigateGroups(Map<?, ?> params); + + /** + * 鏍规嵁杞亴缁勭紪鍙疯幏鍙栧彇姘村彛鍒楄〃 + * @param groupId + * @return + */ + List<Long> getIntakesByGroupId(Long groupId); } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java new file mode 100644 index 0000000..1b36d36 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java @@ -0,0 +1,27 @@ +package com.dy.pipIrrGlobal.daoIr; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:33 + * @LastEditTime 2025-02-20 15:33 + * @Description + */ + +@Mapper +public interface IrIrrigatePlanMapper extends BaseMapper<IrIrrigatePlan> { + int deleteByPrimaryKey(Long id); + + int insert(IrIrrigatePlan record); + + int insertSelective(IrIrrigatePlan record); + + IrIrrigatePlan selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(IrIrrigatePlan record); + + int updateByPrimaryKey(IrIrrigatePlan record); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java new file mode 100644 index 0000000..7d2b824 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java @@ -0,0 +1,26 @@ +package com.dy.pipIrrGlobal.daoIr; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:35 + * @LastEditTime 2025-02-20 15:35 + * @Description + */ +@Mapper +public interface IrIrrigateScheduleMapper extends BaseMapper<IrIrrigateSchedule> { + int deleteByPrimaryKey(Long id); + + int insert(IrIrrigateSchedule record); + + int insertSelective(IrIrrigateSchedule record); + + IrIrrigateSchedule selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(IrIrrigateSchedule record); + + int updateByPrimaryKey(IrIrrigateSchedule record); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java index d7cd2b6..1c80909 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java @@ -2,8 +2,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit; -import com.dy.pipIrrGlobal.voIr.VoProject; -import com.dy.pipIrrGlobal.voIr.VoProjectOne; import com.dy.pipIrrGlobal.voIr.VoUnit; import com.dy.pipIrrGlobal.voIr.VoUnitOne; import org.apache.ibatis.annotations.Mapper; @@ -46,4 +44,11 @@ * @return */ List<VoUnit> getUnits(Map<?, ?> params); + + /** + * 鏍规嵁鐏屾簤鍗曞厓ID鑾峰彇鍙栨按鍙D + * @param unitId + * @return + */ + Long getIntakeIdByUnitId(Long unitId); } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java new file mode 100644 index 0000000..7e13c82 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java @@ -0,0 +1,26 @@ +package com.dy.pipIrrGlobal.daoIr; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:35 + * @LastEditTime 2025-02-20 15:35 + * @Description + */ +@Mapper +public interface IrOpeningScheduleMapper extends BaseMapper<IrOpeningSchedule> { + int deleteByPrimaryKey(Long id); + + int insert(IrOpeningSchedule record); + + int insertSelective(IrOpeningSchedule record); + + IrOpeningSchedule selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(IrOpeningSchedule record); + + int updateByPrimaryKey(IrOpeningSchedule record); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java index 2721de6..cda09fd 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java @@ -2,7 +2,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoIr.IrUnitClient; +import com.dy.pipIrrGlobal.voIr.VoUnitSimple; import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -25,4 +29,17 @@ int updateByPrimaryKey(IrUnitClient record); + /** + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鏁伴噺 + * @param params + * @return + */ + Long getUnitCountByClientId(Map<?, ?> params); + + /** + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鍒楄〃 + * @param params + * @return + */ + List<VoUnitSimple> getUnitsByClientId(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java new file mode 100644 index 0000000..f0c2679 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java @@ -0,0 +1,83 @@ +package com.dy.pipIrrGlobal.pojoIr; + +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 jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:33 + * @LastEditTime 2025-02-20 15:33 + * @Description 鐏屾簤璁″垝瀹炰綋绫� + */ + +@TableName(value="ir_irrigate_plan", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class IrIrrigatePlan implements BaseEntity { + public static final long serialVersionUID = 202502201543001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 椤圭洰ID + */ + private Long projectId; + + /** + * 璁″垝鍚嶇О + */ + @NotBlank(message = "璁″垝鍚嶇О涓嶈兘涓虹┖") + private String planName; + + /** + * 璁″垝鍚姩妯″紡;1-鎵嬪姩鍚姩锛�2-鑷姩鍚姩 + */ + @NotNull(message = "璁″垝鍚姩妯″紡涓嶈兘涓虹┖") + private Byte startupMode; + + /** + * 鐏屾簤寮�濮嬫椂闂�;绮剧‘鍒板垎 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date planStartTime; + + /** + * 鐏屾簤缁撴潫鏃堕棿;绮剧‘鍒板垎 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date planStopTime; + + /** + * 璁″垝鐘舵��;1-鑽夌锛�2-宸插彂甯� + */ + private Byte planState; + + /** + * 鎵ц鐘舵��;1-鏈墽琛岋紝2-鎵ц涓紝3-宸叉殏鍋滐紝4-宸茬粓姝紝5-宸插畬鎴� + */ + private Byte executingState; + + /** + * 閫昏緫鍒犻櫎鏍囪瘑;鏈垹闄や负0锛屽凡鍒犻櫎涓哄垹闄ゆ椂闂� + */ + private Long deleted; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java new file mode 100644 index 0000000..07ed9a3 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java @@ -0,0 +1,78 @@ +package com.dy.pipIrrGlobal.pojoIr; + +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 jakarta.validation.constraints.NotNull; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:35 + * @LastEditTime 2025-02-20 15:35 + * @Description 鐏屾簤娆″簭瀹炰綋绫� + */ + +@TableName(value="ir_irrigate_schedule", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class IrIrrigateSchedule implements BaseEntity { + public static final long serialVersionUID = 202502201601001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 鐏屾簤璁″垝ID + */ + @NotNull(message = "鐏屾簤璁″垝ID涓嶈兘涓虹┖") + private Long planId; + + /** + * 杞亴缁処D + */ + private Long groupId; + + /** + * 鐏屾簤鍗曞厓ID + */ + private Long unitId; + + /** + * 鐏屾簤寮�濮嬫椂闂� + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @NotNull(message = "鐏屾簤寮�濮嬫椂闂翠笉鑳戒负绌�") + private Date startTime; + + /** + * 鐏屾簤缁撴潫鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @NotNull(message ="鐏屾簤缁撴潫鏃堕棿涓嶈兘涓虹┖") + private Date stopTime; + + /** + * 鍙栨按鍙D鍒楄〃 + */ + private String intakeIds; + + /** + * 褰撳墠鐘舵��;1-姝e父锛�2-鏆傚仠锛�3-缁堟 + */ + private Byte currentState; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java new file mode 100644 index 0000000..e5bb0b1 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java @@ -0,0 +1,57 @@ +package com.dy.pipIrrGlobal.pojoIr; + +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 jakarta.validation.constraints.NotNull; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:35 + * @LastEditTime 2025-02-20 15:35 + * @Description 寮�闃�璁″垝瀹炰綋绫� + */ + +@TableName(value="ir_opening_schedule", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class IrOpeningSchedule implements BaseEntity { + public static final long serialVersionUID = 202502201600001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 鐏屾簤娆″簭ID + */ + @NotNull(message = "鐏屾簤娆″簭ID涓嶈兘涓虹┖") + private Long scheduleId; + + /** + * 寮�闃�鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @NotNull(message = "寮�闃�鏃堕棿涓嶈兘涓虹┖") + private Date startTime; + + /** + * 鐏屾簤鏃堕暱;鍒嗛挓 + */ + @NotNull(message = "鐏屾簤鏃堕暱涓嶈兘涓虹┖") + private Integer duration; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitSimple.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitSimple.java new file mode 100644 index 0000000..a96efa1 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitSimple.java @@ -0,0 +1,36 @@ +package com.dy.pipIrrGlobal.voIr; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.dy.common.po.BaseEntity; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 11:01 + * @LastEditTime 2025-02-20 11:01 + * @Description 鐏屾簤鍗曞厓绠�鍗曡鍥惧璞� + */ + +@Data +@JsonPropertyOrder({"unitId", "intakeNo", "remarks"}) +public class VoUnitSimple implements BaseEntity { + public static final long serialVersionUID = 202502201102001L; + + /** + * 鐏屾簤鍗曞厓ID + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long unitId; + + /** + * 鍙栨按鍙g紪鐮� + */ + private String intakeNo; + + /** + * 澶囨敞 + */ + private String remarks; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml index ea0fe18..992f079 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml @@ -1,113 +1,132 @@ <?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.daoIr.IrGroupClientMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> - <!--@mbg.generated--> - <!--@Table ir_group_client--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="group_id" jdbcType="BIGINT" property="groupId" /> - <result column="client_id" jdbcType="BIGINT" property="clientId" /> - <result column="operator" jdbcType="BIGINT" property="operator" /> - <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, group_id, client_id, `operator`, operate_time - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from ir_group_client - where id = #{id,jdbcType=BIGINT} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from ir_group_client - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> - <!--@mbg.generated--> - insert into ir_group_client (id, group_id, client_id, - `operator`, operate_time) - values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, - #{operator,jdbcType=BIGINT}, #{operateTime,jdbcType=TIMESTAMP}) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> - <!--@mbg.generated--> - insert into ir_group_client - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> + <!--@mbg.generated--> + <!--@Table ir_group_client--> + <id column="id" jdbcType="BIGINT" property="id"/> + <result column="group_id" jdbcType="BIGINT" property="groupId"/> + <result column="client_id" jdbcType="BIGINT" property="clientId"/> + <result column="operator" jdbcType="BIGINT" property="operator"/> + <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime"/> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> id, - </if> - <if test="groupId != null"> group_id, - </if> - <if test="clientId != null"> client_id, - </if> - <if test="operator != null"> `operator`, - </if> - <if test="operateTime != null"> - operate_time, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="groupId != null"> - #{groupId,jdbcType=BIGINT}, - </if> - <if test="clientId != null"> - #{clientId,jdbcType=BIGINT}, - </if> - <if test="operator != null"> - #{operator,jdbcType=BIGINT}, - </if> - <if test="operateTime != null"> - #{operateTime,jdbcType=TIMESTAMP}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> - <!--@mbg.generated--> - update ir_group_client - <set> - <if test="groupId != null"> - group_id = #{groupId,jdbcType=BIGINT}, - </if> - <if test="clientId != null"> - client_id = #{clientId,jdbcType=BIGINT}, - </if> - <if test="operator != null"> - `operator` = #{operator,jdbcType=BIGINT}, - </if> - <if test="operateTime != null"> - operate_time = #{operateTime,jdbcType=TIMESTAMP}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> - <!--@mbg.generated--> - update ir_group_client - set group_id = #{groupId,jdbcType=BIGINT}, - client_id = #{clientId,jdbcType=BIGINT}, - `operator` = #{operator,jdbcType=BIGINT}, - operate_time = #{operateTime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - </update> + operate_time + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from ir_group_client + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete + from ir_group_client + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> + <!--@mbg.generated--> + insert into ir_group_client (id, group_id, client_id, + `operator`, operate_time) + values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, + #{operator,jdbcType=BIGINT}, #{operateTime,jdbcType=TIMESTAMP}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> + <!--@mbg.generated--> + insert into ir_group_client + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="groupId != null"> + group_id, + </if> + <if test="clientId != null"> + client_id, + </if> + <if test="operator != null"> + `operator`, + </if> + <if test="operateTime != null"> + operate_time, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="groupId != null"> + #{groupId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + #{clientId,jdbcType=BIGINT}, + </if> + <if test="operator != null"> + #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + #{operateTime,jdbcType=TIMESTAMP}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> + <!--@mbg.generated--> + update ir_group_client + <set> + <if test="groupId != null"> + group_id = #{groupId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + client_id = #{clientId,jdbcType=BIGINT}, + </if> + <if test="operator != null"> + `operator` = #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + operate_time = #{operateTime,jdbcType=TIMESTAMP}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient"> + <!--@mbg.generated--> + update ir_group_client + set group_id = #{groupId,jdbcType=BIGINT}, + client_id = #{clientId,jdbcType=BIGINT}, + `operator` = #{operator,jdbcType=BIGINT}, + operate_time = #{operateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + </update> - <!--鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛�--> - <select id="getGroupsByClientId" resultType="com.dy.pipIrrGlobal.voIr.VoGroupSimple"> - SELECT - grp.id AS groupId, - grp.group_code AS groupCode - FROM ir_group_client gc - INNER JOIN ir_irrigate_group grp ON grp.id = gc.group_id - WHERE grp.deleted = 0 AND client_id = #{clientId} - ORDER BY grp.group_code - </select> + <!--鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勬暟閲�--> + <select id="getGroupCountByClientId" resultType="java.lang.Long"> + SELECT + count(*) + FROM ir_irrigate_group grp + INNER JOIN ir_group_client gc ON gc.group_id = grp.id + WHERE grp.deleted = 0 AND gc.client_id = #{clientId} + </select> + + <!--鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛�--> + <select id="getGroupsByClientId" resultType="com.dy.pipIrrGlobal.voIr.VoGroupSimple"> + SELECT + grp.id AS groupId, + grp.group_code AS groupCode + FROM ir_irrigate_group grp + INNER JOIN ir_group_client gc ON gc.group_id = grp.id + WHERE grp.deleted = 0 AND gc.client_id = #{clientId} + ORDER BY grp.group_code + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml index ae93ff0..242f89b 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml @@ -173,4 +173,15 @@ GROUP BY gro.id ) a </select> + + <!--鏍规嵁杞亴缁勭紪鍙疯幏鍙栧彇姘村彛鍒楄〃--> + <select id="getIntakesByGroupId" resultType="java.lang.Long"> + SELECT + uni.intake_id AS intakeId + FROM ir_irrigate_group grp + INNER JOIN ir_group_unit gu ON gu.group_id = grp.id + INNER JOIN ir_irrigate_unit uni ON uni.id = gu.unit_id + WHERE grp.deleted = 0 AND grp.id = #{groupId} + + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml new file mode 100644 index 0000000..9dbad15 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml @@ -0,0 +1,151 @@ +<?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.daoIr.IrIrrigatePlanMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> + <!--@mbg.generated--> + <!--@Table ir_irrigate_plan--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="project_id" jdbcType="BIGINT" property="projectId" /> + <result column="plan_name" jdbcType="VARCHAR" property="planName" /> + <result column="startup_mode" jdbcType="TINYINT" property="startupMode" /> + <result column="plan_start_time" jdbcType="TIMESTAMP" property="planStartTime" /> + <result column="plan_stop_time" jdbcType="TIMESTAMP" property="planStopTime" /> + <result column="plan_state" jdbcType="TINYINT" property="planState" /> + <result column="executing_state" jdbcType="TINYINT" property="executingState" /> + <result column="deleted" jdbcType="BIGINT" property="deleted" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, project_id, plan_name, startup_mode, plan_start_time, plan_stop_time, plan_state, + executing_state, deleted + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_irrigate_plan + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_irrigate_plan + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> + <!--@mbg.generated--> + insert into ir_irrigate_plan (id, project_id, plan_name, + startup_mode, plan_start_time, plan_stop_time, + plan_state, executing_state, deleted + ) + values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT}, #{planName,jdbcType=VARCHAR}, + #{startupMode,jdbcType=TINYINT}, #{planStartTime,jdbcType=TIMESTAMP}, #{planStopTime,jdbcType=TIMESTAMP}, + #{planState,jdbcType=TINYINT}, #{executingState,jdbcType=TINYINT}, #{deleted,jdbcType=BIGINT} + ) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> + <!--@mbg.generated--> + insert into ir_irrigate_plan + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="projectId != null"> + project_id, + </if> + <if test="planName != null"> + plan_name, + </if> + <if test="startupMode != null"> + startup_mode, + </if> + <if test="planStartTime != null"> + plan_start_time, + </if> + <if test="planStopTime != null"> + plan_stop_time, + </if> + <if test="planState != null"> + plan_state, + </if> + <if test="executingState != null"> + executing_state, + </if> + <if test="deleted != null"> + deleted, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="projectId != null"> + #{projectId,jdbcType=BIGINT}, + </if> + <if test="planName != null"> + #{planName,jdbcType=VARCHAR}, + </if> + <if test="startupMode != null"> + #{startupMode,jdbcType=TINYINT}, + </if> + <if test="planStartTime != null"> + #{planStartTime,jdbcType=TIMESTAMP}, + </if> + <if test="planStopTime != null"> + #{planStopTime,jdbcType=TIMESTAMP}, + </if> + <if test="planState != null"> + #{planState,jdbcType=TINYINT}, + </if> + <if test="executingState != null"> + #{executingState,jdbcType=TINYINT}, + </if> + <if test="deleted != null"> + #{deleted,jdbcType=BIGINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> + <!--@mbg.generated--> + update ir_irrigate_plan + <set> + <if test="projectId != null"> + project_id = #{projectId,jdbcType=BIGINT}, + </if> + <if test="planName != null"> + plan_name = #{planName,jdbcType=VARCHAR}, + </if> + <if test="startupMode != null"> + startup_mode = #{startupMode,jdbcType=TINYINT}, + </if> + <if test="planStartTime != null"> + plan_start_time = #{planStartTime,jdbcType=TIMESTAMP}, + </if> + <if test="planStopTime != null"> + plan_stop_time = #{planStopTime,jdbcType=TIMESTAMP}, + </if> + <if test="planState != null"> + plan_state = #{planState,jdbcType=TINYINT}, + </if> + <if test="executingState != null"> + executing_state = #{executingState,jdbcType=TINYINT}, + </if> + <if test="deleted != null"> + deleted = #{deleted,jdbcType=BIGINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> + <!--@mbg.generated--> + update ir_irrigate_plan + set project_id = #{projectId,jdbcType=BIGINT}, + plan_name = #{planName,jdbcType=VARCHAR}, + startup_mode = #{startupMode,jdbcType=TINYINT}, + plan_start_time = #{planStartTime,jdbcType=TIMESTAMP}, + plan_stop_time = #{planStopTime,jdbcType=TIMESTAMP}, + plan_state = #{planState,jdbcType=TINYINT}, + executing_state = #{executingState,jdbcType=TINYINT}, + deleted = #{deleted,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + </update> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml new file mode 100644 index 0000000..38799f3 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml @@ -0,0 +1,137 @@ +<?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.daoIr.IrIrrigateScheduleMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> + <!--@mbg.generated--> + <!--@Table ir_irrigate_schedule--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="plan_id" jdbcType="BIGINT" property="planId" /> + <result column="group_id" jdbcType="BIGINT" property="groupId" /> + <result column="unit_id" jdbcType="BIGINT" property="unitId" /> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> + <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" /> + <result column="intake_ids" jdbcType="VARCHAR" property="intakeIds" /> + <result column="current_state" jdbcType="TINYINT" property="currentState" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, plan_id, group_id, unit_id, start_time, stop_time, intake_ids, current_state + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_irrigate_schedule + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_irrigate_schedule + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> + <!--@mbg.generated--> + insert into ir_irrigate_schedule (id, plan_id, group_id, + unit_id, start_time, stop_time, + intake_ids, current_state) + values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, + #{unitId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, #{stopTime,jdbcType=TIMESTAMP}, + #{intakeIds,jdbcType=VARCHAR}, #{currentState,jdbcType=TINYINT}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> + <!--@mbg.generated--> + insert into ir_irrigate_schedule + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="planId != null"> + plan_id, + </if> + <if test="groupId != null"> + group_id, + </if> + <if test="unitId != null"> + unit_id, + </if> + <if test="startTime != null"> + start_time, + </if> + <if test="stopTime != null"> + stop_time, + </if> + <if test="intakeIds != null"> + intake_ids, + </if> + <if test="currentState != null"> + current_state, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="planId != null"> + #{planId,jdbcType=BIGINT}, + </if> + <if test="groupId != null"> + #{groupId,jdbcType=BIGINT}, + </if> + <if test="unitId != null"> + #{unitId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="stopTime != null"> + #{stopTime,jdbcType=TIMESTAMP}, + </if> + <if test="intakeIds != null"> + #{intakeIds,jdbcType=VARCHAR}, + </if> + <if test="currentState != null"> + #{currentState,jdbcType=TINYINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> + <!--@mbg.generated--> + update ir_irrigate_schedule + <set> + <if test="planId != null"> + plan_id = #{planId,jdbcType=BIGINT}, + </if> + <if test="groupId != null"> + group_id = #{groupId,jdbcType=BIGINT}, + </if> + <if test="unitId != null"> + unit_id = #{unitId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + start_time = #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="stopTime != null"> + stop_time = #{stopTime,jdbcType=TIMESTAMP}, + </if> + <if test="intakeIds != null"> + intake_ids = #{intakeIds,jdbcType=VARCHAR}, + </if> + <if test="currentState != null"> + current_state = #{currentState,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> + <!--@mbg.generated--> + update ir_irrigate_schedule + set plan_id = #{planId,jdbcType=BIGINT}, + group_id = #{groupId,jdbcType=BIGINT}, + unit_id = #{unitId,jdbcType=BIGINT}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + stop_time = #{stopTime,jdbcType=TIMESTAMP}, + intake_ids = #{intakeIds,jdbcType=VARCHAR}, + current_state = #{currentState,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml index 600d56d..c5d4759 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml @@ -187,4 +187,12 @@ </if> </where> </select> + + <!--鏍规嵁鐏屾簤鍗曞厓ID鑾峰彇鍙栨按鍙D--> + <select id="getIntakeIdByUnitId" resultType="java.lang.Long"> + SELECT + intake_id AS intakeId + FROM ir_irrigate_unit + WHERE deleted = 0 AND id = #{unitId} + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml new file mode 100644 index 0000000..8ff2b08 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml @@ -0,0 +1,91 @@ +<?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.daoIr.IrOpeningScheduleMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule"> + <!--@mbg.generated--> + <!--@Table ir_opening_schedule--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="schedule_id" jdbcType="BIGINT" property="scheduleId" /> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> + <result column="duration" jdbcType="INTEGER" property="duration" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, schedule_id, start_time, duration + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_opening_schedule + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_opening_schedule + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule"> + <!--@mbg.generated--> + insert into ir_opening_schedule (id, schedule_id, start_time, + duration) + values (#{id,jdbcType=BIGINT}, #{scheduleId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, + #{duration,jdbcType=INTEGER}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule"> + <!--@mbg.generated--> + insert into ir_opening_schedule + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="scheduleId != null"> + schedule_id, + </if> + <if test="startTime != null"> + start_time, + </if> + <if test="duration != null"> + duration, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="scheduleId != null"> + #{scheduleId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="duration != null"> + #{duration,jdbcType=INTEGER}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule"> + <!--@mbg.generated--> + update ir_opening_schedule + <set> + <if test="scheduleId != null"> + schedule_id = #{scheduleId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + start_time = #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="duration != null"> + duration = #{duration,jdbcType=INTEGER}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule"> + <!--@mbg.generated--> + update ir_opening_schedule + set schedule_id = #{scheduleId,jdbcType=BIGINT}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + duration = #{duration,jdbcType=INTEGER} + where id = #{id,jdbcType=BIGINT} + </update> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml index 6d74a8b..154ca20 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml @@ -99,4 +99,32 @@ operate_time = #{operateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> + + <!--鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鏁伴噺--> + <select id="getUnitCountByClientId" resultType="java.lang.Long"> + SELECT + count(*) + FROM ir_irrigate_unit uni + INNER JOIN pr_intake inta ON inta.id = uni.intake_id + INNER JOIN ir_unit_client uc ON uc.unit_id = uni.id + WHERE uni.deleted = 0 AND uc.client_id = #{clientId} + </select> + + <!--鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鍒楄〃--> + <select id="getUnitsByClientId" resultType="com.dy.pipIrrGlobal.voIr.VoUnitSimple"> + SELECT + uni.id AS unitId, + inta.`name` AS intakeNo, + uni.remarks + FROM ir_irrigate_unit uni + INNER JOIN pr_intake inta ON inta.id = uni.intake_id + INNER JOIN ir_unit_client uc ON uc.unit_id = uni.id + WHERE uni.deleted = 0 AND uc.client_id = #{clientId} + ORDER BY uni.id + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java deleted file mode 100644 index 0f22e38..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.dy.pipIrrIrrigate.irrigatePlan; - -import com.dy.common.aop.SsoAop; -import com.dy.common.webUtil.BaseResponse; -import com.dy.common.webUtil.BaseResponseUtils; -import com.dy.pipIrrGlobal.voIr.VoGroupSimple; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * @author ZhuBaoMin - * @date 2024-11-28 17:20 - * @LastEditTime 2024-11-28 17:20 - * @Description 鐏屾簤璁″垝鎺у埗绫� - */ - -@Slf4j -@RestController -@RequestMapping(path = "irrigatePlan") -@RequiredArgsConstructor -public class IrrigatePlanCtrl { - private final IrrigatePlanSv irrigatePlanSv; - - /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� - * @return - */ - @GetMapping(path = "/getGroups") - @SsoAop() - public BaseResponse<List<VoGroupSimple>> getGroups(@RequestParam("clientId") Long clientId) { - try { - return BaseResponseUtils.buildSuccess(irrigatePlanSv.getGroups(clientId)); - } catch (Exception e) { - log.error("鑾峰彇浠诲姟绫诲瀷寮傚父", e); - return BaseResponseUtils.buildException(e.getMessage()); - } - } -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanSv.java deleted file mode 100644 index 6350b50..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanSv.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.dy.pipIrrIrrigate.irrigatePlan; - -import com.dy.pipIrrGlobal.daoIr.IrGroupClientMapper; -import com.dy.pipIrrGlobal.voIr.VoGroupSimple; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @author ZhuBaoMin - * @date 2024-11-28 17:20 - * @LastEditTime 2024-11-28 17:20 - * @Description 鐏屾簤璁″垝鏈嶅姟绫� - */ - -@Slf4j -@Service -public class IrrigatePlanSv { - @Autowired - private IrGroupClientMapper irGroupClientMapper; - - /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� - * @param clientId - * @return - */ - public List<VoGroupSimple> getGroups(Long clientId) { - return irGroupClientMapper.getGroupsByClientId(clientId); - } -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java index 7c417b3..10e0d98 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/PipIrrWechatApplication.java @@ -18,7 +18,7 @@ }) } ) -@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoFi"}) +@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoFi", "com.dy.pipIrrGlobal.daoIr"}) public class PipIrrWechatApplication { public static void main(String[] args) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java new file mode 100644 index 0000000..ed15346 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java @@ -0,0 +1,89 @@ +package com.dy.pipIrrWechat.irrigatePlan; + +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan; +import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule; +import com.dy.pipIrrWechat.irrigatePlan.dto.IrrigatePlan; +import com.dy.pipIrrWechat.irrigatePlan.dto.IrrigateSchedule; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Objects; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:27 + * @LastEditTime 2025-02-20 15:27 + * @Description + */ + +@Slf4j +@RestController +@RequestMapping(path = "plan") +@RequiredArgsConstructor +public class IrrigatePlanCtrl { + private final IrrigatePlanSv irrigatePlanSv; + + @PostMapping(path = "createPlan", consumes = MediaType.APPLICATION_JSON_VALUE) + @Transactional(rollbackFor = Exception.class) + public BaseResponse<Boolean> createPlan(@RequestBody @Valid IrrigatePlan planAndSchedule, BindingResult bindingResult){ + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + IrIrrigatePlan plan = new IrIrrigatePlan(); + plan.setProjectId(planAndSchedule.getProjectId()); + plan.setPlanName(planAndSchedule.getPlanName()); + plan.setStartupMode(planAndSchedule.getStartupMode()); + plan.setPlanStartTime(planAndSchedule.getPlanStartTime()); + plan.setPlanStopTime(planAndSchedule.getPlanStopTime()); + plan.setPlanState((byte)1); + plan.setExecutingState((byte)1); + plan.setDeleted(0L); + + Long planId = irrigatePlanSv.addIrrigatePlan(plan); + if(planId != null){ + for(IrrigateSchedule schedule : planAndSchedule.getSchedules()){ + IrIrrigateSchedule po = new IrIrrigateSchedule(); + po.setPlanId(planId); + + if(planAndSchedule.getIrrigateType() == 1) { + po.setGroupId(schedule.getIrrigateId()); + List<Long> intakesData = irrigatePlanSv.getIntakesByGroupId(schedule.getIrrigateId()); + if(intakesData != null && intakesData.size() > 0){ + String intakeIds = ""; + for(Long intakeId : intakesData){ + intakeIds += intakeId + ","; + } + po.setIntakeIds(intakeIds.substring(0, intakeIds.length() - 1)); + } + }else { + po.setUnitId(schedule.getIrrigateId()); + Long intakeId = irrigatePlanSv.getIntakeIdByUnitId(schedule.getIrrigateId()); + if(intakeId != null){ + po.setIntakeIds(intakeId.toString()); + } + } + + po.setStartTime(schedule.getStartTime()); + po.setStopTime(schedule.getStopTime()); + //po.setIntakeIds(schedule.getIntakeIds()); + po.setCurrentState((byte)1); + Long scheduleId = irrigatePlanSv.addIrrigateSchedule(po); + } + } + + + return BaseResponseUtils.buildSuccess(); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java new file mode 100644 index 0000000..e123311 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java @@ -0,0 +1,74 @@ +package com.dy.pipIrrWechat.irrigatePlan; + +import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper; +import com.dy.pipIrrGlobal.daoIr.IrIrrigatePlanMapper; +import com.dy.pipIrrGlobal.daoIr.IrIrrigateScheduleMapper; +import com.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper; +import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan; +import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:27 + * @LastEditTime 2025-02-20 15:27 + * @Description + */ + +@Slf4j +@Service +public class IrrigatePlanSv { + @Autowired + private IrIrrigatePlanMapper irrigatePlanMapper; + + @Autowired + private IrIrrigateScheduleMapper irIrrigateScheduleMapper; + + @Autowired + private IrIrrigateGroupMapper irIrrigateGroupMapper; + + @Autowired + private IrIrrigateUnitMapper irIrrigateUnitMapper; + + /** + * 娣诲姞鐏屾簤璁″垝璁板綍 + * @param po + * @return + */ + public Long addIrrigatePlan(IrIrrigatePlan po) { + irrigatePlanMapper.insert(po); + return po.getId(); + } + + /** + * 娣诲姞鐏屾簤娆″簭璁板綍 + * @param po + * @return + */ + public Long addIrrigateSchedule(IrIrrigateSchedule po) { + irIrrigateScheduleMapper.insert(po); + return po.getId(); + } + + /** + * 鏍规嵁杞亴缁処D鑾峰彇鍙栨按鍙D鍒楄〃 + * @param groupId + * @return + */ + public List<Long> getIntakesByGroupId(Long groupId) { + return irIrrigateGroupMapper.getIntakesByGroupId(groupId); + } + + /** + * 鏍规嵁鐏屾簤鍗曞厓ID鑾峰彇鍙栨按鍙D + * @param unitId + * @return + */ + public Long getIntakeIdByUnitId(Long unitId) { + return irIrrigateUnitMapper.getIntakeIdByUnitId(unitId); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java new file mode 100644 index 0000000..55c7d07 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java @@ -0,0 +1,60 @@ +package com.dy.pipIrrWechat.irrigatePlan.dto; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 14:48 + * @LastEditTime 2025-02-20 14:48 + * @Description 鐏屾簤璁″垝瀵硅薄 + */ + +@Data +public class IrrigatePlan { + public static final long serialVersionUID = 202502201511001L; + + /** + * 椤圭洰ID + */ + private Long projectId; + + /** + * 璁″垝鍚嶇О + */ + @NotBlank(message = "璁″垝鍚嶇О涓嶈兘涓虹┖") + private String planName; + + /** + * 璁″垝鍚姩妯″紡锛�1-鎵嬪伐鍚姩锛�2-鑷姩鍚姩 + */ + @NotNull(message = "璁″垝鍚姩妯″紡涓嶈兘涓虹┖") + private Byte startupMode; + + /** + * 璁″垝鍚姩鏃堕棿 + */ + private Date planStartTime; + + /** + * 璁″垝鍋滄鏃堕棿 + */ + private Date planStopTime; + + /** + * 鐏屾簤绫诲瀷锛�1-杞亴缁勶紝2-鐏屾簤鍗曞厓 + */ + @NotNull(message = "鐏屾簤绫诲瀷涓嶈兘涓虹┖") + private Byte irrigateType; + + /** + * 鐏屾簤娆″簭 + */ + @NotEmpty(message = "宸℃杞ㄨ抗涓嶈兘涓虹┖") + private List<IrrigateSchedule> schedules; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java new file mode 100644 index 0000000..6611243 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java @@ -0,0 +1,24 @@ +package com.dy.pipIrrWechat.irrigatePlan.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 15:17 + * @LastEditTime 2025-02-20 15:17 + * @Description 鐏屾簤娆″簭瀵硅薄琛� + */ + +@Data +public class IrrigateSchedule { + public static final long serialVersionUID = 202502201519001L; + + private Long irrigateId; + + private Date startTime; + + private Date stopTime; + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java new file mode 100644 index 0000000..e2ffc0d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java @@ -0,0 +1,62 @@ +package com.dy.pipIrrWechat.irrigation; + +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.voIr.VoGroupSimple; +import com.dy.pipIrrGlobal.voIr.VoUnitSimple; +import com.dy.pipIrrWechat.irrigation.qo.QoClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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 ZhuBaoMin + * @date 2025-02-20 8:59 + * @LastEditTime 2025-02-20 8:59 + * @Description + */ + +@Slf4j +@RestController +@RequestMapping(path = "irrigation") +@RequiredArgsConstructor +public class IrrigationCtrl { + private final IrrigationSv irrigationSv; + + /** + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� + * @param vo + * @return + */ + @GetMapping(path = "/getGroups") + public BaseResponse<QueryResultVo<List<VoGroupSimple>>> getGroups(QoClient vo) { + try { + QueryResultVo<List<VoGroupSimple>> res = irrigationSv.getGroupsByClientId(vo); + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇杞亴缁勮褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + /** + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鍒楄〃 + * @param vo + * @return + */ + @GetMapping(path = "/getUnits") + public BaseResponse<QueryResultVo<List<VoUnitSimple>>> getUnits(QoClient vo) { + try { + QueryResultVo<List<VoUnitSimple>> res = irrigationSv.getUnitsByClientId(vo); + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇鐏屾簤鍗曞厓璁板綍寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java new file mode 100644 index 0000000..55c979c --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java @@ -0,0 +1,70 @@ +package com.dy.pipIrrWechat.irrigation; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoIr.IrGroupClientMapper; +import com.dy.pipIrrGlobal.daoIr.IrUnitClientMapper; +import com.dy.pipIrrGlobal.voIr.VoGroupSimple; +import com.dy.pipIrrGlobal.voIr.VoUnitSimple; +import com.dy.pipIrrWechat.irrigation.qo.QoClient; +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 ZhuBaoMin + * @date 2025-02-20 8:59 + * @LastEditTime 2025-02-20 8:59 + * @Description + */ + +@Slf4j +@Service +public class IrrigationSv { + @Autowired + private IrGroupClientMapper irGroupClientMapper; + + @Autowired + private IrUnitClientMapper irUnitClientMapper; + + /** + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� + * @param queryVo + * @return + */ + public QueryResultVo<List<VoGroupSimple>> getGroupsByClientId(QoClient queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + + Long itemTotal = irGroupClientMapper.getGroupCountByClientId(params); + + QueryResultVo<List<VoGroupSimple>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryVo.pageSize; + rsVo.pageCurr = queryVo.pageCurr; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = irGroupClientMapper.getGroupsByClientId(params); + return rsVo; + } + + /** + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鍒楄〃 + * @param queryVo + * @return + */ + public QueryResultVo<List<VoUnitSimple>> getUnitsByClientId(QoClient queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + + Long itemTotal = irUnitClientMapper.getUnitCountByClientId(params); + + QueryResultVo<List<VoUnitSimple>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryVo.pageSize; + rsVo.pageCurr = queryVo.pageCurr; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = irUnitClientMapper.getUnitsByClientId(params); + return rsVo; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoClient.java new file mode 100644 index 0000000..b6cd89c --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoClient.java @@ -0,0 +1,21 @@ +package com.dy.pipIrrWechat.irrigation.qo; + +import com.dy.common.webUtil.QueryConditionVo; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author ZhuBaoMin + * @date 2025-02-20 9:40 + * @LastEditTime 2025-02-20 9:40 + * @Description 杞亴缁勩�佺亴婧夊崟鍏冩煡璇㈠璞� + */ + +@Data +@EqualsAndHashCode(callSuper = false) +public class QoClient extends QueryConditionVo { + /** + * 鍐滄埛缂栧彿 + */ + private Long clientId; +} -- Gitblit v1.8.0