Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
1 文件已重命名
15个文件已修改
32个文件已添加
| | |
| | | if(ssoVo.hasPower){ |
| | | if(!StringUtils.isNullOrEmpty(ssoVo.dataSourceName)){ |
| | | DataSourceContext.set(ssoVo.dataSourceName); |
| | | return point.proceed(); |
| | | Object obj = point.proceed(); |
| | | DataSourceContext.remove(); |
| | | return obj ; |
| | | }else{ |
| | | //无数据源 |
| | | return BaseResponseUtils.buildError("后端系统出错,未得到当前登录用户所属机构标签(数据源名)") ; |
| | |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 多数据源应用中,通过注解确定某个数据源 |
| | | * 例如在Services层方法上注解: |
| | | * @DataSource("test") |
| | | * 表示应用数据源test |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.METHOD) |
| | | public @interface DataSource { |
| | |
| | | import java.lang.reflect.Method; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | @Slf4j |
| | | @Aspect |
| | | @Order(Constant.AspectOrderDataSource) |
New file |
| | |
| | | package com.dy.common.multiDataSource; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | /** |
| | | * 针对一个数据源(中间件应用),多数据源应用中实际只用了一个数据源 |
| | | * 多数据源应用中,通过注解确定某个数据源。 |
| | | * 确定数据源有两种方法: |
| | | * 1、注解明确了数据源: |
| | | * 例如在Services层方法上注解: @DataSourceSingle(“test”), 表示应用数据源test |
| | | * 2、注解不明确数据源: |
| | | * 例如在Services层方法上注解: @DataSourceSingle(), 未明确数据源,需要在AOP实现中确定数据源 |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.METHOD) |
| | | public @interface DataSourceSingle { |
| | | String value() default ""; |
| | | } |
New file |
| | |
| | | package com.dy.common.multiDataSource; |
| | | |
| | | |
| | | import com.dy.common.contant.Constant; |
| | | import com.dy.common.springUtil.SpringContextUtil; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @Aspect |
| | | @Order(Constant.AspectOrderDataSource) |
| | | @Component |
| | | public class DataSourceSingleAspect { |
| | | |
| | | @Pointcut("@annotation(com.dy.common.multiDataSource.DataSourceSingle)") |
| | | public void dataSourceSinglePointCut() { |
| | | } |
| | | |
| | | @Around("dataSourceSinglePointCut()") |
| | | public Object around(ProceedingJoinPoint point) throws Throwable { |
| | | MethodSignature signature = (MethodSignature) point.getSignature(); |
| | | Method method = signature.getMethod(); |
| | | DataSourceSingle dataSource = method.getAnnotation(DataSourceSingle.class); |
| | | |
| | | if (Objects.nonNull(dataSource) && !StringUtils.isNullOrEmpty(dataSource.value())) { |
| | | log.info("数据源指定为" + dataSource.value()); |
| | | //强制转成方法上配置的数据源,替换掉DataSourceContext中保存的数据源 |
| | | DataSourceContext.set(dataSource.value()); |
| | | }else{ |
| | | String datasourceName = SpringContextUtil.getApplicationContext().getEnvironment().getProperty("spring.datasource.names") ; |
| | | if(!StringUtils.isNullOrEmpty(datasourceName)){ |
| | | log.info("根据配置数据源为" + datasourceName); |
| | | DataSourceContext.set(datasourceName); |
| | | }else{ |
| | | log.error("数据源未指定"); |
| | | } |
| | | } |
| | | try { |
| | | log.info("数据库操作开始" + dataSource.value()); |
| | | return point.proceed(); |
| | | } finally { |
| | | // 销毁数据源 在执行方法之后 |
| | | log.info("数据源操作完毕" + dataSource.value()); |
| | | DataSourceContext.remove(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public class MultiDataSource extends AbstractRoutingDataSource { |
| | | |
| | | /** |
| | | * 实现多数据源接口的determineCurrentLookupKey方法 |
| | | * 以供其他部分调用,以确定当前所连接的数据库及数据源。 |
| | | * @return |
| | | */ |
| | | @Override |
| | | protected Object determineCurrentLookupKey() { |
| | | return DataSourceContext.get(); |
| | |
| | | import java.util.Properties; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * SpringBoot容器启动时,针对数据源,第一步启动本类: |
| | | * 收集多数据源的配置,形成各数据源的定义, |
| | | * 把数据源的定义作为“dataSource”注册到Spring容器中 |
| | | */ |
| | | @Slf4j |
| | | public class MultiDataSourceBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar, EnvironmentAware { |
| | | |
| | |
| | | import org.springframework.core.io.Resource; |
| | | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
| | | |
| | | /** |
| | | * SpringBoot容器启动时,针对数据源,第二步启动本类: |
| | | * 把第一步形成各数据源定义,注入本类对象multiDataSource属性中, |
| | | * 本类生成SQL会话工厂对象,工厂对象持有事务工厂对象,和各数据源(数据库)表的定义(Mapper.xml) |
| | | */ |
| | | @Configuration |
| | | public class MultiDataSourceConfig { |
| | | |
| | |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ConcurrentMap; |
| | | |
| | | /** |
| | | * 多数据源的事务类,事务对象由事务工厂创建,完成数据库事务操作。 |
| | | * 事务对象包裹着: |
| | | * 数据库连接、事务提交、事务回滚等对象及操作 |
| | | * 在事务对象中具体决定采用的具体数据源 |
| | | */ |
| | | public class MultiDataSourceTransaction implements Transaction { |
| | | |
| | | private final DataSource multidataSource; |
| | |
| | | private boolean autoCommit; |
| | | |
| | | |
| | | public MultiDataSourceTransaction(DataSource dataSource) { |
| | | public MultiDataSourceTransaction(DataSource dataSource, boolean autoCommit) { |
| | | //dataSource是DynamicDataSource类的实例 |
| | | this.multidataSource = dataSource; |
| | | this.autoCommit = autoCommit; |
| | | curConMap = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | |
| | | if (!this.curConMap.containsKey(nowDsName)) { |
| | | try { |
| | | Connection conn = this.multidataSource.getConnection(); |
| | | autoCommit=false; |
| | | this.autoCommit = false; |
| | | conn.setAutoCommit(false); |
| | | this.curConMap.put(nowDsName, conn); |
| | | } catch (SQLException ex) { |
| | |
| | | |
| | | import javax.sql.DataSource; |
| | | |
| | | /** |
| | | * 在数据库连接会话启动后,由本事务工厂产生具体事务对象, |
| | | * 由事务对象完成数据库表的事务操作。 |
| | | */ |
| | | public class MultiDataSourceTransactionFactory extends SpringManagedTransactionFactory { |
| | | @Override |
| | | public Transaction newTransaction(DataSource multiDataSource, TransactionIsolationLevel level, boolean autoCommit) { |
| | | return new MultiDataSourceTransaction(multiDataSource); |
| | | Transaction transaction = new MultiDataSourceTransaction(multiDataSource, autoCommit); |
| | | return transaction ; |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 初始化线程池 |
| | | * @param threadPoolName 线程池和线程名称 |
| | | * @param maxThreadNum 线程池最大线程数 ,若为-1,不受限制 |
| | | * @param minThreadNum 线程池最小线程数,或初始线程数 |
| | | * @param poolName 线程池和线程名称 |
| | | * @param maxNum 线程池最大线程数 ,若为-1,不受限制 |
| | | * @param minNum 线程池最小线程数,或初始线程数 |
| | | * @param freeTimeout 空闲线程超时时长(秒) |
| | | * @param busyTimeout 忙碌线程超时时长(秒),若为-1,不受限制 |
| | | * @return 线程池实例 |
| | |
| | | |
| | | /** |
| | | * 初始化线程池 |
| | | * @param threadPoolName 线程池和线程名称 |
| | | * @param maxThreadNum 线程池最大线程数,若为-1,不受限制 |
| | | * @param minThreadNum 线程池最小线程数,或初始线程数 |
| | | * @param poolName 线程池和线程名称 |
| | | * @param maxNum 线程池最大线程数,若为-1,不受限制 |
| | | * @param minNum 线程池最小线程数,或初始线程数 |
| | | * @param freeTimeout 空闲线程超时时长(秒) |
| | | * @param busyTimeout 忙碌线程超时时长(秒),若为-1,不受限制 |
| | | * @return 线程池实例 |
| | |
| | | } |
| | | /** |
| | | * 得到唯一线程池实例 |
| | | * @param dataSourceName |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | |
| | | } |
| | | /** |
| | | * 得到唯一线程池实例 |
| | | * @param dataSourceName |
| | | * @return |
| | | * @throws Exception |
| | | */ |
File was renamed from pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRTU.java |
| | |
| | | /** |
| | | * 控制器实体,RTU阀控一体机 |
| | | */ |
| | | @TableName(value = "ba_intake", autoResultMap = true) |
| | | @TableName(value = "ba_rtu", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU阀控一体机实体") |
| | | public class BaRTU implements BaseEntity { |
| | | public class BaRtu implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202312011021001L; |
| | | |
| | |
| | | public Long id; |
| | | |
| | | /** |
| | | * 控制器编号 |
| | | * 控制器地址 |
| | | */ |
| | | @Schema(description = "控制器编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "控制器编号不能为空") //不能为空也不能为null |
| | | @Length(message = "控制器编号不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String num; |
| | | @Schema(description = "控制器地址", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | public String rtuAddr; |
| | | |
| | | /** |
| | | * 外键,指向取水口 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在取水口ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在取水口不能为空") //不能为null |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 外键,指向农户(用水户) |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所属农户ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所属农户不能为空") //不能为null |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @Schema(description = "负责人", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "负责人不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String header; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "联系电话不能为空") //不能为空也不能为null |
| | | @Length(message = "联系电话必须{max}位数据", min = 11, max = 11) |
| | | public String phone; |
| | | |
| | | /** |
| | | * 开关阀 |
| | | */ |
| | | @Schema(description = "开关阀", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "0关阀,1开阀") //不能为空也不能为null |
| | | @Length(message = "联系电话必须{max}位数据", min = 1, max = 1) |
| | | public Byte isOpen; |
| | | |
| | | /** |
| | | * 控制器名称 |
| | | */ |
| | | @Schema(description = "控制器名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotEmpty(message = "控制器名称非必填") //不能为空也不能为null |
| | | @Length(message = "控制器名称不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String name; |
| | | |
| | | /** |
| | | * 厂家名称 |
| | | */ |
| | | @Schema(description = "厂家名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotEmpty(message = "厂家名称非必填") //不能为空也不能为null |
| | | @Length(message = "厂家名称不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String manufacturer; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 50) |
| | | public String remark; |
| | | |
| | | /** |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test0", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据0") |
| | | public class TestPo0 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8") |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo0Mapper extends BaseMapper<TestPo0> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo0 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test1", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据1") |
| | | public class TestPo1 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo1Mapper extends BaseMapper<TestPo1> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo1 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test2", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据2") |
| | | public class TestPo2 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo2Mapper extends BaseMapper<TestPo2> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo2 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test3", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据3") |
| | | public class TestPo3 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo3Mapper extends BaseMapper<TestPo3> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo3 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test4", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据4") |
| | | public class TestPo4 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo4Mapper extends BaseMapper<TestPo4> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo4 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test5", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据5") |
| | | public class TestPo5 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo5Mapper extends BaseMapper<TestPo5> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo5 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test6", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据6") |
| | | public class TestPo6 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo6Mapper extends BaseMapper<TestPo6> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo6 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test7", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据7") |
| | | public class TestPo7 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo7Mapper extends BaseMapper<TestPo7> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo7 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test8", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据8") |
| | | public class TestPo8 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo8Mapper extends BaseMapper<TestPo8> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo8 po); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | 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 lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 测试表 |
| | | */ |
| | | @TableName(value="test9", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU测试上报数据9") |
| | | public class TestPo9 implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id ; |
| | | |
| | | @Schema(description = "rtu地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String rtuAddr ; |
| | | |
| | | @Schema(description = "上报数据时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Date dt ; |
| | | |
| | | @Schema(description = "上报数据内容(HEX)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String content ; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.test; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface TestPo9Mapper extends BaseMapper<TestPo9> { |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param po the record |
| | | * @return insert count |
| | | */ |
| | | int putin(TestPo9 po); |
| | | |
| | | |
| | | } |
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.test.TestPo0Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo0"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test0--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo0"> |
| | | <!--@mbg.generated--> |
| | | insert into test0 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo1Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo1"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test1--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo1"> |
| | | <!--@mbg.generated--> |
| | | insert into test1 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo2Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo2"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test2--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo2"> |
| | | <!--@mbg.generated--> |
| | | insert into test2 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo3Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo3"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test3--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo3"> |
| | | <!--@mbg.generated--> |
| | | insert into test3 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo4Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo4"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test4--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo4"> |
| | | <!--@mbg.generated--> |
| | | insert into test4 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo5Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo5"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test5--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo5"> |
| | | <!--@mbg.generated--> |
| | | insert into test5 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo6Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo6"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test6--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo6"> |
| | | <!--@mbg.generated--> |
| | | insert into test6 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo7Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo7"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test7--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo7"> |
| | | <!--@mbg.generated--> |
| | | insert into test7 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo8Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo8"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test8--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo8"> |
| | | <!--@mbg.generated--> |
| | | insert into test8 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </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.test.TestPo9Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.test.TestPo9"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table test9--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="rtuAddr" jdbcType="VARCHAR" property="rtuAddr" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="dt" jdbcType="TIMESTAMP" property="dt" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, rtuAddr, content, dt |
| | | </sql> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.test.TestPo9"> |
| | | <!--@mbg.generated--> |
| | | insert into test9 (id, rtuAddr, content, dt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, |
| | | #{content,jdbcType=VARCHAR}, |
| | | #{dt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | </mapper> |
| | |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.EnableAspectJAutoProxy; |
| | | |
| | | @SpringBootApplication |
| | | @EnableAspectJAutoProxy |
| | | //@EnableAspectJAutoProxy(exposeProxy=true)//见https://blog.csdn.net/qq_32590703/article/details/109320381 |
| | | @EnableMultiDataSource |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.aceMw"}) |
| | | @MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm"}) |
| | | @MapperScan(basePackages={"com.dy.pipIrrGlobal.test","com.dy.pipIrrGlobal.daoRm"}) |
| | | public class PipIrrMwAcceptApplication implements CommandLineRunner { |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | ServerProperties.lastUpDataTimeLive = conf.getSetAttrPlusInt(doc, "config.base", "lastUpDataTimeLive", null, 0, 5, null) * 1000L ; |
| | | //数据库数据id生成器的id后缀,0是默认的后缀,一般web系统应用,数据中间件id后缀大于等于1 |
| | | ServerProperties.dbDataIdSuffix = conf.getSetAttrInt(doc, "config.base", "dbDataIdSuffix", null, 0, 99, null); |
| | | //上下行数据缓存队列中缓存数据个数的报警量,这个与现实项目所接水表数相关 |
| | | ServerProperties.cacheUpDownDataWarnCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataWarnCount", null, 1, null, null) ; |
| | | //上下行数据缓存队列中缓存数据个数的最大值,这个与现实项目所接水表数相关 |
| | | ServerProperties.cacheUpDownDataMaxCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataMaxCount", null, 1, null, null) ; |
| | | if(ServerProperties.cacheUpDownDataMaxCount <= ServerProperties.cacheUpDownDataWarnCount){ |
| | | throw new Exception("cacheUpDownDataMaxCount必须大于cacheUpDownDataWarnCount") ; |
| | | } |
| | | |
| | | //设置ID生成器的后缀 |
| | | IDLongGenerator.setSuffix(ServerProperties.dbDataIdSuffix.intValue()); |
| | |
| | | package com.dy.aceMw.server.rtuData.dbSv; |
| | | |
| | | import com.dy.common.multiDataSource.DataSourceSingle; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | import java.util.Date; |
| | | |
| | | import com.dy.pipIrrGlobal.test.*; |
| | | |
| | | @Service() |
| | | public class RtuSv { |
| | | @Autowired |
| | | public TestPo0Mapper dao0 ; |
| | | @Autowired |
| | | public TestPo1Mapper dao1 ; |
| | | @Autowired |
| | | public TestPo2Mapper dao2 ; |
| | | @Autowired |
| | | public TestPo3Mapper dao3 ; |
| | | @Autowired |
| | | public TestPo4Mapper dao4 ; |
| | | @Autowired |
| | | public TestPo5Mapper dao5 ; |
| | | @Autowired |
| | | public TestPo6Mapper dao6 ; |
| | | @Autowired |
| | | public TestPo7Mapper dao7 ; |
| | | @Autowired |
| | | public TestPo8Mapper dao8 ; |
| | | @Autowired |
| | | public TestPo9Mapper dao9 ; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private RtuSv sv ; |
| | | |
| | | public int save(Data data){ |
| | | int count = 0 ; |
| | | if(data != null && data.getSubData() != null){ |
| | | Object obj = data.getSubData() ; |
| | | if(obj != null && obj instanceof DataV1_0_1){ |
| | | DataV1_0_1 dataV1_0_1 = (DataV1_0_1)obj ; |
| | | if(dataV1_0_1 != null && dataV1_0_1.dataCdC0Vo != null){ |
| | | //见https://blog.csdn.net/qq_32590703/article/details/109320381 |
| | | //this.save0(dataV1_0_1)这种调用方法save0,save0上的注解不生效,因为采用AOP后,会生产代理类来运行 |
| | | //count += ((RtuSv)AopContext.currentProxy()).save0(dataV1_0_1); |
| | | //count += ((RtuSv)AopContext.currentProxy()).save1(dataV1_0_1); |
| | | |
| | | count += sv.save0(dataV1_0_1); |
| | | count += sv.save1(dataV1_0_1); |
| | | count += sv.save2(dataV1_0_1); |
| | | count += sv.save3(dataV1_0_1); |
| | | count += sv.save4(dataV1_0_1); |
| | | count += sv.save5(dataV1_0_1); |
| | | count += sv.save6(dataV1_0_1); |
| | | count += sv.save7(dataV1_0_1); |
| | | count += sv.save8(dataV1_0_1); |
| | | count += sv.save9(dataV1_0_1); |
| | | } |
| | | } |
| | | } |
| | | return count ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save0(DataV1_0_1 dataV1_0_1){ |
| | | TestPo0 po = new TestPo0() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao0.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save1(DataV1_0_1 dataV1_0_1){ |
| | | TestPo1 po = new TestPo1() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao1.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save2(DataV1_0_1 dataV1_0_1){ |
| | | TestPo2 po = new TestPo2() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao2.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save3(DataV1_0_1 dataV1_0_1){ |
| | | TestPo3 po = new TestPo3() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao3.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save4(DataV1_0_1 dataV1_0_1){ |
| | | TestPo4 po = new TestPo4() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao4.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save5(DataV1_0_1 dataV1_0_1){ |
| | | TestPo5 po = new TestPo5() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao5.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save6(DataV1_0_1 dataV1_0_1){ |
| | | TestPo6 po = new TestPo6() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao6.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save7(DataV1_0_1 dataV1_0_1){ |
| | | TestPo7 po = new TestPo7() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao7.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save8(DataV1_0_1 dataV1_0_1){ |
| | | TestPo8 po = new TestPo8() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao8.putin(po) ; |
| | | } |
| | | |
| | | @DataSourceSingle() |
| | | @Transactional |
| | | public int save9(DataV1_0_1 dataV1_0_1){ |
| | | TestPo9 po = new TestPo9() ; |
| | | po.rtuAddr = dataV1_0_1.rtuAddr ; |
| | | po.dt = new Date() ; |
| | | po.content = dataV1_0_1.dataCdC0Vo.toString() ; |
| | | return dao9.putin(po) ; |
| | | } |
| | | } |
| | |
| | | package com.dy.aceMw.server.rtuData.p206V1_0_0; |
| | | |
| | | import com.dy.aceMw.server.rtuData.TaskSurpport; |
| | | import com.dy.aceMw.server.rtuData.dbSv.RtuSv; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.springUtil.SpringContextUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | Data d = (Data)data ; |
| | | String rtuAddr = d.getRtuAddr() ; |
| | | log.info("RTU" + rtuAddr + "数据到此,还未实现处理:" + data.toString()); |
| | | |
| | | RtuSv sv = (RtuSv)SpringContextUtil.getBean(RtuSv.class) ; |
| | | sv.save(d) ; |
| | | |
| | | //得到本地RTU 数据,以备后面节点应用 |
| | | /* |
| | | BuziInterface baseBusi = BuziGeter.getBaseBusi() ; |
| | |
| | | offLineCachTimeout: 不在线缓存的命令最大缓存时长(秒) |
| | | lastUpDataTimeLive: TCP上行数据时刻缓存时长(秒),当达到时长时,TCP上行数据时刻被清空,采用TCP上行数据时刻目的是,阻止上行数据同时下发数据,因为RTU处理不过来(经初次实验,1秒还是有问题,2秒无问题) |
| | | dbDataIdSuffix:数据库数据id生成器的id后缀,0是默认的后缀,一般web系统应用,数据中间件id后缀大于等于1 |
| | | cacheUpDownDataWarnCount:上下行数据缓存队列中缓存数据个数的报警量,这个与现实项目所接水表数相关 |
| | | cacheUpDownDataMaxCount:上下行数据缓存队列中缓存数据个数的最大值,这个与现实项目所接水表数相关 |
| | | --> |
| | | <base |
| | | isLowPower="false" |
| | | onlyOneProtocol="true" |
| | | downComandMaxResendTimes="1" |
| | | downComandMaxResendTimes="3" |
| | | commandSendInterval="3" |
| | | cachWaitResultTimeout="60" |
| | | offLineCachTimeout="86400" |
| | | lastUpDataTimeLive="1" |
| | | dbDataIdSuffix="1" |
| | | dbDataIdSuffix="0" |
| | | cacheUpDownDataWarnCount="100000" |
| | | cacheUpDownDataMaxCount="110000" |
| | | /> |
| | | |
| | | <!-- |
| | | centerAddr: 中心地址,当前,在户表系统中的,centerAddr未用到 |
| | | centerAddr: 中心地址,当前,centerAddr未用到 |
| | | synchroRtuClock: 是否对RTU校时 |
| | | synchroRtuClockTimepieces:当RTU与服务器时钟相差一定毫秒(配置文件是秒钟)后,进行校时 |
| | | --> |
| | |
| | | <!-- |
| | | 支持模块 |
| | | 短工作时长线程池,线程负责用时较短的工作任务 |
| | | short_maxThread: 池中最大线程数为所有CPU核数+1 |
| | | short_minThread: 池中最小线程数 |
| | | short_maxThread: 池中最大线程数为所有CPU核数+1(short池与long池各分一半),若为-1,不受限制 ,设置为0,表示不启动线程池 |
| | | short_minThread: 池中最小线程数,若为-1,不受限制,设置为0,表示不启动线程池 |
| | | short_freeTimeout: 线程数空闲时长,若池中线程数量大于minThread,且有的线程空闲时长超过freeTimeout,则清除该线程,为了不清除,把minThread与maxThread设置相等 |
| | | short_busyTimeout:线程不间断工作时长(单位为秒)超时限,认为线程已经了崩溃,将强制清除,短工作时长设置为5秒 |
| | | 长工作时长线程池,线程负责用时较长的工作任务,例如从Redis中取缓存的RTU上行数据 |
| | | long_maxThread: 池中最大线程数,若为-1,不受限制 |
| | | long_minThread: 池中最小线程数 |
| | | 长工作时长线程池,线程负责用时较长的工作任务,例如数据库存取操作 |
| | | long_maxThread: 池中最大线程数为所有CPU核数+1(short池与long池各分一半),若为-1,不受限制,设置为0,表示不启动线程池 |
| | | long_minThread: 池中最小线程数,若为-1,不受限制,设置为0,表示不启动线程池 |
| | | long_freeTimeout: 线程数空闲时长,若池中线程数量大于minThread,且有的线程空闲时长超过freeTimeout,则清除该线程 |
| | | long_busyTimeout:线程不间断工作时长(单位为秒)超时限,若为-1,不受限制 |
| | | enableThreadPool:是否启用线程池 |
| | | --> |
| | | <support |
| | | short_maxThread="100" |
| | | short_minThread="5" |
| | | short_maxThread="6" |
| | | short_minThread="6" |
| | | short_freeTimeout="60" |
| | | short_busyTimeout="5" |
| | | long_maxThread="200" |
| | | long_minThread="0" |
| | | long_maxThread="6" |
| | | long_minThread="6" |
| | | long_freeTimeout="60" |
| | | long_busyTimeout="-1" |
| | | enableThreadPool="true" |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(PipIrrSsoApplication.class, args); |
| | | log.info("容器启动成功... "); |
| | | |
| | | // SpringCacheService springCacheService = SpringContextUtil.getBean(SpringCacheService.class); |
| | | // springCacheService.query(); |
| | | |
| | | // MyGuavaCacheService myGuavaCacheService = SpringContextUtil.getBean(MyGuavaCacheService.class); |
| | | // myGuavaCacheService.query(); |
| | | } |
| | | } |