Closed fx820 closed 1 year ago
具体表现是啥?
上图中PagerResult等三个类在4.0.13的jar包里有,但是为了自定义sql查询引入hsweb-commons-crud-4.0.16-SNAPSHOT.jar后,这三个类就无法使用了。下图是4.0.13版本的jar包,含有业务中一直在用的类。是否是因为依赖的版本号不一致?
下图是项目pom文件
全部模块都使用4.0.16-SNAPSHOT这个版本..
在pom中添加这个仓库就行了
<repository>
<id>hsweb-nexus</id>
<name>Nexus Release Repository</name>
<url>https://nexus.hsweb.me/content/groups/public/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
十分感谢。统一到4.0.16-SNAPSHOT这个版本就好了。不过我们公司内网只能访问阿里云的central仓库,没法访问https://nexus.hsweb.me/,还是想问下大佬,4.0.16何时会release?
近期就会release
hsweb-easy-orm-rdb这个包,是不是没有4.0.16-SNAPSHOT版本Could not find artifact org.hswebframework:hsweb-easy-orm-rdb:pom:4.0.16-SNAPSHOT in hsweb-nexus (https://nexus.hsweb.me/content/groups/public/)
我尝试改到4.1.0和4.1.1-SNAPSHOT,启动时又有以下报错 java.lang.NoSuchMethodError: io.r2dbc.spi.RowMetadata.getColumnMetadatas()Ljava/util/List; at org.hswebframework.ezorm.rdb.executor.reactive.r2dbc.R2dbcReactiveSqlExecutor.lambda$null$8(R2dbcReactiveSqlExecutor.java:124)
easyorm使用 4.1.1-SNAPSHOT
版本,然后要升级r2dbc版本到 Borca-SR2
升级r2dbc版本到 Borca-SR2是指这个依赖吗?我在阿里云maven上没找到,hsweb-nexus也没下载到┑( ̄Д  ̄)┍
r2dbc-mysql 已经迁移到了io.asyncer
: https://github.com/mirromutth/r2dbc-mysql/issues/251
<dependency>
<groupId>io.asyncer</groupId>
<artifactId>r2dbc-mysql</artifactId>
<version>0.9.1</version>
</dependency>
换了gruopId, r2dbc-mysql改成0.9.1和最新的1.0.2,启动项目时均有以下报错
java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: io/r2dbc/spi/Result$Segment
at io.asyncer.r2dbc.mysql.MySqlResult.
<r2dbc.version>Borca-SR2</r2dbc.version>
<reactor.version>2020.0.31</reactor.version>
可以帮我看下项目pom文件吗,我没发现哪里有问题 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.cdc.ciot</groupId>
<artifactId>deviceAlarm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>deviceAlarm</name>
<description>deviceAlarm</description>
<properties>
<java.version>1.8</java.version>
<r2dbc.version>Borca-SR2</r2dbc.version>
<reactor.version>2020.0.31</reactor.version>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.6</version>
<configuration>
<fork>true</fork>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<mainClass>com.cdc.ciot.deviceAlarm.DeviceAlarmApplication</mainClass>
<layout>ZIP</layout>
<layers>
<enabled>true</enabled>
</layers>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- network component dependencies-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
<version>4.4.15</version>
</dependency>
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.15</version>
</dependency>
<!-- 支持 @ConfigurationProperties 注解 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- flywaydb dependencies -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
<version>8.5.13</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>8.5.13</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-mqtt</artifactId>
<version>4.3.1</version>
</dependency>
<!-- 4.0.14-SNAPSHOT change to 4.0.13 -->
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-system-dictionary</artifactId>
<version>4.0.16-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-api</artifactId>
<version>4.0.16-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-starter</artifactId>
<version>4.0.16-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hswebframework</groupId>
<artifactId>hsweb-easy-orm-rdb</artifactId>
<version>4.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-basic</artifactId>
<version>4.0.16-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-system-file</artifactId>
<version>4.0.16-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-access-logging-aop</artifactId>
<version>4.0.16-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-commons-crud</artifactId>
<version>4.0.16-SNAPSHOT</version>
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/src/main/resources/hsweb-commons-crud-4.0.16-SNAPSHOT.jar</systemPath>-->
</dependency>
<!-- 1.1.10-SNAPSHOT change to 1.1.9 -->
<dependency>
<groupId>org.jetlinks</groupId>
<artifactId>rule-engine-support</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>org.jetlinks</groupId>
<artifactId>rule-engine-api</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>org.jetlinks</groupId>
<artifactId>rule-engine-cluster</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>org.jetlinks</groupId>
<artifactId>jetlinks-supports</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>guava</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<classifier>osx-x86_64</classifier>
<version>4.1.73.Final</version>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<version>0.8.8.RELEASE</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-h2</artifactId>
<version>0.8.4.RELEASE</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-mssql</artifactId>
<version>0.8.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>2.57</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-ui</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-springdoc-ui</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>com.cronutils</groupId>
<artifactId>cron-utils</artifactId>
<version>9.1.6</version>
</dependency>
<dependency>
<groupId>org.jetlinks</groupId>
<artifactId>reactor-ql</artifactId>
<version>1.0.13</version>
</dependency>
<!-- <dependency>
<groupId>dev.miku</groupId>
<artifactId>r2dbc-mysql</artifactId>
<scope>runtime</scope>
</dependency>-->
<dependency>
<groupId>io.asyncer</groupId>
<artifactId>r2dbc-mysql</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>io.lettuce</groupId>-->
<!-- <artifactId>lettuce-core</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<version>2.6.6</version>
</dependency>
<!-- config components dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-r2dbc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-pool</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.5.14</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.3.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://git.chintcloud.net/api/v4/groups/41/-/packages/maven</url>
</repository>
<repository>
<id>hsweb-nexus</id>
<name>Nexus Release Repository</name>
<url>https://nexus.hsweb.me/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>https://git.chintcloud.net/api/v4/projects/48/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://git.chintcloud.net/api/v4/projects/48/packages/maven</url>
</snapshotRepository>
</distributionManagement>
再请教一个问题:queryPaged在自定义sql时显示报错:undefined column[1],而query是正常的,但是没有分页,需要自己实现。是否有方法解决undefined column?
异常栈看看。还有where条件支持动态注入,不建议拼接sql
都用queryPaged的情况下,很神奇的是,动态注入时会报undefined column[1],sql拼接是正常的(无分页)。
2023-08-01 08:51:41.778 ERROR 14956 --- [ctor-http-nio-3] o.h.w.c.web.CommonErrorControllerAdvice : undefined column [1]
java.lang.IllegalArgumentException: undefined column [1] at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:509) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s): *__checkpoint ⇢ Handler com.cdc.ciot.deviceAlarm.controllers.DeviceAlarmHistoryController#queryForSaasReal(int, int, String, String, String) [DispatcherHandler] Original Stack Trace: at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:509) at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:492) at org.hswebframework.ezorm.rdb.operator.builder.fragments.AbstractTermsFragmentBuilder.createPrepareFragments(AbstractTermsFragmentBuilder.java:122) at org.hswebframework.ezorm.rdb.operator.builder.fragments.AbstractTermsFragmentBuilder.createTermFragments(AbstractTermsFragmentBuilder.java:159) at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:496) at org.hswebframework.web.crud.query.QueryAnalyzerImpl$SimpleQueryRefactor.appendWhere(QueryAnalyzerImpl.java:812) at org.hswebframework.web.crud.query.QueryAnalyzerImpl$SimpleQueryRefactor.refactor(QueryAnalyzerImpl.java:700) at org.hswebframework.web.crud.query.QueryAnalyzerImpl.refactor(QueryAnalyzerImpl.java:61) at org.hswebframework.web.crud.query.DefaultQueryHelper$NativeQuerySpecImpl.fetchPaged(DefaultQueryHelper.java:235) at org.hswebframework.web.crud.query.DefaultQueryHelper$NativeQuerySpecImpl.fetchPaged(DefaultQueryHelper.java:214) at com.cdc.ciot.deviceAlarm.controllers.DeviceAlarmHistoryController.lambda$query4RealNewTest$35(DeviceAlarmHistoryController.java:585) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:125) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127) at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2398) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:169) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:169) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:169) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:110) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) at reactor.core.publisher.MonoCurrentContext.subscribe(MonoCurrentContext.java:36) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at org.hswebframework.web.i18n.LocaleUtils$LocaleMono.lambda$subscribe$0(LocaleUtils.java:490) at org.hswebframework.web.i18n.LocaleUtils.doWith(LocaleUtils.java:71) at org.hswebframework.web.i18n.LocaleUtils$LocaleMono.subscribe(LocaleUtils.java:487) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249) at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79) at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200) at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.complete(MonoIgnoreThen.java:292) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onNext(MonoIgnoreThen.java:187) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:151) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) at reactor.core.publisher.MonoZip$ZipCoordinator.signal(MonoZip.java:251) at reactor.core.publisher.MonoZip$ZipInner.onNext(MonoZip.java:336) at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:180) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:109) at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:85) at reactor.core.publisher.Operators$MonoSubscriber.onComplete(Operators.java:1858) at reactor.core.publisher.MonoSupplier.subscribe(MonoSupplier.java:59) at reactor.core.publisher.Mono.subscribe(Mono.java:4400) at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:82) at reactor.core.publisher.Operators.complete(Operators.java:137) at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:145) at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53) at reactor.core.publisher.Mono.subscribe(Mono.java:4385) at reactor.core.publisher.MonoZip.subscribe(MonoZip.java:128) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:240) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:203) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onComplete(MonoFlatMap.java:181) at reactor.core.publisher.Operators.complete(Operators.java:137) at reactor.core.publisher.MonoZip.subscribe(MonoZip.java:120) at reactor.core.publisher.Mono.subscribe(Mono.java:4400) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:263) at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74) at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82) at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.java:282) at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:863) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127) at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:180) at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2398) at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.request(MonoPeekTerminal.java:139) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:169) at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2194) at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2068) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onSubscribe(MonoPeekTerminal.java:152) at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:55) at reactor.core.publisher.Mono.subscribe(Mono.java:4400) at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:451) at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.java:219) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:165) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:87) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) at org.hswebframework.web.i18n.LocaleUtils$LocaleMono.lambda$subscribe$0(LocaleUtils.java:490) at org.hswebframework.web.i18n.LocaleUtils.doWith(LocaleUtils.java:71) at org.hswebframework.web.i18n.LocaleUtils$LocaleMono.subscribe(LocaleUtils.java:487) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:109) at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142) at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:102) at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:846) at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:608) at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:588) at reactor.core.publisher.FluxFlatMap$FlatMapMain.onComplete(FluxFlatMap.java:465) at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:294) at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:230) at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:371) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:165) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:87) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) at reactor.core.publisher.Mono.subscribe(Mono.java:4400) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:263) at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:55) at reactor.netty.http.server.HttpServer$HttpServerHandle.onStateChange(HttpServer.java:967) at reactor.netty.ReactorNetty$CompositeConnectionObserver.onStateChange(ReactorNetty.java:677) at reactor.netty.transport.ServerTransport$ChildObserver.onStateChange(ServerTransport.java:478) at reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:570) at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:222) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)
2023-08-01 08:51:41.785 DEBUG 14956 --- [ctor-http-nio-3] o.h.w.s.j.CustomJackson2jsonEncoder : [c6c453b5-1] Encoding [org.hswebframework.web.crud.web.ResponseMessage@2789784c]
你传入的查询条件是什么
where条件是 1=1 and project_id like '%,1033,%'
where条件是 1=1 and project_id like '%,1033,%'
去掉1=1,后端不是直接拼接sql的。建议看一下 https://hanta.yuque.com/px7kg1/dev/pm29nrpt7ysudh86
去掉1=1就可以。感谢指教
再请教一下,自定义SQL是不是不支持嵌套子查询?传入原生where和term形式的查询条件,都会报错,但是SQL在数据库里执行是没问题的
java.lang.IllegalArgumentException: undefined column [alarm_level]
at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:509)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ Handler com.cdc.ciot.deviceAlarm.controllers.DeviceAlarmHistoryController#queryForSaasReal(int, int, String, String, String) [DispatcherHandler]
Original Stack Trace:
at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:509)
at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:492)
at org.hswebframework.ezorm.rdb.operator.builder.fragments.AbstractTermsFragmentBuilder.createPrepareFragments(AbstractTermsFragmentBuilder.java:122)
at org.hswebframework.ezorm.rdb.operator.builder.fragments.AbstractTermsFragmentBuilder.createTermFragments(AbstractTermsFragmentBuilder.java:159)
at org.hswebframework.web.crud.query.QueryAnalyzerImpl$QueryAnalyzerTermsFragmentBuilder.createTermFragments(QueryAnalyzerImpl.java:496)
at org.hswebframework.web.crud.query.QueryAnalyzerImpl$SimpleQueryRefactor.appendWhere(QueryAnalyzerImpl.java:812)
at org.hswebframework.web.crud.query.QueryAnalyzerImpl$SimpleQueryRefactor.refactor(QueryAnalyzerImpl.java:700)
at org.hswebframework.web.crud.query.QueryAnalyzerImpl.refactor(QueryAnalyzerImpl.java:61)
at org.hswebframework.web.crud.query.DefaultQueryHelper$NativeQuerySpecImpl.fetchPaged(DefaultQueryHelper.java:235)
at org.hswebframework.web.crud.query.DefaultQueryHelper$NativeQuerySpecImpl.fetchPaged(DefaultQueryHelper.java:214)
你的子查询里的 列是 alarmLevel,试试使用 alarmLevel。
ps. 原生where表达式 也是解析为Term的。 where参数并不等同于sql中的where。
刚刚试过传入alarmLevel,会报undefined column [alarmLevel],不得已又直接拼接sql才跑通。。
rule_dev_alarm_real 表结构看看.直接复制ddl
CREATE TABLE `devicealarm`.`Untitled` (
`execute_state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`alarm_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`description` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`device_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`alarm_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`event_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`alarm_level` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`confirm_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`alarm_node` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`product_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`alarm_time` datetime(6) NULL DEFAULT NULL,
`execute_people` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`confirm_state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`alarm_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`confirm_time` datetime(6) NULL DEFAULT NULL,
`update_time` datetime(6) NULL DEFAULT NULL,
`confirm_people` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`alarm_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`project_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`execute_time` datetime(6) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_rare_device_id`(`device_id` ASC) USING BTREE,
INDEX `idx_rare_alarm_id`(`alarm_id` ASC) USING BTREE,
INDEX `idx_rare_product_id`(`product_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
应该是没问题的哦。 前端传递的参数看一下。
get传参,projectId和tenantId2个字段是从header里拿的。 http://localhost:8848/api/history/_query/realTime?pageNum=1&pageSize=10&startTime=2023-08-01 14:39:18&endTime=2023-08-01 18:39:18&alarmLevel=1
刷新一下maven再试试
还是报同样的错。我这样引入jar,应该是最新版了吧。因为内网里不能直接下到,我在外面更新maven后拖jar包目录进内网的
我项目里看到的代码和您贴出来的不一样,应该是我没拷对jar包,我再重试一下。谢谢啦
好像不对。我看到的是.class文件,您发的是.java文件。以下是我的.class 文件的内容,好像基本逻辑是一样的。而且我在始终更新snapshot的测试环境也试了,还是undefined column
private Map<String, QueryAnalyzer.Column> getColumnMappings() {
if (this.columnMappings == null) {
synchronized(this) {
if (this.columnMappings == null) {
this.columnMappings = new HashMap();
Iterator var2;
QueryAnalyzer.Column column;
QueryAnalyzer.Column column;
if (this.select.table instanceof QueryAnalyzer.SelectTable) {
var2 = ((QueryAnalyzer.SelectTable)this.select.getTable()).getColumns().entrySet().iterator();
while(var2.hasNext()) {
Map.Entry<String, QueryAnalyzer.Column> entry = (Map.Entry)var2.next();
column = (QueryAnalyzer.Column)entry.getValue();
column = new QueryAnalyzer.Column(column.getName(), column.getAlias(), this.select.table.alias, column.metadata);
this.columnMappings.put(entry.getKey(), column);
this.columnMappings.put(this.select.table.alias + "." + (String)entry.getKey(), column);
if (column.metadata != null) {
this.columnMappings.put(column.metadata.getName(), column);
this.columnMappings.put(this.select.table.alias + "." + column.metadata.getName(), column);
}
}
QueryParamEntity 内容看看
会不会是因为commons-api的版本没更新
使用alarm_level呢。 这个表在后端有对应实体类没
使用alarm_level就可以了。在后端有对应实体类。感谢~ 另外还想咨询一下,hsweb好像是不支持SaaS化部署多租户,动态切换数据源的,是吗?
按道理来说有实体类的话,应该就可以用实体类中的属性名。
不支持SaaS化部署。 如果是jetlinks,企业版支持 数据权限控制(逻辑数据隔离)。
4.0.16已发布
环境
java: 1.8.0_131 hsweb: 4.0.13
问题说明
单独引入hsweb-commons-crud-4.0.16-SNAPSHOT.jar,引发了以下的jar包冲突![image](https://github.com/hs-web/hsweb-framework/assets/28852158/a8997bbb-8f86-4841-b302-74a7db1eb332)