Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| New file |
| | |
| | | # Default ignored files |
| | | /shelf/ |
| | | /workspace.xml |
| | | # Datasource local storage ignored files |
| | | /../../../../../:\javaWorkspaces\pipIrr\pipIrr-platform\.idea/dataSources/ |
| | | /dataSources.local.xml |
| | | # Editor-based HTTP Client requests |
| | | /httpRequests/ |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="MavenProjectsManager"> |
| | | <option name="originalFiles"> |
| | | <list> |
| | | <option value="$PROJECT_DIR$/pom.xml" /> |
| | | </list> |
| | | </option> |
| | | </component> |
| | | <component name="ProjectRootManager" version="2" project-jdk-name="20" project-jdk-type="JavaSDK" /> |
| | | </project> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="VcsDirectoryMappings"> |
| | | <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> |
| | | </component> |
| | | </project> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.voPr.VoController; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 9:59 |
| | | * @LastEditTime 2023-12-29 9:59 |
| | | * @LastEditTime 2024-01-02 16:22 |
| | | * @Description |
| | | */ |
| | | |
| | |
| | | int updateByPrimaryKeySelective(PrController record); |
| | | |
| | | int updateByPrimaryKey(PrController record); |
| | | |
| | | /** |
| | | * 根据指定获取控制器记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定获取控制器记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoController> getControllers(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据控制器编号获取控制器列表 |
| | | * @param controllerCode |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getControllersByCode(@Param("controllerCode") String controllerCode); |
| | | |
| | | /** |
| | | * 根据控制器编号逻辑删除控制 |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | | Integer deleteControllerById(@Param("controllerId") Long controllerId); |
| | | |
| | | /** |
| | | * 根据控制器编号获取未删除的控制器数量 |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfController(@Param("controllerId") Long controllerId); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-04 16:02 |
| | | * @LastEditTime 2024-01-04 16:02 |
| | | * @Description |
| | | */ |
| | | public interface PrFlowMonitoringMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrFlowMonitoring record); |
| | | |
| | | int insertSelective(PrFlowMonitoring record); |
| | | |
| | | PrFlowMonitoring selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrFlowMonitoring record); |
| | | |
| | | int updateByPrimaryKey(PrFlowMonitoring record); |
| | | |
| | | /** |
| | | * 根据监测站编号删除监测站 |
| | | * @param flowMonitoringId |
| | | * @return |
| | | */ |
| | | Integer deleteFlowMonitoringById(@Param("flowMonitoringId") Long flowMonitoringId); |
| | | |
| | | /** |
| | | * 根据监测站编号获取未删除的监测站数量 |
| | | * @param flowMonitoringId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowMonitoring(@Param("flowMonitoringId") Long flowMonitoringId); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:04 |
| | | * @LastEditTime 2024-01-05 9:04 |
| | | * @Description |
| | | */ |
| | | public interface PrFlowmeterMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrFlowmeter record); |
| | | |
| | | int insertSelective(PrFlowmeter record); |
| | | |
| | | PrFlowmeter selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrFlowmeter record); |
| | | |
| | | int updateByPrimaryKey(PrFlowmeter record); |
| | | |
| | | /** |
| | | * 据编号删除流量计 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | Integer deleteFlowmeterById(@Param("flowmeterId") Long flowmeterId); |
| | | |
| | | /** |
| | | * 根据流量计编号获取未删除的流量计数量 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfFlowmeter(@Param("flowmeterId") Long flowmeterId); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntakeController; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 9:16 |
| | | * @LastEditTime 2024-01-02 9:16 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface PrIntakeControllerMapper extends BaseMapper<PrIntakeController> { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrIntakeController record); |
| | | |
| | | int insertSelective(PrIntakeController record); |
| | | |
| | | PrIntakeController selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrIntakeController record); |
| | | |
| | | int updateByPrimaryKey(PrIntakeController record); |
| | | |
| | | /** |
| | | * 根据取水口编号、控制器编号、操作类别获取记录数量 |
| | | * 重复绑定、重复解绑都用该方法判断 |
| | | * @param intakeId 取水口ID |
| | | * @param controllerId 控制器ID |
| | | * @param operateType 操作类型 1-捆绑,2-解绑 |
| | | * @return 如何条件记录数 |
| | | */ |
| | | Integer getBindRecordCount(@Param("intakeId") Long intakeId, @Param("controllerId") Long controllerId, @Param("operateType") Byte operateType); |
| | | |
| | | /** |
| | | * 根据取水口编号获取绑定记录列表 |
| | | * @param intakeId 取水口编号 |
| | | * @return 取水口与控制器绑定列表 |
| | | */ |
| | | List<Map<String, Object>> getBindsByIntakeId(@Param("intakeId") Long intakeId); |
| | | |
| | | /** |
| | | * 根据控制器编号获取绑定记录列表 |
| | | * @param controllerId 控制器编号 |
| | | * @return 取水口与控制器绑定列表 |
| | | */ |
| | | List<Map<String, Object>> getBindsByControllerId(@Param("controllerId") Long controllerId); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoIntake; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author wuzeyu |
| | | * @date 2023/12/26 13:56 |
| | | * @LastEditTime 2023/12/26 13:56 |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface PrIntakeMapper { |
| | | |
| | | /** |
| | | * select by primary key |
| | | * @param id primary key |
| | | * @return object by primary key |
| | | */ |
| | | PrIntake selectByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * 得到全部实体 |
| | | * @return 全部实体 |
| | | * */ |
| | | List<PrIntake> selectAll(); |
| | | |
| | | /** |
| | | * 逻辑删除 |
| | | * @param id primaryKey |
| | | * @return deleteCount |
| | | */ |
| | | int deleteLogicById(Long id); |
| | | |
| | | /** |
| | | * 实际删除 |
| | | * @param id primaryKey |
| | | * @return deleteCount |
| | | */ |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrIntake record); |
| | | |
| | | int insertSelective(PrIntake record); |
| | | |
| | | /** |
| | | * update record |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKey(PrIntake record); |
| | | |
| | | /** |
| | | * update record selective |
| | | * @param record the updated record |
| | | * @return update count |
| | | */ |
| | | int updateByPrimaryKeySelective(PrIntake record); |
| | | |
| | | /** |
| | | * 根据指定条件获取取水口记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取取水口记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoIntake> getIntakes(Map<?, ?> params); |
| | | |
| | | Long getSupperByVillageId(long vaId); |
| | | |
| | | /** |
| | | * 根据取水口编号获取未删除的取水口数量 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | Integer getRecordCountOfIntake(@Param("intakeId") Long intakeId); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:18 |
| | | * @LastEditTime 2024-01-05 10:18 |
| | | * @Description |
| | | */ |
| | | public interface PrMonitoringFlowmeterMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrMonitoringFlowmeter record); |
| | | |
| | | int insertSelective(PrMonitoringFlowmeter record); |
| | | |
| | | PrMonitoringFlowmeter selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrMonitoringFlowmeter record); |
| | | |
| | | int updateByPrimaryKey(PrMonitoringFlowmeter record); |
| | | |
| | | /** |
| | | * 根据流量监测站、流量计、操作类型获取记录数量 |
| | | * @param monitoringId 监测站编号 |
| | | * @param flowmeterId 流量计编号 |
| | | * @param operateType 操作类型 1-捆绑,2-解绑 |
| | | * @return 符合条件记录数量 |
| | | */ |
| | | Integer getBindRecordCount(@Param("monitoringId") Long monitoringId, @Param("flowmeterId") Long flowmeterId, @Param("operateType") Byte operateType); |
| | | } |
| | |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | * 编号 |
| | | */ |
| | | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "控制器编号不能为空") |
| | | @Length(message = "控制器编号不大于{max}字",max = 25) |
| | | private String code; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | | */ |
| | | * 通讯协议 |
| | | */ |
| | | @Schema(description = "通讯协议", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "通讯协议不能为空") |
| | | @Length(message = "通讯协议不大于{max}字",max = 25) |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | * 在线状态;1-在线,2-离线 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlinestate; |
| | | |
| | | /** |
| | | * 最近上报时间 |
| | | */ |
| | | @Schema(description = "最近上报时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date reporttime; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addways; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte deleted; |
| | | } |
| | |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "所在县ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | //@NotEmpty(message = "所在县不能为空") |
| | | private Long countyid; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "所在镇ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | //@NotEmpty(message = "所在镇不能为空") |
| | | private Long townid; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | //@NotEmpty(message = "所在村不能为空") |
| | | @NotNull(message = "所在村不能为空") |
| | | private Long villageid; |
| | | |
| | | /** |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-04 16:02 |
| | | * @LastEditTime 2024-01-04 16:02 |
| | | * @Description |
| | | */ |
| | | |
| | | @TableName(value="pr_flow_monitoring", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "流量监测站实体") |
| | | public class PrFlowMonitoring implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 所在县 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "所在县ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Long countyid; |
| | | |
| | | /** |
| | | * 所在镇 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "所在镇ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Long townid; |
| | | |
| | | /** |
| | | * 所在村 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在村不能为空") |
| | | private Long villageid; |
| | | |
| | | /** |
| | | * 监测站名称 |
| | | */ |
| | | @Schema(description = "监测站名称", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "监测站名称不能为空") |
| | | @Length(message = "监测站名称不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | private String name; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lng; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lat; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte deleted; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:04 |
| | | * @LastEditTime 2024-01-05 9:04 |
| | | * @Description |
| | | */ |
| | | |
| | | @TableName(value="pr_flowmeter", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "流量计实体") |
| | | public class PrFlowmeter implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流量计编号 |
| | | */ |
| | | @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "流量计编号不能为空") |
| | | @Length(message = "流量计编号不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | private String code; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | | */ |
| | | @Schema(description = "通讯协议", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "通讯协议不能为空") |
| | | @Length(message = "通讯协议不大于{max}字",max = 25) |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 在线状态;1-在线,2-离线 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlinestate; |
| | | |
| | | /** |
| | | * 最近上报时间 |
| | | */ |
| | | @Schema(description = "最近上报时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date reporttime; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addways; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte deleted; |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 取水口表 |
| | | */ |
| | | |
| | | @TableName(value = "pr_intake", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口实体") |
| | | public class PrIntake implements BaseEntity { |
| | | public static final long serialVersionUID = 202312260931001L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 所在县 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在县ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | //@NotEmpty(message = "所在县不能为空") |
| | | private Long countyId; |
| | | |
| | | /** |
| | | * 所在镇 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在镇ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | //@NotEmpty(message = "所在镇不能为空") |
| | | private Long townId; |
| | | |
| | | /** |
| | | * 所在村 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | //@NotEmpty(message = "所在村不能为空") |
| | | private Long villageId; |
| | | |
| | | /** |
| | | * 所在分水口 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在分水口ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在分水口不能为空") |
| | | private Long divideId; |
| | | |
| | | /** |
| | | * 所在片区 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在片区不能为空") |
| | | private Long blockId; |
| | | |
| | | /** |
| | | * 取水口名称 |
| | | */ |
| | | @Schema(description = "取水口名称", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "取水口名称不能为空") |
| | | @Length(message = "取水口名称不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | private String name; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lng; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lat; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operateDt; |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte deleted; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 9:16 |
| | | * @LastEditTime 2024-01-02 9:16 |
| | | * @Description |
| | | */ |
| | | |
| | | /** |
| | | * 取水口捆绑表 |
| | | */ |
| | | |
| | | @TableName(value="pr_intake_controller", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口捆绑实体") |
| | | public class PrIntakeController implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 取水口编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "取水口ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "取水口ID不能为空") |
| | | private Long intakeid; |
| | | |
| | | /** |
| | | * 控制器编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "控制器ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "控制器ID不能为空") |
| | | private Long controllerid; |
| | | |
| | | /** |
| | | * 操作类型;1-捆绑,2-解绑 |
| | | */ |
| | | @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Max(message = "操作类型只能1或2", value = 2) |
| | | @Min(message = "操作类型只能1或2",value = 1) |
| | | private Byte operatetype; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:18 |
| | | * @LastEditTime 2024-01-05 10:18 |
| | | * @Description |
| | | */ |
| | | |
| | | @TableName(value="pr_monitoring_flowmeter", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "监测站流量计关联实体") |
| | | public class PrMonitoringFlowmeter implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 监测站编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "监测站编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "监测站ID不能为空") |
| | | private Long monitoringid; |
| | | |
| | | /** |
| | | * 流量计编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "流量计ID不能为空") |
| | | private Long flowmeterid; |
| | | |
| | | /** |
| | | * 操作类型;1-捆绑,2-解绑 |
| | | */ |
| | | @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Max(message = "操作类型只能1或2", value = 2) |
| | | @Min(message = "操作类型只能1或2",value = 1) |
| | | private Byte operatetype; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | //@Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operatedt; |
| | | } |
| | |
| | | @Schema(title = "控制器编号") |
| | | @ExcelProperty("控制器编号") |
| | | @ColumnWidth(15) |
| | | private String code; |
| | | private String controllerCode; |
| | | |
| | | @Schema(title = "在线状态") |
| | | @ExcelProperty("在线状态") |
| | | @ColumnWidth(15) |
| | | private String state; |
| | | private String onlineState; |
| | | |
| | | @Schema(title = "绑定取水口") |
| | | @ExcelProperty("绑定取水口") |
| | |
| | | @Schema(title = "绑定次数") |
| | | @ExcelProperty("绑定次数") |
| | | @ColumnWidth(10) |
| | | private Integer bindings; |
| | | private Integer bindNumber; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "最近上报时间") |
| | | @ExcelProperty("最近上报时间") |
| | | @ColumnWidth(30) |
| | | private Date operateDt; |
| | | private Date reportTime; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voPr; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-04 17:14 |
| | | * @LastEditTime 2024-01-04 17:14 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "管网流量监测站视图对象") |
| | | public class VoFlowMonitoring implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "ID") |
| | | @ExcelProperty("ID") |
| | | @ColumnWidth(10) |
| | | private Long id; |
| | | |
| | | @Schema(title = "管网流量监测站名称") |
| | | @ExcelProperty("管网流量监测站名称") |
| | | @ColumnWidth(15) |
| | | private String name; |
| | | |
| | | @Schema(title = "绑定状态") |
| | | @ExcelProperty("绑定状态") |
| | | @ColumnWidth(15) |
| | | private Integer bindState; |
| | | |
| | | @Schema(title = "地址") |
| | | @ExcelProperty("地址") |
| | | @ColumnWidth(20) |
| | | private String address; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voPr; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author WuZeYu |
| | | * @date 2023/12/26 10:40 |
| | | * @LastEditTime 2023/12/26 10:40 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "取水口视图对象") |
| | | public class VoIntake implements BaseEntity { |
| | | private static final long serialVersionUID = 202312261049001L; |
| | | |
| | | @Schema(title = "ID") |
| | | @ExcelProperty("ID") |
| | | @ColumnWidth(10) |
| | | private Long id; |
| | | |
| | | @Schema(title = "取水口名称") |
| | | @ExcelProperty("取水口名称") |
| | | @ColumnWidth(15) |
| | | private String intakeName; |
| | | |
| | | @Schema(title = "所属分水房") |
| | | @ExcelProperty("所属分水房") |
| | | @ColumnWidth(15) |
| | | private String divideName; |
| | | |
| | | @Schema(title = "所属片区") |
| | | @ExcelProperty("所属片区") |
| | | @ColumnWidth(15) |
| | | private String blockName; |
| | | |
| | | @Schema(title = "绑定设备") |
| | | @ExcelProperty("绑定设备") |
| | | @ColumnWidth(6) |
| | | private String isBind; |
| | | |
| | | @Schema(title = "地址") |
| | | @ExcelProperty("地址") |
| | | @ColumnWidth(25) |
| | | private String address; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "操作时间") |
| | | @ExcelIgnore |
| | | private Date operateDt; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 15:56 |
| | | * @LastEditTime 2024-01-02 15:56 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "控制器视图对象") |
| | | public class VoController implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "ID") |
| | | private Long id; |
| | | |
| | | @Schema(title = "控制器编号") |
| | | private Long controllerCode; |
| | | |
| | | @Schema(title = "在线状态") |
| | | private String onlineState; |
| | | |
| | | @Schema(title = "绑定取水口") |
| | | private String intakeName; |
| | | |
| | | @Schema(title = "绑定次数") |
| | | private Integer bindNumber; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "最近上报时间") |
| | | private Date reportTime; |
| | | } |
| | |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="code" jdbcType="VARCHAR" property="code" /> |
| | | <result column="protocol" jdbcType="VARCHAR" property="protocol" /> |
| | | <result column="onlineState" jdbcType="TINYINT" property="onlinestate" /> |
| | | <result column="reportTime" jdbcType="TIMESTAMP" property="reporttime" /> |
| | | <result column="addWays" jdbcType="TINYINT" property="addways" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, code, protocol, addWays, `operator`, operateDt, deleted |
| | | id, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_controller (id, code, protocol, |
| | | addWays, `operator`, operateDt, |
| | | deleted) |
| | | onlineState, reportTime, addWays, |
| | | `operator`, operateDt, deleted |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, |
| | | #{addways,jdbcType=TINYINT}, #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, |
| | | #{deleted,jdbcType=TINYINT}) |
| | | #{onlinestate,jdbcType=TINYINT}, #{reporttime,jdbcType=TIMESTAMP}, #{addways,jdbcType=TINYINT}, |
| | | #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT} |
| | | ) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | onlineState, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | reportTime, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays, |
| | |
| | | </if> |
| | | <if test="protocol != null"> |
| | | #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | #{onlinestate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | #{reporttime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | #{addways,jdbcType=TINYINT}, |
| | |
| | | <if test="protocol != null"> |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | </if> |
| | |
| | | update pr_controller |
| | | set code = #{code,jdbcType=VARCHAR}, |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据指定获取控制器记录数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM pr_controller con |
| | | INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id |
| | | INNER JOIN pr_intake inta ON ic.intakeId = inta.id |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | AND ic.operateType = 1 |
| | | |
| | | <if test = "id != null and id > 0"> |
| | | AND con.id = ${id} |
| | | </if> |
| | | |
| | | <if test = "controllerCode != null and controllerCode !=''"> |
| | | AND con.code like CONCAT('%',#{controllerCode},'%') |
| | | </if> |
| | | |
| | | <if test = "onlineState != null and onlineState > 0"> |
| | | AND con.onlineState = ${onlineState} |
| | | </if> |
| | | |
| | | <if test = "bindNumber != null and bindNumber > 0"> |
| | | AND (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) = ${bindNumber} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定获取控制器记录--> |
| | | <select id="getControllers" resultType="com.dy.pipIrrGlobal.voPr.VoController"> |
| | | SELECT |
| | | (@i:=@i+1) AS id, |
| | | t.* FROM( |
| | | SELECT |
| | | con.code AS controllerCode, |
| | | (CASE |
| | | WHEN con.onlineState = 1 THEN "在线" |
| | | WHEN con.onlineState = 2 THEN "离线" |
| | | END) AS onlineState, |
| | | inta.name AS intakeName, |
| | | (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) AS bindNumber, |
| | | con.reportTime |
| | | FROM pr_controller con |
| | | INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id |
| | | INNER JOIN pr_intake inta ON ic.intakeId = inta.id |
| | | <where> |
| | | AND ic.operateType = 1 |
| | | |
| | | <if test = "id != null and id > 0"> |
| | | AND con.id = ${id} |
| | | </if> |
| | | |
| | | <if test = "controllerCode != null and controllerCode !=''"> |
| | | AND con.code like CONCAT('%',#{controllerCode},'%') |
| | | </if> |
| | | |
| | | <if test = "onlineState != null and onlineState > 0"> |
| | | AND con.onlineState = ${onlineState} |
| | | </if> |
| | | |
| | | <if test = "bindNumber != null and bindNumber > 0"> |
| | | AND (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) = ${bindNumber} |
| | | </if> |
| | | </where> |
| | | ORDER BY con.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | ) t |
| | | , (SELECT @i:=0) AS itable |
| | | </select> |
| | | |
| | | <!--根据控制器编号获取控制器列表--> |
| | | <select id="getControllersByCode" resultType="java.util.Map"> |
| | | SELECT id, code FROM pr_controller WHERE code LIKE CONCAT('%',#{controllerCode},'%') |
| | | </select> |
| | | |
| | | <!--根据控制器编号逻辑删除控制--> |
| | | <update id="deleteControllerById"> |
| | | UPDATE pr_controller SET deleted = 1 WHERE id = ${controllerId} |
| | | </update> |
| | | |
| | | <!--根据控制器编号获取未删除的控制器数量--> |
| | | <select id="getRecordCountOfController" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCount FROM pr_controller WHERE deleted = 0 AND id = ${controllerId} |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?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.daoPr.PrFlowMonitoringMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_flow_monitoring--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="countyId" jdbcType="BIGINT" property="countyid" /> |
| | | <result column="townId" jdbcType="BIGINT" property="townid" /> |
| | | <result column="villageId" jdbcType="BIGINT" property="villageid" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="lng" jdbcType="DOUBLE" property="lng" /> |
| | | <result column="lat" jdbcType="DOUBLE" property="lat" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, countyId, townId, villageId, `name`, lng, lat, remarks, `operator`, operateDt, |
| | | deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_flow_monitoring |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_flow_monitoring |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flow_monitoring (id, countyId, townId, |
| | | villageId, `name`, lng, |
| | | lat, remarks, `operator`, |
| | | operateDt, deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{countyid,jdbcType=BIGINT}, #{townid,jdbcType=BIGINT}, |
| | | #{villageid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, |
| | | #{lat,jdbcType=DOUBLE}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flow_monitoring |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="countyid != null"> |
| | | countyId, |
| | | </if> |
| | | <if test="townid != null"> |
| | | townId, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | villageId, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="countyid != null"> |
| | | #{countyid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townid != null"> |
| | | #{townid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | #{villageid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | update pr_flow_monitoring |
| | | <set> |
| | | <if test="countyid != null"> |
| | | countyId = #{countyid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townid != null"> |
| | | townId = #{townid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageid != null"> |
| | | villageId = #{villageid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring"> |
| | | <!--@mbg.generated--> |
| | | update pr_flow_monitoring |
| | | set countyId = #{countyid,jdbcType=BIGINT}, |
| | | townId = #{townid,jdbcType=BIGINT}, |
| | | villageId = #{villageid,jdbcType=BIGINT}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据监测站编号删除监测站--> |
| | | <update id="deleteFlowMonitoringById"> |
| | | UPDATE pr_flow_monitoring SET deleted = 1 WHERE id = ${flowMonitoringId} |
| | | </update> |
| | | |
| | | <!--根据监测站编号获取未删除的监测站数量--> |
| | | <select id="getRecordCountOfFlowMonitoring" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowMonitoring FROM pr_flow_monitoring WHERE deleted = 0 AND id = ${flowMonitoringId} |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?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.daoPr.PrFlowmeterMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_flowmeter--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="code" jdbcType="VARCHAR" property="code" /> |
| | | <result column="protocol" jdbcType="VARCHAR" property="protocol" /> |
| | | <result column="onlineState" jdbcType="TINYINT" property="onlinestate" /> |
| | | <result column="reportTime" jdbcType="TIMESTAMP" property="reporttime" /> |
| | | <result column="addWays" jdbcType="TINYINT" property="addways" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks, |
| | | deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flowmeter (id, code, protocol, |
| | | onlineState, reportTime, addWays, |
| | | `operator`, operateDt, remarks, |
| | | deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, |
| | | #{onlinestate,jdbcType=TINYINT}, #{reporttime,jdbcType=TIMESTAMP}, #{addways,jdbcType=TINYINT}, |
| | | #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, |
| | | #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_flowmeter |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="code != null"> |
| | | code, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | onlineState, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | reportTime, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="code != null"> |
| | | #{code,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | #{onlinestate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | #{reporttime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | #{addways,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_flowmeter |
| | | <set> |
| | | <if test="code != null"> |
| | | code = #{code,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="onlinestate != null"> |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="reporttime != null"> |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_flowmeter |
| | | set code = #{code,jdbcType=VARCHAR}, |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | onlineState = #{onlinestate,jdbcType=TINYINT}, |
| | | reportTime = #{reporttime,jdbcType=TIMESTAMP}, |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--据编号删除流量计--> |
| | | <update id="deleteFlowmeterById"> |
| | | UPDATE pr_flowmeter SET deleted = 1 WHERE id = ${flowmeterId} |
| | | </update> |
| | | |
| | | <!--根据流量计编号获取未删除的流量计数量--> |
| | | <select id="getRecordCountOfFlowmeter" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCountOfFlowmeter FROM pr_flowmeter WHERE deleted = 0 AND id = ${flowmeterId} |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?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.daoPr.PrIntakeControllerMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrIntakeController"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_intake_controller--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="intakeId" jdbcType="BIGINT" property="intakeid" /> |
| | | <result column="controllerId" jdbcType="BIGINT" property="controllerid" /> |
| | | <result column="operateType" jdbcType="TINYINT" property="operatetype" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, intakeId, controllerId, operateType, remarks, `operator`, operateDt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_intake_controller |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_intake_controller |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntakeController"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_intake_controller (id, intakeId, controllerId, |
| | | operateType, remarks, `operator`, |
| | | operateDt) |
| | | values (#{id,jdbcType=BIGINT}, #{intakeid,jdbcType=BIGINT}, #{controllerid,jdbcType=BIGINT}, |
| | | #{operatetype,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntakeController"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_intake_controller |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="intakeid != null"> |
| | | intakeId, |
| | | </if> |
| | | <if test="controllerid != null"> |
| | | controllerId, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | operateType, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="intakeid != null"> |
| | | #{intakeid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="controllerid != null"> |
| | | #{controllerid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | #{operatetype,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntakeController"> |
| | | <!--@mbg.generated--> |
| | | update pr_intake_controller |
| | | <set> |
| | | <if test="intakeid != null"> |
| | | intakeId = #{intakeid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="controllerid != null"> |
| | | controllerId = #{controllerid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | operateType = #{operatetype,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntakeController"> |
| | | <!--@mbg.generated--> |
| | | update pr_intake_controller |
| | | set intakeId = #{intakeid,jdbcType=BIGINT}, |
| | | controllerId = #{controllerid,jdbcType=BIGINT}, |
| | | operateType = #{operatetype,jdbcType=TINYINT}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据取水口编号、控制器编号、操作类别获取记录数量--> |
| | | <select id="getBindRecordCount" resultType="java.lang.Integer"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM pr_intake_controller |
| | | <where> |
| | | <if test = "intakeId != null and intakeId > 0"> |
| | | AND intakeId = ${intakeId} |
| | | </if> |
| | | |
| | | <if test = "controllerId != null and controllerId > 0"> |
| | | AND controllerId = ${controllerId} |
| | | </if> |
| | | |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND operateType = ${operateType} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据取水口编号获取绑定记录列表--> |
| | | <select id="getBindsByIntakeId" resultType="java.util.Map"> |
| | | SELECT |
| | | user.name AS userName, |
| | | con.code AS controllerCode, |
| | | (CASE |
| | | WHEN ic.operateType = 1 THEN "绑定" |
| | | WHEN ic.operateType = 2 THEN "解绑" |
| | | END) AS operateType, |
| | | ic.operateDt |
| | | FROM pr_intake inta |
| | | INNER JOIN pr_intake_controller ic ON inta.id= ic.intakeId |
| | | INNER JOIN ba_user user ON ic.operator = user.id |
| | | INNER JOIN pr_controller con ON ic.controllerId = con.id |
| | | <if test = "intakeId != null and intakeId > 0"> |
| | | AND inta.id = ${intakeId} |
| | | </if> |
| | | ORDER BY ic.operateDt DESC |
| | | </select> |
| | | |
| | | <!--根据控制器编号获取绑定记录列表--> |
| | | <select id="getBindsByControllerId" resultType="java.util.Map"> |
| | | SELECT |
| | | (CASE |
| | | WHEN ic.operateType = 1 THEN "绑定" |
| | | WHEN ic.operateType = 2 THEN "解绑" |
| | | END) AS operateType, |
| | | inta.name AS intakeName, |
| | | user.name AS userName, |
| | | ic.operateDt |
| | | FROM pr_controller con |
| | | INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id |
| | | INNER JOIN pr_intake inta ON ic.intakeId = inta.id |
| | | INNER JOIN ba_user user ON ic.operator = user.id |
| | | <if test = "controllerId != null and controllerId > 0"> |
| | | AND con.id = ${controllerId} |
| | | </if> |
| | | ORDER BY ic.operateDt DESC |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?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.daoPr.PrIntakeMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrIntake"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_intake--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="countyId" jdbcType="BIGINT" property="countyId" /> |
| | | <result column="townId" jdbcType="BIGINT" property="townId" /> |
| | | <result column="villageId" jdbcType="BIGINT" property="villageId" /> |
| | | <result column="divideId" jdbcType="BIGINT" property="divideId" /> |
| | | <result column="blockId" jdbcType="BIGINT" property="blockId" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="lng" jdbcType="DOUBLE" property="lng" /> |
| | | <result column="lat" jdbcType="DOUBLE" property="lat" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operateDt" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, countyId, townId, villageId, divideId, blockId, `name`, lng, lat, remarks, `operator`, |
| | | operateDt, deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_intake |
| | | where id = #{id,jdbcType=BIGINT} and deleted = 0 |
| | | </select> |
| | | |
| | | <delete id="deleteLogicById" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | update pr_intake |
| | | set deleted = 1 |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <select id="selectAll" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from pr_intake |
| | | where deleted != 1 |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_intake |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_intake (id, countyId, townId, |
| | | villageId, divideId, blockId, |
| | | `name`, lng, lat, remarks, |
| | | `operator`, operateDt, deleted |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, #{townId,jdbcType=BIGINT}, |
| | | #{villageId,jdbcType=BIGINT}, #{divideId,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT}, |
| | | #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_intake |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="countyId != null"> |
| | | countyId, |
| | | </if> |
| | | <if test="townId != null"> |
| | | townId, |
| | | </if> |
| | | <if test="villageId != null"> |
| | | villageId, |
| | | </if> |
| | | <if test="divideId != null"> |
| | | divideId, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | blockId, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operateDt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="countyId != null"> |
| | | #{countyId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townId != null"> |
| | | #{townId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageId != null"> |
| | | #{villageId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="divideId != null"> |
| | | #{divideId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | #{blockId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operateDt != null"> |
| | | #{operateDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake"> |
| | | <!--@mbg.generated--> |
| | | update pr_intake |
| | | <set> |
| | | <if test="countyId != null"> |
| | | countyId = #{countyId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="townId != null"> |
| | | townId = #{townId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="villageId != null"> |
| | | villageId = #{villageId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="divideId != null"> |
| | | divideId = #{divideId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | blockId = #{blockId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operateDt != null"> |
| | | operateDt = #{operateDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake"> |
| | | <!--@mbg.generated--> |
| | | update pr_intake |
| | | set countyId = #{countyId,jdbcType=BIGINT}, |
| | | townId = #{townId,jdbcType=BIGINT}, |
| | | villageId = #{villageId,jdbcType=BIGINT}, |
| | | divideId = #{divideId,jdbcType=BIGINT}, |
| | | blockId = #{blockId,jdbcType=BIGINT}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | lng = #{lng,jdbcType=DOUBLE}, |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operateDt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据指定条件获取取水口记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM pr_intake ge |
| | | INNER JOIN ba_divide divi ON ge.divideId = divi.id |
| | | INNER JOIN ba_block blo ON divi.blockId = blo.id |
| | | INNER JOIN ba_district country ON ge.countyId = country.id |
| | | INNER JOIN ba_district town ON ge.townId = town.id |
| | | INNER JOIN ba_district village ON ge.villageId = village.id |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | ge.deleted = 0 |
| | | AND divi.deleted = 0 |
| | | and blo.deleted = 0 |
| | | <if test="intakeName != null and intakeName != ''"> |
| | | AND ge.name LIKE CONCAT('%', #{intakeName}, '%') |
| | | </if> |
| | | |
| | | <if test="divideName != null and divideName != ''"> |
| | | AND divi.name LIKE CONCAT('%', #{divideName}, '%') |
| | | </if> |
| | | |
| | | <if test="blockName != null and blockName != ''"> |
| | | AND blo.name = #{blockName} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取取水口记录--> |
| | | <select id="getIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntake"> |
| | | SELECT (@i:=@i+1) AS id, |
| | | ge.`name` AS intakeName, |
| | | divi.`name` AS divideName, |
| | | blo.`name` AS blockName, |
| | | ge.operateDt As operateDt, |
| | | CONCAT(country.`name`, town.`name`, village.`name`) AS address |
| | | FROM pr_intake ge |
| | | INNER JOIN pr_divide divi ON ge.divideId = divi.id |
| | | INNER JOIN ba_block blo ON divi.blockId = blo.id |
| | | INNER JOIN ba_district country ON ge.countyId = country.id |
| | | INNER JOIN ba_district town ON ge.townId = town.id |
| | | INNER JOIN ba_district village ON ge.villageId = village.id |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | ge.deleted = 0 |
| | | AND divi.deleted = 0 |
| | | and blo.deleted = 0 |
| | | <if test="intakeName != null and intakeName != ''"> |
| | | AND ge.name LIKE CONCAT('%', #{intakeName}, '%') |
| | | </if> |
| | | <if test="divideName != null and divideName != ''"> |
| | | AND divi.name LIKE CONCAT('%', #{divideName}, '%') |
| | | </if> |
| | | |
| | | <if test="blockName != null and blockName != ''"> |
| | | AND blo.name = #{blockName} |
| | | </if> |
| | | </where> |
| | | ORDER BY ge.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根据下级获取上一级地址--> |
| | | <select id="getSupperByVillageId" parameterType="_long" resultType="java.lang.Long"> |
| | | select dis_tow.* |
| | | from ba_district dis_vil |
| | | inner join |
| | | ba_district dis_tow |
| | | on dis_vil.supperId = dis_tow.id |
| | | where dis_vil.id = #{vaId,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <!--根据取水口编号获取未删除的取水口数量--> |
| | | <select id="getRecordCountOfIntake" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCount FROM pr_intake WHERE deleted = 0 AND id = ${intakeId} |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?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.daoPr.PrMonitoringFlowmeterMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_monitoring_flowmeter--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="monitoringId" jdbcType="BIGINT" property="monitoringid" /> |
| | | <result column="flowmeterId" jdbcType="BIGINT" property="flowmeterid" /> |
| | | <result column="operateType" jdbcType="TINYINT" property="operatetype" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, monitoringId, flowmeterId, operateType, remarks, `operator`, operateDt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_monitoring_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_monitoring_flowmeter |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_monitoring_flowmeter (id, monitoringId, flowmeterId, |
| | | operateType, remarks, `operator`, |
| | | operateDt) |
| | | values (#{id,jdbcType=BIGINT}, #{monitoringid,jdbcType=BIGINT}, #{flowmeterid,jdbcType=BIGINT}, |
| | | #{operatetype,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_monitoring_flowmeter |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="monitoringid != null"> |
| | | monitoringId, |
| | | </if> |
| | | <if test="flowmeterid != null"> |
| | | flowmeterId, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | operateType, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="monitoringid != null"> |
| | | #{monitoringid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="flowmeterid != null"> |
| | | #{flowmeterid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | #{operatetype,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_monitoring_flowmeter |
| | | <set> |
| | | <if test="monitoringid != null"> |
| | | monitoringId = #{monitoringid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="flowmeterid != null"> |
| | | flowmeterId = #{flowmeterid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatetype != null"> |
| | | operateType = #{operatetype,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter"> |
| | | <!--@mbg.generated--> |
| | | update pr_monitoring_flowmeter |
| | | set monitoringId = #{monitoringid,jdbcType=BIGINT}, |
| | | flowmeterId = #{flowmeterid,jdbcType=BIGINT}, |
| | | operateType = #{operatetype,jdbcType=TINYINT}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据流量监测站、流量计、操作类型获取记录数量--> |
| | | <select id="getBindRecordCount" resultType="java.lang.Integer"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM pr_monitoring_flowmeter |
| | | <where> |
| | | <if test = "monitoringId != null and monitoringId > 0"> |
| | | AND monitoringId = ${monitoringId} |
| | | </if> |
| | | |
| | | <if test = "flowmeterId != null and flowmeterId > 0"> |
| | | AND flowmeterId = ${flowmeterId} |
| | | </if> |
| | | |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND operateType = ${operateType} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaBlock> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaBlock> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaBlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaBlock po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaBlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaBlock po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaClient>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaClient>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaClient>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaClient> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaClient> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | import com.dy.pipIrrBase.user.QueryVo; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClientType; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Valid QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaClientType>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaClientType> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaClientType> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaClientType po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaClientType po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | package com.dy.pipIrrBase.district; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mybatis.envm.Deleted; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaDistrict; |
| | | import com.dy.pipIrrGlobal.util.DistrictLevel; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaDistrict> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaDistrict> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_Districts); |
| | | } |
| | | |
| | | /** |
| | | * 获取三级行政区划 |
| | | * @return 县镇村三级行政区划 |
| | | */ |
| | | @GetMapping(path = "/three") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getThreeDistrict() { |
| | | JSONArray array_counties = new JSONArray(); |
| | | JSONArray array_towns = new JSONArray(); |
| | | JSONArray array_villages = new JSONArray(); |
| | | |
| | | List<Map<String, Object>> list_counties = Optional.ofNullable(sv.getDistrictgsByLevel(2)).orElse(new ArrayList<>()); |
| | | if(list_counties.size() > 0) { |
| | | array_counties = JSONArray.parseArray(JSON.toJSONString(list_counties)); |
| | | // 遍历每一个县,将县下的镇村加到县的子集 |
| | | for(int i = 0; i < array_counties.size(); i++) { |
| | | JSONObject job_county = array_counties.getJSONObject(i); |
| | | Long countyId = job_county.getLong("id"); |
| | | List<Map<String, Object>> list_towns = Optional.ofNullable(sv.getDistrictsBySupperId(countyId)).orElse(new ArrayList<>()); |
| | | if(list_towns.size() > 0) { |
| | | array_towns = JSONArray.parseArray(JSON.toJSONString(list_towns)); |
| | | // 遍历每一个镇,将镇下村列表加到镇的子集 |
| | | for(int j = 0; j < array_towns.size(); j++) { |
| | | JSONObject job_town = array_towns.getJSONObject(j); |
| | | Long townId = job_town.getLong("id"); |
| | | List<Map<String, Object>> list_villages = Optional.ofNullable(sv.getDistrictsBySupperId(townId)).orElse(new ArrayList<>()); |
| | | if(list_villages.size() > 0) { |
| | | array_villages = JSONArray.parseArray(JSON.toJSONString(list_villages)); |
| | | job_town.put("children", array_villages); |
| | | } |
| | | } |
| | | //System.out.println("----" + array_towns); |
| | | } |
| | | // 镇村组装完毕,将镇村加到县下 |
| | | job_county.put("children", array_towns); |
| | | } |
| | | // 县组装完毕 |
| | | //String a = array_counties.toJSONString(); |
| | | //System.out.println(a); |
| | | return BaseResponseUtils.buildSuccess(array_counties); |
| | | }else { |
| | | return BaseResponseUtils.buildFail("县级行政区划不存在"); |
| | | } |
| | | |
| | | |
| | | //return BaseResponseUtils.buildSuccess(); |
| | | } |
| | | } |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaDivide; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaDivide> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaDivide> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | /** |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaDivide>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) DivideVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaDivide>>> some(@RequestBody DivideVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaDivide>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaRole; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaRolePermissions; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | @Slf4j |
| | | @Tag(name = "角色管理", description = "角色增删改查等操作") |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody @Valid QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaRole>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaRole> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaRole> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaRole po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaRole po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "setPrivs", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> setPrivileges(@Parameter(description = "实体id", required = true) Long id, |
| | | @Parameter(description = "权限id数组") Long[] privIds){ |
| | | public BaseResponse<Boolean> setPrivileges(Long id, Long[] privIds){ |
| | | Long[] privIds_lg = null ; |
| | | if(privIds != null && privIds.length > 0){ |
| | | privIds_lg = new Long[privIds.length] ; |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | @PostMapping(path = "addPermissions", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> permission(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRolePermissions po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> permission(@RequestBody @Valid BaRolePermissions po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.voBa.VoUserInfo; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo) { |
| | | public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody @Valid QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<BaUser>> res = this.sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaUser> one(@Parameter(description = "实体id", required = true) String id) { |
| | | public BaseResponse<BaUser> one(String id) { |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(Long.parseLong(id))); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaUser po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaUser po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> changePassword(@Parameter(description = "实体id", required = true) String id, |
| | | @Parameter(description = "旧密码", required = true) String oldPassword, |
| | | @Parameter(description = "新密码", required = true) String newPassword) throws Exception { |
| | | public BaseResponse<Boolean> changePassword(String id, String oldPassword, String newPassword) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "resetPassword", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> resetPassword(@RequestBody @Parameter(description = "form表单json数据", required = true) ResetPasswordVo vo) throws Exception { |
| | | public BaseResponse<Boolean> resetPassword(@RequestBody ResetPasswordVo vo) throws Exception { |
| | | if (vo.id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "resetPasswordByDefault", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> resetPasswordByDefault(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | public BaseResponse<Boolean> resetPasswordByDefault(String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "resetPasswordByRandom", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<String> resetPasswordByRandom(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | public BaseResponse<String> resetPasswordByRandom(String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "setRoles", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> setRoles(@Parameter(description = "实体id", required = true) String id, |
| | | public BaseResponse<Boolean> setRoles(String id, |
| | | @Parameter(description = "角色id数组") String[] roleIds) { |
| | | Long[] roleId_lg = null; |
| | | if (roleIds != null && roleIds.length > 0) { |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) String id) { |
| | | public BaseResponse<Boolean> delete(String id) { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.support.ExcelTypeEnum; |
| | | 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.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.voPr.VoController; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | public class ControllerCtrl { |
| | | private final ControllerSv controllerSv; |
| | | |
| | | /** |
| | | * 根据指定条件获取控制器列表 |
| | | * @param vo 查询条件 |
| | | * @return 符合条件的控制器列表 |
| | | */ |
| | | @Operation(summary = "获得一页控制器记录", description = "返回一页控制器数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页控制器数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getControllers") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoController>>> getControllers(QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoController>> res = controllerSv.getControllers(vo); |
| | | if(res.itemTotal != null && res.itemTotal > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_RECORDS.getMessage()); |
| | | } |
| | | //return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号获取控制器列表 |
| | | * @param controllerCode 控制器编号 |
| | | * @return 符合条件的控制器列表 |
| | | */ |
| | | @Operation(summary = "获得控制器记录", description = "返回取控制器数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回控制器数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "controller_list") |
| | | @SsoAop() |
| | | public BaseResponse<List<Map<String, Object>>> getControllersByCode(String controllerCode){ |
| | | try { |
| | | List<Map<String, Object>> list = Optional.ofNullable(controllerSv.getControllersByCode(controllerCode)).orElse(new ArrayList<>()); |
| | | if(list.size() <= 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_RECORDS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("查询控制器异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加控制器 |
| | | * @param po 控制器实体对象 |
| | | * @param bindingResult |
| | | * @return 添加是否成功 |
| | | */ |
| | | @Operation(summary = "添加控制器记录", description = "添加控制器记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrController po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoController po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | PrController prController = DtoToPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | Integer rec = Optional.ofNullable(controllerSv.addController(po)).orElse(0); |
| | | prController.setOperatedt(operateTime); |
| | | prController.setDeleted((byte)0); |
| | | prController.setReporttime(operateTime); |
| | | Integer rec = Optional.ofNullable(controllerSv.addController(prController)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.CONTROLLER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号删除控制器 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Operation(summary = "删除控制器记录", description = "删除控制器记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "delete") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map){ |
| | | if(map == null || map.size() <=0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_CONTROLLER_ID.getMessage()); |
| | | } |
| | | |
| | | Long controllerId = Long.parseLong(map.get("controllerId").toString()); |
| | | Integer recordCount = Optional.ofNullable(controllerSv.deleteControllerById(controllerId)).orElse(0); |
| | | if(recordCount == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_CONTROLLER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 导出控制器列表 |
| | | * @param response |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @RequestMapping(value = "/export", method = RequestMethod.GET) |
| | | public void export(HttpServletResponse response, QueryVo vo) { |
| | | setExcelRespProp(response, "控制器列表"); |
| | | //List<VoDivide> memberList = LocalJsonUtil.getListFromJson("json/members.json", VoDivide.class); |
| | | List<VoController> memberList = controllerSv.export(vo); |
| | | |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .head(VoController.class) |
| | | .excelType(ExcelTypeEnum.XLSX) |
| | | .sheet("控制器列表") |
| | | .doWrite(memberList); |
| | | } |
| | | |
| | | /** |
| | | * 设置excel下载响应头属性 |
| | | */ |
| | | private void setExcelRespProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.voPr.VoController; |
| | | 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.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | private PrControllerMapper prControllerMapper; |
| | | |
| | | /** |
| | | * 根据指定获取控制器记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoController>> getControllers(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = prControllerMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoController>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prControllerMapper.getControllers(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 添加控制器 |
| | | * @param po |
| | | * @return |
| | |
| | | public Integer addController(PrController po) { |
| | | return prControllerMapper.insert(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号获取控制器列表 |
| | | * @param controllerCode |
| | | * @return |
| | | */ |
| | | public List<Map<String, Object>> getControllersByCode(String controllerCode) { |
| | | return prControllerMapper.getControllersByCode(controllerCode); |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号逻辑删除控制 |
| | | * @param controllerId |
| | | * @return |
| | | */ |
| | | public Integer deleteControllerById(Long controllerId) { |
| | | return prControllerMapper.deleteControllerById(controllerId); |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件导出控制器列表 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public List<VoController> export(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | List<VoController> rsVo = new ArrayList<>(); |
| | | rsVo = prControllerMapper.getControllers(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | public Integer getRecordCountOfController(Long controllerId) { |
| | | return prControllerMapper.getRecordCountOfController(controllerId); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 16:36 |
| | | * @LastEditTime 2024-01-02 16:36 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "控制器传入对象") |
| | | public class DtoController { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "控制器编号不能为空") |
| | | @Length(message = "控制器编号不大于{max}字",max = 25) |
| | | private String code; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | | */ |
| | | @Schema(description = "通讯协议", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "通讯协议不能为空") |
| | | @Length(message = "通讯协议不大于{max}字",max = 25) |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 在线状态 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlineState; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addWays; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long operator; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 16:39 |
| | | * @LastEditTime 2024-01-02 16:39 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface DtoToPojo { |
| | | DtoToPojo INSTANCT = Mappers.getMapper(DtoToPojo.class); |
| | | @Mapping(target = "code", source = "code") |
| | | @Mapping(target = "protocol", source = "protocol") |
| | | @Mapping(target = "onlinestate", source = "onlineState") |
| | | @Mapping(target = "addways", source = "addWays") |
| | | @Mapping(target = "operator", source = "operator") |
| | | PrController po2vo(DtoController po); |
| | | } |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 10:07 |
| | | * @LastEditTime 2023-12-29 10:07 |
| | | * @Description |
| | | */ |
| | | public class QueryVo { |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "控制器查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | |
| | | @Schema(description = "控制器ID") |
| | | private Long id; |
| | | |
| | | @Schema(description = "控制器编号") |
| | | private String controllerCode; |
| | | |
| | | @Schema(description = "在线状态") |
| | | public Integer onlineState; |
| | | |
| | | @Schema(description = "绑定数量") |
| | | public Integer bindNumber; |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | Long villageId = po.getVillageId(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | |
| | | PrDivide prDivide = DtoToDividePojo.INSTANCT.po2vo(po); |
| | | |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | po.setCountyid(countryId); |
| | | po.setTownid(townId); |
| | | prDivide.setCountyid(countryId); |
| | | prDivide.setTownid(townId); |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | Integer rec = Optional.ofNullable(divideSv.addDivide(po)).orElse(0); |
| | | prDivide.setOperatedt(operateTime); |
| | | prDivide.setDeleted((byte)0); |
| | | Integer rec = Optional.ofNullable(divideSv.addDivide(prDivide)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DIVIDE_FAIL.getMessage()); |
| | | } |
| | |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PrDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @RequestMapping(value = "/exportDivides", method = RequestMethod.GET) |
| | | public void exportDivides(HttpServletResponse response, QueryVo vo) { |
| | | @RequestMapping(value = "/export", method = RequestMethod.GET) |
| | | public void export(HttpServletResponse response, QueryVo vo) { |
| | | setExcelRespProp(response, "分水房列表"); |
| | | //List<VoDivide> memberList = LocalJsonUtil.getListFromJson("json/members.json", VoDivide.class); |
| | | List<VoDivide> memberList = divideSv.exportDivides(vo); |
| New file |
| | |
| | | package com.dy.pipIrrProject.divide; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 17:00 |
| | | * @LastEditTime 2024-01-05 17:00 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "分水房传入对象") |
| | | public class DtoDivide { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 所在村 |
| | | */ |
| | | @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在村不能为空") |
| | | private Long villageId; |
| | | |
| | | /** |
| | | * 所在片区 |
| | | */ |
| | | @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在片区不能为空") |
| | | private Long blockId; |
| | | |
| | | /** |
| | | * 分水口名称或编号 |
| | | */ |
| | | @Schema(description = "分水口名称", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "分水房名称不能为空") |
| | | @Length(max = 25, message = "分水口名称最多25字") |
| | | private String name; |
| | | |
| | | /** |
| | | * 覆盖村 |
| | | */ |
| | | @Schema(description = "覆盖村", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Length(max = 100, message = "覆盖村最多100字") |
| | | private String villages; |
| | | |
| | | /** |
| | | * 覆盖面积(平方公里) |
| | | */ |
| | | @Schema(description = "覆盖面积", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private Double area; |
| | | |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @Schema(description = "负责人", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private String header; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Length(max = 11, message = "联系电话最大11位") |
| | | private String phone; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lng; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "经度不能为空") |
| | | private Double lat; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(max = 200, message = "备注最多200字") |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.divide; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrDivide; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 17:10 |
| | | * @LastEditTime 2024-01-05 17:10 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface DtoToDividePojo { |
| | | DtoToDividePojo INSTANCT = Mappers.getMapper(DtoToDividePojo.class); |
| | | |
| | | @Mapping(target = "villageid", source = "villageId") |
| | | @Mapping(target = "blockid", source = "blockId") |
| | | @Mapping(target = "name", source = "name") |
| | | @Mapping(target = "villages", source = "villages") |
| | | @Mapping(target = "area", source = "area") |
| | | @Mapping(target = "header", source = "header") |
| | | @Mapping(target = "phone", source = "phone") |
| | | @Mapping(target = "lng", source = "lng") |
| | | @Mapping(target = "lat", source = "lat") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | | @Mapping(target = "operator", source = "operator") |
| | | |
| | | PrDivide po2vo(DtoDivide po); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:33 |
| | | * @LastEditTime 2024-01-05 9:33 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "流量计传入对象") |
| | | public class DtoFlowmeter { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "控制器编号不能为空") |
| | | @Length(message = "控制器编号不大于{max}字",max = 25) |
| | | private String code; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | | */ |
| | | @Schema(description = "通讯协议", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "通讯协议不能为空") |
| | | @Length(message = "通讯协议不大于{max}字",max = 25) |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 在线状态 |
| | | */ |
| | | @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte onlineState; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addWays; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) |
| | | private String remarks; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:36 |
| | | * @LastEditTime 2024-01-05 10:36 |
| | | * @Description 流量监测站、流量计绑定传入对象 |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "流量监测站、流量计绑定传入对象") |
| | | public class DtoMoniFlow { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 监测站编号 |
| | | */ |
| | | @Schema(description = "监测站编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "监测站ID不能为空") |
| | | private Long monitoringId; |
| | | |
| | | /** |
| | | * 流量计编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "流量计ID不能为空") |
| | | private Long flowmeterId; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:38 |
| | | * @LastEditTime 2024-01-05 9:38 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface DtoToFlowmeterPojo { |
| | | DtoToFlowmeterPojo INSTANCT = Mappers.getMapper(DtoToFlowmeterPojo.class); |
| | | @Mapping(target = "code", source = "code") |
| | | @Mapping(target = "protocol", source = "protocol") |
| | | @Mapping(target = "onlinestate", source = "onlineState") |
| | | @Mapping(target = "addways", source = "addWays") |
| | | @Mapping(target = "operator", source = "operator") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | | PrFlowmeter po2vo(DtoFlowmeter po); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:43 |
| | | * @LastEditTime 2024-01-05 10:43 |
| | | * @Description 流量监测站、流量计Dto转Pojo |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface DtoToMoniFlowPojo { |
| | | DtoToMoniFlowPojo INSTANCT = Mappers.getMapper(DtoToMoniFlowPojo.class); |
| | | @Mapping(target = "monitoringid", source = "monitoringId") |
| | | @Mapping(target = "flowmeterid", source = "flowmeterId") |
| | | @Mapping(target = "operator", source = "operator") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | | PrMonitoringFlowmeter po2vo(DtoMoniFlow po); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | 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.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-04 16:11 |
| | | * @LastEditTime 2024-01-04 16:11 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站管理", description = "流量监测站操作") |
| | | @RestController |
| | | @RequestMapping(path="flow_monitoring") |
| | | @RequiredArgsConstructor |
| | | public class FlowMonitoringCtrl { |
| | | private final FlowMonitoringSv flowMonitoringSv; |
| | | |
| | | /** |
| | | * 添加管网流量监测站 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "添加流量监测站记录", description = "添加流量监测站记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid PrFlowMonitoring po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(flowMonitoringSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | po.setCountyid(countryId); |
| | | po.setTownid(townId); |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | Integer rec = Optional.ofNullable(flowMonitoringSv.addFlowMonitoring(po)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.FLOW_MONITORING_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 删除流量监测站 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Operation(summary = "删除流量监测站记录", description = "删除流量监测站记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "delete") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map){ |
| | | if(map == null || map.size() <=0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_FLOW_MONITORING_ID.getMessage()); |
| | | } |
| | | |
| | | Long flowMonitoringId = Long.parseLong(map.get("flowMonitoringId").toString()); |
| | | Integer recordCount = Optional.ofNullable(flowMonitoringSv.deleteFlowMonitoring(flowMonitoringId)).orElse(0); |
| | | if(recordCount == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_FLOW_MONITORING_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrFlowMonitoringMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-04 16:11 |
| | | * @LastEditTime 2024-01-04 16:11 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class FlowMonitoringSv { |
| | | @Autowired |
| | | private PrFlowMonitoringMapper prFlowMonitoringMapper; |
| | | |
| | | @Autowired |
| | | private BaDistrictMapper baDistrictMapper; |
| | | |
| | | /** |
| | | * 根据村编号获取5级区划信息 |
| | | * @param villageId 村编号(主键) |
| | | * @return 5级行政区划信息 |
| | | */ |
| | | public Map getDistrictsByVillageId(Long villageId) { |
| | | return baDistrictMapper.getDistrictsByVillageId(villageId); |
| | | } |
| | | |
| | | /** |
| | | * 添加管网流量监测站 |
| | | * @param prFlowMonitoring 流量监测站实体 |
| | | * @return |
| | | */ |
| | | public Integer addFlowMonitoring(PrFlowMonitoring prFlowMonitoring) { |
| | | return prFlowMonitoringMapper.insert(prFlowMonitoring); |
| | | } |
| | | |
| | | /** |
| | | * 根据监测站编号删除监测站 |
| | | * @param flowMonitoringId |
| | | * @return |
| | | */ |
| | | public Integer deleteFlowMonitoring(Long flowMonitoringId) { |
| | | return prFlowMonitoringMapper.deleteFlowMonitoringById(flowMonitoringId); |
| | | } |
| | | |
| | | /** |
| | | * 根据监测站编号获取未删除的监测站数量 |
| | | * @param flowMonitoringId 流量监测站编号 |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfFlowMonitoring(Long flowMonitoringId) { |
| | | return prFlowMonitoringMapper.getRecordCountOfFlowMonitoring(flowMonitoringId); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | 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.Date; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:21 |
| | | * @LastEditTime 2024-01-05 9:21 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站管理", description = "流量监测站操作") |
| | | @RestController |
| | | @RequestMapping(path="flowmeter") |
| | | @RequiredArgsConstructor |
| | | public class FlowmeterCtrl { |
| | | private final FlowmeterSv flowmeterSv; |
| | | |
| | | @Operation(summary = "添加流量计记录", description = "添加流量计记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoFlowmeter po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | PrFlowmeter prFlowmeter = DtoToFlowmeterPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prFlowmeter.setOperatedt(operateTime); |
| | | prFlowmeter.setDeleted((byte)0); |
| | | prFlowmeter.setReporttime(operateTime); |
| | | Integer rec = Optional.ofNullable(flowmeterSv.addFlowmeter(prFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.ADD_FLOWMETER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 删除流量计 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Operation(summary = "删除流量计记录", description = "删除流量计记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "delete") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map){ |
| | | if(map == null || map.size() <=0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_FLOW_MONITORING_ID.getMessage()); |
| | | } |
| | | |
| | | Long flowmeterId = Long.parseLong(map.get("flowmeterId").toString()); |
| | | Integer recordCount = Optional.ofNullable(flowmeterSv.deleteFlowmeter(flowmeterId)).orElse(0); |
| | | if(recordCount == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_FLOWMETER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.daoPr.PrFlowmeterMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 9:20 |
| | | * @LastEditTime 2024-01-05 9:20 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class FlowmeterSv { |
| | | @Autowired |
| | | private PrFlowmeterMapper prFlowmeterMapper; |
| | | |
| | | /** |
| | | * 添加流量计 |
| | | * @param prFlowmeter |
| | | * @return |
| | | */ |
| | | public Integer addFlowmeter(PrFlowmeter prFlowmeter) { |
| | | return prFlowmeterMapper.insert(prFlowmeter); |
| | | } |
| | | |
| | | /** |
| | | * 删除流量计 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | public Integer deleteFlowmeter(Long flowmeterId) { |
| | | return prFlowmeterMapper.deleteFlowmeterById(flowmeterId); |
| | | } |
| | | |
| | | /** |
| | | * 根据流量计编号获取未删除的流量计数量 |
| | | * @param flowmeterId |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfFlowmeter(Long flowmeterId) { |
| | | return prFlowmeterMapper.getRecordCountOfFlowmeter(flowmeterId); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import 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.Date; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:26 |
| | | * @LastEditTime 2024-01-05 10:26 |
| | | * @Description 管网流量监测站、流量计关联控制类 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "流量监测站、流量计关联管理", description = "流量监测站、流量计关联操作") |
| | | @RestController |
| | | @RequestMapping(path="moni_flow") |
| | | @RequiredArgsConstructor |
| | | public class MoniFlowCtrl { |
| | | private final MoniFlowSv moniFlowSv; |
| | | |
| | | private final FlowMonitoringSv flowMonitoringSv; |
| | | private final FlowmeterSv flowmeterSv; |
| | | |
| | | /** |
| | | * 流量监测站绑定流量计 |
| | | * 若流量监测站或流量计不存在需提示用户 |
| | | * 若流量监测站已经与流量计绑定需提示用户 |
| | | * @param po 绑定关系对象 |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "添加绑定记录", description = "添加绑定记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "bind", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> bind(@RequestBody @Valid DtoMoniFlow po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 根据编号分别获取流量监测站、流量计未删除记录数 |
| | | Integer recFlowMonitoring = Optional.ofNullable(flowMonitoringSv.getRecordCountOfFlowMonitoring(po.getMonitoringId())).orElse(0); |
| | | Integer recFlowmeter = Optional.ofNullable(flowmeterSv.getRecordCountOfFlowmeter(po.getFlowmeterId())).orElse(0); |
| | | if(recFlowMonitoring == 0 || recFlowmeter == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.STATION_OR_FLOWMETER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | // 根据编号获取已绑定数量 |
| | | Integer recordCount = Optional.ofNullable(moniFlowSv.getBindRecordCount(po.getMonitoringId(), po.getFlowmeterId(), (byte)1)).orElse(0); |
| | | if(recordCount > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_HAS_BINDED_FLOWMETER.getMessage()); |
| | | } |
| | | |
| | | PrMonitoringFlowmeter prMonitoringFlowmeter = DtoToMoniFlowPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prMonitoringFlowmeter .setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte)1); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | @Operation(summary = "添加解绑记录", description = "添加解绑记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "unbind", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> unbind(@RequestBody @Valid DtoMoniFlow po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 根据编号分别获取流量监测站、流量计未删除记录数 |
| | | Integer recFlowMonitoring = Optional.ofNullable(flowMonitoringSv.getRecordCountOfFlowMonitoring(po.getMonitoringId())).orElse(0); |
| | | Integer recFlowmeter = Optional.ofNullable(flowmeterSv.getRecordCountOfFlowmeter(po.getFlowmeterId())).orElse(0); |
| | | if(recFlowMonitoring == 0 || recFlowmeter == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.STATION_OR_FLOWMETER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | // 根据编号获取已绑定数量 |
| | | Integer recordCount = Optional.ofNullable(moniFlowSv.getBindRecordCount(po.getMonitoringId(), po.getFlowmeterId(), (byte)2)).orElse(0); |
| | | if(recordCount > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.STATION_FLOWMETER_HAS_UNBOUND.getMessage()); |
| | | } |
| | | |
| | | PrMonitoringFlowmeter prMonitoringFlowmeter = DtoToMoniFlowPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prMonitoringFlowmeter .setOperatedt(operateTime); |
| | | prMonitoringFlowmeter.setOperatetype((byte)1); |
| | | |
| | | Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.pipIrrGlobal.daoPr.PrMonitoringFlowmeterMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-05 10:25 |
| | | * @LastEditTime 2024-01-05 10:25 |
| | | * @Description 管网流量监测站、流量计关联管理服务类 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class MoniFlowSv { |
| | | @Autowired |
| | | private PrMonitoringFlowmeterMapper prMonitoringFlowmeterMapper; |
| | | |
| | | /** |
| | | * 添加流量监测站、流量计关联关系 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer addRecord(PrMonitoringFlowmeter po) { |
| | | return prMonitoringFlowmeterMapper.insert(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据流量监测站、流量计、操作类型获取记录数量 |
| | | * @param monitoringId 监测站编号 |
| | | * @param flowmeterId 流量计编号 |
| | | * @param operateType 操作类型 1-捆绑,2-解绑 |
| | | * @return |
| | | */ |
| | | Integer getBindRecordCount(Long monitoringId, Long flowmeterId, Byte operateType) { |
| | | return prMonitoringFlowmeterMapper.getBindRecordCount(monitoringId, flowmeterId, operateType); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.flowMonitoring; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-04 17:21 |
| | | * @LastEditTime 2024-01-04 17:21 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "管网流量监测站查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | @Schema(description = "流量监测站编号") |
| | | private Long id; |
| | | |
| | | @Schema(description = "流量监测站名称") |
| | | public String name; |
| | | |
| | | @Schema(title = "绑定状态") |
| | | private Integer bindState; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.intake; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.support.ExcelTypeEnum; |
| | | 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.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoIntake; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | 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.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author WuZeYu |
| | | * @date 2023/12/26 20:11 |
| | | * @LastEditTime 2023/12/20 20:11 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "取水口管理", description = "取水口操作") |
| | | @RestController |
| | | @RequestMapping(path="intake") |
| | | @RequiredArgsConstructor |
| | | public class IntakeCtrl { |
| | | private final IntakeSv intakeSv; |
| | | |
| | | /** |
| | | * 客户端请求得到所有取水口名字 |
| | | * @return 所有取水口名字 |
| | | */ |
| | | @Operation(summary = "获得全部取水口", description = "返回全部取水口数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回全部取水口数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = PrIntake.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<PrIntake>>> all(){ |
| | | try { |
| | | QueryResultVo<List<PrIntake>> res = this.intakeSv.selectAll(); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询取水口异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 得到一个取水口数据 |
| | | * @return 一个取水口数据 |
| | | */ |
| | | @Operation(summary = "一个取水口", description = "得到一个取水口数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一个取水口数据(BaseResponse.content:{})", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = PrIntake.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one/{id}") |
| | | @SsoAop() |
| | | public BaseResponse<PrIntake> one(@PathVariable("id") Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.intakeSv.selectById(id)); |
| | | } |
| | | |
| | | @Operation(summary = "获得一页取水口记录", description = "返回一页取水口数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页取水口数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getIntakes", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoIntake>>> getIntakes(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoIntake>> res = intakeSv.getIntakes(vo); |
| | | if(res == null) { |
| | | return BaseResponseUtils.buildFail("查询失败"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取取水口记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | @Operation(summary = "添加取水口记录", description = "添加取水口记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperateDt(operateTime); |
| | | Integer rec = Optional.ofNullable(intakeSv.addIntake(po)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 编辑修改取水口 |
| | | * @param po 保存取水口form表单对象 |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "编辑修改取水口", description = "提交取水口数据(form表单),进行修改") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | int count; |
| | | Date operateTime = new Date(); |
| | | po.setOperateDt(operateTime); |
| | | try { |
| | | count = this.intakeSv.update(po); |
| | | } catch (Exception e) { |
| | | log.error("保存分水口异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | if(count <= 0){ |
| | | return BaseResponseUtils.buildFail("数据库存储失败") ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除取水口 |
| | | * @param id 取水口ID |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "删除分水口", description = "提交取水口ID,进行逻辑删除") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete/{id}") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@PathVariable("id") Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | | int count; |
| | | try { |
| | | count = this.intakeSv.delete(id); |
| | | } catch (Exception e) { |
| | | log.error("保存分水口异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | if(count <= 0){ |
| | | return BaseResponseUtils.buildFail("数据库存储失败") ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出取水口列表 |
| | | * @param response |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @GetMapping(value = "exportIntakes") |
| | | public void exportIntakes(HttpServletResponse response, QueryVo vo) { |
| | | setExcelRespProp(response, "取水口列表"); |
| | | //List<VoDivide> memberList = LocalJsonUtil.getListFromJson("json/members.json", VoDivide.class); |
| | | List<VoIntake> memberList = intakeSv.exportIntakes(vo); |
| | | |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .head(VoIntake.class) |
| | | .excelType(ExcelTypeEnum.XLSX) |
| | | .sheet("取水口列表") |
| | | .doWrite(memberList); |
| | | } |
| | | |
| | | /** |
| | | * 导入取水口列表 |
| | | * @param file |
| | | */ |
| | | @SneakyThrows |
| | | @PostMapping(value = "importIntakes") |
| | | @ResponseBody |
| | | public BaseResponse<Boolean> importIntakes(@RequestPart("file") MultipartFile file) { |
| | | List<VoIntake> memberList = EasyExcel.read(file.getInputStream()) |
| | | .head(VoIntake.class) |
| | | .sheet() |
| | | .doReadSync(); |
| | | return BaseResponseUtils.buildSuccess(memberList) ; |
| | | } |
| | | |
| | | /** |
| | | * 设置excel下载响应头属性 |
| | | */ |
| | | private void setExcelRespProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.intake; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoIntake; |
| | | 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 wuzeyu |
| | | * @date 2023/12/26 11:12 |
| | | * @LastEditTime 2023/12/26 11:12 |
| | | * @Description 取水口服务类 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class IntakeSv { |
| | | @Autowired |
| | | private PrIntakeMapper prIntakeMapper; |
| | | |
| | | /** |
| | | * 添加取水口 |
| | | * |
| | | * @param po |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | Integer addIntake(PrIntake po) { |
| | | if (po.getTownId()==null||po.getTownId()==0) |
| | | { |
| | | Long townId=getSupperByVillageId(po.getVillageId()); |
| | | po.setTownId(townId); |
| | | } |
| | | if (po.getCountyId()==null||po.getCountyId()==0) |
| | | { |
| | | Long countyId=getSupperByVillageId(getSupperByVillageId(po.getVillageId())); |
| | | po.setCountyId(countyId); |
| | | } |
| | | return prIntakeMapper.insertSelective(po); |
| | | } |
| | | public Long getSupperByVillageId(long vaId){ |
| | | return prIntakeMapper.getSupperByVillageId(vaId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存修改实体 |
| | | * @param po 实体 |
| | | * @return 数量 |
| | | */ |
| | | |
| | | public int update(PrIntake po){ |
| | | if (po.getTownId()==null||po.getTownId()==0) |
| | | { |
| | | Long townId=getSupperByVillageId(po.getVillageId()); |
| | | po.setTownId(townId); |
| | | } |
| | | if (po.getCountyId()==null||po.getCountyId()==0) |
| | | { |
| | | Long countyId=getSupperByVillageId(getSupperByVillageId(po.getVillageId())); |
| | | po.setCountyId(countyId); |
| | | } |
| | | return this.prIntakeMapper.updateByPrimaryKeySelective(po) ; |
| | | // return this.prIntakeMapper.updateByPrimaryKey(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取取水口记录 |
| | | * |
| | | * @param queryVo 查询视图 |
| | | * @return 取水口记录列表 |
| | | */ |
| | | public QueryResultVo<List<VoIntake>> getIntakes(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | Long itemTotal = prIntakeMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = queryVo.pageSize; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prIntakeMapper.getIntakes(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件导出取水口列表 |
| | | * |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public List<VoIntake> exportIntakes(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | List<VoIntake> rsVo = prIntakeMapper.getIntakes(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 得到所有取水口 |
| | | * @return 所有取水口集合 |
| | | */ |
| | | public QueryResultVo<List<PrIntake>> selectAll() { |
| | | QueryResultVo<List<PrIntake>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.obj = this.prIntakeMapper.selectAll() ; |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 得到一个取水口 |
| | | * @param id 取水口ID |
| | | * @return 取水口实体 |
| | | */ |
| | | public PrIntake selectById(Long id) { |
| | | return this.prIntakeMapper.selectByPrimaryKey(id) ; |
| | | } |
| | | |
| | | /** |
| | | * 逻辑删除实体 |
| | | * @param id 实体ID |
| | | * @return 数量 |
| | | */ |
| | | @Transactional |
| | | public int delete(Long id){ |
| | | return this.prIntakeMapper.deleteLogicById(id) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据取水口编号获取未删除的取水口数量 |
| | | * @param intakeId |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountOfIntake(Long intakeId) { |
| | | return prIntakeMapper.getRecordCountOfIntake(intakeId); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.intake; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "取水口查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | @Schema(description = "取水口名称") |
| | | public String intakeName; |
| | | |
| | | @Schema(description = "所属分水房") |
| | | public String divideName; |
| | | |
| | | @Schema(description = "所属片区") |
| | | public String blockName; |
| | | |
| | | @Schema(description = "是否绑定设备") |
| | | public String isBind; |
| | | |
| | | @Schema(description = "地址") |
| | | public String address; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.intakeController; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 10:53 |
| | | * @LastEditTime 2024-01-02 10:53 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "取水口、控制器绑定关系传入对象") |
| | | public class DtoIntakeController { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 取水口编号 |
| | | */ |
| | | @Schema(description = "取水口ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "取水口ID不能为空") |
| | | private Long intakeId; |
| | | |
| | | /** |
| | | * 控制器编号 |
| | | */ |
| | | @Schema(description = "控制器ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "控制器ID不能为空") |
| | | private Long controllerId; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 1, max = 200) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | private Long operator; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.intakeController; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntakeController; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.Mapping; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 10:59 |
| | | * @LastEditTime 2024-01-02 10:59 |
| | | * @Description DtoToPojo 转 PrIntakeController |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface DtoToPojo { |
| | | DtoToPojo INSTANCT = Mappers.getMapper(DtoToPojo.class); |
| | | @Mapping(target = "intakeid", source = "intakeId") |
| | | @Mapping(target = "controllerid", source = "controllerId") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | | @Mapping(target = "operator", source = "operator") |
| | | PrIntakeController po2vo(DtoIntakeController po); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.intakeController; |
| | | |
| | | 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.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntakeController; |
| | | import com.dy.pipIrrProject.controller.ControllerSv; |
| | | import com.dy.pipIrrProject.intake.IntakeSv; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import 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.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 9:18 |
| | | * @LastEditTime 2024-01-02 9:18 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "取水口/控制器关联管理", description = "取水口/控制器关联操作") |
| | | @RestController |
| | | @RequestMapping(path="intake_controller") |
| | | @RequiredArgsConstructor |
| | | public class IntakeControllerCtrl { |
| | | private final IntakeControllerSv intakeControllerSv; |
| | | private final IntakeSv intakeSv; |
| | | private final ControllerSv controllerSv; |
| | | |
| | | /** |
| | | * 添加取水口/控制器捆绑记录 |
| | | * 若取水口或控制器不存在需提示用户 |
| | | * 若取水口已经与控制器绑定需提示用户 |
| | | */ |
| | | @Operation(summary = "添加绑定记录", description = "添加绑定记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "bind", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> bind(@RequestBody @Valid DtoIntakeController po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | // 根据编号分别获取取水口、控制器未删除记录数 |
| | | Integer recIntke = Optional.ofNullable(intakeSv.getRecordCountOfIntake(po.getIntakeId())).orElse(0); |
| | | Integer recController = Optional.ofNullable(controllerSv.getRecordCountOfController(po.getControllerId())).orElse(0); |
| | | if(recIntke == 0 || recController == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_OR_CONTROLLER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | Integer recordCount = Optional.ofNullable(intakeControllerSv.getBindRecordCount(po.getIntakeId(), po.getControllerId(), (byte)1)).orElse(0); |
| | | if(recordCount > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_HAS_BINDED_CONTROLLER.getMessage()); |
| | | } |
| | | |
| | | PrIntakeController prIntakeController = DtoToPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prIntakeController.setOperatedt(operateTime); |
| | | prIntakeController.setOperatetype((byte)1); |
| | | |
| | | Integer rec = Optional.ofNullable(intakeControllerSv.addRecord(prIntakeController)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 添加取水口/控制器解绑记录 |
| | | * 1. 判断取水口是否存在 |
| | | * 2. 判断控制器是否存在 |
| | | * 3. 判断取水口、控制器解绑关系是否已存在 |
| | | */ |
| | | @Operation(summary = "添加解绑记录", description = "添加解绑记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "unbind", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> unbind(@RequestBody @Valid DtoIntakeController po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 根据编号分别获取取水口、控制器未删除记录数 |
| | | Integer recIntke = Optional.ofNullable(intakeSv.getRecordCountOfIntake(po.getIntakeId())).orElse(0); |
| | | Integer recController = Optional.ofNullable(controllerSv.getRecordCountOfController(po.getControllerId())).orElse(0); |
| | | if(recIntke == 0 || recController == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_OR_CONTROLLER_NO_EXIST.getMessage()); |
| | | } |
| | | |
| | | Integer recordCount = Optional.ofNullable(intakeControllerSv.getBindRecordCount(po.getIntakeId(), po.getControllerId(), (byte)2)).orElse(0); |
| | | if(recordCount > 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_CONTROLLER_HAS_UNBOUND.getMessage()); |
| | | } |
| | | |
| | | PrIntakeController prIntakeController = DtoToPojo.INSTANCT.po2vo(po); |
| | | Date operateTime = new Date(); |
| | | prIntakeController.setOperatedt(operateTime); |
| | | prIntakeController.setOperatetype((byte)2); |
| | | |
| | | Integer rec = Optional.ofNullable(intakeControllerSv.addRecord(prIntakeController)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.BIND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据取水口编号获取绑定记录列表 |
| | | * @param intakeId 取水口编号 |
| | | * @return 取水口下控制器的绑定、解绑记录 |
| | | */ |
| | | @Operation(summary = "获得取水口下控制器绑定及解绑记录", description = "返回取水口下控制器绑定及解绑数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回全部绑定及解绑数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "intake_binds") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getBindsByIntakeId(Long intakeId){ |
| | | try { |
| | | List<Map<String, Object>> list = Optional.ofNullable(intakeControllerSv.getBindsByIntakeId(intakeId)).orElse(new ArrayList<>()); |
| | | if(list.size() <= 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_NO_RECORDS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("查询农户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号获取绑定记录列表 |
| | | * @param controllerId 控制器编号 |
| | | * @return 与该控制器相关的绑定、解绑记录 |
| | | */ |
| | | @Operation(summary = "获得控制器与取水口绑定及解绑记录", description = "返回控制器与取水口绑定及解绑数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回全部绑定及解绑数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "controller_binds") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getBindsByControllerId(Long controllerId){ |
| | | try { |
| | | List<Map<String, Object>> list = Optional.ofNullable(intakeControllerSv.getBindsByControllerId(controllerId)).orElse(new ArrayList<>()); |
| | | if(list.size() <= 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.CONTROLLER_NO_RECORDS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("查询农户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.intakeController; |
| | | |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntakeController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-02 9:19 |
| | | * @LastEditTime 2024-01-02 9:19 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class IntakeControllerSv { |
| | | @Autowired |
| | | private PrIntakeControllerMapper prIntakeControllerMapper; |
| | | |
| | | /** |
| | | * 根据取水口编号、控制器编号、操作类别获取记录数量 |
| | | * 重复绑定、重复解绑都用该方法判断 |
| | | * @param intakeId 取水口ID |
| | | * @param controllerId 控制器ID |
| | | * @param operateType 操作类型 1-捆绑,2-解绑 |
| | | * @return 如何条件记录数 |
| | | */ |
| | | Integer getBindRecordCount(Long intakeId, Long controllerId, Byte operateType) { |
| | | return prIntakeControllerMapper.getBindRecordCount(intakeId, controllerId, operateType); |
| | | } |
| | | /** |
| | | * 添加取水口、控制器捆绑记录,1-捆绑,2-解绑 |
| | | * @param po 取水口/控制器实体对象 |
| | | * @return |
| | | */ |
| | | Integer addRecord(PrIntakeController po) { |
| | | return prIntakeControllerMapper.insert(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据取水口编号获取绑定记录列表 |
| | | * @param intakeId 取水口编号 |
| | | * @return 取水口与控制器绑定列表 |
| | | */ |
| | | List<Map<String, Object>> getBindsByIntakeId(Long intakeId) { |
| | | return prIntakeControllerMapper.getBindsByIntakeId(intakeId); |
| | | } |
| | | |
| | | /** |
| | | * 根据控制器编号获取绑定记录列表 |
| | | * @param controllerId 控制器编号 |
| | | * @return 取水口与控制器绑定列表 |
| | | */ |
| | | List<Map<String, Object>> getBindsByControllerId(Long controllerId) { |
| | | return prIntakeControllerMapper.getBindsByControllerId(controllerId); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 控制器 |
| | | */ |
| | | CONTROLLER_FAIL(30001, "控制器添加失败"); |
| | | CONTROLLER_FAIL(30001, "控制器添加失败"), |
| | | NO_RECORDS(30002, "没有符合条件的控制器数据"), |
| | | PLEASE_INPUT_CONTROLLER_ID(30003, "请输入控制器编号"), |
| | | DELETE_CONTROLLER_FAIL(30004, "控制器删除失败"), |
| | | |
| | | /** |
| | | * 取水口、控制器关联 |
| | | */ |
| | | INTAKE_HAS_BINDED_CONTROLLER(40001, "取水口与控制器已绑定"), |
| | | BIND_FAIL(40002, "取水口与控制器绑定失败"), |
| | | INTAKE_CONTROLLER_HAS_UNBOUND(40003, "取水口与控制器已解绑"), |
| | | INTAKE_NO_RECORDS(40004, "该取水口无绑定记录"), |
| | | CONTROLLER_NO_RECORDS(40005, "该控制器无绑定记录"), |
| | | INTAKE_OR_CONTROLLER_NO_EXIST(40006, "取水口或控制器不存在"), |
| | | |
| | | /** |
| | | * 流量监测站 |
| | | */ |
| | | FLOW_MONITORING_FAIL(50001, "流量监测站添加失败"), |
| | | PLEASE_INPUT_FLOW_MONITORING_ID(50002, "请输入流量监测站编号"), |
| | | DELETE_FLOW_MONITORING_FAIL(50003, "流量监测站删除失败"), |
| | | |
| | | /** |
| | | * 流量计 |
| | | */ |
| | | ADD_FLOWMETER_FAIL(60001, "流量计添加失败"), |
| | | DELETE_FLOWMETER_FAIL(60002, "流量计删除失败"), |
| | | |
| | | /** |
| | | * 流量监测站、流量计关联 |
| | | */ |
| | | MONITORING_HAS_BINDED_FLOWMETER(70001, "流量监测站与流量计已绑定"), |
| | | MONITORING_FLOWMETER_BIND_FAIL(70002, "流量监测站与流量计绑定失败"), |
| | | STATION_OR_FLOWMETER_NO_EXIST(70003, "流量监测站或流量计不存在"), |
| | | STATION_FLOWMETER_HAS_UNBOUND(70004, "流量监测站与流量计已解绑"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | |
| | | import com.dy.pipIrrSell.recharge.RechargeCtrl; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | //@GetMapping(path = "/getActiveCards", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @GetMapping(path = "/getActiveCards") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoActiveCard>>> getActiveCards(QueryVo vo){ |
| | |
| | | @PostMapping(path = "add_active", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Valid DtoActiveCard po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | @PostMapping(path = "add_reissue", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Valid DtoActiveCard po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoCancel po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoCancel po, BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid DtoClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoLoss po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoLoss po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoRecharge po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoReversal po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoReversal po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoUnlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoUnlock po, BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | //@PostMapping(path = "addRecharge") |
| | | //@Transactional(rollbackFor = Exception.class) |
| | | //@SsoAop() |
| | | //public BaseResponse<Boolean> addRecharge(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoWalletRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | //public BaseResponse<Boolean> addRecharge(@RequestBody @Valid DtoWalletRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // if(bindingResult != null && bindingResult.hasErrors()){ |
| | | // return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |