init
This commit is contained in:
commit
7d18c3a3ca
|
|
@ -0,0 +1,30 @@
|
|||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
# *.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
target
|
||||
/.factorypath
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
FROM docker.io/maven:3.9.6-amazoncorretto-21-debian as build
|
||||
WORKDIR /workspace
|
||||
COPY pom.xml .
|
||||
COPY src src
|
||||
COPY libs libs
|
||||
RUN ls
|
||||
RUN --mount=type=cache,target=/root/.m2,id=my_m2,sharing=locked \
|
||||
mvn package -Dmaven.test.skip
|
||||
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
|
||||
|
||||
FROM docker.io/eclipse-temurin:21-jre-alpine
|
||||
ARG DEPENDENCY=/workspace/target/dependency
|
||||
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
|
||||
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
|
||||
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
|
||||
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
RUN echo "Asia/Shanghai" > /etc/timezone
|
||||
ENTRYPOINT ["java","-cp","app:app/lib/*","jj.tech.paolu.Application","--spring.profiles.active=prod"]
|
||||
|
|
@ -0,0 +1,594 @@
|
|||
<?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 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>jj.tech.yx</groupId>
|
||||
<artifactId>yx</artifactId>
|
||||
<name>yx</name>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- <jooq.version>3.17.10</jooq.version> -->
|
||||
<!-- <start-class>...</start-class>
|
||||
<docker.image.prefix>springcloud</docker.image.prefix> -->
|
||||
</properties>
|
||||
|
||||
|
||||
<!--<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>2022.0.3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>-->
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
</dependency> -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-ribbon</artifactId>
|
||||
</dependency> -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency> -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
|
||||
</dependency> -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
|
||||
</dependency> -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency> -->
|
||||
|
||||
<!-- 2020 bootstrap.yaml独立 -->
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-consul-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jooq</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.dynamic-sql</groupId>
|
||||
<artifactId>mybatis-dynamic-sql</artifactId>
|
||||
<version>1.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-core</artifactId>
|
||||
<version>1.4.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 使用slf4j+logbakc日志 (淘汰log4j和commons-logging) logback-classic包改善了log4j,且实现了SLF4J API,maven自动引入slf4j-api、logback-core-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>com.github.loki4j</groupId>
|
||||
<artifactId>loki-logback-appender</artifactId>
|
||||
<version>1.5.1</version>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-common</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--driver-->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--apache-->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>fluent-hc</artifactId>
|
||||
<version>4.5.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcutil-jdk18on</artifactId>
|
||||
<version>1.78.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--jwt-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<version>0.12.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<version>0.12.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<version>0.12.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.lionsoul</groupId>
|
||||
<artifactId>ip2region</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.16.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 腾讯短信-->
|
||||
<!--<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-sms</artifactId>
|
||||
<version>3.1.622</version>
|
||||
</dependency>-->
|
||||
|
||||
|
||||
<!--excel解析-->
|
||||
<!--<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.3.4</version>
|
||||
</dependency>-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<!-- spring 引导 maven 插件提供了许多方便的功能:
|
||||
1、它收集了类路径上的所有 jar, 并生成一个单一的可运行的 "超级jar", 这使得执行和传输服务更加方便。
|
||||
2、它搜索公共静态 void main () 方法以将其标记为可运行类。
|
||||
3、它提供了一个内置的依赖项冲突解决程序, 它将版本号设置为与 spring 启动依赖项匹配。
|
||||
4、您可以重写任何您希望的版本, 但它将默认为启动所选的一组版本。 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<!-- 读取项目yaml文件,编译打包的时候赋值给pom文件,很久没有维护,希望找到代替 -->
|
||||
<plugin>
|
||||
<groupId>it.ozimov</groupId>
|
||||
<artifactId>yaml-properties-maven-plugin</artifactId>
|
||||
<version>1.1.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>read-project-properties</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<files>
|
||||
<file>src/main/resources/application.yml</file>
|
||||
</files>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!--<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>sql-maven-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<configuration>
|
||||
<skip>${maven.test.skip}</skip>
|
||||
</configuration>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-database-h2</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>execute</goal>
|
||||
</goals>
|
||||
|
||||
<configuration>
|
||||
<driver>org.h2.Driver</driver>
|
||||
<url>jdbc:h2:./test;MODE=MySQL;AUTO_SERVER=TRUE</url>
|
||||
<username>sa</username>
|
||||
<password></password>
|
||||
|
||||
<autocommit>true</autocommit>
|
||||
<srcFiles>
|
||||
<srcFile>src/main/resources/sql/schema-h2.sql</srcFile>
|
||||
<srcFile>src/main/resources/sql/data-h2.sql</srcFile>
|
||||
</srcFiles>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>${h2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>${mariadb.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</plugin>-->
|
||||
<!-- <plugin>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-maven-plugin</artifactId>
|
||||
<version>9.20.1</version>
|
||||
<configuration>
|
||||
<driver>org.h2.Driver</driver>
|
||||
<url>jdbc:h2:./test;MODE=MySQL;AUTO_SERVER=TRUE</url>
|
||||
<user>sa</user>
|
||||
<password></password>
|
||||
<locations>
|
||||
<location>filesystem:src/main/resources/sql</location>
|
||||
<location>classpath:src/main/resources/sql</location>
|
||||
</locations>
|
||||
<baselineOnMigrate>true</baselineOnMigrate>
|
||||
<sqlMigrationSuffixes>
|
||||
<sqlMigrationSuffix>.sql</sqlMigrationSuffix>
|
||||
</sqlMigrationSuffixes>
|
||||
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-database-h2</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>migrate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>${h2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>${mariadb.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin> -->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq-codegen-maven</artifactId>
|
||||
<configuration>
|
||||
<configurationFile>${basedir}/src/main/resources/generate/jooq/JooqConfig.xml</configurationFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-jooq</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>${h2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>${mariadb.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<!--<plugin>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-maven-plugin</artifactId>
|
||||
<version>1.4.2</version>
|
||||
<configuration>
|
||||
<overwrite>true</overwrite>
|
||||
<configurationFile>${basedir}/src/main/resources/generate/mybatis/generatorConfig.xml</configurationFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate myBatis</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>${h2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>${mariadb.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</plugin>-->
|
||||
|
||||
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>repo</id>
|
||||
<name>repo</name>
|
||||
<url>file://${project.basedir}/libs</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>aliyun-public</id>
|
||||
<name>aliyun-public</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aliyun-central</id>
|
||||
<name>aliyun-central</name>
|
||||
<url>https://maven.aliyun.com/repository/central</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aliyun-spring</id>
|
||||
<url>https://maven.aliyun.com/repository/spring</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
<!-- sm9 -->
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://www.jitpack.io</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>aliyun-plugin</id>
|
||||
<name>aliyun-plugin</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>aliyun-plugin-central</id>
|
||||
<name>aliyun-plugin-central</name>
|
||||
<url>https://maven.aliyun.com/repository/central</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
|
||||
//档案申请
|
||||
contract Application {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
string constant TABLE_SUFFIX = "_application";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct ApplicationData{
|
||||
string id;
|
||||
string used_org_code;
|
||||
int256 provider_audit_status;
|
||||
string used_json_data;
|
||||
string provider_json_data;
|
||||
string application_json_data;
|
||||
int256 create_time;
|
||||
int256 update_time;
|
||||
}
|
||||
|
||||
//利用方审批完成后上链
|
||||
function insert(string memory table_prefix,string memory id,string memory used_org_code,string memory used_json_data,string memory application_json_data,int256 create_time,int256 update_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
//id重复校验
|
||||
if(existById(id,table)){
|
||||
return (0,"id exists,insert failed");
|
||||
}
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
entry.set("used_org_code", used_org_code);
|
||||
entry.set("provider_audit_status", int256(0));
|
||||
entry.set("used_json_data", used_json_data);
|
||||
entry.set("application_json_data", application_json_data);
|
||||
entry.set("create_time", create_time);
|
||||
entry.set("update_time", update_time);
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
|
||||
return (count,"success");
|
||||
|
||||
}
|
||||
|
||||
//提供方完成审批后的结果上链
|
||||
function updateAudit(string memory table_prefix,string memory id,string memory provider_json_data,int256 update_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
//id重复校验
|
||||
if(!existById(id,table)){
|
||||
return (0,"id not find");
|
||||
}
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("provider_json_data", provider_json_data);
|
||||
entry.set("provider_audit_status", int256(1));
|
||||
entry.set("update_time", update_time);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
if(count>0){
|
||||
emit UpdateResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
|
||||
}
|
||||
|
||||
//提供方查询目标为本提供方的待本公司审批的审批记录
|
||||
function selectProviderNotAudit(string memory table_prefix)
|
||||
public
|
||||
view
|
||||
returns (ApplicationData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("provider_audit_status", int256(0));
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
ApplicationData[] memory applicationDatas = new ApplicationData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
applicationDatas[i]=ApplicationData(entry.getString("id"),entry.getString("used_org_code"),entry.getInt("provider_audit_status"),entry.getString("used_json_data"),entry.getString("provider_json_data"),entry.getString("application_json_data"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
}
|
||||
|
||||
return (applicationDatas);
|
||||
}
|
||||
|
||||
//利用方查询本机构发起的且提供方已经完成的审批结果
|
||||
function selectUsedAudit(string memory table_prefix,string memory used_org_code)
|
||||
public
|
||||
view
|
||||
returns (ApplicationData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("provider_audit_status", int256(1));
|
||||
condition.EQ("used_org_code", used_org_code);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
ApplicationData[] memory applicationDatas = new ApplicationData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
applicationDatas[i]=ApplicationData(entry.getString("id"),entry.getString("used_org_code"),entry.getInt("provider_audit_status"),entry.getString("used_json_data"),entry.getString("provider_json_data"),entry.getString("application_json_data"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
}
|
||||
|
||||
return (applicationDatas);
|
||||
|
||||
}
|
||||
|
||||
//利用方查询本机构发起的且提供方已经完成的审批结果,更新时间后的
|
||||
function selectUsedAuditAndUpdateTime(string memory table_prefix,string memory used_org_code,int256 update_time)
|
||||
public
|
||||
view
|
||||
returns (ApplicationData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("provider_audit_status", int256(1));
|
||||
condition.EQ("used_org_code", used_org_code);
|
||||
condition.GE("update_time", update_time);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
ApplicationData[] memory applicationDatas = new ApplicationData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
applicationDatas[i]=ApplicationData(entry.getString("id"),entry.getString("used_org_code"),entry.getInt("provider_audit_status"),entry.getString("used_json_data"),entry.getString("provider_json_data"),entry.getString("application_json_data"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
}
|
||||
|
||||
return (applicationDatas);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Utils.sol";
|
||||
import "./Provider.sol";
|
||||
|
||||
contract ArchivesFile {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
Utils utils = new Utils();
|
||||
Provider provider = new Provider();
|
||||
|
||||
string constant TABLE_SUFFIX = "_archives_file";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct ArchivesFileData{
|
||||
string id;
|
||||
string catalog_id;
|
||||
string other_params;
|
||||
int256 create_time;
|
||||
int256 update_time;
|
||||
|
||||
}
|
||||
|
||||
//查询单个件
|
||||
function selectById(string memory table_prefix,string memory archives_file_id)
|
||||
public
|
||||
view
|
||||
returns (ArchivesFileData[] memory){
|
||||
if(provider.existByPrefix(table_prefix)==false){
|
||||
revert("table_prefix not exists");
|
||||
}
|
||||
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", archives_file_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
ArchivesFileData[] memory archivesFiles = new ArchivesFileData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
archivesFiles[i]=ArchivesFileData(entry.getString("id"),entry.getString("catalog_id"),entry.getString("other_params"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
|
||||
|
||||
}
|
||||
//合约不可以返回空,而又会自动给ArchivesFileData对象赋默认值,这样业务程序会判断很复杂
|
||||
//所以干脆搞成一个列表得了,业务程序用列表长度来判断是否存在
|
||||
return (archivesFiles);
|
||||
}
|
||||
|
||||
//查询某个目录下的所有直属件
|
||||
function selectByCatalogId(string memory table_prefix,string memory catalog_id)
|
||||
public
|
||||
view
|
||||
returns (ArchivesFileData[] memory){
|
||||
if(provider.existByPrefix(table_prefix)==false){
|
||||
revert("table_prefix not exists");
|
||||
}
|
||||
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("catalog_id", catalog_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
ArchivesFileData[] memory archivesFiles = new ArchivesFileData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
archivesFiles[i]=ArchivesFileData(entry.getString("id"),entry.getString("catalog_id"),entry.getString("other_params"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
|
||||
}
|
||||
|
||||
return (archivesFiles);
|
||||
}
|
||||
|
||||
function insert(string memory id,string memory catalog_id, string memory other_params,int256 create_time,int256 update_time )
|
||||
public
|
||||
returns(int256,string memory){
|
||||
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your archive_file table, have you regiestered as a provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
// //id重复校验
|
||||
if(existById(id,table)){
|
||||
revert("id can not repeat");
|
||||
}
|
||||
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
entry.set("catalog_id", catalog_id);
|
||||
entry.set("other_params", other_params);
|
||||
entry.set("create_time", create_time);
|
||||
entry.set("update_time", update_time);
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
function update(string memory id,string memory catalog_id, string memory other_params,int256 update_time )
|
||||
public
|
||||
returns(int256,string memory){
|
||||
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your archive_file table, have you regiestered as a provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set("other_params",other_params);
|
||||
entry.set("catalog_id",catalog_id);
|
||||
entry.set("update_time",update_time);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//根据archives_file_id删除
|
||||
function remove(string[] memory archives_file_id)
|
||||
public
|
||||
returns (int256) {
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your archive_file table, have you regiestered as a provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
int256 count = 0;
|
||||
|
||||
for(uint256 i=0;i<archives_file_id.length;i++){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", archives_file_id[i]);
|
||||
int256 deleteCount = table.remove(KEY_VALUE, condition);
|
||||
if(deleteCount>0){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if(count>0){
|
||||
emit RemoveResult(count);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
//根据catalog_id判定是否存在
|
||||
function existByCatalogId(string memory catalog_id,string memory table_prefix)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, "_catalog"));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", catalog_id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Provider.sol";
|
||||
import "./Utils.sol";
|
||||
|
||||
contract Catalog {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
Utils utils = new Utils();
|
||||
Provider provider = new Provider();
|
||||
string constant TABLE_SUFFIX = "_catalog";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct CatalogData{
|
||||
string id;
|
||||
string parent_id;
|
||||
string other_params;
|
||||
int256 create_time;
|
||||
int256 update_time;
|
||||
}
|
||||
|
||||
function selectByParentId(string memory table_prefix,string memory parent_id)
|
||||
public
|
||||
view
|
||||
returns (CatalogData[]){
|
||||
if(provider.existByPrefix(table_prefix)==false){
|
||||
revert("table_prefix not exists");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("parent_id", parent_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
CatalogData[] memory catalogDatas = new CatalogData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
catalogDatas[i]=CatalogData(entry.getString("id"),entry.getString("parent_id"),entry.getString("other_params"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
}
|
||||
|
||||
return (catalogDatas);
|
||||
}
|
||||
|
||||
function selectById(string memory table_prefix,string memory id)
|
||||
public
|
||||
view
|
||||
returns (CatalogData[]){
|
||||
if(provider.existByPrefix(table_prefix)==false){
|
||||
revert("table_prefix not exists");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
CatalogData[] memory catalogDatas = new CatalogData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
catalogDatas[i]=CatalogData(entry.getString("id"),entry.getString("parent_id"),entry.getString("other_params"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
}
|
||||
|
||||
return (catalogDatas);
|
||||
}
|
||||
|
||||
function insert(string memory id,string memory other_params,string memory parent_id,int256 create_time,int256 update_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//表格前缀
|
||||
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your catalog table, are you regiester as provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
//id重复校验
|
||||
if(existById(id,table)){
|
||||
revert("id exist, insert failed");
|
||||
}
|
||||
//parent_id如果不为空则校验父级是否存在
|
||||
// if(utils.strIsEmpty(parent_id)){
|
||||
// //不存在
|
||||
// if(!existByParentId(parent_id,table)){
|
||||
// return (0,"parent_id not find");
|
||||
// }
|
||||
// }
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
entry.set("other_params", other_params);
|
||||
entry.set("parent_id", parent_id);
|
||||
entry.set("create_time", create_time);
|
||||
entry.set("update_time", update_time);
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
|
||||
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
function update(string memory id,string memory other_params,string memory parent_id,int256 update_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//必填项校验
|
||||
if(utils.strIsEmpty(other_params)){
|
||||
revert("other_params can not empty");
|
||||
}
|
||||
if(update_time == 0){
|
||||
revert("update_time can not empty");
|
||||
}
|
||||
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your catalog table, are you regiester as provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, "_catalog"));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set("other_params",other_params);
|
||||
entry.set("parent_id",parent_id);
|
||||
entry.set("update_time",update_time);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
if(count>0){
|
||||
emit UpdateResult(count);
|
||||
}
|
||||
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
//根据catalog_id删除
|
||||
function remove(string memory catalog_id)
|
||||
public
|
||||
returns (int256) {
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your catalog table, are you regiester as provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", catalog_id);
|
||||
|
||||
int256 count = table.remove(KEY_VALUE, condition);
|
||||
if(count>0){
|
||||
emit RemoveResult(count);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//判断catalog_id是否有子archives_file
|
||||
function existArchivesFileById(string memory catalog_id,string memory table_prefix)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, "_archives_file"));
|
||||
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("catalog_id", catalog_id);
|
||||
Entries entries = table.select("key", condition);
|
||||
return entries.size()>0;
|
||||
|
||||
}
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
//根据parent_id判定是否存在
|
||||
function existByParentId(string memory parent_id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("parent_id", parent_id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Provider.sol";
|
||||
import "./Utils.sol";
|
||||
|
||||
//证书审核记录
|
||||
contract CertRecord {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
Utils utils = new Utils();
|
||||
Provider provider = new Provider();
|
||||
string constant TABLE_SUFFIX = "_cert_record";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct CertRecordData{
|
||||
string id;
|
||||
string cert_id;
|
||||
string user_id;
|
||||
string org_id;
|
||||
string audit_status;
|
||||
string json_data;
|
||||
int256 create_time;
|
||||
}
|
||||
|
||||
//根据id查询记录
|
||||
function selectById(string memory table_prefix,string memory id)
|
||||
public
|
||||
view
|
||||
returns (CertRecordData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
CertRecordData[] memory recordDatas = new CertRecordData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
recordDatas[i]=CertRecordData(entry.getString("id"),entry.getString("cert_id"),entry.getString("user_id"),entry.getString("org_id"),entry.getString("audit_status"),entry.getString("json_data"),entry.getInt("create_time"));
|
||||
}
|
||||
|
||||
return (recordDatas);
|
||||
}
|
||||
|
||||
//根据userid查询记录
|
||||
function selectByUserId(string memory table_prefix,string memory user_id)
|
||||
public
|
||||
view
|
||||
returns (CertRecordData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("user_id", user_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
CertRecordData[] memory recordDatas = new CertRecordData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
recordDatas[i]=CertRecordData(entry.getString("id"),entry.getString("cert_id"),entry.getString("user_id"),entry.getString("org_id"),entry.getString("audit_status"),entry.getString("json_data"),entry.getInt("create_time"));
|
||||
}
|
||||
|
||||
return (recordDatas);
|
||||
}
|
||||
|
||||
//根据userid查询记录
|
||||
function selectByCertId(string memory table_prefix,string memory cert_id)
|
||||
public
|
||||
view
|
||||
returns (CertRecordData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("cert_id", cert_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
CertRecordData[] memory recordDatas = new CertRecordData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
recordDatas[i]=CertRecordData(entry.getString("id"),entry.getString("cert_id"),entry.getString("user_id"),entry.getString("org_id"),entry.getString("audit_status"),entry.getString("json_data"),entry.getInt("create_time"));
|
||||
}
|
||||
|
||||
return (recordDatas);
|
||||
}
|
||||
|
||||
//根据orgid查询记录
|
||||
function selectByOrgId(string memory table_prefix,string memory org_id)
|
||||
public
|
||||
view
|
||||
returns (CertRecordData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("org_id", org_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
CertRecordData[] memory recordDatas = new CertRecordData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
recordDatas[i]=CertRecordData(entry.getString("id"),entry.getString("cert_id"),entry.getString("user_id"),entry.getString("org_id"),entry.getString("audit_status"),entry.getString("json_data"),entry.getInt("create_time"));
|
||||
}
|
||||
|
||||
return (recordDatas);
|
||||
}
|
||||
|
||||
//添加证书审核记录
|
||||
function insert(string memory id, string memory cert_id,string memory user_id,string memory org_id,string memory audit_status,string memory json_data,int256 create_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
return (0,"table_prefix not find");
|
||||
}
|
||||
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
//id重复校验
|
||||
if(existById(id,table)){
|
||||
return (0,"id exists,insert failed");
|
||||
}
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
entry.set("cert_id", cert_id);
|
||||
entry.set("user_id", user_id);
|
||||
entry.set("org_id", org_id);
|
||||
entry.set("audit_status", audit_status);
|
||||
entry.set("json_data", json_data);
|
||||
entry.set("create_time", create_time);
|
||||
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
|
||||
}
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
import "../Table.sol";
|
||||
|
||||
contract CreateTable {
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
function create(string table_prefix)
|
||||
public
|
||||
{
|
||||
|
||||
string memory TABLE_NAME = string(abi.encodePacked(table_prefix, "_archives_file"));
|
||||
//创建表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,catalog_id,other_params,create_time,update_time");
|
||||
|
||||
TABLE_NAME = string(abi.encodePacked(table_prefix, "_file"));
|
||||
//创建表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,archive_file_id,other_params,create_time,update_time");
|
||||
|
||||
TABLE_NAME = string(abi.encodePacked(table_prefix, "_catalog"));
|
||||
//创建表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,parent_id,other_params,create_time,update_time");
|
||||
|
||||
TABLE_NAME = string(abi.encodePacked(table_prefix, "_application"));
|
||||
//创建表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,used_org_code,provider_audit_status,used_json_data,provider_json_data,application_json_data,create_time,update_time");
|
||||
|
||||
TABLE_NAME = string(abi.encodePacked(table_prefix, "_download_record"));
|
||||
//创建下载记录表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,weid,content_type,content_id,timestamp,application_id,watermark_data,create_time,sign");
|
||||
|
||||
TABLE_NAME = string(abi.encodePacked(table_prefix, "_decryption_record"));
|
||||
//创建解密记录表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,weid,sm9Hibe_id,content_type,content_id,timestamp,location,create_time,sign");
|
||||
|
||||
TABLE_NAME = string(abi.encodePacked(table_prefix, "_reading_record"));
|
||||
//创建阅读记录表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,weid,sm9Hibe_id,content_type,content_id,timestamp,duration,location,create_time,sign");
|
||||
|
||||
TABLE_NAME = string(abi.encodePacked(table_prefix, "_cert_record"));
|
||||
//创建证书审核记录表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "id,cert_id,user_id,org_id,audit_status,json_data,create_time");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Provider.sol";
|
||||
import "./Utils.sol";
|
||||
|
||||
//解密记录
|
||||
contract DecryptionRecord {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
Utils utils = new Utils();
|
||||
Provider provider = new Provider();
|
||||
string constant TABLE_SUFFIX = "_decryption_record";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct DecryptionRecordData{
|
||||
string id;
|
||||
string weid;
|
||||
string sm9Hibe_id;
|
||||
int256 content_type;
|
||||
string content_id;
|
||||
int256 timestamp;
|
||||
string location;
|
||||
int256 create_time;
|
||||
string sign;
|
||||
}
|
||||
|
||||
//根据id查询记录
|
||||
function select(string memory table_prefix,string memory id)
|
||||
public
|
||||
view
|
||||
returns (DecryptionRecordData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
DecryptionRecordData[] memory recordDatas = new DecryptionRecordData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
recordDatas[i]=DecryptionRecordData(entry.getString("id"),entry.getString("weid"),entry.getString("sm9Hibe_id"),entry.getInt("content_type"),entry.getString("content_id"),entry.getInt("timestamp"),entry.getString("location"),entry.getInt("create_time"),entry.getString("sign"));
|
||||
}
|
||||
|
||||
return (recordDatas);
|
||||
}
|
||||
|
||||
//添加下载记录,临时用数组方式传入int类型变量规避堆栈过深
|
||||
function insert(string memory id, string[] memory str_attr_name,string[] memory str_attr_value,string[] memory int_attr_name,int256[] memory int_attr_value)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
return (0,"table_prefix not find");
|
||||
}
|
||||
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
//id重复校验
|
||||
if(existById(id,table)){
|
||||
return (0,"id exists,insert failed");
|
||||
}
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
|
||||
//保存str类型属性
|
||||
for (uint256 i = 0; i < str_attr_name.length; ++i) {
|
||||
entry.set(str_attr_name[i],str_attr_value[i]);
|
||||
}
|
||||
|
||||
//保存int类型属性
|
||||
for ( i = 0; i < int_attr_name.length; ++i) {
|
||||
entry.set(int_attr_name[i],int_attr_value[i]);
|
||||
}
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
|
||||
}
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Provider.sol";
|
||||
import "./Utils.sol";
|
||||
|
||||
//下载记录
|
||||
contract DownloadRecord {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
Utils utils = new Utils();
|
||||
Provider provider = new Provider();
|
||||
string constant TABLE_SUFFIX = "_download_record";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct DownloadRecordData{
|
||||
string id;
|
||||
string weid;
|
||||
int256 content_type;
|
||||
string content_id;
|
||||
int256 timestamp;
|
||||
string application_id;
|
||||
string watermark_data;
|
||||
int256 create_time;
|
||||
string sign;//数字签名
|
||||
}
|
||||
|
||||
//根据id查询记录
|
||||
function select(string memory table_prefix,string memory id)
|
||||
public
|
||||
view
|
||||
returns (DownloadRecordData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
DownloadRecordData[] memory recordDatas = new DownloadRecordData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
recordDatas[i]=DownloadRecordData(entry.getString("id"),entry.getString("weid"),entry.getInt("content_type"),entry.getString("content_id"),entry.getInt("timestamp"),entry.getString("application_id"),entry.getString("watermark_data"),entry.getInt("create_time"),entry.getString("sign"));
|
||||
}
|
||||
|
||||
return (recordDatas);
|
||||
}
|
||||
|
||||
//添加下载记录,临时用数组方式传入int类型变量规避堆栈过深
|
||||
function insert(string memory id, string[] memory str_attr_name,string[] memory str_attr_value,string[] memory int_attr_name,int256[] memory int_attr_value)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
return (0,"table_prefix not find");
|
||||
}
|
||||
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
//id重复校验
|
||||
if(existById(id,table)){
|
||||
return (0,"id exists,insert failed");
|
||||
}
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
|
||||
//保存str类型属性
|
||||
for (uint256 i = 0; i < str_attr_name.length; ++i) {
|
||||
entry.set(str_attr_name[i],str_attr_value[i]);
|
||||
}
|
||||
|
||||
//保存int类型属性
|
||||
for ( i = 0; i < int_attr_name.length; ++i) {
|
||||
entry.set(int_attr_name[i],int_attr_value[i]);
|
||||
}
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Utils.sol";
|
||||
import "./Provider.sol";
|
||||
|
||||
contract File {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
Utils utils = new Utils();
|
||||
Provider provider = new Provider();
|
||||
|
||||
|
||||
string constant TABLE_SUFFIX = "_file";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct FileData{
|
||||
string id;
|
||||
string archive_file_id;
|
||||
string other_params;
|
||||
int256 create_time;
|
||||
int256 update_time;
|
||||
}
|
||||
|
||||
//查询单个文件
|
||||
function selectById(string memory table_prefix,string memory file_id)
|
||||
public
|
||||
view
|
||||
returns (FileData[] memory){
|
||||
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", file_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
FileData[] memory files = new FileData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
files[i]=FileData(entry.getString("id"),entry.getString("archive_file_id"),entry.getString("other_params"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
|
||||
}
|
||||
|
||||
return (files);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//查询某个件下的所有文件
|
||||
function selectByCatalogId(string memory table_prefix,string memory archive_file_id)
|
||||
public
|
||||
view
|
||||
returns (FileData[] memory){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("archive_file_id", archive_file_id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
FileData[] memory files = new FileData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
files[i]=FileData(entry.getString("id"),entry.getString("archive_file_id"),entry.getString("other_params"),entry.getInt("create_time"),entry.getInt("update_time"));
|
||||
}
|
||||
|
||||
return (files);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function insert(string memory id,string memory archive_file_id, string memory other_params,int256 create_time,int256 update_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//表格前缀,这样确保只有自身才可以修改自身的目录数据
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your file table, have you regiestered as a provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
// //id重复校验
|
||||
if(existById(id,table)){
|
||||
revert("id can not repeated");
|
||||
}
|
||||
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
entry.set("archive_file_id", archive_file_id);
|
||||
entry.set("other_params", other_params);
|
||||
entry.set("create_time", create_time);
|
||||
entry.set("update_time", update_time);
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
|
||||
function update(string memory id,string memory archive_file_id, string memory other_params,int256 update_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//表格前缀,这样确保只有自身才可以修改自身的目录数据
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your file table, have you regiestered as a provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set("archive_file_id", archive_file_id);
|
||||
entry.set("other_params", other_params);
|
||||
entry.set("update_time",update_time);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
if(count>0){
|
||||
emit UpdateResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
|
||||
//根据file_id删除
|
||||
function remove(string[] memory file_id)
|
||||
public
|
||||
returns (int256) {
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
revert("can not find your file table, have you regiestered as a provder?");
|
||||
}
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
int256 count = 0;
|
||||
|
||||
for(uint256 i=0;i<file_id.length;i++){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", file_id[i]);
|
||||
int256 deleteCount = table.remove(KEY_VALUE, condition);
|
||||
if(deleteCount>0){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(count>0){
|
||||
emit RemoveResult(count);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
//根据archive_file_id判定是否存在
|
||||
function existByArchiveFileId(string memory archive_file_id,string memory table_prefix)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, "_archives_file"));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", archive_file_id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
//组织证书,存储各个组织的来自CA颁发的数字证书
|
||||
contract OrgCert {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
struct OrgCertData{
|
||||
string public_key;//公钥,十六进制串
|
||||
string issuer_name;//颁发者名称
|
||||
string subject_name;//拥有者名称
|
||||
string sig_alg_name;//签名算法名称
|
||||
string cert_content;//证书内容,以上所有字段均可由证书内容解析出来
|
||||
int256 create_time;
|
||||
int256 update_time;
|
||||
string status;//valid;invalid;
|
||||
}
|
||||
|
||||
TableFactory tableFactory;
|
||||
string constant TABLE_NAME = "org_cert2";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
constructor() public {
|
||||
tableFactory = TableFactory(0x1001); //The fixed address is 0x1001 for TableFactory
|
||||
// the parameters of createTable are tableName,keyField,"vlaueFiled1,vlaueFiled2,vlaueFiled3,..."
|
||||
//创建表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "public_key,issuer_name,subject_name,sig_alg_name,cert_content,create_time,update_time,status");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function select()
|
||||
public
|
||||
view
|
||||
returns (OrgCertData[] memory){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
OrgCertData[] memory pArray = new OrgCertData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
pArray[i]=OrgCertData(entry.getString("public_key"),entry.getString("issuer_name"),entry.getString("subject_name"),entry.getString("sig_alg_name"),entry.getString("cert_content"),entry.getInt("create_time"),entry.getInt("update_time"),entry.getString("status"));
|
||||
|
||||
}
|
||||
|
||||
return pArray;
|
||||
}
|
||||
|
||||
function insert(string memory public_key,string memory issuer_name,string subject_name,string sig_alg_name,string cert_content,int256 create_time,int256 update_time, string status)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
if(existByPublicKey(public_key)){
|
||||
return (0,"public_key can not repeat");
|
||||
}
|
||||
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("public_key", public_key);
|
||||
entry.set("issuer_name", issuer_name);
|
||||
entry.set("subject_name", subject_name);
|
||||
entry.set("sig_alg_name", sig_alg_name);
|
||||
entry.set("cert_content", cert_content);
|
||||
entry.set("create_time", create_time);
|
||||
entry.set("update_time", update_time);
|
||||
entry.set("status", status);
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
|
||||
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//根据公钥删除,实际上是更新状态为invalid
|
||||
function remove(string memory public_key,int256 update_time)
|
||||
public
|
||||
returns (int256) {
|
||||
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set("update_time",update_time);
|
||||
entry.set("status","invalid");
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("public_key", public_key);
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//根据public_key判定是否存在
|
||||
function existByPublicKey(string memory public_key)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("public_key", public_key);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
//个人证书,存储各个个人的来自组织颁发的身份凭证,可预计范围内,用户数量大约在数十万级别,不用分表
|
||||
contract PersonCert {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
struct PersonCertData{
|
||||
string weid;//用户的weid
|
||||
string issuer_name;//颁发者名称
|
||||
string issuer_public_key;//颁发者的公钥,16进制字符串
|
||||
string credential_content;//证书内容,以上所有字段均可由证书内容解析出来
|
||||
int256 create_time;
|
||||
int256 update_time;
|
||||
int256 invalid_time;//设置为无效的时间
|
||||
string status;//valid;invalid;
|
||||
}
|
||||
|
||||
TableFactory tableFactory;
|
||||
string constant TABLE_NAME = "person_cert";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
constructor() public {
|
||||
tableFactory = TableFactory(0x1001); //The fixed address is 0x1001 for TableFactory
|
||||
// the parameters of createTable are tableName,keyField,"vlaueFiled1,vlaueFiled2,vlaueFiled3,..."
|
||||
//创建表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "weid,issuer_name,issuer_public_key,credential_content,create_time,update_time,invalid_time,status");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function select()
|
||||
public
|
||||
view
|
||||
returns (PersonCertData[] memory){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
PersonCertData[] memory pArray = new PersonCertData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
pArray[i]=PersonCertData(entry.getString("weid"),entry.getString("issuer_name"),entry.getString("issuer_public_key"),entry.getString("credential_content"),entry.getInt("create_time"),entry.getInt("update_time"),entry.getInt("invalid_time"),entry.getString("status"));
|
||||
|
||||
}
|
||||
|
||||
return pArray;
|
||||
}
|
||||
|
||||
function selectByWeid(string memory weid)
|
||||
public
|
||||
view
|
||||
returns (PersonCertData[] memory){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("weid", weid);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
PersonCertData[] memory pArray = new PersonCertData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
pArray[i]=PersonCertData(entry.getString("weid"),entry.getString("issuer_name"),entry.getString("issuer_public_key"),entry.getString("credential_content"),entry.getInt("create_time"),entry.getInt("update_time"),entry.getInt("invalid_time"),entry.getString("status"));
|
||||
}
|
||||
|
||||
return pArray;
|
||||
}
|
||||
|
||||
function insert(string memory weid,string memory issuer_name,string issuer_public_key,string credential_content,int256 create_time,int256 update_time, int256 invalid_time,string status)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
if(existByWeid(weid)){
|
||||
return (0,"weid can not repeat");
|
||||
}
|
||||
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("weid", weid);
|
||||
entry.set("issuer_name", issuer_name);
|
||||
entry.set("issuer_public_key", issuer_public_key);
|
||||
entry.set("credential_content", credential_content);
|
||||
entry.set("create_time", create_time);
|
||||
entry.set("update_time", update_time);
|
||||
entry.set("invalid_time", invalid_time);
|
||||
entry.set("status", status);
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//根据weid删除,实际上是更新状态为invalid
|
||||
function remove(string memory weid,int256 update_time)
|
||||
public
|
||||
returns (int256) {
|
||||
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set("update_time",update_time);
|
||||
entry.set("invalid_time",update_time);
|
||||
entry.set("status","invalid");
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("weid", weid);
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
if(count>0){
|
||||
emit UpdateResult(count);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//根据public_key判定是否存在
|
||||
function existByWeid(string memory weid)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("weid", weid);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,233 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Utils.sol";
|
||||
import "./CreateTable.sol";
|
||||
|
||||
contract Provider {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
struct ProviderData{
|
||||
string table_prefix;
|
||||
string name;
|
||||
string addr;
|
||||
int256 create_time;
|
||||
int256 update_time;
|
||||
string status;//valid invalid
|
||||
int256 update_data_time;
|
||||
}
|
||||
Utils utils = new Utils();
|
||||
CreateTable createTable = new CreateTable();
|
||||
TableFactory tableFactory;
|
||||
string constant TABLE_NAME = "provider_20240607_1";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
constructor() public {
|
||||
tableFactory = TableFactory(0x1001); //The fixed address is 0x1001 for TableFactory
|
||||
// the parameters of createTable are tableName,keyField,"vlaueFiled1,vlaueFiled2,vlaueFiled3,..."
|
||||
//创建表
|
||||
tableFactory.createTable(TABLE_NAME, KEY_NAME, "table_prefix,name,addr,create_time,update_time,status,update_data_time");
|
||||
}
|
||||
|
||||
|
||||
//插入,只能自己插入自己的
|
||||
function insert(string memory table_prefix,string memory name,int256 create_time,int256 update_time)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
if(existByName(name) || existByPrefix(table_prefix)){
|
||||
return (0,"name and table_prefix not repeat");
|
||||
}
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("addr", utils.toString(tx.origin));
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
if(entries.size()>0){
|
||||
revert("you address have register one provider, can not repeat regester");
|
||||
}
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("table_prefix", table_prefix);
|
||||
entry.set("name", name);
|
||||
entry.set("addr", utils.toString(tx.origin));
|
||||
entry.set("create_time", create_time);
|
||||
entry.set("update_time", update_time);
|
||||
entry.set("status", "valid");
|
||||
entry.set("update_data_time",create_time);//默认设置为与本记录的创建时间相同
|
||||
|
||||
//创建附属表
|
||||
createTable.create(table_prefix);
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
|
||||
function select()
|
||||
public
|
||||
view
|
||||
returns (ProviderData[] memory){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
ProviderData[] memory pArray = new ProviderData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
pArray[i]=ProviderData(entry.getString("table_prefix"),entry.getString("name"),entry.getString("addr"),entry.getInt("create_time"),entry.getInt("update_time"),entry.getString("status"),entry.getInt("update_data_time"));
|
||||
|
||||
}
|
||||
|
||||
return (pArray);
|
||||
}
|
||||
|
||||
|
||||
function selectMySelf()
|
||||
public
|
||||
view
|
||||
returns (ProviderData[] memory){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("addr", utils.toString(tx.origin));
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
ProviderData[] memory pArray = new ProviderData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
pArray[i]=ProviderData(entry.getString("table_prefix"),entry.getString("name"),entry.getString("addr"),entry.getInt("create_time"),entry.getInt("update_time"),entry.getString("status"),entry.getInt("update_data_time"));
|
||||
|
||||
}
|
||||
|
||||
return (pArray);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//更新数据的更新时间,在上传或者更新了自身的目录数据之后调用,便于利用方在恰当时间发起查询链上目录数据的请求
|
||||
function updateData(int256 update_data_time)
|
||||
public
|
||||
returns (int256,string memory)
|
||||
{
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set("update_data_time",update_data_time);
|
||||
entry.set("update_time",update_data_time);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("addr", utils.toString(tx.origin));
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
if(count>0){
|
||||
emit UpdateResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//修改名称
|
||||
function updateName(string memory name,int256 update_time)
|
||||
public
|
||||
returns (int256,string memory)
|
||||
{
|
||||
if(utils.strIsEmpty(name)){
|
||||
return (0,"name not empty");
|
||||
}
|
||||
if(update_time == 0){
|
||||
return (0,"update_time not empty");
|
||||
}
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
//检查名称是否重复
|
||||
if(existByName(name)){
|
||||
return (0,"Name already exists");
|
||||
}
|
||||
|
||||
Entry entry = table.newEntry();
|
||||
entry.set("name",name);
|
||||
entry.set("update_time",update_time);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("addr", utils.toString(tx.origin));
|
||||
|
||||
int256 count = table.update(KEY_VALUE, entry, condition);
|
||||
if(count>0){
|
||||
emit UpdateResult(count);
|
||||
}
|
||||
|
||||
return (count,"success");
|
||||
}
|
||||
|
||||
//根据机构名称删除
|
||||
function remove()
|
||||
public
|
||||
returns (int256) {
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("addr", utils.toString(tx.origin));
|
||||
|
||||
int256 count = table.remove(KEY_VALUE, condition);
|
||||
if(count>0){
|
||||
emit RemoveResult(count);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
//根据name判定是否存在
|
||||
function existByName(string memory name)
|
||||
public
|
||||
view
|
||||
returns (bool){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("name", name);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
//根据table_prefix判定是否存在
|
||||
function existByPrefix(string memory table_prefix)
|
||||
public
|
||||
view
|
||||
returns (bool){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("table_prefix", table_prefix);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
|
||||
//根据地址查找机构的表前缀
|
||||
function selectPrefixByAddr(string addr)
|
||||
public
|
||||
view
|
||||
returns (string memory){
|
||||
Table table = tableFactory.openTable(TABLE_NAME);
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("addr",addr);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
if(entries.size()>0){
|
||||
Entry entry = entries.get(int256(0));
|
||||
return entry.getString("table_prefix");
|
||||
}
|
||||
revert("caller need regerest as a provider");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
//pragma solidity >=0.6.10 <0.8.20;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../Table.sol";
|
||||
import "./Provider.sol";
|
||||
import "./Utils.sol";
|
||||
|
||||
//阅读记录
|
||||
contract ReadingRecord {
|
||||
event CreateResult(int256 count);
|
||||
event InsertResult(int256 count);
|
||||
event UpdateResult(int256 count);
|
||||
event RemoveResult(int256 count);
|
||||
|
||||
|
||||
TableFactory tableFactory = TableFactory(0x1001);
|
||||
Utils utils = new Utils();
|
||||
Provider provider = new Provider();
|
||||
string constant TABLE_SUFFIX = "_reading_record";
|
||||
string constant KEY_NAME = "key";
|
||||
string constant KEY_VALUE = "key";
|
||||
|
||||
struct DecryptionRecordData{
|
||||
string id;
|
||||
string weid;
|
||||
string sm9Hibe_id;
|
||||
int256 content_type;
|
||||
string content_id;
|
||||
int256 timestamp;
|
||||
int256 duration;
|
||||
string location;
|
||||
int256 create_time;
|
||||
string sign;
|
||||
}
|
||||
|
||||
//根据id查询记录
|
||||
function select(string memory table_prefix,string memory id)
|
||||
public
|
||||
view
|
||||
returns (DecryptionRecordData[]){
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
uint256 dataLen = uint256(entries.size());
|
||||
DecryptionRecordData[] memory recordDatas = new DecryptionRecordData[](dataLen);
|
||||
|
||||
for (uint256 i = 0; i < dataLen; ++i) {
|
||||
Entry entry = entries.get(int256(i));
|
||||
recordDatas[i]=DecryptionRecordData(entry.getString("id"),entry.getString("weid"),entry.getString("sm9Hibe_id"),entry.getInt("content_type"),entry.getString("content_id"),entry.getInt("timestamp"),entry.getInt("duration"),entry.getString("location"),entry.getInt("create_time"),entry.getString("sign"));
|
||||
}
|
||||
|
||||
return (recordDatas);
|
||||
}
|
||||
|
||||
//添加下载记录,临时用数组方式传入int类型变量规避堆栈过深
|
||||
function insert(string memory id, string[] memory str_attr_name,string[] memory str_attr_value,string[] memory int_attr_name,int256[] memory int_attr_value)
|
||||
public
|
||||
returns(int256,string memory){
|
||||
//表格前缀
|
||||
string memory table_prefix = provider.selectPrefixByAddr(utils.toString(tx.origin));
|
||||
if(utils.strIsEmpty(table_prefix)){
|
||||
return (0,"table_prefix not find");
|
||||
}
|
||||
|
||||
//确定表格名称
|
||||
string memory table_name = string(abi.encodePacked(table_prefix, TABLE_SUFFIX));
|
||||
Table table = tableFactory.openTable(table_name);
|
||||
//id重复校验
|
||||
if(existById(id,table)){
|
||||
return (0,"id exists,insert failed");
|
||||
}
|
||||
Entry entry = table.newEntry();
|
||||
entry.set(KEY_NAME, KEY_VALUE);
|
||||
entry.set("id", id);
|
||||
|
||||
//保存str类型属性
|
||||
for (uint256 i = 0; i < str_attr_name.length; ++i) {
|
||||
entry.set(str_attr_name[i],str_attr_value[i]);
|
||||
}
|
||||
|
||||
//保存int类型属性
|
||||
for ( i = 0; i < int_attr_name.length; ++i) {
|
||||
entry.set(int_attr_name[i],int_attr_value[i]);
|
||||
}
|
||||
|
||||
int256 count = table.insert(KEY_VALUE, entry);
|
||||
if(count>0){
|
||||
emit InsertResult(count);
|
||||
}
|
||||
return (count,"success");
|
||||
|
||||
}
|
||||
|
||||
//根据id判定是否存在
|
||||
function existById(string memory id,Table table)
|
||||
private
|
||||
view
|
||||
returns (bool){
|
||||
Condition condition = table.newCondition();
|
||||
condition.EQ("id", id);
|
||||
Entries entries = table.select(KEY_VALUE, condition);
|
||||
return entries.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
pragma solidity ^0.4.24;
|
||||
|
||||
contract Utils {
|
||||
|
||||
//==============================string工具函数==============================
|
||||
function strIsEmpty(string memory str)
|
||||
public pure
|
||||
returns (bool) {
|
||||
bytes memory bytesStr = bytes(str);
|
||||
return bytesStr.length == 0;
|
||||
}
|
||||
|
||||
function strIsEqual(string memory str1, string memory str2)
|
||||
public pure
|
||||
returns (bool) {
|
||||
if (bytes(str1).length != bytes(str2).length) {
|
||||
return false;
|
||||
} else {
|
||||
return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function toString(address account) public pure returns (string memory) {
|
||||
return toString(abi.encodePacked(account));
|
||||
}
|
||||
|
||||
function toString(uint256 value) public pure returns (string memory) {
|
||||
return toString(abi.encodePacked(value));
|
||||
}
|
||||
|
||||
function toString(bytes32 value) public pure returns (string memory) {
|
||||
return toString(abi.encodePacked(value));
|
||||
}
|
||||
|
||||
function toString(bytes memory data) public pure returns (string memory) {
|
||||
bytes memory alphabet = "0123456789abcdef";
|
||||
|
||||
bytes memory str = new bytes(2 + data.length * 2);
|
||||
str[0] = "0";
|
||||
str[1] = "x";
|
||||
for (uint i = 0; i < data.length; i++) {
|
||||
str[2 + i * 2] = alphabet[uint(uint8(data[i] >> 4))];
|
||||
str[3 + i * 2] = alphabet[uint(uint8(data[i] & 0x0f))];
|
||||
}
|
||||
return string(str);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package jj.tech.paolu;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
|
||||
/**
|
||||
* @SpringBootApplication 是一个方便的注释, 它添加了以下所有内容:
|
||||
*
|
||||
@Configuration 将类标记为应用程序上下文的 bean 定义的源。
|
||||
@EnableAutoConfiguration 告诉 spring 引导开始根据类路径设置、其他 bean 和各种属性设置添加 bean。
|
||||
通常你会为 spring mvc 应用程序添加 @EnableWebMvc, 但是 spring 引导在类路径上看到 spring WebMvc 时会自动添加它。这将应用程序标记为 web 应用程序, 并激活诸如设置 DispatcherServlet 之类的关键行为。
|
||||
@ComponentScan 告诉 spring 在 hello 包中查找其他组件、配置和服务, 使其能够找到控制器。
|
||||
|
||||
main () 方法使用 spring 引导的 SpringApplication. run () 方法来启动应用程序。
|
||||
没有单行 xml?没有任何 web. xml 文件。此 web 应用程序是100% 纯 java, 您不必处理配置任何管道或基础结构。
|
||||
还有一个标记为 @Bean 的 CommandLineRunner 方法, 并在启动时运行。它检索所有的 bean, 由您的应用程序创建或自动添加感谢春季启动。它的排序和打印出来。
|
||||
* @author Dou
|
||||
*
|
||||
*/
|
||||
|
||||
@SpringBootApplication
|
||||
//@EnableDiscoveryClient
|
||||
@EnableScheduling
|
||||
public class Application {
|
||||
|
||||
|
||||
//打成war包需要继承
|
||||
// @SpringBootApplication
|
||||
// public class Application extends SpringBootServletInitializer {
|
||||
//
|
||||
// @Override
|
||||
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
// return application.sources(Application.class);
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// SpringApplication.run(Application.class, args);
|
||||
// }
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
||||
return args -> {
|
||||
System.out.println("Let's inspect the beans provided by Spring Boot:");
|
||||
|
||||
String[] beanNames = ctx.getBeanDefinitionNames();
|
||||
Arrays.sort(beanNames);
|
||||
for (String beanName : beanNames) {
|
||||
System.err.println(beanName);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// @StreamListener(IOrderProcessor.INPUT_ORDER)
|
||||
// public void input(Message<A> message) {
|
||||
// System.out.println("一般监听收到:" + message.getPayload());
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// public JdbcConnectionPool JdbcConnectionPool(){
|
||||
// String url = "jdbc:h2:~/test";
|
||||
// String user = "sa";
|
||||
// String password = "";
|
||||
// return JdbcConnectionPool.create(url, user, password);
|
||||
// }
|
||||
|
||||
|
||||
// @Bean
|
||||
// @StreamMessageConverter
|
||||
// public MessageConverter customMessageConverter() {
|
||||
// return new MyCustomMessageConverter();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
//package jj.tech.paolu.biz.demo.controller;
|
||||
//
|
||||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
//import jj.tech.paolu.biz.demo.dao.UserDao;
|
||||
//import jj.tech.paolu.biz.demo.service.AService;
|
||||
//import jj.tech.paolu.biz.demo.service.BService;
|
||||
//import jj.tech.paolu.biz.webadmin.dao.SelectMapper;
|
||||
//import jj.tech.paolu.repository.jooq.tables.SysAdminRole;
|
||||
//import jj.tech.paolu.repository.jooq.tables.pojos.SysAdmin;
|
||||
//import jj.tech.paolu.repository.jooq.tables.records.SysAdminRoleRecord;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.UserInfoMapper;
|
||||
//import jj.tech.paolu.utils.IDHelp;
|
||||
//import org.jooq.*;
|
||||
//import org.mybatis.dynamic.sql.BasicColumn;
|
||||
//import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.util.HashMap;
|
||||
//
|
||||
//import static jj.tech.paolu.repository.jooq.Tables.*;
|
||||
//import static jj.tech.paolu.repository.mybatis.dao.support.UserInfoDynamicSqlSupport.*;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.count;
|
||||
//
|
||||
//
|
||||
////@RequestMapping(value="/demo", name="demo11")
|
||||
//@RestController
|
||||
//public class DemoController {
|
||||
//
|
||||
// @Value("${server.port}")
|
||||
// String port;
|
||||
//
|
||||
// @Autowired ObjectMapper objectMapper;
|
||||
// @Autowired UserDao userDao;
|
||||
//
|
||||
// @Autowired UserInfoMapper userInfoMapper;
|
||||
// @Autowired DSLContext dsl;
|
||||
//
|
||||
//
|
||||
// @Autowired AService aService;
|
||||
// @Autowired BService bService;
|
||||
// @Autowired SelectMapper selectMapper;
|
||||
//
|
||||
//// @Autowired SysAdminDao sysAdminDaos;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * JOOQ默认嵌入式事务
|
||||
// * @return
|
||||
// */
|
||||
//// @GetMapping(value="/")
|
||||
//// @Transactional
|
||||
//// public Object mian() {
|
||||
//// aService.aa();
|
||||
//// try {
|
||||
//// aService.bb();
|
||||
//// }catch(Exception e) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
//// return "ok";
|
||||
//// }
|
||||
//
|
||||
// /**
|
||||
// * JOOQ默认嵌入式事务
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("/t")
|
||||
// @Transactional
|
||||
// public Object t() {
|
||||
// aService.aa();
|
||||
// try {
|
||||
// aService.cc();
|
||||
// }catch(Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return "ok";
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// @GetMapping("/get")
|
||||
// public Object get(String username, String password) {
|
||||
//
|
||||
//// //获取实际jdbc连接
|
||||
//// Object r =
|
||||
//// dslContext.connectionResult(c ->{
|
||||
//// Object result =
|
||||
//// DSL.using(c)
|
||||
//// .select(USER_INFO.USER_NAME)
|
||||
//// .from(USER_INFO)
|
||||
//// .where(USER_INFO.USER_NAME.eq(username))
|
||||
//// .and(USER_INFO.PASSWORD.eq(password))
|
||||
//// .orderBy(USER_INFO.ID.desc())
|
||||
//// .fetchAnyMap();
|
||||
//// return result;
|
||||
//// });
|
||||
//// return r;
|
||||
// return "OK";
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @GetMapping("/getById/{id}")
|
||||
// public Object getById(@PathVariable Long id) {
|
||||
// //create.fetch("SELECT * FROM BOOK WHERE ID = ? AND TITLE = ?", 5, "Animal Farm");
|
||||
//// SysAdmin result = sysAdminDaos.fetchOneById(id);
|
||||
//// return result;
|
||||
// return "OK";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @PostMapping("/add")
|
||||
// public Object add() {
|
||||
//
|
||||
//// if (bean.getId() == null) {
|
||||
//// IDHelp id = IDHelp.getInstance(1,1);
|
||||
//// bean.setId(id.nextId());
|
||||
//// }
|
||||
//// int i =
|
||||
//// dslContext
|
||||
//// .insertInto(USER_INFO)
|
||||
//// .set(USER_INFO.ID, bean.getId())
|
||||
//// .set(USER_INFO.REAL_NAME, bean.getRealName())
|
||||
//// .set(USER_INFO.USER_NAME, bean.getUserName())
|
||||
//// .set(USER_INFO.PASSWORD, bean.getPassword())
|
||||
//// .set(USER_INFO.HEAD_IMG, bean.getHeadImg())
|
||||
//// .execute();
|
||||
//
|
||||
//// UserInfoRecord r = dslContext.newRecord(USER_INFO);
|
||||
//// r.setUserName("ssss");
|
||||
//// r.setRealName("bbbbb");
|
||||
//// r.setPassword("ssss");
|
||||
//// r.setPassword("ssss");
|
||||
//// r.store();
|
||||
//// System.out.println(r.getUserName());
|
||||
//// r.setHeadImg((String)null);
|
||||
//// int i = r.store();
|
||||
//
|
||||
//// return i;
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/updata/{id}")
|
||||
// public Object updata(@PathVariable Integer id) {
|
||||
//// int ok =
|
||||
//// dslContext
|
||||
//// .update(USER_INFO)
|
||||
//// .set(USER_INFO.ID, 1L)
|
||||
//// .set(USER_INFO.USER_NAME, "")
|
||||
//// .set(USER_INFO.PASSWORD, "")
|
||||
//// .set(USER_INFO.HEAD_IMG, (String)null)
|
||||
//// .where(USER_INFO.ID.eq(id))
|
||||
//// .execute();
|
||||
//// dslContext.newRecord(USER_INFO);
|
||||
// dsl.update(USER_INFO).set(USER_INFO.ID, 2L);
|
||||
//
|
||||
// return "OK";
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/ss")
|
||||
// public Object ss() {
|
||||
// LocalDateTime d = LocalDateTime.now();
|
||||
// HashMap<String,Object> h = new HashMap<String,Object>();
|
||||
// IDHelp id = IDHelp.getInstance(0, 0);
|
||||
// Long i = id.nextId();
|
||||
// System.out.println(i);
|
||||
// h.put("s", i);
|
||||
// h.put("d", d);
|
||||
//
|
||||
//// U s = new U();
|
||||
// SysAdmin s =
|
||||
// dsl.selectFrom(SYS_ADMIN)
|
||||
// .where(SYS_ADMIN.USERNAME.eq("admin"))
|
||||
// .fetchOne().into(SysAdmin.class);
|
||||
//
|
||||
// Table<?> ur =
|
||||
// dsl.select(SYS_ROLE.ID)
|
||||
// .from(SYS_ROLE)
|
||||
// .where(SYS_ROLE.ID.eq(1L))
|
||||
// .asTable("ur");
|
||||
//
|
||||
// Field<Long> role_id = ur.field("role_id").coerce(Long.class);
|
||||
// SysAdminRole r = SYS_ADMIN_ROLE.as("r");
|
||||
// Result<Record1<SysAdminRoleRecord>> bb =
|
||||
// dsl.select(r).from(ur)
|
||||
// .leftJoin(r)
|
||||
// .on(r.ID.equal(role_id)).fetch();
|
||||
//
|
||||
// return bb.intoMaps();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @GetMapping("/mybatis")
|
||||
// @Transactional
|
||||
// public Object mybatis() {
|
||||
//
|
||||
// BasicColumn[] selectList = BasicColumn.columnList(id, realname, count(id).as("idss"));
|
||||
// SelectStatementProvider provider = SqlBuilder.select(selectList)
|
||||
// .from(userInfo)
|
||||
//// .leftJoin(sysAdmin.withAlias("admin")).on(id, equalTo(sysAdmin.id))
|
||||
// .groupBy(id)
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// System.out.println(provider.getSelectStatement());
|
||||
// Object m = userDao.selectSome(provider);
|
||||
// // selectMapper.select(provider);
|
||||
// return selectMapper.select(provider);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("66")
|
||||
// public Object a() {
|
||||
// aService.aa();
|
||||
// try {
|
||||
// aService.bb();
|
||||
// }catch(Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return "ok";
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package jj.tech.paolu.biz.demo.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/ttt")
|
||||
public class Test2Controller {
|
||||
|
||||
// @Resource
|
||||
// private SharedService sharedService;
|
||||
//
|
||||
// @GetMapping("/test/{id}")
|
||||
// public Object test(@PathVariable Long id) throws Exception {
|
||||
//
|
||||
// return sharedService.getTest(id);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
//package jj.tech.paolu.biz.demo.controller;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.select;
|
||||
//
|
||||
//import java.net.URI;
|
||||
//import java.nio.file.Path;
|
||||
//import java.nio.file.Paths;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Comparator;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Set;
|
||||
//import java.util.concurrent.atomic.AtomicInteger;
|
||||
//import java.util.stream.Collectors;
|
||||
//import java.util.stream.Stream;
|
||||
//
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.jooq.DSLContext;
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.springframework.aop.support.AopUtils;
|
||||
//import org.springframework.beans.factory.ListableBeanFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.jdbc.core.JdbcTemplate;
|
||||
//import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
//import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
//import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
//import org.springframework.stereotype.Controller;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.springframework.web.bind.annotation.GetMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
//import org.springframework.web.util.UriComponents;
|
||||
//import org.springframework.web.util.UriComponentsBuilder;
|
||||
//
|
||||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
//
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysUrlsMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.UserInfoMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysUrlsDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysUrls;
|
||||
//
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping(value="/ttt")
|
||||
//public class TestController {
|
||||
//
|
||||
// @Autowired UserInfoMapper userInfoMapper;
|
||||
// @Autowired SysUrlsMapper sysUrlsMapper;
|
||||
//
|
||||
// @Autowired DSLContext dsl;
|
||||
// @Autowired JdbcTemplate jdbcTemplate;
|
||||
// @Autowired ListableBeanFactory listableBeanFactory; //获取实时扫描运行的bean,性能较低
|
||||
// @Autowired RequestMappingHandlerMapping requestMappingHandlerMapping;
|
||||
//
|
||||
//
|
||||
//
|
||||
// @GetMapping(value = "/test", name="测试")
|
||||
// public void text() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @GetMapping(value="/url", name = "....")
|
||||
// @Transactional
|
||||
// public Object url() {
|
||||
//
|
||||
// //1 获取所有controller的url
|
||||
// final List<Object[]> list = new ArrayList<Object[]>();
|
||||
// requestMappingHandlerMapping
|
||||
// .getHandlerMethods()
|
||||
// .forEach((requestMappingInfo,handlerMethod) -> {
|
||||
// requestMappingInfo
|
||||
// .getPathPatternsCondition()
|
||||
// .getPatternValues()
|
||||
// .forEach((url)->{
|
||||
// RequestMapping mapping = handlerMethod.getMethodAnnotation(RequestMapping.class);
|
||||
// String name = mapping.name();
|
||||
// if(StringUtils.isAllBlank(name)) {
|
||||
// name = handlerMethod.getMethod().getName();
|
||||
// }
|
||||
// Object[] arry = {null, null, 1, 0, url, name, handlerMethod.toString()};
|
||||
// list.add(arry);
|
||||
// });
|
||||
// } );
|
||||
//
|
||||
//
|
||||
// //按url字符大小ascii排序, 再去重
|
||||
// HashMap<Object, Boolean> map = new HashMap<>();
|
||||
// List<Object[]> urls = list.stream()
|
||||
// .sorted(
|
||||
// (a,b)-> {
|
||||
// return a[4].toString().compareTo(b[4].toString());
|
||||
// }
|
||||
// )
|
||||
// .filter(i->{
|
||||
// return map.putIfAbsent(i[4], Boolean.TRUE) == null;
|
||||
// })
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// //2 构建父节点,菜单类型
|
||||
// Map<String,Object[]> parentUrlMap = new HashMap<String,Object[]>();
|
||||
// Object[] arry0 = {1, 0, 2, 0, "#/", "boot", null};
|
||||
// parentUrlMap.put("#/", arry0);
|
||||
// AtomicInteger id = new AtomicInteger(2);
|
||||
//
|
||||
//
|
||||
// //3 添加ID和父节点的所有Url
|
||||
// List<Object[]> sonUrl = new ArrayList<Object[]>();
|
||||
//
|
||||
// urls.forEach(arr->{
|
||||
// String url = arr[4].toString();
|
||||
// Object name = arr[5];
|
||||
// Object method = arr[6];
|
||||
// List<String> parents = getAllParents(url);
|
||||
// int level = 1;
|
||||
// for(int i=parents.size()-1; i>=0; i--) {
|
||||
//
|
||||
// String item = parents.get(i);
|
||||
// if(i== parents.size()-1) { //最终父节点
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if(i==0) { //最小节点
|
||||
// String parent = "#"+parents.get(i+1);//获取父节点
|
||||
//// System.err.println(parent+parentUrlMap.get(parent));
|
||||
// Object pid = parentUrlMap.get(parent)[0];
|
||||
// Object[] arry = {id.getAndIncrement(), pid, 1, level, item, name, method};
|
||||
// sonUrl.add(arry);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if(!parentUrlMap.containsKey("#"+item)) {
|
||||
// String parent = "#"+parents.get(i+1);//获取父节点
|
||||
// Object pid = parentUrlMap.get(parent)[0];
|
||||
// Object[] arry = {id.getAndIncrement(), pid, 2, level, "#"+item, null, null};
|
||||
// parentUrlMap.put("#"+item, arry);
|
||||
// }
|
||||
// level++;
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
//
|
||||
// //4 将controller上的@RequestMapping(value="", name="一级菜单"), 的name赋值给构建的菜单parentUrlMap
|
||||
// Map<String, String> menus= new HashMap<String, String>();
|
||||
//
|
||||
// Map<String, Object> controllers = listableBeanFactory.getBeansWithAnnotation(Controller.class);
|
||||
// controllers.forEach((k,v)->{
|
||||
// Class<?> source = AopUtils.getTargetClass(v);//获取实际类,而不是spring的代理类
|
||||
// RequestMapping mapping = source.getAnnotation(RequestMapping.class);
|
||||
// if(mapping != null) {
|
||||
// String mappingurl = mapping.value()[0];
|
||||
// if(!StringUtils.startsWith(mappingurl, "/")) {
|
||||
// mappingurl = "/" +mappingurl;
|
||||
// }
|
||||
// mappingurl = "#"+mappingurl;
|
||||
//
|
||||
// String name = mapping.name();
|
||||
//
|
||||
// String value = menus.get(mappingurl);
|
||||
// if(menus.containsKey(mappingurl)) {
|
||||
// //按名称ascii小的顺序赋值
|
||||
// if(StringUtils.isNoneBlank(name) && name.compareTo(value)<0) {
|
||||
// menus.put(mappingurl, name);
|
||||
// }
|
||||
// }else {
|
||||
// if(StringUtils.isNoneBlank(name)) {
|
||||
// menus.put(mappingurl, name);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// //赋值
|
||||
// menus.forEach((k,v)->{
|
||||
// Object[] arr = parentUrlMap.get(k);
|
||||
// if(arr!=null) {
|
||||
// arr[5]=v;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
//
|
||||
// List<Object[]> parentUrl = parentUrlMap.entrySet()
|
||||
// .stream()
|
||||
// .map(v->v.getValue())
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
//
|
||||
// jdbcTemplate.execute("TRUNCATE TABLE sys_urls");
|
||||
// String sql = "INSERT INTO sys_urls (ID,PID,TYPES,LEVEL,URL,NAME,METHOD) VALUES (?,?,?,?,?,?,?)";
|
||||
// jdbcTemplate.batchUpdate(sql, sonUrl);
|
||||
// jdbcTemplate.batchUpdate(sql, parentUrl);
|
||||
//
|
||||
// return "ok";
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * @param uri ="/aa/bb/cc"
|
||||
// * @return /aa/bb/cc, /aa/bb, /aa, /
|
||||
// */
|
||||
// public static List<String> getAllParents(String uri){
|
||||
// if(StringUtils.isBlank(uri)) {
|
||||
// return List.of("");
|
||||
// }
|
||||
// UriComponents components = UriComponentsBuilder.fromUriString("file://"+uri).build();
|
||||
// URI u = components.toUri();
|
||||
//
|
||||
// List<String> urilist = components.getPathSegments();
|
||||
//
|
||||
// List<Path> paths = new ArrayList<Path>();
|
||||
// Path path = Paths.get(u);
|
||||
// paths.add(path);
|
||||
//
|
||||
// for(int i=0; i<urilist.size(); i++) {
|
||||
// Path parent =paths.get(i).getParent();
|
||||
// paths.add(parent);
|
||||
// }
|
||||
//
|
||||
// return paths.stream().map(pa->{
|
||||
// return pa.toString().replace("\\", "/");
|
||||
// }).toList();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public Map<String,SysUrls> getAll(){
|
||||
// var provider = select(SysUrlsMapper.selectList)
|
||||
// .from(SysUrlsDynamicSqlSupport.sysUrls)
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
// List<SysUrls> allList = sysUrlsMapper.selectMany(provider);
|
||||
//
|
||||
// Map<String,SysUrls> map = allList.stream().collect(
|
||||
// Collectors.toMap(SysUrls::getUrl, v->v));
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public void updataMenu(Map<String,SysUrls> db, Map<String,Object[]> parent, Map<String,Object[]> url) {
|
||||
// NamedParameterJdbcTemplate namejdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
|
||||
//
|
||||
//
|
||||
// Map<String,SysUrls> dbwaitDelete = new HashMap<String,SysUrls>();
|
||||
//
|
||||
// Map<String,Object[]> all =
|
||||
// Stream.of(parent,url)
|
||||
// .flatMap(map->map.entrySet().stream())
|
||||
// .collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue));
|
||||
//
|
||||
// Map<String,Object[]> allAdd = new HashMap<String,Object[]>();
|
||||
// Map<String,Object[]> allUpdate = new HashMap<String,Object[]>();
|
||||
//
|
||||
// //1、菜单在数据库不存在则新增加,存在则更新
|
||||
// all.entrySet().stream().forEach(set->{
|
||||
// SysUrls bean = db.get(set.getKey());
|
||||
// if(bean==null) {
|
||||
// allAdd.put(set.getKey(), set.getValue());
|
||||
// }else {
|
||||
// Object[] arr = set.getValue();
|
||||
// Object[] up = new Object[] {arr[1],arr[2],arr[3],arr[5],arr[6],arr[4]};
|
||||
// allUpdate.put(set.getKey(), up);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// //2、数据库存在的菜单,在程序里不存在的,删除
|
||||
// db.entrySet().stream().forEach(set->{
|
||||
// String key = set.getKey();
|
||||
// Object[] arr = all.get(key);
|
||||
// if(arr==null) {
|
||||
// dbwaitDelete.put(key, set.getValue());
|
||||
// }
|
||||
// });
|
||||
//
|
||||
//
|
||||
// List<Object[]> add = allAdd.entrySet()
|
||||
// .stream()
|
||||
// .map(v->v.getValue())
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// String addsql = "INSERT INTO SYS_URLS (ID,PID,TYPES,LEVEL,URL,NAME,METHOD) VALUES (?,?,?,?,?,?,?)";
|
||||
// jdbcTemplate.batchUpdate(addsql, add);
|
||||
//
|
||||
//
|
||||
// List<Object[]> update = allUpdate.entrySet()
|
||||
// .stream()
|
||||
// .map(v->v.getValue())
|
||||
// .collect(Collectors.toList());
|
||||
// String updatesql = "UPDATE SYS_URLS SET PID=?,TYPES=?,LEVEL=?,NAME=?,METHOD=? WHERE URL=?";
|
||||
//
|
||||
// update.forEach(i->{
|
||||
// System.out.println(i[3]+" == "+i[5]);
|
||||
// });
|
||||
// jdbcTemplate.batchUpdate(updatesql, update);
|
||||
//
|
||||
//
|
||||
// //删除
|
||||
// if(dbwaitDelete.size()>0) {
|
||||
// Set<String> urls = dbwaitDelete.keySet();
|
||||
//
|
||||
// MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||
// parameters.addValue("urls", urls);
|
||||
// String deletesql = "DELETE SYS_URLS WHERE URL IN (:urls)";
|
||||
// namejdbcTemplate.update(deletesql, parameters);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package jj.tech.paolu.biz.demo.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
@Mapper
|
||||
public interface UserDao {
|
||||
|
||||
@Results( value = {
|
||||
@Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="REAL_NAME", property="realName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="USER_NAME", property="userName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="PASSWORD", property="password", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="HEAD_IMG", property="headImg", jdbcType=JdbcType.VARCHAR)
|
||||
})
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
List<HashMap<Object,Object>> selectSome (SelectStatementProvider selectStatement);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package jj.tech.paolu.biz.demo.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import jj.tech.paolu.utils.IDHelp;
|
||||
|
||||
public class U {
|
||||
|
||||
String i = IDHelp.getInstance(0, 0).nextId();
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "CST")//中国时区
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT")//即标准时区GMT+8
|
||||
LocalDateTime d = LocalDateTime.now();
|
||||
|
||||
public String getI() {
|
||||
return i;
|
||||
}
|
||||
public void setI(String i) {
|
||||
this.i = i;
|
||||
}
|
||||
public LocalDateTime getD() {
|
||||
return d;
|
||||
}
|
||||
public void setD(LocalDateTime d) {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package jj.tech.paolu.biz.demo.service;
|
||||
|
||||
//import static tech.bcnew.jooq.repository.Tables.SYS_ADMIN;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class AService {
|
||||
|
||||
|
||||
@Autowired DSLContext dsl;
|
||||
|
||||
@Transactional
|
||||
public void aa(){
|
||||
// dsl.insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "1")
|
||||
// .set(SYS_ADMIN.USERNAME,"1")
|
||||
// .set(SYS_ADMIN.PASSWORD,"1")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0)
|
||||
// .execute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void bb(){
|
||||
|
||||
dsl.transaction(tx->{
|
||||
|
||||
// tx.dsl().insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "2")
|
||||
// .set(SYS_ADMIN.USERNAME,"SS")
|
||||
// .set(SYS_ADMIN.PASSWORD,"SS")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0)
|
||||
// .execute();
|
||||
//
|
||||
// tx.dsl().insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "2")
|
||||
// .set(SYS_ADMIN.USERNAME,"SS")
|
||||
// .set(SYS_ADMIN.PASSWORD,"SS")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0 )
|
||||
// .execute();
|
||||
int i = 1/0;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.NESTED)
|
||||
public void cc(){
|
||||
|
||||
|
||||
// dsl.insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "2")
|
||||
// .set(SYS_ADMIN.USERNAME,"SS")
|
||||
// .set(SYS_ADMIN.PASSWORD,"SS")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0)
|
||||
// .execute();
|
||||
//
|
||||
// dsl.insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "2")
|
||||
// .set(SYS_ADMIN.USERNAME,"SS")
|
||||
// .set(SYS_ADMIN.PASSWORD,"SS")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0 )
|
||||
// .execute();
|
||||
int i = 1/0;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package jj.tech.paolu.biz.demo.service;
|
||||
|
||||
//import static tech.bcnew.jooq.repository.Tables.SYS_ADMIN;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class BService {
|
||||
|
||||
@Autowired DSLContext dsl;
|
||||
|
||||
|
||||
@Transactional
|
||||
public void aa(){
|
||||
// dsl.insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "1")
|
||||
// .set(SYS_ADMIN.USERNAME,"1")
|
||||
// .set(SYS_ADMIN.PASSWORD,"1")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0)
|
||||
// .execute();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用jooq提供的事务管理器,默认是嵌入式事务
|
||||
*/
|
||||
public void bb(){
|
||||
|
||||
// dsl.transaction(tx->{
|
||||
//
|
||||
// tx.dsl().insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "2")
|
||||
// .set(SYS_ADMIN.USERNAME,"SS")
|
||||
// .set(SYS_ADMIN.PASSWORD,"SS")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0)
|
||||
// .execute();
|
||||
//
|
||||
// tx.dsl().insertInto(SYS_ADMIN)
|
||||
// .set(SYS_ADMIN.REALNAME, "2")
|
||||
// .set(SYS_ADMIN.USERNAME,"SS")
|
||||
// .set(SYS_ADMIN.PASSWORD,"SS")
|
||||
// .set(SYS_ADMIN.IS_LOCKED, (byte)0 )
|
||||
// .execute();
|
||||
// int i = 1/0;
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,555 @@
|
|||
//package jj.tech.paolu.biz.webadmin.controller;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.constant;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.count;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.equalTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isEqualToWhenPresent;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isIn;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isInWhenPresent;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isLike;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isNotEqualTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.select;
|
||||
//
|
||||
//import java.awt.image.BufferedImage;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Optional;
|
||||
//import java.util.Properties;
|
||||
//import java.util.Random;
|
||||
//import java.util.function.Function;
|
||||
//
|
||||
//import javax.imageio.ImageIO;
|
||||
//
|
||||
//import org.apache.commons.codec.digest.DigestUtils;
|
||||
//import org.apache.commons.collections.CollectionUtils;
|
||||
//import org.apache.commons.lang3.ArrayUtils;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.mybatis.dynamic.sql.BasicColumn;
|
||||
//import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
//import org.mybatis.dynamic.sql.select.SelectModel;
|
||||
//import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
//import org.mybatis.dynamic.sql.where.WhereApplier;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.springframework.validation.annotation.Validated;
|
||||
//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 com.google.code.kaptcha.impl.DefaultKaptcha;
|
||||
//import com.google.code.kaptcha.util.Config;
|
||||
//
|
||||
//import io.swagger.v3.oas.annotations.Operation;
|
||||
//import jakarta.servlet.ServletOutputStream;
|
||||
//import jakarta.servlet.http.HttpServletRequest;
|
||||
//import jakarta.servlet.http.HttpServletResponse;
|
||||
//import jj.tech.paolu.biz.webadmin.dao.SelectMapper;
|
||||
//import jj.tech.paolu.biz.webadmin.service.OrgService;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.AdminListVo;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.Id;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.IdsAndPwd;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.IdsAndPwdUpdate;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.LoginVo;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.SysAdminAddVo;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.SysAdminLock;
|
||||
//import jj.tech.paolu.config.security.user.WebAdminUtil;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.CertificateApplyMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.CertificateApplyRecordMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.CertificateDetailMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysAdminMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysAdminRoleMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysAdminWeidMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysOrgMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysRoleMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.FilesApplyDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysAdminDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysAdminRoleDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysRoleDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysAdmin;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysAdminRole;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysOrg;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysRole;
|
||||
//import jj.tech.paolu.utils.CookieUtil;
|
||||
//import jj.tech.paolu.utils.IDHelp;
|
||||
//import jj.tech.paolu.utils.Page;
|
||||
//import jj.tech.paolu.utils.R;
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping(value = "/op/admin", name = "管理员账号管理列表")
|
||||
//public class AdminManagerContronller {
|
||||
//
|
||||
// @Autowired SysAdminMapper sysAdminMapper;
|
||||
// @Autowired SysAdminWeidMapper sysAdminWeidMapper;
|
||||
// @Autowired SysAdminRoleMapper sysAdminRoleMapper;
|
||||
// @Autowired SysOrgMapper sysOrgMapper;
|
||||
// @Autowired SysRoleMapper sysRoleMapper;
|
||||
// @Autowired CertificateApplyMapper certificateApplyMapper;
|
||||
// @Autowired CertificateApplyRecordMapper certificateApplyRecordMapper;
|
||||
// @Autowired CertificateDetailMapper certificateDetailMapper;
|
||||
// @Autowired SelectMapper selectMapper;
|
||||
// @Autowired OrgService orgService;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "管理员登录", description = "admin 000000")
|
||||
// @PostMapping("/login")
|
||||
// public Object login(@Validated @RequestBody LoginVo parame,
|
||||
// HttpServletRequest request, HttpServletResponse response) {
|
||||
//
|
||||
// String passwordEncode = DigestUtils.sha3_256Hex(parame.password);
|
||||
// String captchaSha = DigestUtils.sha3_256Hex(parame.captcha);
|
||||
// String captchaShaCookie = CookieUtil.fine(request, "captcha");
|
||||
// if(!captchaSha.equals(captchaShaCookie)) {
|
||||
// return R.FALSE("验证码错误");
|
||||
// }
|
||||
// var provider = select(SysAdminMapper.selectList)
|
||||
// .from(SysAdminDynamicSqlSupport.sysAdmin)
|
||||
// .where(SysAdminDynamicSqlSupport.username, isEqualTo(parame.username))
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// Optional<SysAdmin> op = sysAdminMapper.selectOne(provider);
|
||||
// if(!op.isPresent()) {
|
||||
// return R.FALSE("管理员不存在");
|
||||
// }
|
||||
// SysAdmin bean = op.get();
|
||||
// if(!passwordEncode.equals(bean.getPassword())) {
|
||||
// return R.FALSE("密码错误");
|
||||
// }
|
||||
//
|
||||
// if(!bean.getId().equals("1") && bean.getIslock() == 0) {
|
||||
// return R.FALSE("管理员已被禁用");
|
||||
// }
|
||||
// bean.setPassword(null);
|
||||
//
|
||||
// String token = WebAdminUtil.addUser(bean);
|
||||
// HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
// map.put("webadmin", token);
|
||||
// map.put("admin", bean);
|
||||
// CookieUtil.delete(response, "captcha");
|
||||
// return R.SUCCESS(map);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "登出", description = "")
|
||||
// @PostMapping("/logout")
|
||||
// public Object logout() {
|
||||
// WebAdminUtil.deleteUser();
|
||||
// return R.SUCCESS("logout is ok");
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "验证码", description = "")
|
||||
// @PostMapping("/captcha")
|
||||
// public Object captcha(HttpServletRequest request, HttpServletResponse response){
|
||||
// try
|
||||
// {
|
||||
// response.setDateHeader("Expires", 0);
|
||||
// response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||
// response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
||||
// response.setHeader("Pragma", "no-cache");
|
||||
// response.setContentType("image/jpeg");
|
||||
//
|
||||
// DefaultKaptcha captchaProducer = new DefaultKaptcha();
|
||||
// Properties p = new Properties();
|
||||
//// p.setProperty("kaptcha.image.width", null);
|
||||
//// p.setProperty("kaptcha.image.height", null);
|
||||
//// p.setProperty("kaptcha.textproducer.char.string", "0123456789");
|
||||
// p.setProperty("kaptcha.textproducer.char.length", "4");
|
||||
//
|
||||
// Config cfig = new Config(p);
|
||||
// captchaProducer.setConfig(cfig);
|
||||
//
|
||||
// String capText = captchaProducer.createText();
|
||||
// CookieUtil.add("captcha", DigestUtils.sha3_256Hex(capText), response);
|
||||
//
|
||||
// //request.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);
|
||||
//
|
||||
// BufferedImage bi = captchaProducer.createImage(capText);
|
||||
//
|
||||
// ServletOutputStream out = response.getOutputStream();
|
||||
// ImageIO.write(bi, "jpg", out);
|
||||
// out.flush();
|
||||
//
|
||||
// }catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "管理员列表,按内容搜索", description = "")
|
||||
// @PostMapping("/list")
|
||||
// public Object list(@RequestBody AdminListVo parame) {
|
||||
//
|
||||
// Page p = new Page(parame.pageNum,parame.pageSize);
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
// List<SysOrg> orgs = orgService.allFarter(admin.getOrg_id());
|
||||
// SysOrg endOrg = orgs.getLast();
|
||||
//
|
||||
// BasicColumn[] adminCloudList = BasicColumn.columnList(SysAdminDynamicSqlSupport.sysAdmin.allColumns());
|
||||
// BasicColumn roleNames = constant("string_agg(sys_role.rolename, ',')").as("rolenames");
|
||||
// BasicColumn[] basic = ArrayUtils.addAll(adminCloudList,roleNames);
|
||||
//
|
||||
//
|
||||
// Function<QueryExpressionDSL.FromGatherer<SelectModel>, QueryExpressionDSL<SelectModel>.JoinSpecificationFinisher> function =
|
||||
// s -> {
|
||||
//
|
||||
// var from = s
|
||||
// .from(SysAdminDynamicSqlSupport.sysAdmin)
|
||||
// .leftJoin(SysAdminRoleDynamicSqlSupport.sysAdminRole)
|
||||
// .on(SysAdminRoleDynamicSqlSupport.adminid,equalTo(SysAdminDynamicSqlSupport.id))
|
||||
// .leftJoin(SysRoleDynamicSqlSupport.sysRole)
|
||||
// .on(SysRoleDynamicSqlSupport.id,equalTo(SysAdminRoleDynamicSqlSupport.roleid))
|
||||
// ;
|
||||
//
|
||||
// return from;
|
||||
// };
|
||||
//
|
||||
//
|
||||
//
|
||||
// var where = SqlBuilder.where(SysAdminDynamicSqlSupport.id, isNotEqualTo("1"));
|
||||
// if(!admin.getId().equals("1")) {
|
||||
// where.and(SysAdminDynamicSqlSupport.company_id, isEqualToWhenPresent(endOrg.getId()));
|
||||
// }
|
||||
// where.and(SysAdminDynamicSqlSupport.islock, isEqualToWhenPresent(parame.islock));
|
||||
// where.and(SysAdminDynamicSqlSupport.username, isEqualTo(parame.username).filter(StringUtils::isNoneBlank));
|
||||
// where.and(SysAdminDynamicSqlSupport.gender, isEqualToWhenPresent(parame.gender));
|
||||
// where.and(SysAdminDynamicSqlSupport.job, isLike(parame.getJob()).filter(StringUtils::isNoneBlank).map(s -> "%" + s + "%"));
|
||||
// where.and(SysAdminDynamicSqlSupport.realname, isLike(parame.getRealname()).filter(StringUtils::isNoneBlank).map(s -> "%" + s + "%"));
|
||||
// where.and(SysAdminDynamicSqlSupport.phone, isEqualTo(parame.getPhone()).filter(StringUtils::isNoneBlank));
|
||||
// where.and(SysAdminDynamicSqlSupport.type, isEqualToWhenPresent(parame.type));
|
||||
// where.and(SysAdminDynamicSqlSupport.org_id, isEqualToWhenPresent(parame.getOrg_id()).filter(StringUtils::isNoneBlank));
|
||||
// if(CollectionUtils.isNotEmpty(parame.getRolesId())){
|
||||
// where.and(SysAdminRoleDynamicSqlSupport.roleid, isInWhenPresent(parame.getRolesId()));
|
||||
// }
|
||||
//
|
||||
// WhereApplier applier = where.toWhereApplier();
|
||||
//
|
||||
// SelectStatementProvider provider = function.apply(select(basic))
|
||||
// .applyWhere(applier)
|
||||
// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
// .groupBy(SysAdminDynamicSqlSupport.id)
|
||||
// .orderBy(FilesApplyDynamicSqlSupport.id.descending())
|
||||
// .limit(p.getPageSize())
|
||||
// .offset(p.limitStart())
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
//
|
||||
//
|
||||
// SelectStatementProvider count = select(count())
|
||||
// .from(function.apply(select(basic))
|
||||
// .applyWhere(applier)
|
||||
// .groupBy(SysAdminDynamicSqlSupport.id)
|
||||
// .orderBy(FilesApplyDynamicSqlSupport.id.descending()),
|
||||
// "t1")
|
||||
// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
//// .groupBy(SysAdminDynamicSqlSupport.id)
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
//
|
||||
//
|
||||
// var list = selectMapper.selectMany(provider);
|
||||
// long total = selectMapper.count(count);
|
||||
// p.setList(list);
|
||||
// p.setTotal(total);
|
||||
// return R.SUCCESS(p);
|
||||
// }
|
||||
//
|
||||
// @Transactional
|
||||
// @Operation(summary = "管理员添加", description = "")
|
||||
// @PostMapping("/add")
|
||||
// public Object add(@RequestBody(required = true) SysAdminAddVo parame) {
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
// if(admin.getId().equals("1")) {
|
||||
// if(parame.getType()!=1) { //是否是企业管理员
|
||||
// return R.FALSE("超级管理员只能添加企业管理员账号");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(!admin.getId().equals("1")) {
|
||||
// if(parame.getType()!=0) { //是否是企业管理员
|
||||
// return R.FALSE("企业管理员只能创建普通用户");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<SysOrg> orgs = orgService.allFarter(parame.getOrg_id());
|
||||
// SysOrg endOrg = orgs.getLast();
|
||||
// //用户名系统生成
|
||||
// parame.setUsername(generateUsername());
|
||||
//
|
||||
// if(StringUtils.isEmpty(parame.getUsername())) {
|
||||
// return R.FALSE("用户名不能为空");
|
||||
// }
|
||||
//
|
||||
// parame.setId(IDHelp.getInstance().nextId());
|
||||
// String password = parame.getPassword();
|
||||
//
|
||||
//
|
||||
// if(StringUtils.isEmpty(password)) {
|
||||
// password = "123456pwd";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //该公司是否存在企业管理员的账号
|
||||
// if(parame.getType()==1) {
|
||||
// List<SysAdmin> has =
|
||||
// sysAdminMapper.select(s->s.where(SysAdminDynamicSqlSupport.company_id, isEqualTo(endOrg.getId()))
|
||||
// .and(SysAdminDynamicSqlSupport.type, isEqualTo(1))
|
||||
// );
|
||||
// if(has.size()>0) {
|
||||
// return R.FALSE("已经存在企业管理员:" + has.getFirst().getUsername());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// String passwordEncode = DigestUtils.sha3_256Hex(password);
|
||||
// parame.setPassword(passwordEncode);
|
||||
// parame.setCompany_id(endOrg.getId());
|
||||
//
|
||||
//
|
||||
// sysAdminMapper.insertSelective(parame);
|
||||
// if(parame.role_ids.isEmpty()) {
|
||||
// return R.FALSE("角色不能为空");
|
||||
// }
|
||||
//
|
||||
// List<SysAdminRole> roles = new ArrayList<SysAdminRole>();
|
||||
// parame.role_ids.forEach(roleid->{
|
||||
// SysAdminRole bean = new SysAdminRole();
|
||||
// bean.setId(IDHelp.getInstance().nextId());
|
||||
// bean.setAdminid(parame.getId());
|
||||
// bean.setRoleid(roleid);
|
||||
// roles.add(bean);
|
||||
// });
|
||||
//
|
||||
// sysAdminRoleMapper.insertMultiple(roles);
|
||||
//
|
||||
// /**
|
||||
// * 创建用户的时候不生成weid,在用户成功申请完个人证书后再添加
|
||||
// */
|
||||
//// CreateResult cr = nBWeidService.createWeId().getResult();
|
||||
//// SysAdminWeid adwid = new SysAdminWeid();
|
||||
//// adwid.setId(IDHelp.getInstance().nextId());
|
||||
//// adwid.setAdmin_id(parame.getId());
|
||||
//// adwid.setWid(cr.getWeIdDocument().getId());
|
||||
//// adwid.setWprivate_key(cr.getPrivateKeyHexStr());
|
||||
//// sysAdminWeidMapper.insertSelective(adwid);
|
||||
//
|
||||
// return R.SUCCESS(parame);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Transactional
|
||||
// @Operation(summary = "管理员更新", description = "")
|
||||
// @PostMapping("/update")
|
||||
// public Object update(@RequestBody(required = true) SysAdminAddVo parame) {
|
||||
// if(StringUtils.isEmpty(parame.getUsername())) {
|
||||
// return R.FALSE("用户名不能为空");
|
||||
// }
|
||||
// String password = parame.getPassword();
|
||||
// if(StringUtils.isNoneBlank(password)) {
|
||||
// String passwordEncode = DigestUtils.sha3_256Hex(password);
|
||||
// parame.setPassword(passwordEncode);
|
||||
// }
|
||||
// if(parame.getId() == null) {
|
||||
// return R.FALSE("id不能为空");
|
||||
// }
|
||||
// if(parame.getId().equals("1")) {
|
||||
// return R.FALSE("超级管理不能修改");
|
||||
// }
|
||||
// if(parame.role_ids.isEmpty()) {
|
||||
// return R.FALSE("角色不能为空");
|
||||
// }
|
||||
//
|
||||
// sysAdminMapper.updateByPrimaryKeySelective(parame);
|
||||
// sysAdminRoleMapper.delete(d->d.where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(parame.getId())));
|
||||
//
|
||||
// List<SysAdminRole> roles = new ArrayList<SysAdminRole>();
|
||||
// parame.role_ids.forEach(roleid->{
|
||||
// SysAdminRole bean = new SysAdminRole();
|
||||
// bean.setId(IDHelp.getInstance().nextId());
|
||||
// bean.setAdminid(parame.getId());
|
||||
// bean.setRoleid(roleid);
|
||||
// roles.add(bean);
|
||||
// });
|
||||
//
|
||||
// sysAdminRoleMapper.insertMultiple(roles);
|
||||
// return R.SUCCESS(parame);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Transactional
|
||||
// @Operation(summary = "按管理员ID删除")
|
||||
// @PostMapping("/delete")
|
||||
// public Object delete(@Validated @RequestBody Id parame) {
|
||||
// String id = parame.getId();
|
||||
// if(id !=null && !id.equals("1")) {
|
||||
// sysAdminMapper.deleteByPrimaryKey(id);
|
||||
// sysAdminRoleMapper.delete(d->d.where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(id)));
|
||||
// }
|
||||
// if(id.equals("1")) {
|
||||
// return R.FALSE("超级管理员不能删除");
|
||||
// }
|
||||
// return R.SUCCESS("delete: "+id);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "按管理员ID获取", description = "")
|
||||
// @PostMapping("/get")
|
||||
// public Object get(@Validated @RequestBody Id id) {
|
||||
// Optional<SysAdmin> op = sysAdminMapper.selectByPrimaryKey(id.getId());
|
||||
// if(op.isPresent()) {
|
||||
// SysAdmin admin = op.get();
|
||||
// admin.setPassword(null);
|
||||
//
|
||||
// SysOrg org = sysOrgMapper.selectByPrimaryKey(admin.getOrg_id()).orElse(null);
|
||||
//
|
||||
// List<SysRole> roles =
|
||||
// sysRoleMapper.select(s->s.where(SysRoleDynamicSqlSupport.id, isIn(
|
||||
// select(SysAdminRoleDynamicSqlSupport.roleid)
|
||||
// .from(SysAdminRoleDynamicSqlSupport.sysAdminRole)
|
||||
// .where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(admin.getId()))
|
||||
// )));
|
||||
//
|
||||
//// CertificateDetail cert = certificateDetailMapper.selectOne(s->s
|
||||
//// .where(CertificateDetailDynamicSqlSupport.id, isEqualTo(
|
||||
//// select(CertificateApplyDynamicSqlSupport.cer_id)
|
||||
//// .from(CertificateApplyDynamicSqlSupport.certificateApply)
|
||||
//// .where(CertificateApplyDynamicSqlSupport.user_id, isEqualTo(admin.getId()))
|
||||
//// .and(CertificateApplyDynamicSqlSupport.is_org, isEqualTo(0))
|
||||
//// .orderBy(CertificateApplyDynamicSqlSupport.id.descending())
|
||||
//// .limit(1)
|
||||
//// ))
|
||||
//// ).orElse(null);
|
||||
//
|
||||
// HashMap<String,Object> h = new HashMap<String,Object>();
|
||||
// h.put("admin", admin);
|
||||
// h.put("org", org);
|
||||
// h.put("roles", roles);
|
||||
//// h.put("cert", cert);
|
||||
// return R.SUCCESS(h);
|
||||
// }
|
||||
// return R.SUCCESS("can no find");
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "更新管理员状态", description = "")
|
||||
// @PostMapping("/updateIsLock")
|
||||
// public Object updateIsLock(@Validated @RequestBody SysAdminLock param){
|
||||
// SysAdmin sysAdmin = new SysAdmin();
|
||||
// sysAdmin.setId(param.getId());
|
||||
// sysAdmin.setIslock(param.getIsLock());
|
||||
// int i = sysAdminMapper.updateByPrimaryKeySelective(sysAdmin);
|
||||
// return R.SUCCESS(i);
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "更新管理员角色", description = "")
|
||||
// @PostMapping("/updateRoles")
|
||||
// @Transactional
|
||||
// public Object updateRoles(@RequestBody SysAdminAddVo param){
|
||||
// List<String> role_ids = param.role_ids;
|
||||
// if (CollectionUtils.isEmpty(role_ids)) {
|
||||
// return R.FALSE("角色不能为空");
|
||||
// }
|
||||
// List<SysAdminRole> roles = new ArrayList<SysAdminRole>();
|
||||
// sysAdminRoleMapper.delete(d -> d.where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(param.getId())));
|
||||
// role_ids.forEach(roleid->{
|
||||
// SysAdminRole bean = new SysAdminRole();
|
||||
// bean.setId(IDHelp.getInstance().nextId());
|
||||
// bean.setAdminid(param.getId());
|
||||
// bean.setRoleid(roleid);
|
||||
// roles.add(bean);
|
||||
// });
|
||||
// sysAdminRoleMapper.insertMultiple(roles);
|
||||
// return R.SUCCESS("success");
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "重置管理员密码", description = "")
|
||||
// @PostMapping("/resetPwd")
|
||||
// public Object resetPwd(@Validated @RequestBody IdsAndPwd params){
|
||||
// String pwd = params.getPassword();
|
||||
// if (!StringUtils.isEmpty(params.getPassword())){
|
||||
// pwd = DigestUtils.sha3_256Hex("123456pwd");
|
||||
// }else {
|
||||
// return R.FALSE("密码不能为空");
|
||||
// }
|
||||
// String finalPwd = pwd;
|
||||
// int update = sysAdminMapper.update(c -> c.set(SysAdminDynamicSqlSupport.password).equalTo(finalPwd)
|
||||
// .where(SysAdminDynamicSqlSupport.id, isInWhenPresent(params.getIds())));
|
||||
// return R.SUCCESS(update);
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "修改管理员密码", description = "")
|
||||
// @PostMapping("/updatePwd")
|
||||
// public Object updatePwd(@Validated @RequestBody IdsAndPwdUpdate params,
|
||||
// HttpServletRequest request, HttpServletResponse response){
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
// String captchaSha = DigestUtils.sha3_256Hex(params.captcha);
|
||||
// String oldPasswordEncode = DigestUtils.sha3_256Hex(params.password);
|
||||
//
|
||||
// SysAdmin bean =
|
||||
// sysAdminMapper.selectOne(s->s.where(SysAdminRoleDynamicSqlSupport.id, isEqualTo(admin.getId()))).orElse(null);
|
||||
// if(!bean.getPassword().equals(oldPasswordEncode)) {
|
||||
// return R.FALSE("旧密码不正确");
|
||||
// }
|
||||
// if(oldPasswordEncode.equals(DigestUtils.sha3_256Hex(params.newpassword))) {
|
||||
// return R.FALSE("旧密码不能和新密码相同");
|
||||
// }
|
||||
//
|
||||
// String captchaShaCookie = CookieUtil.fine(request, "captcha");
|
||||
// if(!captchaSha.equals(captchaShaCookie)) {
|
||||
// return R.FALSE("验证码错误");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// String pwd = DigestUtils.sha3_256Hex(params.newpassword);
|
||||
//
|
||||
// int update = sysAdminMapper.update(c -> c.set(SysAdminDynamicSqlSupport.password).equalTo(pwd)
|
||||
// .where(SysAdminDynamicSqlSupport.id, isEqualTo(admin.getId())));
|
||||
//
|
||||
// CookieUtil.delete(response, "captcha");
|
||||
//
|
||||
// return R.SUCCESS(update);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 生成用户名
|
||||
// * @return
|
||||
// */
|
||||
// private String generateUsername(){
|
||||
// Random random = new Random();
|
||||
// //长度8位,不已0开头
|
||||
// int number;
|
||||
// do {
|
||||
// number = 10000000 + random.nextInt(90000000); // 生成100000到999999之间的随机数
|
||||
// // 将生成的随机数转换为字符串,确保不以0开头
|
||||
// } while (number % 10 == 0 && number != 0);
|
||||
// String username = String.valueOf(number);
|
||||
// //判断用户名是否已存在
|
||||
// long count = sysAdminMapper.count(c -> c.applyWhere(whereFinisher -> whereFinisher.and(SysAdminDynamicSqlSupport.username, isEqualTo(username))));
|
||||
// if(count > 0){
|
||||
// return generateUsername();
|
||||
// }else {
|
||||
// return username;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
//package jj.tech.paolu.biz.webadmin.controller;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isIn;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.select;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Optional;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.validation.annotation.Validated;
|
||||
//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 io.swagger.v3.oas.annotations.Operation;
|
||||
//import jj.tech.paolu.biz.webadmin.dao.TreeMapper;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.Id;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.Ids;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.MenuTree;
|
||||
//import jj.tech.paolu.config.security.user.WebAdminUtil;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysAdminRoleMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysMenuMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysRoleMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysAdminRoleDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysMenuDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysRoleMenuDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysRoleUrlDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysAdmin;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysMenu;
|
||||
//import jj.tech.paolu.utils.IDHelp;
|
||||
//import jj.tech.paolu.utils.R;
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping(value = "/op/menu", name = "菜单管理")
|
||||
//public class MenuManagerController {
|
||||
// @Autowired SysMenuMapper sysMenuMapper;
|
||||
// @Autowired SysRoleMapper sysRoleMapper;
|
||||
// @Autowired SysAdminRoleMapper sysAdminRoleMapper;
|
||||
//
|
||||
// @Autowired TreeMapper treeMapper;
|
||||
//
|
||||
// private final IDHelp ID_HELP = IDHelp.getInstance();
|
||||
//
|
||||
// @Operation(summary = "所有一级和二级菜单", description = "")
|
||||
// @PostMapping("/all")
|
||||
// public Object all() {
|
||||
//
|
||||
// var from = select(SysMenuMapper.selectList)
|
||||
// .from(SysMenuDynamicSqlSupport.sysMenu)
|
||||
//// .where()
|
||||
//// .and(SysMenuDynamicSqlSupport.types, isEqualTo(2))
|
||||
//// .and(SysMenuDynamicSqlSupport.level, isEqualTo(2), or(SysMenuDynamicSqlSupport.level, isEqualTo(3)))
|
||||
//// .and(SysMenuDynamicSqlSupport.name, isNotNull())
|
||||
// .orderBy(SysMenuDynamicSqlSupport.id,SysMenuDynamicSqlSupport.sort);
|
||||
//
|
||||
//
|
||||
// SelectStatementProvider provider = from
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// List<MenuTree> list = treeMapper.selectManyMenu(provider);
|
||||
//
|
||||
// Map<String, List<MenuTree>> map = list.stream().collect(Collectors.groupingBy(MenuTree::getParent_id));
|
||||
// list.stream().forEach(i->{
|
||||
// i.setChildren(map.get(i.getId()));
|
||||
// });
|
||||
//
|
||||
// return R.SUCCESS(map.get("0"));
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "获取管理员对应的菜单", description = "")
|
||||
// @PostMapping("/list")
|
||||
// public Object admin() {
|
||||
//
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
//
|
||||
// if(admin == null) {
|
||||
// return R.FALSE("admin can not find");
|
||||
// }
|
||||
//
|
||||
// if(admin.getId().equals("1")) {
|
||||
// return this.all();
|
||||
// }
|
||||
//
|
||||
// var adminrole = select(SysAdminRoleDynamicSqlSupport.roleid)
|
||||
// .from(SysAdminRoleDynamicSqlSupport.sysAdminRole)
|
||||
// .where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(admin.getId()));
|
||||
//
|
||||
// var roleurl = select(SysMenuDynamicSqlSupport.url)
|
||||
// .from(SysRoleUrlDynamicSqlSupport.sysRoleUrl)
|
||||
// .where(SysRoleUrlDynamicSqlSupport.roleid, isIn(adminrole));
|
||||
//
|
||||
// var sysurl = select(SysMenuMapper.selectList)
|
||||
// .from(SysMenuDynamicSqlSupport.sysMenu)
|
||||
// .where(SysMenuDynamicSqlSupport.url, isIn(roleurl))
|
||||
// .orderBy(SysMenuDynamicSqlSupport.url)
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// List<MenuTree> list = treeMapper.selectManyMenu(sysurl);
|
||||
//
|
||||
// Map<String, List<MenuTree>> map = list.stream().collect(Collectors.groupingBy(MenuTree::getParent_id));
|
||||
// list.stream().forEach(i->{
|
||||
// i.setChildren(map.get(i.getId()));
|
||||
// });
|
||||
//
|
||||
// return R.SUCCESS(map.get("0"));
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "获取当前用户对应的菜单", description = "")
|
||||
// @PostMapping("/menuLit")
|
||||
// public Object menuLit() {
|
||||
//
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
//
|
||||
// if(admin == null) {
|
||||
// return R.FALSE("admin can not find");
|
||||
// }
|
||||
//
|
||||
// if(admin.getId().equals("1")) {
|
||||
// return this.all();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// var adminrole = select(SysAdminRoleDynamicSqlSupport.roleid)
|
||||
// .from(SysAdminRoleDynamicSqlSupport.sysAdminRole)
|
||||
// .where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(admin.getId()));
|
||||
//
|
||||
// var rolemenu = select(SysRoleMenuDynamicSqlSupport.menuid)
|
||||
// .from(SysRoleMenuDynamicSqlSupport.sysRoleMenu)
|
||||
// .where(SysRoleMenuDynamicSqlSupport.roleid, isIn(adminrole));
|
||||
//
|
||||
// var sysmenu = select(SysMenuMapper.selectList)
|
||||
// .from(SysMenuDynamicSqlSupport.sysMenu)
|
||||
// .where(SysMenuDynamicSqlSupport.id, isIn(rolemenu))
|
||||
// .orderBy(SysMenuDynamicSqlSupport.sort)
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// List<MenuTree> list = treeMapper.selectManyMenu(sysmenu);
|
||||
//
|
||||
// Map<String, List<MenuTree>> map = list.stream().collect(Collectors.groupingBy(MenuTree::getParent_id));
|
||||
// list.stream().forEach(i->{
|
||||
// i.setChildren(map.get(i.getId()));
|
||||
// });
|
||||
//
|
||||
// return R.SUCCESS(map.get("0"));
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "根据菜单id查询", description = "")
|
||||
// @PostMapping("/get")
|
||||
// public Object get(@Validated @RequestBody Id param){
|
||||
// Optional<SysMenu> sysMenu = sysMenuMapper.selectByPrimaryKey(param.getId());
|
||||
// return sysMenu.map(R::SUCCESS).orElse(R.FALSE("can no find"));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "新增菜单", description = "")
|
||||
// @PostMapping("/save")
|
||||
// public Object save(@RequestBody SysMenu param){
|
||||
// if (param.getId() == null){
|
||||
// String id = ID_HELP.nextId();
|
||||
// param.setId(id);
|
||||
// sysMenuMapper.insertSelective(param);
|
||||
// }else {
|
||||
// sysMenuMapper.updateByPrimaryKeySelective(param);
|
||||
// }
|
||||
// return R.SUCCESS(param);
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "按ID删除", description = "批量删除")
|
||||
// @PostMapping("/delete")
|
||||
// public Object delete(@Validated @RequestBody Ids param) {
|
||||
// List<String> ids = param.getIds();
|
||||
// sysMenuMapper.delete(c -> c.where(SysMenuDynamicSqlSupport.id, isIn(ids)));
|
||||
// return R.SUCCESS("delete: " + ids);
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,319 @@
|
|||
//package jj.tech.paolu.biz.webadmin.controller;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.equalTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isEqualToWhenPresent;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isLikeWhenPresent;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isNotEqualTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.select;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Optional;
|
||||
//
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
//import org.mybatis.dynamic.sql.where.WhereApplier;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.springframework.validation.annotation.Validated;
|
||||
//import org.springframework.web.bind.annotation.PathVariable;
|
||||
//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 io.swagger.v3.oas.annotations.Operation;
|
||||
//import jj.tech.paolu.biz.webadmin.service.OrgService;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.AddAdminRoleMenuVo;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.Id;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.SysAdminRoleVo;
|
||||
//import jj.tech.paolu.biz.webadmin.vo.SysRoleListVo;
|
||||
//import jj.tech.paolu.config.security.user.WebAdminUtil;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysAdminMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysAdminRoleMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysMenuMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysRoleMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysRoleMenuMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysAdminRoleDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysMenuDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysRoleDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysRoleMenuDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysAdmin;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysAdminRole;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysMenu;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysOrg;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysRole;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysRoleMenu;
|
||||
//import jj.tech.paolu.utils.IDHelp;
|
||||
//import jj.tech.paolu.utils.Page;
|
||||
//import jj.tech.paolu.utils.R;
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping(value = "/op/role")
|
||||
//public class RoleManagerController {
|
||||
//
|
||||
// @Autowired SysAdminRoleMapper sysAdminRoleMapper;
|
||||
// @Autowired SysAdminMapper sysAdminMapper;
|
||||
// @Autowired SysRoleMapper sysRoleMapper;
|
||||
// @Autowired SysRoleMenuMapper sysRoleMenuMapper;
|
||||
// @Autowired SysMenuMapper sysMenuMapper;
|
||||
// @Autowired OrgService orgService;
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "用户所属机构下的角色列表", description = "")
|
||||
// @PostMapping("/list")
|
||||
// public Object list(@RequestBody SysRoleListVo parame) {
|
||||
//
|
||||
// Page p = new Page(parame.pageNum, parame.pageSize);
|
||||
//
|
||||
// if (StringUtils.isNotBlank(parame.rolename)) {
|
||||
// parame.rolename = "%" + parame.rolename + "%";
|
||||
// }
|
||||
// if (StringUtils.isNotBlank(parame.describe)) {
|
||||
// parame.describe = "%" + parame.describe + "%";
|
||||
// }
|
||||
//
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
// List<SysOrg> orgs = orgService.allFarter(admin.getOrg_id());
|
||||
// SysOrg endOrg = orgs.getLast();
|
||||
//
|
||||
//
|
||||
//
|
||||
// var from = select(SysRoleMapper.selectList)
|
||||
// .from(SysRoleDynamicSqlSupport.sysRole);
|
||||
//
|
||||
// var where = SqlBuilder.where(SysRoleDynamicSqlSupport.id, isNotEqualTo("1"));
|
||||
// if(!admin.getId().equals("1")) {
|
||||
// where.and(SysRoleDynamicSqlSupport.company_id, isEqualTo(endOrg.getId()));
|
||||
// }
|
||||
//
|
||||
// where.and(SysRoleDynamicSqlSupport.rolename, isLikeWhenPresent(parame.rolename));
|
||||
// where.and(SysRoleDynamicSqlSupport.describe, isLikeWhenPresent(parame.describe));
|
||||
// where.and(SysRoleDynamicSqlSupport.is_open, isEqualToWhenPresent(parame.is_open));
|
||||
//
|
||||
// WhereApplier applier = where.toWhereApplier();
|
||||
// SelectStatementProvider provider = from
|
||||
// .applyWhere(applier)
|
||||
// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
// .limit(p.getPageSize())
|
||||
// .offset(p.limitStart())
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// var list = sysRoleMapper.selectMany(provider);
|
||||
// long total = sysRoleMapper.count(c -> c
|
||||
// .applyWhere(applier)
|
||||
// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
// );
|
||||
// p.setList(list);
|
||||
// p.setTotal(total);
|
||||
// return R.SUCCESS(p);
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "获取管理员所在公司对应所有角色", description = "获取管理员所在公司对应所有角色")
|
||||
// @PostMapping("/all")
|
||||
// public Object all() {
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
// List<SysOrg> orgs = orgService.allFarter(admin.getOrg_id());
|
||||
// SysOrg endOrg = orgs.getLast();
|
||||
//
|
||||
// var from = select(SysRoleMapper.selectList)
|
||||
// .from(SysRoleDynamicSqlSupport.sysRole)
|
||||
// ;
|
||||
//
|
||||
// var where = SqlBuilder.where(SysRoleDynamicSqlSupport.is_open, isEqualTo(1));
|
||||
//
|
||||
// if(!admin.getId().equals("1")) {
|
||||
// where.and(SysRoleDynamicSqlSupport.company_id, isEqualTo(endOrg.getId()));
|
||||
// }
|
||||
//
|
||||
// WhereApplier applier = where.toWhereApplier();
|
||||
// SelectStatementProvider provider = from
|
||||
// .applyWhere(applier)
|
||||
// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// var list = sysRoleMapper.selectMany(provider);
|
||||
//
|
||||
// return R.SUCCESS(list);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "保存管理员对应的角色", description = "只需传角色roleId:[{'roleId': 0}] ")
|
||||
// @PostMapping("/addAdminRole")
|
||||
// @Transactional
|
||||
// public Object addAdminRole(@RequestBody SysAdminRoleVo params) {
|
||||
// String adminid = params.getAdminid();
|
||||
// if (adminid.equals("1")) {
|
||||
// return R.FALSE("超级管理员不能修改角色");
|
||||
// }
|
||||
//
|
||||
// Optional<SysAdmin> op = sysAdminMapper.selectByPrimaryKey(adminid);
|
||||
// if (!op.isPresent()) {
|
||||
// return R.FALSE("admin can not find");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// sysAdminRoleMapper.delete(d -> d.where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(adminid)));
|
||||
// List<SysAdminRole> roles = params.getSysAdminRoles();
|
||||
// roles.forEach(bean -> {
|
||||
// bean.setAdminid(adminid);
|
||||
// if (!bean.getRoleid().equals("1")) {
|
||||
// sysAdminRoleMapper.insertSelective(bean);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return R.SUCCESS(roles.size());
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// @Operation(summary = "获取管理员所在公司对应所有角色", description = "")
|
||||
//// @PostMapping("/getAdminRole")
|
||||
//// public Object getAdminRole(@Validated @RequestBody Id param) {
|
||||
//// String id = param.id;
|
||||
//// Optional<SysAdmin> op = sysAdminMapper.selectByPrimaryKey(id);
|
||||
//// if (!op.isPresent()) {
|
||||
//// return R.FALSE("admin can not find");
|
||||
//// }
|
||||
////
|
||||
//// var roleids = select(SysAdminRoleDynamicSqlSupport.roleid)
|
||||
//// .from(SysAdminRoleDynamicSqlSupport.sysAdminRole)
|
||||
//// .where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(id));
|
||||
////
|
||||
//// var from = select(SysRoleMapper.selectList)
|
||||
//// .from(SysRoleDynamicSqlSupport.sysRole)
|
||||
//// .where(SysRoleDynamicSqlSupport.id, SqlBuilder.isIn(roleids))
|
||||
//// .build()
|
||||
//// .render(RenderingStrategies.MYBATIS3);
|
||||
////
|
||||
//// List<SysRole> roles = sysRoleMapper.selectMany(from);
|
||||
////
|
||||
//// HashMap<String, Object> h = new HashMap<String, Object>();
|
||||
//// SysAdmin bean = op.get();
|
||||
//// bean.setPassword(null);
|
||||
////
|
||||
//// h.put("admin", bean);
|
||||
//// h.put("roles", roles);
|
||||
//// return R.SUCCESS(h);
|
||||
//// }
|
||||
//
|
||||
//
|
||||
//// @Operation(summary = "添加角色对应的菜单", description = "")
|
||||
//// @PostMapping("/addAdminRoleMenu")
|
||||
//// public Object addAdminRoleMenu(@Validated @RequestBody Ids param) {
|
||||
//// Long id = param.id;
|
||||
//// Optional<SysAdmin> op = sysAdminMapper.selectByPrimaryKey(id);
|
||||
//// if(!op.isPresent()) {
|
||||
//// return R.FALSE("admin can not find");
|
||||
//// }
|
||||
////
|
||||
//// var roleids = select(SysAdminRoleDynamicSqlSupport.roleid)
|
||||
//// .from(SysAdminRoleDynamicSqlSupport.sysAdminRole)
|
||||
//// .where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(id));
|
||||
////
|
||||
//// var from = select(SysRoleMapper.selectList)
|
||||
//// .from(SysRoleDynamicSqlSupport.sysRole)
|
||||
//// .where(SysRoleDynamicSqlSupport.id, SqlBuilder.isIn(roleids))
|
||||
//// .build()
|
||||
//// .render(RenderingStrategies.MYBATIS3);
|
||||
////
|
||||
//// List<SysRole> roles = sysRoleMapper.selectMany(from);
|
||||
////
|
||||
//// HashMap<String,Object> h = new HashMap<String,Object>();
|
||||
//// SysAdmin bean = op.get();
|
||||
//// bean.setPassword(null);
|
||||
////
|
||||
//// h.put("admin", bean);
|
||||
//// h.put("roles", roles);
|
||||
//// return R.SUCCESS(h);
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "添加角色对应的菜单", description = "")
|
||||
// @PostMapping("/addRoleMenu")
|
||||
// @Transactional
|
||||
// public Object addAdminRoleMenu(@Validated @RequestBody AddAdminRoleMenuVo param) {
|
||||
// //删除旧关系
|
||||
// int delete = sysRoleMenuMapper.delete(c -> c.applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SysRoleMenuDynamicSqlSupport.roleid, isEqualTo(param.getRole_id()))
|
||||
// ));
|
||||
//
|
||||
// //保存新关系
|
||||
// param.getMenu_ids().forEach(id -> {
|
||||
// SysRoleMenu srm = new SysRoleMenu();
|
||||
// srm.setId(IDHelp.getInstance().nextId());
|
||||
// srm.setRoleid(param.getRole_id());
|
||||
// srm.setMenuid(id);
|
||||
// sysRoleMenuMapper.insert(srm);
|
||||
// });
|
||||
//
|
||||
// return R.SUCCESS();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @PostMapping("delete")
|
||||
// public Object delete(@Validated @RequestBody List<String> ids) {
|
||||
// for(Integer i=0; i<ids.size(); i++) {
|
||||
// int fi=i;
|
||||
// List<SysAdminRole> list =
|
||||
// sysAdminRoleMapper.select(s->s.where(SysAdminRoleDynamicSqlSupport.roleid, isEqualTo(ids.get(fi))));
|
||||
// if(list.size()>0) {
|
||||
// return R.FALSE(ids.get(fi)+"角色下还有绑定用户,请先解除已绑定该角色用户后再进行删除");
|
||||
//
|
||||
// }else {
|
||||
// sysRoleMapper.deleteByPrimaryKey(ids.get(i));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return R.SUCCESS();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @PostMapping("save")
|
||||
// public Object save(@RequestBody SysRole record) {
|
||||
// SysAdmin admin = WebAdminUtil.getUser();
|
||||
// List<SysOrg> orgs = orgService.allFarter(admin.getOrg_id());
|
||||
// SysOrg endOrg = orgs.getLast();
|
||||
//
|
||||
// record.setId(IDHelp.getInstance().nextId());
|
||||
// if(endOrg==null) {
|
||||
// record.setCompany_id("0");
|
||||
// record.setCompany_name("");
|
||||
// }else {
|
||||
// record.setCompany_id(endOrg.getId());
|
||||
// record.setCompany_name(endOrg.getName());
|
||||
// }
|
||||
// return R.SUCCESS(sysRoleMapper.insertSelective(record));
|
||||
// }
|
||||
//
|
||||
// @PostMapping("update")
|
||||
// public Object update(@RequestBody SysRole record) {
|
||||
// return R.SUCCESS(sysRoleMapper.updateByPrimaryKeySelective(record));
|
||||
// }
|
||||
//
|
||||
// @PostMapping("findById/{id}")
|
||||
// public Object findById(@PathVariable("id") String id) {
|
||||
// return R.SUCCESS(sysRoleMapper.selectByPrimaryKey(id).orElse(null));
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "根据角色id查询对应的菜单权限", description = "")
|
||||
// @PostMapping("/findMenuById")
|
||||
// public Object findMenuById(@Validated @RequestBody Id param) {
|
||||
// SelectStatementProvider render = select(SysMenuMapper.selectList)
|
||||
// .from(SysMenuDynamicSqlSupport.sysMenu)
|
||||
// .leftJoin(SysRoleMenuDynamicSqlSupport.sysRoleMenu)
|
||||
// .on(SysMenuDynamicSqlSupport.id, equalTo(SysRoleMenuDynamicSqlSupport.menuid))
|
||||
// .leftJoin(SysRoleDynamicSqlSupport.sysRole)
|
||||
// .on(SysRoleMenuDynamicSqlSupport.roleid, equalTo(SysRoleDynamicSqlSupport.id))
|
||||
// .where(SysRoleDynamicSqlSupport.id, isEqualTo(param.getId()))
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// List<SysMenu> sysMenus = sysMenuMapper.selectMany(render);
|
||||
// return R.SUCCESS(sysMenus);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
//package jj.tech.paolu.biz.webadmin.controller;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.select;
|
||||
//
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import io.swagger.v3.oas.annotations.Operation;
|
||||
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysRoleSignMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysRoleSignDynamicSqlSupport;
|
||||
//import jj.tech.paolu.utils.R;
|
||||
//@RestController
|
||||
//@RequestMapping(value = "/op/roleSign")
|
||||
//@Tag(name = "RoleSignController", description = "角色标记")
|
||||
//public class RoleSignController {
|
||||
//
|
||||
// @Autowired SysRoleSignMapper sysRoleSignMapper;
|
||||
//
|
||||
//
|
||||
//// @Operation(summary = "角色列表", description = "")
|
||||
//// @PostMapping("/list")
|
||||
//// public Object list(@RequestBody SysRoleListVo parame) {
|
||||
////
|
||||
//// Page p = new Page(parame.pageNum, parame.pageSize);
|
||||
////
|
||||
//// if (StringUtils.isNotBlank(parame.rolename)) {
|
||||
//// parame.rolename = "%" + parame.rolename + "%";
|
||||
//// }
|
||||
//// if (StringUtils.isNotBlank(parame.describe)) {
|
||||
//// parame.describe = "%" + parame.describe + "%";
|
||||
//// }
|
||||
////
|
||||
//// var from = select(SysRoleMapper.selectList)
|
||||
//// .from(SysRoleDynamicSqlSupport.sysRole);
|
||||
////
|
||||
//// var where = SqlBuilder.where(SysRoleDynamicSqlSupport.id, isNotEqualTo(1L));
|
||||
////
|
||||
//// where.and(SysRoleDynamicSqlSupport.rolename, isLikeWhenPresent(parame.rolename));
|
||||
//// where.and(SysRoleDynamicSqlSupport.describe, isLikeWhenPresent(parame.describe));
|
||||
//// where.and(SysRoleDynamicSqlSupport.is_open, isEqualToWhenPresent(parame.is_open));
|
||||
////
|
||||
//// WhereApplier applier = where.toWhereApplier();
|
||||
//// SelectStatementProvider provider = from
|
||||
//// .applyWhere(applier)
|
||||
//// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
//// .limit(p.getPageSize())
|
||||
//// .offset(p.limitStart())
|
||||
//// .build()
|
||||
//// .render(RenderingStrategies.MYBATIS3);
|
||||
////
|
||||
//// var list = sysRoleMapper.selectMany(provider);
|
||||
//// long total = sysRoleMapper.count(c -> c
|
||||
//// .applyWhere(applier)
|
||||
//// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
//// );
|
||||
//// p.setList(list);
|
||||
//// p.setTotal(total);
|
||||
//// return R.SUCCESS(p);
|
||||
//// }
|
||||
//
|
||||
// @Operation(summary = "所有标记", description = "")
|
||||
// @PostMapping("/all")
|
||||
// public Object all() {
|
||||
//
|
||||
// var from = select(SysRoleSignMapper.selectList)
|
||||
// .from(SysRoleSignDynamicSqlSupport.sysRoleSign)
|
||||
// ;
|
||||
//
|
||||
// SelectStatementProvider provider = from
|
||||
// .configureStatement(config -> config.setNonRenderingWhereClauseAllowed(true))
|
||||
// .orderBy(SysRoleSignDynamicSqlSupport.id)
|
||||
// .limit(2000)
|
||||
// .build()
|
||||
// .render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// var list = sysRoleSignMapper.selectMany(provider);
|
||||
//
|
||||
// return R.SUCCESS(list);
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
//package jj.tech.paolu.biz.webadmin.controller;
|
||||
//
|
||||
//import jj.tech.paolu.biz.webadmin.dao.SelectMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysAreaMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysAreaDynamicSqlSupport;
|
||||
//import jj.tech.paolu.utils.R;
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.PathVariable;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.select;
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping(value = "/op/area", name = "组织机构管理")
|
||||
//public class SysAreasController {
|
||||
//
|
||||
// @Autowired
|
||||
// public SysAreaMapper sysAreaMapper;
|
||||
// @Autowired
|
||||
// public SelectMapper selectMapper;
|
||||
//
|
||||
// @PostMapping("findById/{id}")
|
||||
// public Object findById(@PathVariable("id") String id) {
|
||||
// return R.SUCCESS(sysAreaMapper.selectByPrimaryKey(id).orElse(null));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取省列表
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("findProvince")
|
||||
// public Object findProvince() {
|
||||
// short level_code = 1;
|
||||
// var sql = select(
|
||||
// SysAreaDynamicSqlSupport.name,
|
||||
// SysAreaDynamicSqlSupport.parent_code,
|
||||
// SysAreaDynamicSqlSupport.area_code
|
||||
// )
|
||||
// .from(SysAreaDynamicSqlSupport.sysArea)
|
||||
// .applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SysAreaDynamicSqlSupport.level_code, isEqualTo(level_code))
|
||||
// )
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// return R.SUCCESS(selectMapper.selectMany(sql));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取省下面的市
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("findCity/{area_code}")
|
||||
// public Object findCity(@PathVariable("area_code") String area_code) {
|
||||
// short level_code = 2;
|
||||
// var sql = select(
|
||||
// SysAreaDynamicSqlSupport.name,
|
||||
// SysAreaDynamicSqlSupport.parent_code,
|
||||
// SysAreaDynamicSqlSupport.area_code
|
||||
// )
|
||||
// .from(SysAreaDynamicSqlSupport.sysArea)
|
||||
// .applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SysAreaDynamicSqlSupport.level_code, isEqualTo(level_code))
|
||||
// .and(SysAreaDynamicSqlSupport.parent_code, isEqualTo(area_code))
|
||||
// )
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// return R.SUCCESS(selectMapper.selectMany(sql));
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
//package jj.tech.paolu.biz.webadmin.controller;
|
||||
//
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SysConfigMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SysConfigDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.SysConfig;
|
||||
//import jj.tech.paolu.utils.IDHelp;
|
||||
//import jj.tech.paolu.utils.R;
|
||||
//import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping(value = "/op/sysConfig",name = "系统配置字典表")
|
||||
//public class SysConfigController {
|
||||
//
|
||||
// @Autowired
|
||||
// public SysConfigMapper sysConfigMapper;
|
||||
//
|
||||
// /**
|
||||
// * 根据分组查找字典配置
|
||||
// * @param subgroup
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("findById/{subgroup}")
|
||||
// public Object findById(@PathVariable("subgroup") String subgroup) {
|
||||
// var sql = select(SysConfigMapper.selectList)
|
||||
// .from(SysConfigDynamicSqlSupport.sysConfig)
|
||||
// .applyWhere(whereFinisher -> whereFinisher.and(SysConfigDynamicSqlSupport.subgroup,isEqualTo(subgroup)))
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// return R.SUCCESS(sysConfigMapper.selectMany(sql));
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package jj.tech.paolu.biz.webadmin.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jj.tech.paolu.biz.webadmin.vo.LoginVo;
|
||||
import jj.tech.paolu.utils.R;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/op/ym",name = "云码图片识别接口")
|
||||
public class YMcodeController {
|
||||
|
||||
@Operation(summary = "管理员登录", description = "admin 000000")
|
||||
@PostMapping("/get")
|
||||
public Object login(@Validated @RequestBody LoginVo parame,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("code", "");
|
||||
return R.SUCCESS(map);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package jj.tech.paolu.biz.webadmin.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections4.map.CaseInsensitiveMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper;
|
||||
|
||||
import jj.tech.paolu.biz.webadmin.vo.Id;
|
||||
|
||||
@Mapper
|
||||
public interface SelectMapper extends CommonDeleteMapper, CommonUpdateMapper {
|
||||
|
||||
/**
|
||||
* 没有映射,直接返回表字段
|
||||
* @param selectStatement
|
||||
* @return
|
||||
*/
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
List<CaseInsensitiveMap<Object,Object>> selectMany (SelectStatementProvider selectStatement);
|
||||
|
||||
@SelectProvider(type = SqlProviderAdapter.class, method = "select")
|
||||
Long count(SelectStatementProvider selectStatement);
|
||||
|
||||
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
List<String> selectList (SelectStatementProvider selectStatement);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package jj.tech.paolu.biz.webadmin.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper;
|
||||
|
||||
import jj.tech.paolu.biz.webadmin.vo.MenuTree;
|
||||
import jj.tech.paolu.biz.webadmin.vo.OrgTree;
|
||||
@Mapper
|
||||
public interface TreeMapper extends CommonDeleteMapper, CommonUpdateMapper{
|
||||
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
List<MenuTree> selectManyMenu (SelectStatementProvider selectStatement);
|
||||
|
||||
@SelectProvider(type = SqlProviderAdapter.class, method = "select")
|
||||
Long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
List<OrgTree> selectManyOrg (SelectStatementProvider selectStatement);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package jj.tech.paolu.biz.webadmin.service;
|
||||
|
||||
import jj.tech.paolu.biz.webadmin.dao.TreeMapper;
|
||||
import jj.tech.paolu.biz.webadmin.vo.MenuTree;
|
||||
import jj.tech.paolu.repository.mybatis.dao.SysMenuMapper;
|
||||
import jj.tech.paolu.repository.mybatis.dao.support.SysAdminRoleDynamicSqlSupport;
|
||||
import jj.tech.paolu.repository.mybatis.dao.support.SysMenuDynamicSqlSupport;
|
||||
import jj.tech.paolu.repository.mybatis.dao.support.SysRoleMenuDynamicSqlSupport;
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysMenu;
|
||||
import jj.tech.paolu.utils.R;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
@Service
|
||||
public class MenuService {
|
||||
|
||||
@Autowired OrgService orgService;
|
||||
@Autowired TreeMapper treeMapper;
|
||||
@Autowired SuperSysAdminComponent superSysAdminComponent;
|
||||
/**
|
||||
* 查询某个用户具有权限的菜单列表
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SysMenu> getAllMenuByUserId(String userId){
|
||||
List<SysMenu> menuList = new ArrayList<>();
|
||||
if(userId.equals(superSysAdminComponent.id)) {//系统管理员拥有全部菜单权限
|
||||
var from = select(SysMenuMapper.selectList).from(SysMenuDynamicSqlSupport.sysMenu)
|
||||
.orderBy(SysMenuDynamicSqlSupport.id,SysMenuDynamicSqlSupport.sort);
|
||||
SelectStatementProvider provider = from.build().render(RenderingStrategies.MYBATIS3);
|
||||
List<MenuTree> list = treeMapper.selectManyMenu(provider);
|
||||
menuList.addAll(list);
|
||||
return menuList;
|
||||
}
|
||||
else{//其他用户,根据角色来查询
|
||||
var adminrole = select(SysAdminRoleDynamicSqlSupport.roleid)
|
||||
.from(SysAdminRoleDynamicSqlSupport.sysAdminRole)
|
||||
.where(SysAdminRoleDynamicSqlSupport.adminid, isEqualTo(userId));
|
||||
|
||||
var rolemenu = select(SysRoleMenuDynamicSqlSupport.menuid)
|
||||
.from(SysRoleMenuDynamicSqlSupport.sysRoleMenu)
|
||||
.where(SysRoleMenuDynamicSqlSupport.roleid, isIn(adminrole));
|
||||
|
||||
var sysmenu = select(SysMenuMapper.selectList)
|
||||
.from(SysMenuDynamicSqlSupport.sysMenu)
|
||||
.where(SysMenuDynamicSqlSupport.id, isIn(rolemenu))
|
||||
.orderBy(SysMenuDynamicSqlSupport.sort)
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
List<MenuTree> list = treeMapper.selectManyMenu(sysmenu);
|
||||
menuList.addAll(list);
|
||||
return menuList;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得“个人证书审核权限”的ID
|
||||
* @return
|
||||
*/
|
||||
public String getPersonCheckMenuId() {
|
||||
|
||||
return "226856895174934528";//现在的权限没有类似于COde一样的业务不变编码,只能用id来判断了。
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
package jj.tech.paolu.biz.webadmin.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jj.tech.paolu.config.enums.CertificateApplyCheckStatus;
|
||||
import jj.tech.paolu.config.enums.UserType;
|
||||
import jj.tech.paolu.repository.mybatis.dao.SysAdminMapper;
|
||||
import jj.tech.paolu.repository.mybatis.dao.support.CertificateApplyRecordDynamicSqlSupport;
|
||||
import jj.tech.paolu.repository.mybatis.dao.support.SysAdminDynamicSqlSupport;
|
||||
import jj.tech.paolu.repository.mybatis.dao.support.SysAdminRoleDynamicSqlSupport;
|
||||
import jj.tech.paolu.repository.mybatis.entity.CertificateApplyRecord;
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysAdmin;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.render.DefaultSelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.where.WhereApplier;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jj.tech.paolu.biz.webadmin.dao.TreeMapper;
|
||||
import jj.tech.paolu.biz.webadmin.vo.OrgTree;
|
||||
import jj.tech.paolu.repository.mybatis.dao.SysOrgMapper;
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysOrg;
|
||||
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
@Service
|
||||
public class OrgService {
|
||||
@Autowired SysOrgMapper sysOrgMapper;
|
||||
@Autowired TreeMapper treeMapper;
|
||||
|
||||
@Autowired
|
||||
SysAdminMapper sysAdminMapper;
|
||||
|
||||
|
||||
public SysAdmin getOrganizationAdmin(String orgId){
|
||||
SysAdmin bean =
|
||||
sysAdminMapper.selectOne(s->s
|
||||
.where(SysAdminDynamicSqlSupport.org_id, isEqualTo(orgId))
|
||||
.and(SysAdminDynamicSqlSupport.type, isEqualTo(UserType.ORG_ADMIN.getCode()))
|
||||
.limit(1)
|
||||
).orElse(null);
|
||||
return bean;
|
||||
|
||||
}
|
||||
|
||||
public SysOrg getCompanyOfUser(String userId){
|
||||
SysAdmin user = sysAdminMapper.selectByPrimaryKey(userId).get();
|
||||
if(user==null){
|
||||
throw new RuntimeException("根据userId:"+userId+"无法找到用户");
|
||||
}
|
||||
return getCompanyOfUser(user);
|
||||
}
|
||||
|
||||
public SysOrg getCompanyOfUser(SysAdmin user){
|
||||
return getCompany(user.getOrg_id());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某一个部门所属的公司
|
||||
* @param orgId
|
||||
* @return
|
||||
*/
|
||||
public SysOrg getCompany(String orgId){
|
||||
List<SysOrg> fathers = allFarter(orgId);
|
||||
if(fathers.size()>0){
|
||||
return fathers.getLast();
|
||||
}
|
||||
else{
|
||||
throw new RuntimeException("根据orgId:"+orgId+"找不到部门组织信息");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回org_id的所有父以上的节点,包括自身
|
||||
* @param org_id
|
||||
* @return
|
||||
*/
|
||||
public List<SysOrg> allFarter(String org_id) {
|
||||
String select_sql =
|
||||
"""
|
||||
WITH RECURSIVE temp_org AS
|
||||
(
|
||||
SELECT *
|
||||
FROM sys_org sun
|
||||
WHERE id = '%s'
|
||||
UNION
|
||||
SELECT p.* FROM temp_org
|
||||
INNER JOIN sys_org AS p
|
||||
ON temp_org.pid = p.id
|
||||
) SELECT * FROM temp_org
|
||||
""";
|
||||
String sql = String.format(select_sql, org_id);
|
||||
|
||||
SelectStatementProvider provider = DefaultSelectStatementProvider
|
||||
.withSelectStatement(sql)
|
||||
.build();
|
||||
|
||||
//所有父组织
|
||||
List<SysOrg> orgs = sysOrgMapper.selectMany(provider);
|
||||
return orgs;
|
||||
}
|
||||
|
||||
|
||||
public List<OrgTree> allFarterTree(String org_id) {
|
||||
String select_sql =
|
||||
"""
|
||||
WITH RECURSIVE temp_org AS
|
||||
(
|
||||
SELECT *
|
||||
FROM sys_org sun
|
||||
WHERE id = '%s'
|
||||
UNION
|
||||
SELECT p.* FROM temp_org
|
||||
INNER JOIN sys_org AS p
|
||||
ON temp_org.pid = p.id
|
||||
) SELECT * FROM temp_org
|
||||
""";
|
||||
String sql = String.format(select_sql, org_id);
|
||||
|
||||
SelectStatementProvider provider = DefaultSelectStatementProvider
|
||||
.withSelectStatement(sql)
|
||||
.build();
|
||||
|
||||
//所有父组织
|
||||
List<OrgTree> list = treeMapper.selectManyOrg(provider);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<SysOrg> allSon(String org_id) {
|
||||
String select_sql =
|
||||
"""
|
||||
WITH RECURSIVE temp_org AS
|
||||
(
|
||||
SELECT *
|
||||
FROM sys_org sun
|
||||
WHERE id = '%s'
|
||||
UNION
|
||||
SELECT p.* FROM temp_org
|
||||
INNER JOIN sys_org AS p
|
||||
ON temp_org.id = p.pid
|
||||
) SELECT * FROM temp_org
|
||||
""";
|
||||
String sql = String.format(select_sql, org_id);
|
||||
|
||||
SelectStatementProvider provider = DefaultSelectStatementProvider
|
||||
.withSelectStatement(sql)
|
||||
.build();
|
||||
|
||||
//所有父组织
|
||||
List<SysOrg> orgs = sysOrgMapper.selectMany(provider);
|
||||
return orgs;
|
||||
}
|
||||
|
||||
public List<OrgTree> allSonTree(String org_id) {
|
||||
String select_sql =
|
||||
"""
|
||||
WITH RECURSIVE temp_org AS
|
||||
(
|
||||
SELECT *
|
||||
FROM sys_org sun
|
||||
WHERE id = '%s'
|
||||
UNION
|
||||
SELECT p.* FROM temp_org
|
||||
INNER JOIN sys_org AS p
|
||||
ON temp_org.id = p.pid
|
||||
) SELECT * FROM temp_org
|
||||
""";
|
||||
String sql = String.format(select_sql, org_id);
|
||||
|
||||
SelectStatementProvider provider = DefaultSelectStatementProvider
|
||||
.withSelectStatement(sql)
|
||||
.build();
|
||||
|
||||
//所有父组织
|
||||
List<OrgTree> list = treeMapper.selectManyOrg(provider);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,793 @@
|
|||
//package jj.tech.paolu.biz.webadmin.service;
|
||||
//
|
||||
//import com.alibaba.fastjson2.JSON;
|
||||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
//import jj.tech.paolu.bcn.model.bo.*;
|
||||
//import jj.tech.paolu.bcn.service.ArchivesFileService;
|
||||
//import jj.tech.paolu.bcn.service.CatalogService;
|
||||
//import jj.tech.paolu.bcn.service.FileService;
|
||||
//import jj.tech.paolu.bcn.service.ProviderService;
|
||||
//import jj.tech.paolu.biz.webadmin.dao.SelectMapper;
|
||||
//import jj.tech.paolu.config.enums.SharedConfigStatus;
|
||||
//import jj.tech.paolu.config.enums.SharedStatus;
|
||||
//import jj.tech.paolu.config.enums.SynStatus;
|
||||
//import jj.tech.paolu.config.enums.SynType;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SharedSynAllMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SynDirectoryFileMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SynDirectoryMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.SynFileMapper;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SharedSynAllDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SynDirectoryDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SynDirectoryFileDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.dao.support.SynFileDynamicSqlSupport;
|
||||
//import jj.tech.paolu.repository.mybatis.entity.*;
|
||||
//import org.apache.commons.collections.CollectionUtils;
|
||||
//import org.apache.commons.lang3.ObjectUtils;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.fisco.bcos.sdk.model.TransactionReceipt;
|
||||
//import org.fisco.bcos.sdk.transaction.model.dto.CallResponse;
|
||||
//import org.fisco.bcos.sdk.transaction.model.dto.TransactionResponse;
|
||||
//import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
//import org.mybatis.dynamic.sql.select.render.DefaultSelectStatementProvider;
|
||||
//import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//
|
||||
//import javax.annotation.PostConstruct;
|
||||
//import javax.annotation.Resource;
|
||||
//import java.math.BigInteger;
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.time.ZoneOffset;
|
||||
//import java.time.format.DateTimeFormatter;
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
//import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
//
|
||||
///**
|
||||
// * 目录分享服务
|
||||
// */
|
||||
//@Service
|
||||
//public class SharedService {
|
||||
// private static final Logger logger = LoggerFactory.getLogger(SharedService.class);
|
||||
// /**
|
||||
// * 链上表前缀
|
||||
// */
|
||||
// public static String TABLE_PREFIX;
|
||||
//
|
||||
// @Value("${system.publicKeyAddress}")
|
||||
// private String publicKeyAddress;
|
||||
// @Resource
|
||||
// private ProviderService providerService;
|
||||
// @Resource
|
||||
// private SharedSynAllMapper sharedSynAllMapper;
|
||||
// @Resource
|
||||
// private SynDirectoryMapper synDirectoryMapper;
|
||||
// @Resource
|
||||
// private SelectMapper selectMapper;
|
||||
// @Resource
|
||||
// private SynDirectoryFileMapper synDirectoryFileMapper;
|
||||
// @Resource
|
||||
// private SynFileMapper synFileMapper;
|
||||
// @Resource
|
||||
// private CatalogService catalogService;
|
||||
// @Resource
|
||||
// private ArchivesFileService archivesFileService;
|
||||
// @Resource
|
||||
// private FileService fileService;
|
||||
// @Resource
|
||||
// private ObjectMapper objectMapper;
|
||||
//
|
||||
// @PostConstruct
|
||||
// public void init() {
|
||||
// //查找当前用户链上表前缀
|
||||
// CallResponse callResponse = null;
|
||||
// try {
|
||||
// callResponse = providerService.selectPrefixByAddr(new ProviderSelectPrefixByAddrInputBO(publicKeyAddress));
|
||||
// if (callResponse.getReturnObject() != null) {
|
||||
// TABLE_PREFIX = callResponse.getReturnObject().getFirst().toString();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 上链数据
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public Object share(String id) throws Exception {
|
||||
// Optional<SharedSynAll> sharedSynAllOptional = sharedSynAllMapper.selectByPrimaryKey(id);
|
||||
// if (sharedSynAllOptional.isEmpty()) {
|
||||
// return null;
|
||||
// }
|
||||
// SharedSynAll sharedSynAll = sharedSynAllOptional.get();
|
||||
// if (sharedSynAll.getSyn_status() != null && sharedSynAll.getSyn_status().equals(SynStatus.SYN.getCode())) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// //需要上链的目录数据列表
|
||||
// if (sharedSynAll.getSyn_type().equals(SynType.DIR.getCode())) {
|
||||
// if (sharedSynAll.getIs_config_rule().equals(SharedConfigStatus.DELETE.getCode())) {
|
||||
// //目录下的所有子元素都下链
|
||||
// downDirChildBcn(sharedSynAll.getSyn_id());
|
||||
// //下链
|
||||
// downDirBcn(sharedSynAll);
|
||||
// } else if (handleDir(sharedSynAll)) {
|
||||
// //上链
|
||||
// upDirBcn(sharedSynAll);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //需要上链的目录文件数据列表
|
||||
// if (sharedSynAll.getSyn_type().equals(SynType.DIRFILE.getCode())) {
|
||||
// if (sharedSynAll.getIs_config_rule().equals(SharedConfigStatus.DELETE.getCode())) {
|
||||
// //目录下的所有子元素都下链
|
||||
// downFileDirChildBcn(sharedSynAll.getSyn_id());
|
||||
// //下链
|
||||
// downFileDirBcn(sharedSynAll);
|
||||
// }
|
||||
// if (handleDirFile(sharedSynAll)) {
|
||||
// upFileDirBcn(sharedSynAll);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //需要上链的文件数据列表
|
||||
// if (sharedSynAll.getSyn_type().equals(SynType.FILE.getCode())) {
|
||||
// if (sharedSynAll.getIs_config_rule().equals(SharedConfigStatus.DELETE.getCode())) {
|
||||
// //目录下的所有子元素都下链
|
||||
// downFileChildBcn(sharedSynAll.getSyn_id());
|
||||
// //下链
|
||||
// downFileBcn(sharedSynAll);
|
||||
// }
|
||||
// if (handleFile(sharedSynAll)) {
|
||||
// upFileBcn(sharedSynAll);
|
||||
// }
|
||||
// }
|
||||
// sharedSynAll.setSyn_status(SynStatus.SYN.getCode());
|
||||
// return sharedSynAllMapper.updateByPrimaryKey(sharedSynAll);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 目录下的所有子元素都下链
|
||||
// *
|
||||
// * @param synId
|
||||
// */
|
||||
// private void downDirChildBcn(String synId) throws Exception {
|
||||
//
|
||||
// //所有子分类目录ids
|
||||
// ArrayList<String> dirIds = new ArrayList<>();
|
||||
// selectChildDirBcn(synId, dirIds);
|
||||
//
|
||||
// //所有子文件目录ids
|
||||
// ArrayList<String> fileDirIds = new ArrayList<>();
|
||||
// for (String dirId : dirIds) {
|
||||
// selectChildFileDirBcn(dirId, fileDirIds);
|
||||
// }
|
||||
//
|
||||
// //所有子文件ids
|
||||
// ArrayList<String> fileIds = new ArrayList<>();
|
||||
// for (String fileDirId : fileDirIds) {
|
||||
// selectChildFileBcn(fileDirId, fileIds);
|
||||
// }
|
||||
//
|
||||
// //下链顺序,先文件,文件目录,目录
|
||||
// FileRemoveInputBO bo = new FileRemoveInputBO();
|
||||
// bo.setFile_id(fileIds);
|
||||
// fileService.remove(bo);
|
||||
//
|
||||
// ArchivesFileRemoveInputBO abo = new ArchivesFileRemoveInputBO();
|
||||
// abo.setArchives_file_id(fileDirIds);
|
||||
// archivesFileService.remove(abo);
|
||||
//
|
||||
// for (String id : dirIds) {
|
||||
// CatalogRemoveInputBO cbo = new CatalogRemoveInputBO();
|
||||
// cbo.setCatalog_id(id);
|
||||
// catalogService.remove(cbo);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件目录下的所有子元素都下链
|
||||
// *
|
||||
// * @param synId
|
||||
// */
|
||||
// private void downFileDirChildBcn(String synId) throws Exception {
|
||||
//
|
||||
// //所有子文件目录ids
|
||||
// ArrayList<String> fileDirIds = new ArrayList<>();
|
||||
// selectChildFileDirBcn(synId.toString(), fileDirIds);
|
||||
//
|
||||
// //所有子文件ids
|
||||
// ArrayList<String> fileIds = new ArrayList<>();
|
||||
// for (String id : fileDirIds) {
|
||||
// selectChildFileBcn(id, fileIds);
|
||||
// }
|
||||
//
|
||||
// //下链顺序,先文件,文件目录,目录
|
||||
// FileRemoveInputBO bo = new FileRemoveInputBO();
|
||||
// bo.setFile_id(fileIds);
|
||||
// fileService.remove(bo);
|
||||
//
|
||||
// ArchivesFileRemoveInputBO abo = new ArchivesFileRemoveInputBO();
|
||||
// abo.setArchives_file_id(fileDirIds);
|
||||
// archivesFileService.remove(abo);
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件目录下的所有子元素都下链
|
||||
// *
|
||||
// * @param synId
|
||||
// */
|
||||
// private void downFileChildBcn(String synId) {
|
||||
// try {
|
||||
//
|
||||
// //所有子文件ids
|
||||
// ArrayList<String> fileIds = new ArrayList<>();
|
||||
// selectChildFileBcn(synId.toString(), fileIds);
|
||||
//
|
||||
// //下链顺序,先文件,文件目录,目录
|
||||
// FileRemoveInputBO bo = new FileRemoveInputBO();
|
||||
// bo.setFile_id(fileIds);
|
||||
// fileService.remove(bo);
|
||||
//
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// logger.error("目录下链失败!{}", e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 目录id在链上所有子目录id(不包括下下级)
|
||||
// */
|
||||
// private void selectChildDirBcn(String id, ArrayList<String> ids) throws Exception {
|
||||
// CatalogSelectByIdInputBO bo = new CatalogSelectByIdInputBO();
|
||||
// bo.setTable_prefix(TABLE_PREFIX);
|
||||
// bo.setId(id.toString());
|
||||
// CallResponse select = null;
|
||||
//
|
||||
// select = catalogService.selectById(bo);
|
||||
// ArrayList<ArrayList<ArrayList>> arrayList = objectMapper.readValue(select.getValues(), ArrayList.class);
|
||||
// for (ArrayList<ArrayList> list : arrayList) {
|
||||
// for (ArrayList l : list) {
|
||||
// ids.add(l.get(0).toString());
|
||||
// selectChildDirBcn(l.get(0).toString(), ids);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 目录id在链上所有文件目录id
|
||||
// *
|
||||
// * @param id 目录id
|
||||
// */
|
||||
// private void selectChildFileDirBcn(String id, ArrayList<String> ids) throws Exception {
|
||||
// ArchivesFileSelectByCatalogIdInputBO bo = new ArchivesFileSelectByCatalogIdInputBO();
|
||||
// bo.setTable_prefix(TABLE_PREFIX);
|
||||
// bo.setCatalog_id(id);
|
||||
// CallResponse select = null;
|
||||
//
|
||||
// select = archivesFileService.selectByCatalogId(bo);
|
||||
// ArrayList<ArrayList<ArrayList>> arrayList = objectMapper.readValue(select.getValues(), ArrayList.class);
|
||||
// arrayList.forEach(list -> {
|
||||
// list.forEach(l -> {
|
||||
// ids.add(l.get(0).toString());
|
||||
// });
|
||||
//
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件目录id在链上所有文件id
|
||||
// *
|
||||
// * @param id 文件目录id
|
||||
// */
|
||||
// private void selectChildFileBcn(String id, ArrayList<String> ids) throws Exception {
|
||||
// FileSelectByCatalogIdInputBO bo = new FileSelectByCatalogIdInputBO();
|
||||
// bo.setTable_prefix(TABLE_PREFIX);
|
||||
// bo.setArchive_file_id(id);
|
||||
// CallResponse select = null;
|
||||
// select = fileService.selectByCatalogId(bo);
|
||||
// ArrayList<ArrayList<ArrayList>> arrayList = objectMapper.readValue(select.getValues(), ArrayList.class);
|
||||
// arrayList.forEach(list -> {
|
||||
// list.forEach(l -> {
|
||||
// ids.add(l.get(0).toString());
|
||||
// });
|
||||
//
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 共享目录:解析出哪些可以上链
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public Boolean handleDir(SharedSynAll sharedSynAll) {
|
||||
// if (ObjectUtils.isEmpty(sharedSynAll)) {
|
||||
// return false;
|
||||
// }
|
||||
// //查询所有文件目录id的父类,包含自己本身
|
||||
// String select_sql =
|
||||
// """
|
||||
// WITH RECURSIVE temp_cet AS
|
||||
// (
|
||||
// SELECT *
|
||||
// FROM syn_directory sun
|
||||
// WHERE id IN (%s)
|
||||
// UNION
|
||||
// SELECT p.* FROM temp_cet
|
||||
// INNER JOIN syn_directory AS p
|
||||
// ON temp_cet.p_id = p.id
|
||||
// ) SELECT id FROM temp_cet
|
||||
// """;
|
||||
// String sql = String.format(select_sql, StringUtils.join(List.of("'"+sharedSynAll.getId()+"'"), ','));
|
||||
//
|
||||
// SelectStatementProvider provider = DefaultSelectStatementProvider
|
||||
// .withSelectStatement(sql)
|
||||
// .build();
|
||||
//
|
||||
// List<String> all_dir_ids = selectMapper.selectList(provider);
|
||||
// Boolean isShare = true;
|
||||
// for (String id : all_dir_ids) {
|
||||
// Optional<SharedSynAll> sharedSynAllOptional = sharedSynAllMapper.selectByPrimaryKey(id);
|
||||
// if (sharedSynAllOptional.isPresent()) {
|
||||
// SharedSynAll sharedSyn = sharedSynAllOptional.get();
|
||||
// //已配置(下级需要全选)
|
||||
// if (sharedSyn.getIs_config_rule().equals(SharedConfigStatus.ADDAll)) {
|
||||
// if (selectAllByDir(sharedSyn.getSyn_id()).equals(false)) {
|
||||
// isShare = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// //已禁用
|
||||
// if (sharedSyn.getIs_config_rule().equals(SharedConfigStatus.DELETE)) {
|
||||
// isShare = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return isShare;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 判断目录下级是否有全选
|
||||
// */
|
||||
// public Boolean selectAllByDir(String id) {
|
||||
// //获取全部下级目录
|
||||
// var sql = select(SynDirectoryMapper.selectList)
|
||||
// .from(SynDirectoryDynamicSqlSupport.synDirectory)
|
||||
// .applyWhere(whereFinisher -> whereFinisher.and(SynDirectoryDynamicSqlSupport.p_id, isEqualTo(id)))
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// List<SynDirectory> synDirectories = synDirectoryMapper.selectMany(sql);
|
||||
// //没有下级目录(出口)
|
||||
// if (CollectionUtils.isEmpty(synDirectories)) {
|
||||
// long count = sharedSynAllMapper.count(c -> c.applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SharedSynAllDynamicSqlSupport.syn_id, isEqualTo(id))
|
||||
// .and(SharedSynAllDynamicSqlSupport.syn_type, isEqualTo(SynType.DIR.getCode()))
|
||||
// .and(SharedSynAllDynamicSqlSupport.is_config_rule, isIn(SharedConfigStatus.DELETE.getCode(), SharedConfigStatus.NULL.getCode()))
|
||||
// ));
|
||||
// if (count > 0) {
|
||||
// return false;
|
||||
// }
|
||||
// //叶目录下判断文件目录下级是否全选
|
||||
// //获取全部文件目录ids
|
||||
// var fileDirSql = select(SynDirectoryFileDynamicSqlSupport.id)
|
||||
// .from(SynDirectoryFileDynamicSqlSupport.synDirectoryFile)
|
||||
// .applyWhere(whereFinisher -> whereFinisher.and(SynDirectoryFileDynamicSqlSupport.p_id, isEqualTo(id)))
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// List<SynDirectoryFile> synDirectoryFiles = synDirectoryFileMapper.selectMany(fileDirSql);
|
||||
// Boolean selectAll = true;
|
||||
// for (SynDirectoryFile synDirectoryFile : synDirectoryFiles) {
|
||||
// if (!selectAllByFileDir(synDirectoryFile.getId())) {
|
||||
// selectAll = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return selectAll;
|
||||
//
|
||||
// } else {
|
||||
// Boolean selectAll = true;
|
||||
// for (SynDirectory synDirectorie : synDirectories) {
|
||||
// if (!selectAllByDir(synDirectorie.getId())) {
|
||||
// selectAll = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return selectAll;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 判断文件目录下级是否有全选
|
||||
// */
|
||||
// public Boolean selectAllByFileDir(String id) {
|
||||
// //当前文件目录
|
||||
// var fileDirSql = select(SharedSynAllMapper.selectList)
|
||||
// .from(SharedSynAllDynamicSqlSupport.sharedSynAll)
|
||||
// .applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SharedSynAllDynamicSqlSupport.syn_type, isEqualTo(SynType.DIRFILE.getCode()))
|
||||
// .and(SharedSynAllDynamicSqlSupport.syn_id, isEqualTo(id))
|
||||
// .and(SharedSynAllDynamicSqlSupport.is_config_rule, isIn(SharedConfigStatus.ADDAll.getCode(), SharedConfigStatus.ADDPART.getCode()))
|
||||
// )
|
||||
// .limit(1)
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
//
|
||||
// Optional<SharedSynAll> sharedSynAllOptional = sharedSynAllMapper.selectOne(fileDirSql);
|
||||
// if (sharedSynAllOptional.isEmpty()) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// //查找目录下所有的文件id
|
||||
// var fileSql = select(SynFileDynamicSqlSupport.id)
|
||||
// .from(SynFileDynamicSqlSupport.synFile)
|
||||
// .applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SynFileDynamicSqlSupport.p_id, isEqualTo(id))
|
||||
// )
|
||||
// .build().render(RenderingStrategies.MYBATIS3);
|
||||
// List<String> ids = synFileMapper.selectMany(fileSql).stream().map(SynFile::getId).collect(Collectors.toList());
|
||||
// long count = sharedSynAllMapper.count(c -> c.applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SharedSynAllDynamicSqlSupport.is_config_rule, isIn(SharedConfigStatus.ADDAll.getCode(), SharedConfigStatus.ADDPART.getCode()))
|
||||
// .and(SharedSynAllDynamicSqlSupport.syn_type, isEqualTo(SynType.FILE.getCode()))
|
||||
// .and(SharedSynAllDynamicSqlSupport.syn_id, isIn(ids))
|
||||
// ));
|
||||
// return count == ids.size();
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 共享目录文件:解析出哪些可以上链
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public Boolean handleDirFile(SharedSynAll sharedSynAll) {
|
||||
// //禁止
|
||||
// if (sharedSynAll.getIs_config_rule().equals(SharedConfigStatus.DELETE.getCode())) {
|
||||
// return false;
|
||||
// }
|
||||
// //父级
|
||||
// Optional<SynDirectoryFile> synDirectoryFileOpt = synDirectoryFileMapper.selectByPrimaryKey(sharedSynAll.getSyn_id());
|
||||
// if (synDirectoryFileOpt.isEmpty()) {
|
||||
// return false;
|
||||
// }
|
||||
// SynDirectoryFile synDirectoryFile = synDirectoryFileOpt.get();
|
||||
//
|
||||
// SharedSynAll sharedSynAllBySynId = getSharedSynAllBySynId(synDirectoryFile.getP_id());
|
||||
// if (sharedSynAllBySynId != null) {
|
||||
// Boolean dirBool = handleDir(sharedSynAllBySynId);
|
||||
// if (dirBool.equals(false)) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //全选
|
||||
// if (sharedSynAll.getIs_config_rule().equals(SharedConfigStatus.ADDAll.getCode())) {
|
||||
// Boolean fileDirBool = selectAllByFileDir(sharedSynAll.getSyn_id());
|
||||
// return !fileDirBool.equals(false);
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 共享文件:解析出哪些可以上链
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public Boolean handleFile(SharedSynAll sharedSynAll) {
|
||||
// //禁止
|
||||
// if (sharedSynAll.getIs_config_rule().equals(SharedConfigStatus.DELETE.getCode())) {
|
||||
// return false;
|
||||
// }
|
||||
// //父级
|
||||
// Optional<SynFile> synFileOpt = synFileMapper.selectByPrimaryKey(sharedSynAll.getSyn_id());
|
||||
// if (synFileOpt.isEmpty()) {
|
||||
// return false;
|
||||
// }
|
||||
// SynFile synFile = synFileOpt.get();
|
||||
//
|
||||
// SharedSynAll sharedSynAllBySynId = getSharedSynAllBySynId(synFile.getP_id());
|
||||
// if (sharedSynAllBySynId != null) {
|
||||
// Boolean dirBool = handleDirFile(sharedSynAllBySynId);
|
||||
// return !dirBool.equals(false);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 根据syn_id获取sharedSynAll
|
||||
// */
|
||||
// public SharedSynAll getSharedSynAllBySynId(String synId) {
|
||||
// Optional<SharedSynAll> sharedSynAllOptional = sharedSynAllMapper.selectOne(c -> c.applyWhere(whereFinisher -> whereFinisher
|
||||
// .and(SharedSynAllDynamicSqlSupport.syn_id, isEqualTo(synId))));
|
||||
// if (sharedSynAllOptional.isPresent()) {
|
||||
// return sharedSynAllOptional.get();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public Object getTest(Long id) {
|
||||
//// try {
|
||||
//// ArrayList<String> ids = new ArrayList<>();
|
||||
//// selectChildFileBcn(id.toString(), ids);
|
||||
//// System.out.println(ids);
|
||||
//// } catch (Exception e) {
|
||||
//// throw new RuntimeException(e);
|
||||
//// }
|
||||
// return TABLE_PREFIX;
|
||||
// }
|
||||
//
|
||||
// public BigInteger getNowTime() {
|
||||
// return BigInteger.valueOf(LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 目录上链
|
||||
// */
|
||||
// public void upDirBcn(SharedSynAll sharedSynAll) {
|
||||
// Optional<SynDirectory> synDirectoryOpt = synDirectoryMapper.selectByPrimaryKey(sharedSynAll.getSyn_id());
|
||||
// if (synDirectoryOpt.isPresent()) {
|
||||
// SynDirectory synDirectory = synDirectoryOpt.get();
|
||||
// CatalogInsertInputBO bo = new CatalogInsertInputBO();
|
||||
// try {
|
||||
// bo.setCreate_time(getNowTime());
|
||||
// bo.setId(sharedSynAll.getSyn_id().toString());
|
||||
// bo.setUpdate_time(getNowTime());
|
||||
// bo.setParent_id(synDirectory.getP_id().toString());
|
||||
// bo.setOther_params(objectMapper.writeValueAsString(synDirectory));
|
||||
// TransactionResponse insert = catalogService.insert(bo);
|
||||
// List<Object> returnObject = insert.getReturnObject();
|
||||
// if (CollectionUtils.isEmpty(returnObject)) {
|
||||
// throw new RuntimeException();
|
||||
// }
|
||||
// TransactionReceipt transactionReceipt = insert.getTransactionReceipt();
|
||||
// sharedSynAll.setShared_status(SharedStatus.SUCESS.getCode());
|
||||
// sharedSynAll.setBlock_hash(transactionReceipt.getBlockHash());
|
||||
// sharedSynAll.setBlock_number(Integer.parseInt(transactionReceipt.getBlockNumber().substring(2), 16) + "");
|
||||
// sharedSynAll.setBlock_time(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// logger.error("目录上链失败!{}", e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 目录下链
|
||||
// */
|
||||
// public void downDirBcn(SharedSynAll sharedSynAll) {
|
||||
// Optional<SynDirectory> synDirectoryOpt = synDirectoryMapper.selectByPrimaryKey(sharedSynAll.getSyn_id());
|
||||
// if (synDirectoryOpt.isPresent()) {
|
||||
// CatalogRemoveInputBO bo = new CatalogRemoveInputBO();
|
||||
// try {
|
||||
// bo.setCatalog_id(sharedSynAll.getSyn_id().toString());
|
||||
// TransactionResponse remove = catalogService.remove(bo);
|
||||
// List<Object> returnObject = remove.getReturnObject();
|
||||
// if (CollectionUtils.isEmpty(returnObject)) {
|
||||
// throw new RuntimeException();
|
||||
// }
|
||||
// TransactionReceipt transactionReceipt = remove.getTransactionReceipt();
|
||||
// sharedSynAll.setShared_status(SharedStatus.INIT.getCode());
|
||||
// sharedSynAll.setBlock_hash(transactionReceipt.getBlockHash());
|
||||
// sharedSynAll.setBlock_number(Integer.parseInt(transactionReceipt.getBlockNumber().substring(2), 16) + "");
|
||||
// sharedSynAll.setBlock_time(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
// } catch (Exception e) {
|
||||
// logger.error("目录下链失败!{}", e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件目录上链
|
||||
// */
|
||||
// public void upFileDirBcn(SharedSynAll sharedSynAll) {
|
||||
// Optional<SynDirectoryFile> synDirectoryFileOpt = synDirectoryFileMapper.selectByPrimaryKey(sharedSynAll.getSyn_id());
|
||||
// if (synDirectoryFileOpt.isPresent()) {
|
||||
// SynDirectoryFile synDirectoryFile = synDirectoryFileOpt.get();
|
||||
// ArchivesFileInsertInputBO bo = new ArchivesFileInsertInputBO();
|
||||
// try {
|
||||
// bo.setId(sharedSynAll.getSyn_id().toString());
|
||||
// bo.setCatalog_id(synDirectoryFile.getP_id().toString());
|
||||
// //字符类型属性
|
||||
//// List<String> attStrNames = new ArrayList<>();
|
||||
//// List<String> attStrValues = new ArrayList<>();
|
||||
//// attStrNames.add("code");
|
||||
//// attStrValues.add(synDirectoryFile.getCode());
|
||||
//// attStrNames.add("name");
|
||||
//// attStrValues.add(synDirectoryFile.getName());
|
||||
//// attStrNames.add("author");
|
||||
//// attStrValues.add(synDirectoryFile.getAuthor());
|
||||
//// attStrNames.add("file_date");
|
||||
//// attStrValues.add(synDirectoryFile.getFile_date());
|
||||
//// attStrNames.add("archives_code");
|
||||
//// attStrValues.add(synDirectoryFile.getArchives_code());
|
||||
//// attStrNames.add("other_params");
|
||||
//// attStrValues.add("");
|
||||
//// attStrNames.add("url");
|
||||
//// attStrValues.add(synDirectoryFile.getUrl());
|
||||
////
|
||||
//// //int类型属性
|
||||
//// List<String> attIntNames = new ArrayList<>();
|
||||
//// List<BigInteger> attIntValues = new ArrayList<>();
|
||||
//// attIntNames.add("index");
|
||||
//// attIntValues.add(BigInteger.valueOf(Optional.ofNullable(synDirectoryFile.getSort()).orElse(0)));
|
||||
//// attIntNames.add("audit_status");
|
||||
//// attIntValues.add(BigInteger.valueOf(Optional.ofNullable(synDirectoryFile.getAudit_status()).orElse(0)));
|
||||
//// attIntNames.add("archives_index");
|
||||
//// attIntValues.add(BigInteger.valueOf(Optional.ofNullable(synDirectoryFile.getArchives_index()).orElse(0)));
|
||||
//// attIntNames.add("page_count");
|
||||
//// attIntValues.add(BigInteger.valueOf(Optional.ofNullable(synDirectoryFile.getPage_count()).orElse(0)));
|
||||
//// attIntNames.add("create_time");
|
||||
//// attIntValues.add(getNowTime());
|
||||
//// attIntNames.add("update_time");
|
||||
//// attIntValues.add(getNowTime());
|
||||
////
|
||||
//// bo.setStr_attr_name(attStrNames);
|
||||
//// bo.setStr_attr_value(attStrValues);
|
||||
//// bo.setInt_attr_name(attIntNames);
|
||||
//// bo.setInt_attr_value(attIntValues);
|
||||
////
|
||||
//// TransactionResponse insert = archivesFileService.insert(bo);
|
||||
//// List<Object> returnObject = insert.getReturnObject();
|
||||
//// if (CollectionUtils.isEmpty(returnObject)) {
|
||||
//// throw new RuntimeException();
|
||||
//// }
|
||||
//// TransactionReceipt transactionReceipt = insert.getTransactionReceipt();
|
||||
// sharedSynAll.setShared_status(SharedStatus.SUCESS.getCode());
|
||||
//// sharedSynAll.setBlock_hash(transactionReceipt.getBlockHash());
|
||||
//// sharedSynAll.setBlock_number(Integer.parseInt(transactionReceipt.getBlockNumber().substring(2), 16) + "");
|
||||
// sharedSynAll.setBlock_time(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
// } catch (Exception e) {
|
||||
// logger.error("文件目录上链失败!{}", e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件目录下链
|
||||
// */
|
||||
// public void downFileDirBcn(SharedSynAll sharedSynAll) {
|
||||
// Optional<SynDirectoryFile> synDirectoryFileOpt = synDirectoryFileMapper.selectByPrimaryKey(sharedSynAll.getId());
|
||||
// if (synDirectoryFileOpt.isPresent()) {
|
||||
// ArchivesFileRemoveInputBO bo = new ArchivesFileRemoveInputBO();
|
||||
// try {
|
||||
// bo.setArchives_file_id(List.of(sharedSynAll.getId().toString()));
|
||||
// TransactionResponse remove = archivesFileService.remove(bo);
|
||||
// List<Object> returnObject = remove.getReturnObject();
|
||||
// if (CollectionUtils.isEmpty(returnObject)) {
|
||||
// throw new RuntimeException();
|
||||
// }
|
||||
// TransactionReceipt transactionReceipt = remove.getTransactionReceipt();
|
||||
// sharedSynAll.setShared_status(SharedStatus.INIT.getCode());
|
||||
// sharedSynAll.setBlock_hash(transactionReceipt.getBlockHash());
|
||||
// sharedSynAll.setBlock_number(Integer.parseInt(transactionReceipt.getBlockNumber().substring(2), 16) + "");
|
||||
// sharedSynAll.setBlock_time(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
// } catch (Exception e) {
|
||||
// logger.error("文件目录下链失败!{}", e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件上链
|
||||
// */
|
||||
// public void upFileBcn(SharedSynAll sharedSynAll) {
|
||||
// Optional<SynFile> synFileOpt = synFileMapper.selectByPrimaryKey(sharedSynAll.getSyn_id());
|
||||
// if (synFileOpt.isPresent()) {
|
||||
// SynFile synFile = synFileOpt.get();
|
||||
// FileInsertInputBO bo = new FileInsertInputBO();
|
||||
// try {
|
||||
// bo.setId(sharedSynAll.getSyn_id().toString());
|
||||
// bo.setArchive_file_id(synFile.getP_id().toString());
|
||||
// //字符类型属性
|
||||
//// List<String> attStrNames = new ArrayList<>();
|
||||
//// List<String> attStrValues = new ArrayList<>();
|
||||
//// attStrNames.add("code");
|
||||
//// attStrValues.add(synFile.getCode());
|
||||
//// attStrNames.add("name");
|
||||
//// attStrValues.add(synFile.getName());
|
||||
//// attStrNames.add("author");
|
||||
//// attStrValues.add(synFile.getAuthor());
|
||||
//// attStrNames.add("file_date");
|
||||
//// attStrValues.add(synFile.getFile_date());
|
||||
//// attStrNames.add("other_params");
|
||||
//// attStrValues.add("");
|
||||
//// attStrNames.add("url");
|
||||
//// attStrValues.add(synFile.getUrl());
|
||||
////
|
||||
//// //int类型属性
|
||||
//// List<String> attIntNames = new ArrayList<>();
|
||||
//// List<BigInteger> attIntValues = new ArrayList<>();
|
||||
//// attIntNames.add("index");
|
||||
//// attIntValues.add(BigInteger.valueOf(Optional.ofNullable(synFile.getSort()).orElse(0)));
|
||||
//// attIntNames.add("file_size");
|
||||
//// attIntValues.add(BigInteger.valueOf(Optional.ofNullable(synFile.getFile_size()).orElse(0)));
|
||||
//// attIntNames.add("page_count");
|
||||
//// attIntValues.add(BigInteger.valueOf(Optional.ofNullable(synFile.getPage_count()).orElse(0)));
|
||||
//// attIntNames.add("create_time");
|
||||
//// attIntValues.add(getNowTime());
|
||||
//// attIntNames.add("update_time");
|
||||
//// attIntValues.add(getNowTime());
|
||||
////
|
||||
//// bo.setStr_attr_name(attStrNames);
|
||||
//// bo.setStr_attr_value(attStrValues);
|
||||
//// bo.setInt_attr_name(attIntNames);
|
||||
//// bo.setInt_attr_value(attIntValues);
|
||||
//// TransactionResponse insert = fileService.insert(bo);
|
||||
//// List<Object> returnObject = insert.getReturnObject();
|
||||
//// if (CollectionUtils.isEmpty(returnObject)) {
|
||||
//// throw new RuntimeException();
|
||||
//// }
|
||||
//// TransactionReceipt transactionReceipt = insert.getTransactionReceipt();
|
||||
// sharedSynAll.setShared_status(SharedStatus.SUCESS.getCode());
|
||||
//// sharedSynAll.setBlock_hash(transactionReceipt.getBlockHash());
|
||||
//// sharedSynAll.setBlock_number(Integer.parseInt(transactionReceipt.getBlockNumber().substring(2), 16) + "");
|
||||
// sharedSynAll.setBlock_time(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
// } catch (Exception e) {
|
||||
// logger.error("文件目录上链失败!{}", e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件下链
|
||||
// */
|
||||
// public void downFileBcn(SharedSynAll sharedSynAll) {
|
||||
// Optional<SynFile> synFileOpt = synFileMapper.selectByPrimaryKey(sharedSynAll.getSyn_id());
|
||||
// if (synFileOpt.isPresent()) {
|
||||
// FileRemoveInputBO bo = new FileRemoveInputBO();
|
||||
// try {
|
||||
// bo.setFile_id(List.of(sharedSynAll.getSyn_id().toString()));
|
||||
// TransactionResponse remove = fileService.remove(bo);
|
||||
// List<Object> returnObject = remove.getReturnObject();
|
||||
// if (CollectionUtils.isEmpty(returnObject)) {
|
||||
// throw new RuntimeException();
|
||||
// }
|
||||
// TransactionReceipt transactionReceipt = remove.getTransactionReceipt();
|
||||
// sharedSynAll.setShared_status(SharedStatus.INIT.getCode());
|
||||
// sharedSynAll.setBlock_hash(transactionReceipt.getBlockHash());
|
||||
// sharedSynAll.setBlock_number(Integer.parseInt(transactionReceipt.getBlockNumber().substring(2), 16) + "");
|
||||
// sharedSynAll.setBlock_time(LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
// } catch (Exception e) {
|
||||
// logger.error("文件目录下链失败!{}", e.getMessage());
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package jj.tech.paolu.biz.webadmin.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jj.tech.paolu.config.enums.UserType;
|
||||
import jj.tech.paolu.repository.mybatis.dao.SysAdminMapper;
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysAdmin;
|
||||
@Service
|
||||
public class SuperSysAdminComponent {
|
||||
public static String id="1";
|
||||
|
||||
@Autowired
|
||||
SysAdminMapper sysAdminMapper;
|
||||
|
||||
|
||||
|
||||
public static boolean isSystemAdmin(SysAdmin user){
|
||||
return user.getId().equalsIgnoreCase(id);
|
||||
}
|
||||
|
||||
public boolean isOrganizationAdmin(SysAdmin user){
|
||||
return user.getType().equals(UserType.ORG_ADMIN.getCode());
|
||||
|
||||
}
|
||||
|
||||
public SysAdmin getSystemAdminUser(){
|
||||
return sysAdminMapper.selectByPrimaryKey("1").get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package jj.tech.paolu.biz.webadmin.service;
|
||||
|
||||
import jj.tech.paolu.repository.mybatis.dao.SysAdminMapper;
|
||||
import jj.tech.paolu.repository.mybatis.dao.SysAdminWeidMapper;
|
||||
import jj.tech.paolu.repository.mybatis.dao.support.SysAdminWeidDynamicSqlSupport;
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysAdminWeid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Service
|
||||
public class SysAdminWeidService {
|
||||
@Autowired
|
||||
SysAdminMapper sysAdminMapper;
|
||||
|
||||
@Autowired
|
||||
SysAdminWeidMapper sysAdminWeidMapper;
|
||||
|
||||
public SysAdminWeid selectByUserId(String userId){
|
||||
SysAdminWeid bean =
|
||||
sysAdminWeidMapper.selectOne(s->s
|
||||
.where(SysAdminWeidDynamicSqlSupport.admin_id, isEqualTo(userId))
|
||||
.limit(1)
|
||||
).orElse(null);
|
||||
return bean;
|
||||
}
|
||||
|
||||
public int deleteByUserId(String userId){
|
||||
return sysAdminWeidMapper.delete(s->s.where(SysAdminWeidDynamicSqlSupport.admin_id, isEqualTo(userId)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
public class AddAdminRoleMenuVo {
|
||||
@NotBlank
|
||||
@Schema(description = "角色id")
|
||||
private String role_id;
|
||||
|
||||
@NotEmpty
|
||||
@Schema(description = "菜单ids")
|
||||
private List<String> menu_ids;
|
||||
|
||||
public String getRole_id() {
|
||||
return role_id;
|
||||
}
|
||||
|
||||
public void setRole_id(String role_id) {
|
||||
this.role_id = role_id;
|
||||
}
|
||||
|
||||
public List<String> getMenu_ids() {
|
||||
return menu_ids;
|
||||
}
|
||||
|
||||
public void setMenu_ids(List<String> menu_ids) {
|
||||
this.menu_ids = menu_ids;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AdminListVo extends PageVo{
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@Schema(description = "用户名")
|
||||
public String username;
|
||||
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Schema(description = "登录密码")
|
||||
public String password;
|
||||
|
||||
@Schema(description = "真实姓名")
|
||||
public String realname;
|
||||
|
||||
@Schema(description = "手机")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "0正常,1锁定")
|
||||
public Integer islock;
|
||||
|
||||
@Schema(description = "用户类型,0普通用户,1企业管理员")
|
||||
public Integer type;
|
||||
|
||||
@Schema(description = "组织id")
|
||||
private String org_id;
|
||||
|
||||
@Schema(description = "性别")
|
||||
public Integer gender;
|
||||
|
||||
@Schema(description = "职位")
|
||||
public String job;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
public List<String> rolesId;
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getOrg_id() {
|
||||
return org_id;
|
||||
}
|
||||
|
||||
public void setOrg_id(String org_id) {
|
||||
this.org_id = org_id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRealname() {
|
||||
return realname;
|
||||
}
|
||||
|
||||
public void setRealname(String realname) {
|
||||
this.realname = realname;
|
||||
}
|
||||
|
||||
public Integer getIslock() {
|
||||
return islock;
|
||||
}
|
||||
|
||||
public void setIslock(Integer islock) {
|
||||
this.islock = islock;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(Integer gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public List<String> getRolesId() {
|
||||
return rolesId;
|
||||
}
|
||||
|
||||
public void setRolesId(List<String> rolesId) {
|
||||
this.rolesId = rolesId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public class Id {
|
||||
@NotNull(message = "id不能为空")
|
||||
public String id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public class IdPageVo extends PageVo{
|
||||
@NotBlank(message = "id不能为空")
|
||||
public String id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public class Ids {
|
||||
@NotNull
|
||||
public List<String> ids = new ArrayList<String>();
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public class IdsAndPwd extends Ids{
|
||||
|
||||
@NotBlank(message = "旧密码不能为空")
|
||||
@Schema(description = "旧密码")
|
||||
public String password;
|
||||
|
||||
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public class IdsAndPwdUpdate {
|
||||
|
||||
@NotBlank(message = "旧密码不能为空")
|
||||
@Schema(description = "旧密码")
|
||||
public String password;
|
||||
|
||||
@NotBlank(message = "新密码不能为空")
|
||||
@Schema(description = "新密码")
|
||||
public String newpassword;
|
||||
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
@Schema(description = "验证码")
|
||||
public String captcha;
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getNewpassword() {
|
||||
return newpassword;
|
||||
}
|
||||
|
||||
public void setNewpassword(String newpassword) {
|
||||
this.newpassword = newpassword;
|
||||
}
|
||||
|
||||
public String getCaptcha() {
|
||||
return captcha;
|
||||
}
|
||||
|
||||
public void setCaptcha(String captcha) {
|
||||
this.captcha = captcha;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public class IdsPageVo extends PageVo{
|
||||
@NotNull
|
||||
public List<String> ids = new ArrayList<String>();
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public class LoginVo {
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@Schema(description = "用户名")
|
||||
public String username;
|
||||
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Schema(description = "登录密码")
|
||||
public String password;
|
||||
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
@Schema(description = "验证码")
|
||||
public String captcha;
|
||||
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getCaptcha() {
|
||||
return captcha;
|
||||
}
|
||||
|
||||
public void setCaptcha(String captcha) {
|
||||
this.captcha = captcha;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysMenu;
|
||||
|
||||
public class MenuTree extends SysMenu{
|
||||
|
||||
private List<MenuTree> children;
|
||||
|
||||
public MenuTree() {
|
||||
}
|
||||
|
||||
public void addChild(MenuTree child) {
|
||||
if(children==null) {
|
||||
children = new ArrayList<MenuTree>();
|
||||
}
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<MenuTree> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<MenuTree> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysOrg;
|
||||
|
||||
public class OrgTree extends SysOrg {
|
||||
private List<OrgTree> children;
|
||||
private Integer isSelect = 0;
|
||||
|
||||
public OrgTree() {
|
||||
}
|
||||
|
||||
public void addChild(OrgTree child) {
|
||||
if(children==null) {
|
||||
children = new ArrayList<OrgTree>();
|
||||
}
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
|
||||
public List<OrgTree> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<OrgTree> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public Integer getIsSelect() {
|
||||
return isSelect;
|
||||
}
|
||||
|
||||
public void setIsSelect(Integer isSelect) {
|
||||
this.isSelect = isSelect;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
public class PageVo {
|
||||
public Integer pageNum=1;
|
||||
public Integer pageSize=10;
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import jj.tech.paolu.repository.mybatis.entity.ReadLog;
|
||||
|
||||
public class ReadLogVo extends ReadLog {
|
||||
private long timestamp;
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysAdmin;
|
||||
|
||||
public class SysAdminAddVo extends SysAdmin{
|
||||
public List<String> role_ids = new ArrayList<String>();;
|
||||
|
||||
|
||||
public List<String> getRole_ids() {
|
||||
return role_ids;
|
||||
}
|
||||
|
||||
public void setRole_ids(List<String> role_ids) {
|
||||
this.role_ids = role_ids;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public class SysAdminLock {
|
||||
@Schema(description = "id")
|
||||
@NotBlank
|
||||
private String id;
|
||||
|
||||
@Schema(description = "状态,1启用,0禁用")
|
||||
@NotNull
|
||||
private Integer isLock;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getIsLock() {
|
||||
return isLock;
|
||||
}
|
||||
|
||||
public void setIsLock(Integer isLock) {
|
||||
this.isLock = isLock;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysAdminRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SysAdminRoleVo {
|
||||
|
||||
@Schema(description = "管理员id")
|
||||
private String adminid;
|
||||
@Schema(description = "角色集合")
|
||||
private List<SysAdminRole> sysAdminRoles;
|
||||
|
||||
public String getAdminid() {
|
||||
return adminid;
|
||||
}
|
||||
|
||||
public void setAdminid(String adminid) {
|
||||
this.adminid = adminid;
|
||||
}
|
||||
|
||||
public List<SysAdminRole> getSysAdminRoles() {
|
||||
return sysAdminRoles;
|
||||
}
|
||||
|
||||
public void setSysAdminRoles(List<SysAdminRole> sysAdminRoles) {
|
||||
this.sysAdminRoles = sysAdminRoles;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package jj.tech.paolu.biz.webadmin.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public class SysRoleListVo extends PageVo{
|
||||
|
||||
public Long id;
|
||||
// @NotBlank(message = "角色名称不能为空")
|
||||
public String rolename;
|
||||
public String describe;
|
||||
public Integer is_open;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getRolename() {
|
||||
return rolename;
|
||||
}
|
||||
public void setRolename(String rolename) {
|
||||
this.rolename = rolename;
|
||||
}
|
||||
public String getDescribe() {
|
||||
return describe;
|
||||
}
|
||||
public void setDescribe(String describe) {
|
||||
this.describe = describe;
|
||||
}
|
||||
public Integer getIs_open() {
|
||||
return is_open;
|
||||
}
|
||||
public void setIs_open(Integer is_open) {
|
||||
this.is_open = is_open;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package jj.tech.paolu.config.datasource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
/**
|
||||
* 定义除spring提供的默认数据源以外的,自定义数据源
|
||||
* 参考: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.data-access.configure-two-datasources
|
||||
* https://github.com/spring-projects/spring-boot/issues/20814
|
||||
* https://github.com/spring-projects/spring-boot/issues/13325
|
||||
* @author Dou
|
||||
*/
|
||||
@Configuration(proxyBeanMethods=false)
|
||||
public class DataSourceConfig {
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConditionalOnClass(HikariDataSource.class)
|
||||
//@ConfigurationProperties("spring.datasource")
|
||||
HikariDataSource dataSource(DataSourceProperties properties) {
|
||||
|
||||
return (HikariDataSource) properties.initializeDataSourceBuilder()
|
||||
.type(HikariDataSource.class).build();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 数据库名称url:需要改成jdbc-url,其他名称值和spring默认的一样
|
||||
// * 就可以自动注入
|
||||
// */
|
||||
// @Bean("dataSource2")
|
||||
// @ConfigurationProperties("app.datasource")
|
||||
// public HikariDataSource dataSource2() {
|
||||
// return (HikariDataSource) DataSourceBuilder.create()
|
||||
// .type(HikariDataSource.class).build();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * @p DataSourceProperties
|
||||
// * @p 如果没有 显示的提供 url 用户名、密码; 创建一个默认的嵌入式的数据库
|
||||
// * @p 并提供url/jdbcUrl的转化
|
||||
// * @p @EnableConfigurationProperties(DataSourceProperties.class),这个注解可以不用加,因为
|
||||
// * spring 在初始化 DataSourceAutoConfiguration的时候,会初始化DataSourceProperties这个类到spring上下文
|
||||
// */
|
||||
// @Bean
|
||||
// @Primary
|
||||
// @ConfigurationProperties("spring.datasource")
|
||||
// public DataSourceProperties dataSourceProperties() {
|
||||
// return new DataSourceProperties();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
/**
|
||||
* 电子档案系统同步数据后本地的处理类型
|
||||
* 因为使用isDel字段来标记是否删除,因此没有删除类型
|
||||
*/
|
||||
public enum ArchiveSynLocalProcessType{
|
||||
INSERT( 1),
|
||||
UPDATE(2);
|
||||
|
||||
private final int code;
|
||||
|
||||
ArchiveSynLocalProcessType(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum CertificateApplyCheckStatus {
|
||||
WAIT(0), //待审核
|
||||
PASS(1), //审核通过
|
||||
NO_PASS(-1), //审核不通过
|
||||
All(null) //全部
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
CertificateApplyCheckStatus(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum CertificateApplyStatus {
|
||||
WAIT(0), //待审核
|
||||
PASS(1), //审核通过
|
||||
NO_PASS(2), //审核不通过
|
||||
DOWNLOAD(3), //已下载
|
||||
All(null), //全部
|
||||
ISSUED(4)//已颁发
|
||||
;
|
||||
|
||||
|
||||
private Integer code;
|
||||
|
||||
CertificateApplyStatus(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum CertificateApplyType {
|
||||
|
||||
apply(1,"证书申请"),
|
||||
unsubscribe(2,"证书注销"),
|
||||
// lost(3,"证书挂失"),
|
||||
// change(4,"证书变更"),
|
||||
;
|
||||
|
||||
|
||||
private Integer code;
|
||||
private String name;
|
||||
|
||||
CertificateApplyType(Integer code, String name) {
|
||||
this.code=code;
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum CertificateDetailStatus {
|
||||
no_work(0), //待审核
|
||||
work(1), //生效
|
||||
unsubscribe(2), //注销
|
||||
expired(3), //过期
|
||||
All(null) //全部
|
||||
;
|
||||
|
||||
|
||||
private Integer code;
|
||||
|
||||
CertificateDetailStatus(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum CertificateOrgApplyType {
|
||||
|
||||
|
||||
//组织申请业务类型
|
||||
settlein(1,"组织机构入驻"),
|
||||
generate(2,"生成组织机构证书公钥"),
|
||||
cancel(3,"组织证书注销")
|
||||
;
|
||||
|
||||
|
||||
private Integer code;
|
||||
private String name;
|
||||
|
||||
CertificateOrgApplyType(Integer code, String name) {
|
||||
this.code=code;
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
/**
|
||||
* 档案的删除状态
|
||||
*/
|
||||
|
||||
public enum DelStatus {
|
||||
IS_DEL((int) 1), NOT_DEL((int) 0);
|
||||
|
||||
private final int code;
|
||||
|
||||
DelStatus(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
/**
|
||||
* 任务的运行状态
|
||||
*/
|
||||
|
||||
public enum ExecuteStatus {
|
||||
SUCCESS( 1), EXECUTING(2),
|
||||
WAIT_EXECUTE(3),
|
||||
FAIL(4);
|
||||
|
||||
private final int code;
|
||||
|
||||
ExecuteStatus(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum FilesApplyStatus {
|
||||
SAVE(1), //草稿
|
||||
CANCEL(2), //取消
|
||||
CHECK_ING(3), //审核中
|
||||
CHECK_EDN(4), //审核通过
|
||||
CHECK_FAILED(5), //审核不通过
|
||||
FINISH(6) //结束
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
FilesApplyStatus(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum FilesCheckStatus {
|
||||
|
||||
WAIT(0), //待审核
|
||||
PASS(1), //审核通过
|
||||
NO_PASS(-1), //审核不通过
|
||||
All(null) //全部
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
FilesCheckStatus(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
/**
|
||||
* 文件属性
|
||||
*/
|
||||
public enum FilesProperties {
|
||||
normal(1), //一般
|
||||
important(2), //重要
|
||||
veryImportant(3) //密集
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
FilesProperties(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum FilesViewType {
|
||||
LOOK(1), //查看
|
||||
PRINT(2), //打印
|
||||
|
||||
;
|
||||
|
||||
private int code;
|
||||
|
||||
FilesViewType(int code) {
|
||||
this.code=code;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum IsApplyProvider {
|
||||
Apply(0), //申请方
|
||||
Provider(1), //提供方
|
||||
|
||||
;
|
||||
|
||||
private int code;
|
||||
|
||||
IsApplyProvider(int code) {
|
||||
this.code=code;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
//角色标签
|
||||
public enum RoleSign {
|
||||
|
||||
DepartmentHead("1","部门负责人"), //部门负责人
|
||||
EnterpriseHead("2","企业负责人"), //企业负责人
|
||||
ArchivesManagementCenter("3","档案管理中心"), //档案管理中心负责人
|
||||
LeaderTeam("4","分管领导"), //分管领导
|
||||
LeaderCharge("5","班子领导") //领导班子
|
||||
;
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
|
||||
RoleSign(String code, String name) {
|
||||
this.code=code;
|
||||
this.name=name;
|
||||
}
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public class RoleSignName {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum SharedConfigStatus {
|
||||
|
||||
ADDAll(1), //已配置(下级需要全选),完全共享
|
||||
ADDPART(2), //已配置部分(下级不需要全选),部分共享
|
||||
NULL(null), //初始化禁用
|
||||
DELETE(-1); //已禁用,不共享
|
||||
|
||||
|
||||
private Integer code;
|
||||
|
||||
SharedConfigStatus(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
/**
|
||||
* 共享的执行状态,即是否上链
|
||||
*/
|
||||
public enum SharedStatus {
|
||||
|
||||
|
||||
INIT(1), //未共享
|
||||
WAIT(2), //待共享发布
|
||||
SUCESS(3); //已共享
|
||||
|
||||
private Integer code;
|
||||
|
||||
SharedStatus(Integer code) {
|
||||
this.code=code;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum SynStatus {
|
||||
WAIT_SYN(0), SYN(1),EXECUTING(2);
|
||||
|
||||
private final Integer code;
|
||||
|
||||
SynStatus(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public enum SynType {
|
||||
|
||||
DIR(1), DIRFILE(2), FILE(3);
|
||||
|
||||
private int code;
|
||||
|
||||
SynType(int code) {
|
||||
this.code=code;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
public class SysConfigGroup {
|
||||
public static String grup_rulenotice = "rulenotice";
|
||||
|
||||
|
||||
|
||||
public static String key_rulenotice_due = "rulenotice_due";
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package jj.tech.paolu.config.enums;
|
||||
|
||||
/**
|
||||
* 用户类型:可为企业管理员或者普通用户两种
|
||||
*/
|
||||
public enum UserType {
|
||||
ORG_ADMIN((int) 1), NORMAL_USER((int) 0);
|
||||
|
||||
private final int code;
|
||||
|
||||
UserType(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
//package jj.tech.paolu.config.exception;
|
||||
//
|
||||
//import jj.tech.paolu.utils.R;
|
||||
//import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
//import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
//import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
//
|
||||
//@RestControllerAdvice
|
||||
//public class ArgumentExceptionHandler {
|
||||
// @ExceptionHandler(value = MethodArgumentNotValidException.class)
|
||||
// public Object exceptionHandler(MethodArgumentNotValidException e) {
|
||||
// return R.FALSE(e.getBindingResult().getFieldError().getDefaultMessage());
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package jj.tech.paolu.config.httpclient;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* Created by liuxu on 2017/12/22.
|
||||
* RestTemplate配置类
|
||||
*/
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate(ClientHttpRequestFactory factory){
|
||||
return new RestTemplate(factory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHttpRequestFactory simpleClientHttpRequestFactory(){
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setReadTimeout(50000);//单位为ms
|
||||
factory.setConnectTimeout(50000);//单位为ms
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
package jj.tech.paolu.config.jooq;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.jooq.ConnectionProvider;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.ExecuteListenerProvider;
|
||||
import org.jooq.impl.DataSourceConnectionProvider;
|
||||
import org.jooq.impl.DefaultConfiguration;
|
||||
import org.jooq.impl.DefaultDSLContext;
|
||||
import org.jooq.impl.DefaultExecuteListenerProvider;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.jooq.DefaultConfigurationCustomizer;
|
||||
import org.springframework.boot.autoconfigure.jooq.JooqExceptionTranslator;
|
||||
import org.springframework.boot.autoconfigure.jooq.JooqProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
|
||||
/**
|
||||
* jooq使用单个jdbc链接的时候:自己不管理数据库链接开关,也不管理事物的开关,由外部管理
|
||||
* jooq使用数据源的时候:每次执行先获取一个链接,执行完毕还给连接池
|
||||
*
|
||||
* @注意该类参考:spring-boot-autoconfigure自动配置jooq包下的JooqAutoConfiguration
|
||||
* 源码复制直接用, 因为spring自动配置包下大多数类不是public类,只能重写
|
||||
*
|
||||
* @在单数据源情况下不用配置任何东西,spring boot 默认配置非常优秀
|
||||
* 需要注意的是事务的传播特性,spring boot jooq默认是嵌入事务
|
||||
* https://blog.jooq.org/nested-transactions-in-jooq/
|
||||
* @jooq代码中写sql
|
||||
* https://blog.jooq.org/using-java-13-text-blocks-for-plain-sql-with-jooq/
|
||||
*
|
||||
* @关于嵌入事务: 错误只回滚自己,其他成功的所有事务都成功
|
||||
* https://stackoverflow.com/questions/6683929/propagation-nested-vs-propagation-required-in-spring
|
||||
* @jooq与jpa,按作者的表述,他不愿意支持ORM
|
||||
* https://github.com/jOOQ/jOOQ/issues/11685
|
||||
* @jooq与r2dbc,胶水写法,脱裤子放屁
|
||||
* https://github.com/jOOQ/jOOQ/issues/11700
|
||||
* https://github.com/jOOQ/jOOQ/tree/main/jOOQ-examples
|
||||
* https://blog.jooq.org/reactive-sql-with-jooq-3-15-and-r2dbc
|
||||
* @examples
|
||||
* https://github.com/jOOQ/jOOQ/tree/main/jOOQ-examples
|
||||
*
|
||||
* @Dou 2020/8/13
|
||||
*/
|
||||
@ConditionalOnClass(DSLContext.class)
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@EnableConfigurationProperties(JooqProperties.class)
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class JooqConfig {
|
||||
|
||||
/**
|
||||
* 创建使用默认数据源,和spring默认嵌入式事务管理器的DSLContext
|
||||
*/
|
||||
@Bean
|
||||
DefaultDSLContext dsl(org.jooq.Configuration configuration) {
|
||||
return new DefaultDSLContext(configuration);
|
||||
}
|
||||
|
||||
@Bean
|
||||
DefaultConfiguration jooqConfiguration(
|
||||
JooqProperties properties,
|
||||
DataSource dataSource,
|
||||
PlatformTransactionManager txManager){
|
||||
DefaultConfiguration configuration = new DefaultConfiguration();
|
||||
configuration.set(properties.determineSqlDialect(dataSource));
|
||||
configuration.set(new DataSourceConnectionProvider(new TransactionAwareDataSourceProxy(dataSource)));
|
||||
configuration.set(new JooqSpringTransactionProvider(txManager)); //spring提供的默认嵌入式事务PROPAGATION_NESTED
|
||||
configuration.set(new DefaultExecuteListenerProvider(new JooqExceptionTranslator()));
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * @spring的事物管理器
|
||||
// * 如果添加spring-boot-starter-jdbc 依赖,框架会默认注入 DataSourceTransactionManager 实例
|
||||
// * 如果你添加的是 spring-boot-starter-data-jpa, 会注入 JpaTransactionManager
|
||||
// *
|
||||
// * @可以指定为:DataSourceTransactionManager,spring boot的自动配置没有指定,所以这里也不指定
|
||||
// * 直接指定DataSourceTransactionManager可以参考: https://www.jooq.org/doc/3.18/manual/sql-execution/transaction-management/
|
||||
//
|
||||
// * @SpringTransactionProvider 已知bug,不适用于 jOOQ 的异步事务: https://github.com/jOOQ/jOOQ/issues/10850
|
||||
// * 并且r2dbc有同样的问题: https://github.com/spring-projects/spring-framework/issues/28133
|
||||
// * 可以取消SpringTransactionProvider事务管理并使用JOOP自己的事务管理解决:
|
||||
// * this.dslContext = dslContext.configuration().derive((TransactionProvider) null).dsl();
|
||||
// */
|
||||
// @Bean
|
||||
// JooqSpringTransactionProvider jooqSpringTransactionProvider(
|
||||
// PlatformTransactionManager txManager) {
|
||||
// return new JooqSpringTransactionProvider(txManager);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * jooq提供对对外的,使用外部的数据库链接,DataSourceConnectionProvider代理类
|
||||
// * 这里使用TransactionAwareDataSourceProxy 可以动态的发现spring 事物上下文transaction context
|
||||
// */
|
||||
// @Bean
|
||||
// DataSourceConnectionProvider dataSourceConnectionProvider(
|
||||
// @Qualifier("dataSource2") DataSource dataSource2) {
|
||||
// return new DataSourceConnectionProvider(
|
||||
// new TransactionAwareDataSourceProxy(dataSource2));
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// SQLDialect sQLDialect(
|
||||
// JooqProperties properties,
|
||||
// @Qualifier("dataSource2") DataSource dataSource2) {
|
||||
// return properties.determineSqlDialect(dataSource2);
|
||||
// }
|
||||
//
|
||||
// @Bean("dsl2")
|
||||
// DSLContext dsl2(
|
||||
// DataSourceConnectionProvider dataSourceConnectionProvider,
|
||||
// SQLDialect sQLDialect,
|
||||
// JooqSpringTransactionProvider jooqSpringTransactionProvider) {
|
||||
//
|
||||
// DefaultConfiguration config = new DefaultConfiguration();
|
||||
// config.set(sQLDialect);
|
||||
// config.set(dataSourceConnectionProvider);
|
||||
// config.set(jooqSpringTransactionProvider); //spring提供的默认嵌入式事务PROPAGATION_NESTED
|
||||
// config.set(new DefaultExecuteListenerProvider(new JooqExceptionTranslator()));
|
||||
// return new DefaultDSLContext(config);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package jj.tech.paolu.config.jooq;
|
||||
|
||||
import org.jooq.Transaction;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
/**
|
||||
* @ 直接复制 org.springframework.boot.autoconfigure.jooq.SpringTransaction类
|
||||
* 因为不是public,只能自己写一个
|
||||
* @author Dou
|
||||
*/
|
||||
public class JooqSpringTransaction implements Transaction{
|
||||
// Based on the jOOQ-spring-example from https://github.com/jOOQ/jOOQ
|
||||
|
||||
private final TransactionStatus transactionStatus;
|
||||
|
||||
JooqSpringTransaction(TransactionStatus transactionStatus) {
|
||||
this.transactionStatus = transactionStatus;
|
||||
}
|
||||
|
||||
TransactionStatus getTxStatus() {
|
||||
return this.transactionStatus;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package jj.tech.paolu.config.jooq;
|
||||
|
||||
import org.jooq.TransactionContext;
|
||||
import org.jooq.TransactionProvider;
|
||||
import org.jooq.tools.JooqLogger;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
/**
|
||||
* 修改默认事务传播行为成:PROPAGATION_REQUIRED
|
||||
* 参考 org.springframework.boot.autoconfigure.jooq.SpringTransactionProvider
|
||||
* 修改TransactionDefinition.PROPAGATION_NESTED 为 PROPAGATION_REQUIRED
|
||||
* @author Dou
|
||||
*
|
||||
*/
|
||||
public class JooqSpringTransactionProvider implements TransactionProvider{
|
||||
|
||||
// Based on the jOOQ-spring-example from https://github.com/jOOQ/jOOQ
|
||||
|
||||
private static final JooqLogger log = JooqLogger.getLogger(JooqSpringTransactionProvider.class);
|
||||
|
||||
private final PlatformTransactionManager transactionManager;
|
||||
|
||||
public JooqSpringTransactionProvider(PlatformTransactionManager transactionManager) {
|
||||
this.transactionManager = transactionManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void begin(TransactionContext context) {
|
||||
log.info("--> begin transaction --->");
|
||||
TransactionDefinition definition = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_NESTED); //PROPAGATION_REQUIRED
|
||||
TransactionStatus status = this.transactionManager.getTransaction(definition);
|
||||
context.transaction(new JooqSpringTransaction(status));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit(TransactionContext ctx) {
|
||||
log.info("--> commit transaction --->");
|
||||
this.transactionManager.commit(getTransactionStatus(ctx));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback(TransactionContext ctx) {
|
||||
log.error("<-- rollback transaction <---");
|
||||
this.transactionManager.rollback(getTransactionStatus(ctx));
|
||||
}
|
||||
|
||||
private TransactionStatus getTransactionStatus(TransactionContext ctx) {
|
||||
JooqSpringTransaction transaction = (JooqSpringTransaction) ctx.transaction();
|
||||
return transaction.getTxStatus();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//package jj.tech.paolu.config.jpa;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
//import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
//import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
//import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
//import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
//import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
//import org.springframework.transaction.PlatformTransactionManager;
|
||||
///**
|
||||
// * JPA多数据源配置,单一数据源由spring boot默认配置
|
||||
// * https://github.com/spring-projects/spring-data-examples/blob/main/jpa/multiple-datasources/src/main/java/example/springdata/jpa/multipleds/customer/CustomerConfig.java
|
||||
// * @author Dou
|
||||
// *
|
||||
// */
|
||||
////@Configuration
|
||||
////@EnableJpaRepositories(entityManagerFactoryRef = "customerEntityManagerFactory",
|
||||
//// transactionManagerRef = "customerTransactionManager")
|
||||
//public class JpaConfig {
|
||||
//// @Bean
|
||||
//// PlatformTransactionManager customerTransactionManager() {
|
||||
//// return new JpaTransactionManager(customerEntityManagerFactory().getObject());
|
||||
//// }
|
||||
////
|
||||
//// @Bean
|
||||
//// LocalContainerEntityManagerFactoryBean customerEntityManagerFactory() {
|
||||
////
|
||||
//// var jpaVendorAdapter = new HibernateJpaVendorAdapter();
|
||||
//// jpaVendorAdapter.setGenerateDdl(true);
|
||||
////
|
||||
//// var factoryBean = new LocalContainerEntityManagerFactoryBean();
|
||||
////
|
||||
//// factoryBean.setDataSource(customerDataSource());
|
||||
//// factoryBean.setJpaVendorAdapter(jpaVendorAdapter);
|
||||
//// factoryBean.setPackagesToScan(JpaConfig.class.getPackage().getName());
|
||||
////
|
||||
//// return factoryBean;
|
||||
//// }
|
||||
////
|
||||
//// @Bean
|
||||
//// DataSource customerDataSource() {
|
||||
//// return new EmbeddedDatabaseBuilder().//
|
||||
//// setType(EmbeddedDatabaseType.HSQL).//
|
||||
//// setName("customers").//
|
||||
//// build();
|
||||
//// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package jj.tech.paolu.config.json;
|
||||
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Configuration
|
||||
public class JacksonConfiguration {
|
||||
|
||||
@Value("${spring.jackson.date-format}")
|
||||
public String DATETIME_FORMAT;
|
||||
|
||||
/**
|
||||
* LoaclTime格式化字符串
|
||||
*/
|
||||
public String TIME_FORMAT = "HH:mm:ss";
|
||||
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
|
||||
return builder -> {
|
||||
|
||||
// formatter
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DATETIME_FORMAT);
|
||||
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern(TIME_FORMAT);
|
||||
|
||||
// deserializers
|
||||
builder.deserializers(new LocalDateTimeDeserializer(dateTimeFormatter));
|
||||
builder.deserializers(new LocalTimeDeserializer(timeFormatter));
|
||||
|
||||
// serializers
|
||||
builder.serializers(new LocalDateTimeSerializer(dateTimeFormatter));
|
||||
builder.serializers(new LocalTimeSerializer(timeFormatter));
|
||||
|
||||
//long
|
||||
builder.serializerByType(Long.TYPE, ToStringSerializer.instance);
|
||||
builder.serializerByType(Long.class, ToStringSerializer.instance);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package jj.tech.paolu.config.security;
|
||||
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
@Configuration
|
||||
public class Cors {
|
||||
|
||||
@Bean
|
||||
CorsFilter corsFilter() {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.addAllowedOriginPattern("*");
|
||||
// corsConfiguration.addAllowedOrigin("file:///C:/Users/lenovo/Desktop/x.html");
|
||||
// corsConfiguration.addAllowedOrigin("http://localhost:8080");
|
||||
// corsConfiguration.addAllowedOrigin("http://localhost:80");
|
||||
// corsConfiguration.addAllowedOrigin("http://localhost:5174");
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
corsConfiguration.setAllowCredentials(true);
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", corsConfiguration);
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<CorsFilter> filterRegistrationBean(CorsFilter corsFilter) {
|
||||
FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(corsFilter);
|
||||
bean.setOrder(1);
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package jj.tech.paolu.config.security;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jj.tech.paolu.config.security.user.WebAdminUtil;
|
||||
import jj.tech.paolu.utils.JsonUtil;
|
||||
|
||||
|
||||
/**
|
||||
* cors开头命名,为了使该过滤器在CorsFilter之后执行
|
||||
* @author admin
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Order(Ordered.LOWEST_PRECEDENCE)
|
||||
public class SecurityFilter extends OncePerRequestFilter {
|
||||
AntPathMatcher matcher = new AntPathMatcher();
|
||||
/**
|
||||
* 不需要token就能访问的url
|
||||
*/
|
||||
List<String> allowUrls = Arrays.asList(
|
||||
"/ws**/**",
|
||||
"/ttt/**",
|
||||
"/swagger-ui/index.html", "/swagger-ui/**", "/v3/**",
|
||||
"/favicon.ico",
|
||||
"/op/admin/login","/op/admin/logout", "/op/admin/captcha",
|
||||
"/mybatis/**",
|
||||
"/op/area/**",
|
||||
"/op/decrypt/dec",
|
||||
"/op/readlog/read",
|
||||
"/op/wb/**"//微柏模拟器的相关接口
|
||||
);
|
||||
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
// 忽略的urls
|
||||
if (this.isIgnoreUrl(request.getRequestURI())) {
|
||||
// 向后执行
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新token的有效时间
|
||||
Boolean verify = WebAdminUtil.verify(request, response);
|
||||
if(verify == false) {
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
this.authError(request, response);
|
||||
return;
|
||||
}
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前 requestURI 是否需要token访问
|
||||
*
|
||||
* @param requestURI uri
|
||||
* @return
|
||||
*/
|
||||
protected Boolean isIgnoreUrl(String requestURI) {
|
||||
for (String i : allowUrls) {
|
||||
if (matcher.match(i, requestURI)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 无token返回
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
protected void authError(HttpServletRequest request, HttpServletResponse response) {
|
||||
//request
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
String msg = "请求访问:" + request.getRequestURI() + ",token验证失败,无法访问资源";
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("code", 401);
|
||||
map.put("msg", msg);
|
||||
try {
|
||||
response.getWriter().write(JsonUtil.writeValueAsString(map));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
package jj.tech.paolu.config.security.user;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jj.tech.paolu.repository.mybatis.entity.SysAdmin;
|
||||
import jj.tech.paolu.utils.AES;
|
||||
import jj.tech.paolu.utils.CookieUtil;
|
||||
|
||||
public class WebAdminUtil {
|
||||
private static Logger logger = LoggerFactory.getLogger(WebAdminUtil.class);
|
||||
private static ObjectMapper objectMapper = new ObjectMapper();
|
||||
public static long exp = 5 * 60 * 60 * 1000; //过期时间5小时
|
||||
public static String WEBADMIN = "webadmin";
|
||||
|
||||
static {
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Boolean verify(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
String token = CookieUtil.fine(request, WEBADMIN);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return false;
|
||||
}
|
||||
AES aes = new AES();
|
||||
String jsonUser = aes.decrypt(token);
|
||||
HashMap<String,Object> map = objectMapper.readValue(jsonUser, HashMap.class);
|
||||
// Long logintime = (Long)map.get("logintime");
|
||||
// Long now = System.currentTimeMillis();
|
||||
//
|
||||
// if(now-logintime > exp) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// //大于30分钟,更新一下用户token
|
||||
// if(now-logintime > 30 * 60 * 1000) {
|
||||
// map.put("logintime", now);
|
||||
// WebAdminUtil.addToCookie(map);
|
||||
// }
|
||||
|
||||
SysAdmin bean = new SysAdmin();
|
||||
BeanUtils.populate(bean, map);
|
||||
request.setAttribute(WEBADMIN, bean);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static SysAdmin getUser() {
|
||||
try {
|
||||
ServletRequestAttributes servlet = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = servlet.getRequest();
|
||||
SysAdmin curr = (SysAdmin)request.getAttribute(WEBADMIN);
|
||||
return curr;
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String addToCookie(Object obj) {
|
||||
try {
|
||||
ServletRequestAttributes servlet = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
HttpServletResponse response = servlet.getResponse();
|
||||
|
||||
String userJson = objectMapper.writeValueAsString(obj);
|
||||
AES aes = new AES();
|
||||
String token = aes.encrypt(userJson);
|
||||
CookieUtil.add(WEBADMIN, token, response);
|
||||
return token;
|
||||
}catch(Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String addUser(SysAdmin entitty) {
|
||||
return addToCookie(entitty);
|
||||
}
|
||||
|
||||
public static void deleteUser() {
|
||||
try {
|
||||
ServletRequestAttributes servlet = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
HttpServletResponse response = servlet.getResponse();
|
||||
CookieUtil.delete(response, WEBADMIN);
|
||||
}catch(Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
//package jj.tech.paolu.config.security.user;
|
||||
//
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//
|
||||
//import org.apache.commons.beanutils.BeanUtils;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.web.context.request.RequestContextHolder;
|
||||
//import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
//
|
||||
//import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
//
|
||||
//import jakarta.servlet.http.HttpServletRequest;
|
||||
//import jakarta.servlet.http.HttpServletResponse;
|
||||
//import jj.tech.paolu.utils.AES;
|
||||
//import jj.tech.paolu.utils.CookieUtil;
|
||||
//
|
||||
//public class WebUserUtil {
|
||||
// private static Logger logger = LoggerFactory.getLogger(WebAdminUtil.class);
|
||||
// private static ObjectMapper objectMapper = new ObjectMapper();
|
||||
// public static String TOKEN = "webtoken";
|
||||
// public static long exp = 5 * 60 * 60 * 1000; //过期时间5小时
|
||||
// static {
|
||||
// objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @SuppressWarnings("unchecked")
|
||||
// public static Boolean verify(HttpServletRequest request, HttpServletResponse response) {
|
||||
// try {
|
||||
// String token = CookieUtil.fine(request, TOKEN);
|
||||
// if (StringUtils.isBlank(token)) {
|
||||
// return false;
|
||||
// }
|
||||
// AES aes = new AES();
|
||||
// String jsonUser = aes.decrypt(token);
|
||||
// HashMap<String,Object> map = objectMapper.readValue(jsonUser, HashMap.class);
|
||||
// Long logintime = (Long)map.get("logintime");
|
||||
// Long now = System.currentTimeMillis();
|
||||
//
|
||||
// if(now-logintime > exp) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// //大于30分钟,更新一下用户token
|
||||
// if(now-logintime > 30 * 60 * 1000) {
|
||||
// map.put("logintime", now);
|
||||
// WebUserUtil.addToCookie(map);
|
||||
// }
|
||||
//
|
||||
// UserInfo bean = new UserInfo();
|
||||
// BeanUtils.populate(bean, map);
|
||||
// request.setAttribute(TOKEN, bean);
|
||||
// return true;
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static UserInfo getUser() {
|
||||
// try {
|
||||
// ServletRequestAttributes servlet = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
// HttpServletRequest request = servlet.getRequest();
|
||||
// UserInfo curr = (UserInfo)request.getAttribute(TOKEN);
|
||||
// return curr;
|
||||
// }catch(Exception e) {
|
||||
// e.printStackTrace();
|
||||
// logger.info(e.getMessage());
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static String addToCookie(Object obj) {
|
||||
// try {
|
||||
// ServletRequestAttributes servlet = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
// HttpServletResponse response = servlet.getResponse();
|
||||
//
|
||||
// String userJson = objectMapper.writeValueAsString(obj);
|
||||
// AES aes = new AES();
|
||||
// String token = aes.encrypt(userJson);
|
||||
// CookieUtil.add(TOKEN, token, response);
|
||||
// return token;
|
||||
// }catch(Exception e) {
|
||||
// logger.info(e.getMessage());
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void deleteUser() {
|
||||
// try {
|
||||
// ServletRequestAttributes servlet = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
// HttpServletResponse response = servlet.getResponse();
|
||||
// CookieUtil.delete(response, TOKEN);
|
||||
// }catch(Exception e) {
|
||||
// logger.info(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package jj.tech.paolu.config.swagger;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.springdoc.core.models.GroupedOpenApi;
|
||||
import org.springdoc.core.utils.SpringDocUtils;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* swagger配置
|
||||
* 加入分组功能(默认注释掉)
|
||||
*
|
||||
* @author Dou
|
||||
* @date 2022/6/30
|
||||
**/
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
|
||||
static {
|
||||
Schema<LocalTime> schema = new Schema<>();
|
||||
schema.example(LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
SpringDocUtils.getConfig().replaceWithSchema(LocalTime.class, schema);
|
||||
}
|
||||
|
||||
@Bean
|
||||
OpenAPI springShopOpenAPI() {
|
||||
|
||||
SecurityScheme securityScheme = new SecurityScheme();
|
||||
securityScheme.type(SecurityScheme.Type.HTTP)
|
||||
.scheme("bearer").bearerFormat("JWT")
|
||||
.in(SecurityScheme.In.HEADER);
|
||||
// .scheme("basic");
|
||||
|
||||
Components compoenents = new Components();
|
||||
compoenents.addSecuritySchemes("bearer-key", securityScheme);
|
||||
|
||||
return new OpenAPI()
|
||||
.components(compoenents)
|
||||
.info(new Info().title("JJ Doc 接口文档")
|
||||
// .description("Spring shop sample application")
|
||||
.version("v0.0.1")
|
||||
.license(new License().name("Apache 2.0").url("http://springdoc.org")))
|
||||
.security(Collections.singletonList(new SecurityRequirement().addList("bearer-key")));
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("prod")
|
||||
GroupedOpenApi prodApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("user-test-api")
|
||||
.pathsToMatch("/null")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi loginApi(OpenAPI openAPI) {
|
||||
String paths[] = {"/op/admin/login", "/op/admin/logout", "/op/admin/captcha"};
|
||||
return GroupedOpenApi.builder()
|
||||
.group("login")
|
||||
// .packagesToScan("tech.bcnew.modular.authaudit.controller")
|
||||
.pathsToMatch(paths)
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*")
|
||||
.build();
|
||||
}
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi mybatisApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("mybatis")
|
||||
.pathsToMatch("/mybatis/**")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*")
|
||||
.build();
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// @Profile("!prod")
|
||||
// GroupedOpenApi jpaApi(OpenAPI openAPI) {
|
||||
// String packagesToscan[] = {"jj.tech.paolu.repository"};
|
||||
// return GroupedOpenApi.builder()
|
||||
// .group("jpa")
|
||||
// .packagesToScan(packagesToscan)
|
||||
// .addOpenApiCustomizer(api -> {
|
||||
// api = openAPI;
|
||||
// })
|
||||
// .pathsToExclude("/health/*")
|
||||
// .build();
|
||||
// }
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi webApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("web")
|
||||
.pathsToMatch("/web/**")
|
||||
//.packagesToScan("/jj/tech/paolu/biz/**")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*", "/jpa*")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@Profile("!prod")
|
||||
GroupedOpenApi webAdminApi(OpenAPI openAPI) {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("operate")
|
||||
.pathsToMatch("/op/**")
|
||||
//.packagesToScan("/jj/tech/paolu/biz/**")
|
||||
.addOpenApiCustomizer(api -> {
|
||||
api = openAPI;
|
||||
})
|
||||
.pathsToExclude("/health/*", "/jpa*")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package jj.tech.paolu.config.wsclient;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.socket.TextMessage;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
import org.springframework.web.socket.client.WebSocketClient;
|
||||
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
|
||||
import org.springframework.web.socket.handler.TextWebSocketHandler;
|
||||
|
||||
public class SpringWebSocketClient extends TextWebSocketHandler{
|
||||
|
||||
@Value("${websocket.url}")
|
||||
private String url;
|
||||
private WebSocketSession clientSession;
|
||||
|
||||
public SpringWebSocketClient () throws Exception{
|
||||
var client = new StandardWebSocketClient();
|
||||
|
||||
this.clientSession = client.execute(new TTextWebSocketHandler(), "wss://echo.websocket.org", new Object())
|
||||
.get();
|
||||
// this.clientSession =
|
||||
// client.doHandshake( new TTextWebSocketHandler(), "wss://echo.websocket.org", new Object()).get();
|
||||
|
||||
//this.clientSession = client.doHandshake(this, new TTextWebSocketHandler(), URI.create("wss://echo.websocket.org")).get();
|
||||
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// public WebSocketClient webSocketClient() throws Exception {
|
||||
// WebSocketClient client = new StandardWebSocketClient();
|
||||
// client.execute(new TTextWebSocketHandler(), url, null);
|
||||
// return client;
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
var sampleClient = new SpringWebSocketClient();
|
||||
sampleClient.getClientSession().sendMessage(new TextMessage("Hello!"));
|
||||
sampleClient.getClientSession().sendMessage(new TextMessage("ssss"));
|
||||
}
|
||||
|
||||
public WebSocketSession getClientSession() {
|
||||
return clientSession;
|
||||
}
|
||||
|
||||
public void setClientSession(WebSocketSession clientSession) {
|
||||
this.clientSession = clientSession;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TTextWebSocketHandler extends TextWebSocketHandler{
|
||||
@Override
|
||||
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
|
||||
System.err.println(message.getPayload());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package jj.tech.paolu.repository;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.mybatis.generator.api.MyBatisGenerator;
|
||||
import org.mybatis.generator.config.Configuration;
|
||||
import org.mybatis.generator.config.xml.ConfigurationParser;
|
||||
import org.mybatis.generator.internal.DefaultShellCallback;
|
||||
|
||||
public class GeneratorMybatis {
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
List<String> warnings = new ArrayList<String>();
|
||||
boolean overwrite = true;
|
||||
File configFile = new File("src/main/resources/generate/mybatis/generatorConfig.xml");
|
||||
ConfigurationParser cp = new ConfigurationParser(warnings);
|
||||
Configuration config = cp.parseConfiguration(configFile);
|
||||
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
|
||||
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
|
||||
myBatisGenerator.generate(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.Constants;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.impl.CatalogImpl;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class DefaultCatalog extends CatalogImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>DEFAULT_CATALOG</code>
|
||||
*/
|
||||
public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog();
|
||||
|
||||
/**
|
||||
* The schema <code>public</code>.
|
||||
*/
|
||||
public final Public PUBLIC = Public.PUBLIC;
|
||||
|
||||
/**
|
||||
* No further instances allowed
|
||||
*/
|
||||
private DefaultCatalog() {
|
||||
super("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Schema> getSchemas() {
|
||||
return Arrays.asList(
|
||||
Public.PUBLIC
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A reference to the 3.18 minor release of the code generator. If this
|
||||
* doesn't compile, it's because the runtime library uses an older minor
|
||||
* release, namely: 3.18. You can turn off the generation of this reference
|
||||
* by specifying /configuration/generator/generate/jooqVersionReference
|
||||
*/
|
||||
private static final String REQUIRE_RUNTIME_JOOQ_VERSION = Constants.VERSION_3_18;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq;
|
||||
|
||||
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDocs;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectory;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectoryFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysArea;
|
||||
|
||||
import org.jooq.Index;
|
||||
import org.jooq.OrderField;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.Internal;
|
||||
|
||||
|
||||
/**
|
||||
* A class modelling indexes of tables in public.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Indexes {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// INDEX definitions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final Index FILES_APPLY_DOCS_FILES_APPLY_ID_IDX = Internal.createIndex(DSL.name("files_apply_docs_files_apply_id_idx"), FilesApplyDocs.FILES_APPLY_DOCS, new OrderField[] { FilesApplyDocs.FILES_APPLY_DOCS.FILES_APPLY_ID }, false);
|
||||
public static final Index IDX_PARENT_CODE = Internal.createIndex(DSL.name("idx_parent_code"), SysArea.SYS_AREA, new OrderField[] { SysArea.SYS_AREA.PARENT_CODE }, false);
|
||||
public static final Index IDX_SYN_DIREC_PID = Internal.createIndex(DSL.name("idx_syn_direc_pid"), SynDirectory.SYN_DIRECTORY, new OrderField[] { SynDirectory.SYN_DIRECTORY.P_ID }, false);
|
||||
public static final Index IDX_SYN_DIRECTOR_FILE_PID = Internal.createIndex(DSL.name("idx_syn_director_file_pid"), SynDirectoryFile.SYN_DIRECTORY_FILE, new OrderField[] { SynDirectoryFile.SYN_DIRECTORY_FILE.P_ID }, false);
|
||||
public static final Index IDX_SYN_FILE_PID = Internal.createIndex(DSL.name("idx_syn_file_pid"), SynFile.SYN_FILE, new OrderField[] { SynFile.SYN_FILE.P_ID }, false);
|
||||
public static final Index UK_CODE = Internal.createIndex(DSL.name("uk_code"), SysArea.SYS_AREA, new OrderField[] { SysArea.SYS_AREA.AREA_CODE }, false);
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq;
|
||||
|
||||
|
||||
import jj.tech.paolu.repository.jooq.tables.ArchiveSynLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateApply;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateDetail;
|
||||
import jj.tech.paolu.repository.jooq.tables.DecryptLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.DownloadLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApply;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyCheckRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDirectoryDocs;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDocs;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDownloadRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.Project;
|
||||
import jj.tech.paolu.repository.jooq.tables.ReadLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.SharedRuleConfig;
|
||||
import jj.tech.paolu.repository.jooq.tables.SharedSynAll;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectory;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectoryFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdmin;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdminRole;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdminWeid;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysArea;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysConfig;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysMenu;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysOrg;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRole;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleMenu;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleSign;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleUrl;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysUrls;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.ArchiveSynLogRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.CertificateApplyRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.CertificateApplyRecordRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.CertificateDetailRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.DecryptLogRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.DownloadLogRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.FilesApplyCheckRecordRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.FilesApplyDirectoryDocsRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.FilesApplyDocsRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.FilesApplyDownloadRecordRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.FilesApplyRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.ProjectRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.ReadLogRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SharedRuleConfigRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SharedSynAllRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SynDirectoryFileRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SynDirectoryRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SynFileRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysAdminRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysAdminRoleRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysAdminWeidRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysAreaRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysConfigRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysMenuRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysOrgRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysRoleMenuRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysRoleRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysRoleSignRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysRoleUrlRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.SysUrlsRecord;
|
||||
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.UniqueKey;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.Internal;
|
||||
|
||||
|
||||
/**
|
||||
* A class modelling foreign key relationships and constraints of tables in
|
||||
* public.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Keys {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// UNIQUE and PRIMARY KEY definitions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final UniqueKey<ArchiveSynLogRecord> ARCHIVE_SYN_LOG_PKEY = Internal.createUniqueKey(ArchiveSynLog.ARCHIVE_SYN_LOG, DSL.name("archive_syn_log_pkey"), new TableField[] { ArchiveSynLog.ARCHIVE_SYN_LOG.ID }, true);
|
||||
public static final UniqueKey<CertificateApplyRecord> CERTIFICATE_APPLY_CER_ID_KEY = Internal.createUniqueKey(CertificateApply.CERTIFICATE_APPLY, DSL.name("certificate_apply_cer_id_key"), new TableField[] { CertificateApply.CERTIFICATE_APPLY.CER_ID }, true);
|
||||
public static final UniqueKey<CertificateApplyRecord> CERTIFICATE_APPLY_PKEY = Internal.createUniqueKey(CertificateApply.CERTIFICATE_APPLY, DSL.name("certificate_apply_pkey"), new TableField[] { CertificateApply.CERTIFICATE_APPLY.ID }, true);
|
||||
public static final UniqueKey<CertificateApplyRecordRecord> CERTIFICATE_APPLY_RECORD_PKEY = Internal.createUniqueKey(jj.tech.paolu.repository.jooq.tables.CertificateApplyRecord.CERTIFICATE_APPLY_RECORD, DSL.name("certificate_apply_record_pkey"), new TableField[] { jj.tech.paolu.repository.jooq.tables.CertificateApplyRecord.CERTIFICATE_APPLY_RECORD.ID }, true);
|
||||
public static final UniqueKey<CertificateDetailRecord> CERTIFICATE_DETAIL_PKEY = Internal.createUniqueKey(CertificateDetail.CERTIFICATE_DETAIL, DSL.name("certificate_detail_pkey"), new TableField[] { CertificateDetail.CERTIFICATE_DETAIL.ID }, true);
|
||||
public static final UniqueKey<DecryptLogRecord> DECRYPT_PKEY = Internal.createUniqueKey(DecryptLog.DECRYPT_LOG, DSL.name("decrypt_pkey"), new TableField[] { DecryptLog.DECRYPT_LOG.ID }, true);
|
||||
public static final UniqueKey<DownloadLogRecord> DOWNLOAD_LOG_PKEY = Internal.createUniqueKey(DownloadLog.DOWNLOAD_LOG, DSL.name("download_log_pkey"), new TableField[] { DownloadLog.DOWNLOAD_LOG.ID }, true);
|
||||
public static final UniqueKey<FilesApplyRecord> FILES_APPLY_PKEY = Internal.createUniqueKey(FilesApply.FILES_APPLY, DSL.name("files_apply_pkey"), new TableField[] { FilesApply.FILES_APPLY.ID }, true);
|
||||
public static final UniqueKey<FilesApplyCheckRecordRecord> FILES_APPLY_CHECK_RECORD_PKEY = Internal.createUniqueKey(FilesApplyCheckRecord.FILES_APPLY_CHECK_RECORD, DSL.name("files_apply_check_record_pkey"), new TableField[] { FilesApplyCheckRecord.FILES_APPLY_CHECK_RECORD.ID }, true);
|
||||
public static final UniqueKey<FilesApplyDirectoryDocsRecord> FILES_APPLY_DIRECTORY_DOCS_PKEY = Internal.createUniqueKey(FilesApplyDirectoryDocs.FILES_APPLY_DIRECTORY_DOCS, DSL.name("files_apply_directory_docs_pkey"), new TableField[] { FilesApplyDirectoryDocs.FILES_APPLY_DIRECTORY_DOCS.ID }, true);
|
||||
public static final UniqueKey<FilesApplyDocsRecord> FILES_APPLY_DOCS_PKEY = Internal.createUniqueKey(FilesApplyDocs.FILES_APPLY_DOCS, DSL.name("files_apply_docs_pkey"), new TableField[] { FilesApplyDocs.FILES_APPLY_DOCS.ID }, true);
|
||||
public static final UniqueKey<FilesApplyDownloadRecordRecord> FILES_APPLY_DOWNLOAD_RECORD_PKEY = Internal.createUniqueKey(FilesApplyDownloadRecord.FILES_APPLY_DOWNLOAD_RECORD, DSL.name("files_apply_download_record_pkey"), new TableField[] { FilesApplyDownloadRecord.FILES_APPLY_DOWNLOAD_RECORD.ID }, true);
|
||||
public static final UniqueKey<ProjectRecord> PROJECT_PKEY = Internal.createUniqueKey(Project.PROJECT, DSL.name("project_pkey"), new TableField[] { Project.PROJECT.ID }, true);
|
||||
public static final UniqueKey<ReadLogRecord> READ_LOG_PKEY = Internal.createUniqueKey(ReadLog.READ_LOG, DSL.name("read_log_pkey"), new TableField[] { ReadLog.READ_LOG.ID }, true);
|
||||
public static final UniqueKey<SharedRuleConfigRecord> SHARED_RULE_CONFIG_PKEY = Internal.createUniqueKey(SharedRuleConfig.SHARED_RULE_CONFIG, DSL.name("shared_rule_config_pkey"), new TableField[] { SharedRuleConfig.SHARED_RULE_CONFIG.ID }, true);
|
||||
public static final UniqueKey<SharedSynAllRecord> SHARED_SYN_ALL_PKEY = Internal.createUniqueKey(SharedSynAll.SHARED_SYN_ALL, DSL.name("shared_syn_all_pkey"), new TableField[] { SharedSynAll.SHARED_SYN_ALL.ID }, true);
|
||||
public static final UniqueKey<SharedSynAllRecord> SHARED_SYN_ALL_SYN_ID_KEY = Internal.createUniqueKey(SharedSynAll.SHARED_SYN_ALL, DSL.name("shared_syn_all_syn_id_key"), new TableField[] { SharedSynAll.SHARED_SYN_ALL.SYN_ID }, true);
|
||||
public static final UniqueKey<SharedSynAllRecord> SHARED_SYN_ALL_SYN_ID_SYN_TYPE_KEY = Internal.createUniqueKey(SharedSynAll.SHARED_SYN_ALL, DSL.name("shared_syn_all_syn_id_syn_type_key"), new TableField[] { SharedSynAll.SHARED_SYN_ALL.SYN_ID, SharedSynAll.SHARED_SYN_ALL.SYN_TYPE }, true);
|
||||
public static final UniqueKey<SynDirectoryRecord> SYN_DIRECTORY_PKEY = Internal.createUniqueKey(SynDirectory.SYN_DIRECTORY, DSL.name("syn_directory_pkey"), new TableField[] { SynDirectory.SYN_DIRECTORY.ID }, true);
|
||||
public static final UniqueKey<SynDirectoryFileRecord> SYN_DIRECTORY_FILE_PKEY = Internal.createUniqueKey(SynDirectoryFile.SYN_DIRECTORY_FILE, DSL.name("syn_directory_file_pkey"), new TableField[] { SynDirectoryFile.SYN_DIRECTORY_FILE.ID }, true);
|
||||
public static final UniqueKey<SynFileRecord> SYN_FILE_PKEY = Internal.createUniqueKey(SynFile.SYN_FILE, DSL.name("syn_file_pkey"), new TableField[] { SynFile.SYN_FILE.ID }, true);
|
||||
public static final UniqueKey<SysAdminRecord> SYS_ADMIN_PKEY = Internal.createUniqueKey(SysAdmin.SYS_ADMIN, DSL.name("sys_admin_pkey"), new TableField[] { SysAdmin.SYS_ADMIN.ID }, true);
|
||||
public static final UniqueKey<SysAdminRecord> SYS_ADMIN_USERNAME_KEY = Internal.createUniqueKey(SysAdmin.SYS_ADMIN, DSL.name("sys_admin_username_key"), new TableField[] { SysAdmin.SYS_ADMIN.USERNAME }, true);
|
||||
public static final UniqueKey<SysAdminRoleRecord> SYS_ADMIN_ROLE_PKEY = Internal.createUniqueKey(SysAdminRole.SYS_ADMIN_ROLE, DSL.name("sys_admin_role_pkey"), new TableField[] { SysAdminRole.SYS_ADMIN_ROLE.ID }, true);
|
||||
public static final UniqueKey<SysAdminWeidRecord> SYS_ADMIN_WEID_ADMIN_ID_KEY = Internal.createUniqueKey(SysAdminWeid.SYS_ADMIN_WEID, DSL.name("sys_admin_weid_admin_id_key"), new TableField[] { SysAdminWeid.SYS_ADMIN_WEID.ADMIN_ID }, true);
|
||||
public static final UniqueKey<SysAdminWeidRecord> SYS_ADMIN_WEID_PKEY = Internal.createUniqueKey(SysAdminWeid.SYS_ADMIN_WEID, DSL.name("sys_admin_weid_pkey"), new TableField[] { SysAdminWeid.SYS_ADMIN_WEID.ID }, true);
|
||||
public static final UniqueKey<SysAreaRecord> SYS_AREA_PKEY = Internal.createUniqueKey(SysArea.SYS_AREA, DSL.name("sys_area_pkey"), new TableField[] { SysArea.SYS_AREA.ID }, true);
|
||||
public static final UniqueKey<SysConfigRecord> SYS_CONFIG_KEYS_KEY = Internal.createUniqueKey(SysConfig.SYS_CONFIG, DSL.name("sys_config_keys_key"), new TableField[] { SysConfig.SYS_CONFIG.KEYS }, true);
|
||||
public static final UniqueKey<SysConfigRecord> SYS_CONFIG_PKEY = Internal.createUniqueKey(SysConfig.SYS_CONFIG, DSL.name("sys_config_pkey"), new TableField[] { SysConfig.SYS_CONFIG.ID }, true);
|
||||
public static final UniqueKey<SysMenuRecord> SYS_MENU_PKEY = Internal.createUniqueKey(SysMenu.SYS_MENU, DSL.name("sys_menu_pkey"), new TableField[] { SysMenu.SYS_MENU.ID }, true);
|
||||
public static final UniqueKey<SysOrgRecord> SYS_ORG_PKEY1 = Internal.createUniqueKey(SysOrg.SYS_ORG, DSL.name("sys_org_pkey1"), new TableField[] { SysOrg.SYS_ORG.ID }, true);
|
||||
public static final UniqueKey<SysRoleRecord> SYS_ROLE_PKEY = Internal.createUniqueKey(SysRole.SYS_ROLE, DSL.name("sys_role_pkey"), new TableField[] { SysRole.SYS_ROLE.ID }, true);
|
||||
public static final UniqueKey<SysRoleMenuRecord> SYS_ROLE_MENU_PKEY = Internal.createUniqueKey(SysRoleMenu.SYS_ROLE_MENU, DSL.name("sys_role_menu_pkey"), new TableField[] { SysRoleMenu.SYS_ROLE_MENU.ID }, true);
|
||||
public static final UniqueKey<SysRoleMenuRecord> SYS_ROLE_MENU_ROLEID_RESID_KEY = Internal.createUniqueKey(SysRoleMenu.SYS_ROLE_MENU, DSL.name("sys_role_menu_roleid_resid_key"), new TableField[] { SysRoleMenu.SYS_ROLE_MENU.ROLEID, SysRoleMenu.SYS_ROLE_MENU.MENUID }, true);
|
||||
public static final UniqueKey<SysRoleSignRecord> SYS_ROLE_SIGN_PKEY = Internal.createUniqueKey(SysRoleSign.SYS_ROLE_SIGN, DSL.name("sys_role_sign_pkey"), new TableField[] { SysRoleSign.SYS_ROLE_SIGN.ID }, true);
|
||||
public static final UniqueKey<SysRoleUrlRecord> SYS_ROLE_URL_PKEY = Internal.createUniqueKey(SysRoleUrl.SYS_ROLE_URL, DSL.name("sys_role_url_pkey"), new TableField[] { SysRoleUrl.SYS_ROLE_URL.ID }, true);
|
||||
public static final UniqueKey<SysUrlsRecord> SYS_URLS_PKEY = Internal.createUniqueKey(SysUrls.SYS_URLS, DSL.name("sys_urls_pkey"), new TableField[] { SysUrls.SYS_URLS.ID }, true);
|
||||
public static final UniqueKey<SysUrlsRecord> SYS_URLS_URL_KEY = Internal.createUniqueKey(SysUrls.SYS_URLS, DSL.name("sys_urls_url_key"), new TableField[] { SysUrls.SYS_URLS.URL }, true);
|
||||
}
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jj.tech.paolu.repository.jooq.tables.ArchiveSynLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateApply;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateApplyRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateDetail;
|
||||
import jj.tech.paolu.repository.jooq.tables.DecryptLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.DownloadLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApply;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyCheckRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDirectoryDocs;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDocs;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDownloadRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.Project;
|
||||
import jj.tech.paolu.repository.jooq.tables.ReadLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.SharedRuleConfig;
|
||||
import jj.tech.paolu.repository.jooq.tables.SharedSynAll;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectory;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectoryFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdmin;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdminRole;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdminWeid;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysArea;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysConfig;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysMenu;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysOrg;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRole;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleMenu;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleSign;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleUrl;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysUrls;
|
||||
|
||||
import org.jooq.Catalog;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.impl.SchemaImpl;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Public extends SchemaImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>public</code>
|
||||
*/
|
||||
public static final Public PUBLIC = new Public();
|
||||
|
||||
/**
|
||||
* 从电子档案系统同步档案目录数据的过程日志
|
||||
*/
|
||||
public final ArchiveSynLog ARCHIVE_SYN_LOG = ArchiveSynLog.ARCHIVE_SYN_LOG;
|
||||
|
||||
/**
|
||||
* The table <code>public.certificate_apply</code>.
|
||||
*/
|
||||
public final CertificateApply CERTIFICATE_APPLY = CertificateApply.CERTIFICATE_APPLY;
|
||||
|
||||
/**
|
||||
* The table <code>public.certificate_apply_record</code>.
|
||||
*/
|
||||
public final CertificateApplyRecord CERTIFICATE_APPLY_RECORD = CertificateApplyRecord.CERTIFICATE_APPLY_RECORD;
|
||||
|
||||
/**
|
||||
* The table <code>public.certificate_detail</code>.
|
||||
*/
|
||||
public final CertificateDetail CERTIFICATE_DETAIL = CertificateDetail.CERTIFICATE_DETAIL;
|
||||
|
||||
/**
|
||||
* 解密情况
|
||||
*/
|
||||
public final DecryptLog DECRYPT_LOG = DecryptLog.DECRYPT_LOG;
|
||||
|
||||
/**
|
||||
* 下载行为记录
|
||||
*/
|
||||
public final DownloadLog DOWNLOAD_LOG = DownloadLog.DOWNLOAD_LOG;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply</code>.
|
||||
*/
|
||||
public final FilesApply FILES_APPLY = FilesApply.FILES_APPLY;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_check_record</code>.
|
||||
*/
|
||||
public final FilesApplyCheckRecord FILES_APPLY_CHECK_RECORD = FilesApplyCheckRecord.FILES_APPLY_CHECK_RECORD;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_directory_docs</code>.
|
||||
*/
|
||||
public final FilesApplyDirectoryDocs FILES_APPLY_DIRECTORY_DOCS = FilesApplyDirectoryDocs.FILES_APPLY_DIRECTORY_DOCS;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_docs</code>.
|
||||
*/
|
||||
public final FilesApplyDocs FILES_APPLY_DOCS = FilesApplyDocs.FILES_APPLY_DOCS;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_download_record</code>.
|
||||
*/
|
||||
public final FilesApplyDownloadRecord FILES_APPLY_DOWNLOAD_RECORD = FilesApplyDownloadRecord.FILES_APPLY_DOWNLOAD_RECORD;
|
||||
|
||||
/**
|
||||
* The table <code>public.project</code>.
|
||||
*/
|
||||
public final Project PROJECT = Project.PROJECT;
|
||||
|
||||
/**
|
||||
* 阅读情况
|
||||
*/
|
||||
public final ReadLog READ_LOG = ReadLog.READ_LOG;
|
||||
|
||||
/**
|
||||
* The table <code>public.shared_rule_config</code>.
|
||||
*/
|
||||
public final SharedRuleConfig SHARED_RULE_CONFIG = SharedRuleConfig.SHARED_RULE_CONFIG;
|
||||
|
||||
/**
|
||||
* The table <code>public.shared_syn_all</code>.
|
||||
*/
|
||||
public final SharedSynAll SHARED_SYN_ALL = SharedSynAll.SHARED_SYN_ALL;
|
||||
|
||||
/**
|
||||
* The table <code>public.syn_directory</code>.
|
||||
*/
|
||||
public final SynDirectory SYN_DIRECTORY = SynDirectory.SYN_DIRECTORY;
|
||||
|
||||
/**
|
||||
* The table <code>public.syn_directory_file</code>.
|
||||
*/
|
||||
public final SynDirectoryFile SYN_DIRECTORY_FILE = SynDirectoryFile.SYN_DIRECTORY_FILE;
|
||||
|
||||
/**
|
||||
* The table <code>public.syn_file</code>.
|
||||
*/
|
||||
public final SynFile SYN_FILE = SynFile.SYN_FILE;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_admin</code>.
|
||||
*/
|
||||
public final SysAdmin SYS_ADMIN = SysAdmin.SYS_ADMIN;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_admin_role</code>.
|
||||
*/
|
||||
public final SysAdminRole SYS_ADMIN_ROLE = SysAdminRole.SYS_ADMIN_ROLE;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_admin_weid</code>.
|
||||
*/
|
||||
public final SysAdminWeid SYS_ADMIN_WEID = SysAdminWeid.SYS_ADMIN_WEID;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_area</code>.
|
||||
*/
|
||||
public final SysArea SYS_AREA = SysArea.SYS_AREA;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_config</code>.
|
||||
*/
|
||||
public final SysConfig SYS_CONFIG = SysConfig.SYS_CONFIG;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_menu</code>.
|
||||
*/
|
||||
public final SysMenu SYS_MENU = SysMenu.SYS_MENU;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_org</code>.
|
||||
*/
|
||||
public final SysOrg SYS_ORG = SysOrg.SYS_ORG;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role</code>.
|
||||
*/
|
||||
public final SysRole SYS_ROLE = SysRole.SYS_ROLE;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role_menu</code>.
|
||||
*/
|
||||
public final SysRoleMenu SYS_ROLE_MENU = SysRoleMenu.SYS_ROLE_MENU;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role_sign</code>.
|
||||
*/
|
||||
public final SysRoleSign SYS_ROLE_SIGN = SysRoleSign.SYS_ROLE_SIGN;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role_url</code>.
|
||||
*/
|
||||
public final SysRoleUrl SYS_ROLE_URL = SysRoleUrl.SYS_ROLE_URL;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_urls</code>.
|
||||
*/
|
||||
public final SysUrls SYS_URLS = SysUrls.SYS_URLS;
|
||||
|
||||
/**
|
||||
* No further instances allowed
|
||||
*/
|
||||
private Public() {
|
||||
super("public", null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Catalog getCatalog() {
|
||||
return DefaultCatalog.DEFAULT_CATALOG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Table<?>> getTables() {
|
||||
return Arrays.asList(
|
||||
ArchiveSynLog.ARCHIVE_SYN_LOG,
|
||||
CertificateApply.CERTIFICATE_APPLY,
|
||||
CertificateApplyRecord.CERTIFICATE_APPLY_RECORD,
|
||||
CertificateDetail.CERTIFICATE_DETAIL,
|
||||
DecryptLog.DECRYPT_LOG,
|
||||
DownloadLog.DOWNLOAD_LOG,
|
||||
FilesApply.FILES_APPLY,
|
||||
FilesApplyCheckRecord.FILES_APPLY_CHECK_RECORD,
|
||||
FilesApplyDirectoryDocs.FILES_APPLY_DIRECTORY_DOCS,
|
||||
FilesApplyDocs.FILES_APPLY_DOCS,
|
||||
FilesApplyDownloadRecord.FILES_APPLY_DOWNLOAD_RECORD,
|
||||
Project.PROJECT,
|
||||
ReadLog.READ_LOG,
|
||||
SharedRuleConfig.SHARED_RULE_CONFIG,
|
||||
SharedSynAll.SHARED_SYN_ALL,
|
||||
SynDirectory.SYN_DIRECTORY,
|
||||
SynDirectoryFile.SYN_DIRECTORY_FILE,
|
||||
SynFile.SYN_FILE,
|
||||
SysAdmin.SYS_ADMIN,
|
||||
SysAdminRole.SYS_ADMIN_ROLE,
|
||||
SysAdminWeid.SYS_ADMIN_WEID,
|
||||
SysArea.SYS_AREA,
|
||||
SysConfig.SYS_CONFIG,
|
||||
SysMenu.SYS_MENU,
|
||||
SysOrg.SYS_ORG,
|
||||
SysRole.SYS_ROLE,
|
||||
SysRoleMenu.SYS_ROLE_MENU,
|
||||
SysRoleSign.SYS_ROLE_SIGN,
|
||||
SysRoleUrl.SYS_ROLE_URL,
|
||||
SysUrls.SYS_URLS
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq;
|
||||
|
||||
|
||||
import jj.tech.paolu.repository.jooq.tables.ArchiveSynLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateApply;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateApplyRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.CertificateDetail;
|
||||
import jj.tech.paolu.repository.jooq.tables.DecryptLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.DownloadLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApply;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyCheckRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDirectoryDocs;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDocs;
|
||||
import jj.tech.paolu.repository.jooq.tables.FilesApplyDownloadRecord;
|
||||
import jj.tech.paolu.repository.jooq.tables.Project;
|
||||
import jj.tech.paolu.repository.jooq.tables.ReadLog;
|
||||
import jj.tech.paolu.repository.jooq.tables.SharedRuleConfig;
|
||||
import jj.tech.paolu.repository.jooq.tables.SharedSynAll;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectory;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynDirectoryFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SynFile;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdmin;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdminRole;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysAdminWeid;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysArea;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysConfig;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysMenu;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysOrg;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRole;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleMenu;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleSign;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysRoleUrl;
|
||||
import jj.tech.paolu.repository.jooq.tables.SysUrls;
|
||||
|
||||
|
||||
/**
|
||||
* Convenience access to all tables in public.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Tables {
|
||||
|
||||
/**
|
||||
* 从电子档案系统同步档案目录数据的过程日志
|
||||
*/
|
||||
public static final ArchiveSynLog ARCHIVE_SYN_LOG = ArchiveSynLog.ARCHIVE_SYN_LOG;
|
||||
|
||||
/**
|
||||
* The table <code>public.certificate_apply</code>.
|
||||
*/
|
||||
public static final CertificateApply CERTIFICATE_APPLY = CertificateApply.CERTIFICATE_APPLY;
|
||||
|
||||
/**
|
||||
* The table <code>public.certificate_apply_record</code>.
|
||||
*/
|
||||
public static final CertificateApplyRecord CERTIFICATE_APPLY_RECORD = CertificateApplyRecord.CERTIFICATE_APPLY_RECORD;
|
||||
|
||||
/**
|
||||
* The table <code>public.certificate_detail</code>.
|
||||
*/
|
||||
public static final CertificateDetail CERTIFICATE_DETAIL = CertificateDetail.CERTIFICATE_DETAIL;
|
||||
|
||||
/**
|
||||
* 解密情况
|
||||
*/
|
||||
public static final DecryptLog DECRYPT_LOG = DecryptLog.DECRYPT_LOG;
|
||||
|
||||
/**
|
||||
* 下载行为记录
|
||||
*/
|
||||
public static final DownloadLog DOWNLOAD_LOG = DownloadLog.DOWNLOAD_LOG;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply</code>.
|
||||
*/
|
||||
public static final FilesApply FILES_APPLY = FilesApply.FILES_APPLY;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_check_record</code>.
|
||||
*/
|
||||
public static final FilesApplyCheckRecord FILES_APPLY_CHECK_RECORD = FilesApplyCheckRecord.FILES_APPLY_CHECK_RECORD;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_directory_docs</code>.
|
||||
*/
|
||||
public static final FilesApplyDirectoryDocs FILES_APPLY_DIRECTORY_DOCS = FilesApplyDirectoryDocs.FILES_APPLY_DIRECTORY_DOCS;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_docs</code>.
|
||||
*/
|
||||
public static final FilesApplyDocs FILES_APPLY_DOCS = FilesApplyDocs.FILES_APPLY_DOCS;
|
||||
|
||||
/**
|
||||
* The table <code>public.files_apply_download_record</code>.
|
||||
*/
|
||||
public static final FilesApplyDownloadRecord FILES_APPLY_DOWNLOAD_RECORD = FilesApplyDownloadRecord.FILES_APPLY_DOWNLOAD_RECORD;
|
||||
|
||||
/**
|
||||
* The table <code>public.project</code>.
|
||||
*/
|
||||
public static final Project PROJECT = Project.PROJECT;
|
||||
|
||||
/**
|
||||
* 阅读情况
|
||||
*/
|
||||
public static final ReadLog READ_LOG = ReadLog.READ_LOG;
|
||||
|
||||
/**
|
||||
* The table <code>public.shared_rule_config</code>.
|
||||
*/
|
||||
public static final SharedRuleConfig SHARED_RULE_CONFIG = SharedRuleConfig.SHARED_RULE_CONFIG;
|
||||
|
||||
/**
|
||||
* The table <code>public.shared_syn_all</code>.
|
||||
*/
|
||||
public static final SharedSynAll SHARED_SYN_ALL = SharedSynAll.SHARED_SYN_ALL;
|
||||
|
||||
/**
|
||||
* The table <code>public.syn_directory</code>.
|
||||
*/
|
||||
public static final SynDirectory SYN_DIRECTORY = SynDirectory.SYN_DIRECTORY;
|
||||
|
||||
/**
|
||||
* The table <code>public.syn_directory_file</code>.
|
||||
*/
|
||||
public static final SynDirectoryFile SYN_DIRECTORY_FILE = SynDirectoryFile.SYN_DIRECTORY_FILE;
|
||||
|
||||
/**
|
||||
* The table <code>public.syn_file</code>.
|
||||
*/
|
||||
public static final SynFile SYN_FILE = SynFile.SYN_FILE;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_admin</code>.
|
||||
*/
|
||||
public static final SysAdmin SYS_ADMIN = SysAdmin.SYS_ADMIN;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_admin_role</code>.
|
||||
*/
|
||||
public static final SysAdminRole SYS_ADMIN_ROLE = SysAdminRole.SYS_ADMIN_ROLE;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_admin_weid</code>.
|
||||
*/
|
||||
public static final SysAdminWeid SYS_ADMIN_WEID = SysAdminWeid.SYS_ADMIN_WEID;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_area</code>.
|
||||
*/
|
||||
public static final SysArea SYS_AREA = SysArea.SYS_AREA;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_config</code>.
|
||||
*/
|
||||
public static final SysConfig SYS_CONFIG = SysConfig.SYS_CONFIG;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_menu</code>.
|
||||
*/
|
||||
public static final SysMenu SYS_MENU = SysMenu.SYS_MENU;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_org</code>.
|
||||
*/
|
||||
public static final SysOrg SYS_ORG = SysOrg.SYS_ORG;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role</code>.
|
||||
*/
|
||||
public static final SysRole SYS_ROLE = SysRole.SYS_ROLE;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role_menu</code>.
|
||||
*/
|
||||
public static final SysRoleMenu SYS_ROLE_MENU = SysRoleMenu.SYS_ROLE_MENU;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role_sign</code>.
|
||||
*/
|
||||
public static final SysRoleSign SYS_ROLE_SIGN = SysRoleSign.SYS_ROLE_SIGN;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_role_url</code>.
|
||||
*/
|
||||
public static final SysRoleUrl SYS_ROLE_URL = SysRoleUrl.SYS_ROLE_URL;
|
||||
|
||||
/**
|
||||
* The table <code>public.sys_urls</code>.
|
||||
*/
|
||||
public static final SysUrls SYS_URLS = SysUrls.SYS_URLS;
|
||||
}
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq.tables;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.function.Function;
|
||||
|
||||
import jj.tech.paolu.repository.jooq.Keys;
|
||||
import jj.tech.paolu.repository.jooq.Public;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.ArchiveSynLogRecord;
|
||||
|
||||
import org.jooq.Field;
|
||||
import org.jooq.ForeignKey;
|
||||
import org.jooq.Function13;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Records;
|
||||
import org.jooq.Row13;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.SelectField;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.TableOptions;
|
||||
import org.jooq.UniqueKey;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.impl.TableImpl;
|
||||
|
||||
|
||||
/**
|
||||
* 从电子档案系统同步档案目录数据的过程日志
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class ArchiveSynLog extends TableImpl<ArchiveSynLogRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>public.archive_syn_log</code>
|
||||
*/
|
||||
public static final ArchiveSynLog ARCHIVE_SYN_LOG = new ArchiveSynLog();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public Class<ArchiveSynLogRecord> getRecordType() {
|
||||
return ArchiveSynLogRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.start_time</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, LocalDateTime> START_TIME = createField(DSL.name("start_time"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.insert_dir_count</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> INSERT_DIR_COUNT = createField(DSL.name("insert_dir_count"), SQLDataType.BIGINT.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.update_dir_count</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> UPDATE_DIR_COUNT = createField(DSL.name("update_dir_count"), SQLDataType.BIGINT.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.insert_dirfile_count</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> INSERT_DIRFILE_COUNT = createField(DSL.name("insert_dirfile_count"), SQLDataType.BIGINT.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.update_dirfile_count</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> UPDATE_DIRFILE_COUNT = createField(DSL.name("update_dirfile_count"), SQLDataType.BIGINT.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.insert_file_count</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> INSERT_FILE_COUNT = createField(DSL.name("insert_file_count"), SQLDataType.BIGINT.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.update_file_count</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> UPDATE_FILE_COUNT = createField(DSL.name("update_file_count"), SQLDataType.BIGINT.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.description</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, String> DESCRIPTION = createField(DSL.name("description"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.run_result</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, String> RUN_RESULT = createField(DSL.name("run_result"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.update_timestamp</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> UPDATE_TIMESTAMP = createField(DSL.name("update_timestamp"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.id</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR.nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.next_update_timestamp</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, Long> NEXT_UPDATE_TIMESTAMP = createField(DSL.name("next_update_timestamp"), SQLDataType.BIGINT, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.archive_syn_log.end_time</code>.
|
||||
*/
|
||||
public final TableField<ArchiveSynLogRecord, LocalDateTime> END_TIME = createField(DSL.name("end_time"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "");
|
||||
|
||||
private ArchiveSynLog(Name alias, Table<ArchiveSynLogRecord> aliased) {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private ArchiveSynLog(Name alias, Table<ArchiveSynLogRecord> aliased, Field<?>[] parameters) {
|
||||
super(alias, null, aliased, parameters, DSL.comment("从电子档案系统同步档案目录数据的过程日志"), TableOptions.table());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.archive_syn_log</code> table reference
|
||||
*/
|
||||
public ArchiveSynLog(String alias) {
|
||||
this(DSL.name(alias), ARCHIVE_SYN_LOG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.archive_syn_log</code> table reference
|
||||
*/
|
||||
public ArchiveSynLog(Name alias) {
|
||||
this(alias, ARCHIVE_SYN_LOG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>public.archive_syn_log</code> table reference
|
||||
*/
|
||||
public ArchiveSynLog() {
|
||||
this(DSL.name("archive_syn_log"), null);
|
||||
}
|
||||
|
||||
public <O extends Record> ArchiveSynLog(Table<O> child, ForeignKey<O, ArchiveSynLogRecord> key) {
|
||||
super(child, key, ARCHIVE_SYN_LOG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema getSchema() {
|
||||
return aliased() ? null : Public.PUBLIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniqueKey<ArchiveSynLogRecord> getPrimaryKey() {
|
||||
return Keys.ARCHIVE_SYN_LOG_PKEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchiveSynLog as(String alias) {
|
||||
return new ArchiveSynLog(DSL.name(alias), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchiveSynLog as(Name alias) {
|
||||
return new ArchiveSynLog(alias, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchiveSynLog as(Table<?> alias) {
|
||||
return new ArchiveSynLog(alias.getQualifiedName(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public ArchiveSynLog rename(String name) {
|
||||
return new ArchiveSynLog(DSL.name(name), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public ArchiveSynLog rename(Name name) {
|
||||
return new ArchiveSynLog(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public ArchiveSynLog rename(Table<?> name) {
|
||||
return new ArchiveSynLog(name.getQualifiedName(), null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row13 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Row13<LocalDateTime, Long, Long, Long, Long, Long, Long, String, String, Long, String, Long, LocalDateTime> fieldsRow() {
|
||||
return (Row13) super.fieldsRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Function13<? super LocalDateTime, ? super Long, ? super Long, ? super Long, ? super Long, ? super Long, ? super Long, ? super String, ? super String, ? super Long, ? super String, ? super Long, ? super LocalDateTime, ? extends U> from) {
|
||||
return convertFrom(Records.mapping(from));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Class,
|
||||
* Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Class<U> toType, Function13<? super LocalDateTime, ? super Long, ? super Long, ? super Long, ? super Long, ? super Long, ? super Long, ? super String, ? super String, ? super Long, ? super String, ? super Long, ? super LocalDateTime, ? extends U> from) {
|
||||
return convertFrom(toType, Records.mapping(from));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq.tables;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import jj.tech.paolu.repository.jooq.Keys;
|
||||
import jj.tech.paolu.repository.jooq.Public;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.CertificateApplyRecord;
|
||||
|
||||
import org.jooq.Field;
|
||||
import org.jooq.ForeignKey;
|
||||
import org.jooq.Function17;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Records;
|
||||
import org.jooq.Row17;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.SelectField;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.TableOptions;
|
||||
import org.jooq.UniqueKey;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.impl.TableImpl;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class CertificateApply extends TableImpl<CertificateApplyRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>public.certificate_apply</code>
|
||||
*/
|
||||
public static final CertificateApply CERTIFICATE_APPLY = new CertificateApply();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public Class<CertificateApplyRecord> getRecordType() {
|
||||
return CertificateApplyRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.is_org</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, Integer> IS_ORG = createField(DSL.name("is_org"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.user_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> USER_ID = createField(DSL.name("user_id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.user_name</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> USER_NAME = createField(DSL.name("user_name"), SQLDataType.VARCHAR(32), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.user_real_name</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> USER_REAL_NAME = createField(DSL.name("user_real_name"), SQLDataType.VARCHAR(32), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.user_phone</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> USER_PHONE = createField(DSL.name("user_phone"), SQLDataType.VARCHAR(32), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.user_org_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> USER_ORG_ID = createField(DSL.name("user_org_id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.user_org_name</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> USER_ORG_NAME = createField(DSL.name("user_org_name"), SQLDataType.VARCHAR(32), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.apply_type</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, Integer> APPLY_TYPE = createField(DSL.name("apply_type"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.status</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, Integer> STATUS = createField(DSL.name("status"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.apply_time</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, LocalDateTime> APPLY_TIME = createField(DSL.name("apply_time"), SQLDataType.LOCALDATETIME(6), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.apply_finish_time</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, LocalDateTime> APPLY_FINISH_TIME = createField(DSL.name("apply_finish_time"), SQLDataType.LOCALDATETIME(6), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.apply_reason</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> APPLY_REASON = createField(DSL.name("apply_reason"), SQLDataType.VARCHAR(255), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.next_check_org_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> NEXT_CHECK_ORG_ID = createField(DSL.name("next_check_org_id"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.end_check_org_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> END_CHECK_ORG_ID = createField(DSL.name("end_check_org_id"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.cer_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> CER_ID = createField(DSL.name("cer_id"), SQLDataType.VARCHAR(32), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply.company_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecord, String> COMPANY_ID = createField(DSL.name("company_id"), SQLDataType.VARCHAR(32).defaultValue(DSL.field(DSL.raw("NULL::character varying"), SQLDataType.VARCHAR)), this, "");
|
||||
|
||||
private CertificateApply(Name alias, Table<CertificateApplyRecord> aliased) {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private CertificateApply(Name alias, Table<CertificateApplyRecord> aliased, Field<?>[] parameters) {
|
||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.certificate_apply</code> table reference
|
||||
*/
|
||||
public CertificateApply(String alias) {
|
||||
this(DSL.name(alias), CERTIFICATE_APPLY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.certificate_apply</code> table reference
|
||||
*/
|
||||
public CertificateApply(Name alias) {
|
||||
this(alias, CERTIFICATE_APPLY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>public.certificate_apply</code> table reference
|
||||
*/
|
||||
public CertificateApply() {
|
||||
this(DSL.name("certificate_apply"), null);
|
||||
}
|
||||
|
||||
public <O extends Record> CertificateApply(Table<O> child, ForeignKey<O, CertificateApplyRecord> key) {
|
||||
super(child, key, CERTIFICATE_APPLY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema getSchema() {
|
||||
return aliased() ? null : Public.PUBLIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniqueKey<CertificateApplyRecord> getPrimaryKey() {
|
||||
return Keys.CERTIFICATE_APPLY_PKEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UniqueKey<CertificateApplyRecord>> getUniqueKeys() {
|
||||
return Arrays.asList(Keys.CERTIFICATE_APPLY_CER_ID_KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateApply as(String alias) {
|
||||
return new CertificateApply(DSL.name(alias), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateApply as(Name alias) {
|
||||
return new CertificateApply(alias, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateApply as(Table<?> alias) {
|
||||
return new CertificateApply(alias.getQualifiedName(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateApply rename(String name) {
|
||||
return new CertificateApply(DSL.name(name), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateApply rename(Name name) {
|
||||
return new CertificateApply(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateApply rename(Table<?> name) {
|
||||
return new CertificateApply(name.getQualifiedName(), null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row17 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Row17<String, Integer, String, String, String, String, String, String, Integer, Integer, LocalDateTime, LocalDateTime, String, String, String, String, String> fieldsRow() {
|
||||
return (Row17) super.fieldsRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Function17<? super String, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super Integer, ? super Integer, ? super LocalDateTime, ? super LocalDateTime, ? super String, ? super String, ? super String, ? super String, ? super String, ? extends U> from) {
|
||||
return convertFrom(Records.mapping(from));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Class,
|
||||
* Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Class<U> toType, Function17<? super String, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super Integer, ? super Integer, ? super LocalDateTime, ? super LocalDateTime, ? super String, ? super String, ? super String, ? super String, ? super String, ? extends U> from) {
|
||||
return convertFrom(toType, Records.mapping(from));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq.tables;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.function.Function;
|
||||
|
||||
import jj.tech.paolu.repository.jooq.Keys;
|
||||
import jj.tech.paolu.repository.jooq.Public;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.CertificateApplyRecordRecord;
|
||||
|
||||
import org.jooq.Field;
|
||||
import org.jooq.ForeignKey;
|
||||
import org.jooq.Function15;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Records;
|
||||
import org.jooq.Row15;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.SelectField;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.TableOptions;
|
||||
import org.jooq.UniqueKey;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.impl.TableImpl;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class CertificateApplyRecord extends TableImpl<CertificateApplyRecordRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>public.certificate_apply_record</code>
|
||||
*/
|
||||
public static final CertificateApplyRecord CERTIFICATE_APPLY_RECORD = new CertificateApplyRecord();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public Class<CertificateApplyRecordRecord> getRecordType() {
|
||||
return CertificateApplyRecordRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>public.certificate_apply_record.certificate_apply_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CERTIFICATE_APPLY_ID = createField(DSL.name("certificate_apply_id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>public.certificate_apply_record.certificate_apply_user_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CERTIFICATE_APPLY_USER_ID = createField(DSL.name("certificate_apply_user_id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>public.certificate_apply_record.certificate_apply_user_org_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CERTIFICATE_APPLY_USER_ORG_ID = createField(DSL.name("certificate_apply_user_org_id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.is_org</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, Integer> IS_ORG = createField(DSL.name("is_org"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.apply_type</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, Integer> APPLY_TYPE = createField(DSL.name("apply_type"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.check_user_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CHECK_USER_ID = createField(DSL.name("check_user_id"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.check_user_name</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CHECK_USER_NAME = createField(DSL.name("check_user_name"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.check_org_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CHECK_ORG_ID = createField(DSL.name("check_org_id"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.check_org_name</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CHECK_ORG_NAME = createField(DSL.name("check_org_name"), SQLDataType.VARCHAR, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.check_describe</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> CHECK_DESCRIBE = createField(DSL.name("check_describe"), SQLDataType.VARCHAR(255), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.check_status</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, Integer> CHECK_STATUS = createField(DSL.name("check_status"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("1"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_apply_record.check_time</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, LocalDateTime> CHECK_TIME = createField(DSL.name("check_time"), SQLDataType.LOCALDATETIME(6), this, "");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>public.certificate_apply_record.next_check_org_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> NEXT_CHECK_ORG_ID = createField(DSL.name("next_check_org_id"), SQLDataType.VARCHAR(32), this, "");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>public.certificate_apply_record.next_check_org_name</code>.
|
||||
*/
|
||||
public final TableField<CertificateApplyRecordRecord, String> NEXT_CHECK_ORG_NAME = createField(DSL.name("next_check_org_name"), SQLDataType.VARCHAR(32), this, "");
|
||||
|
||||
private CertificateApplyRecord(Name alias, Table<CertificateApplyRecordRecord> aliased) {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private CertificateApplyRecord(Name alias, Table<CertificateApplyRecordRecord> aliased, Field<?>[] parameters) {
|
||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.certificate_apply_record</code> table
|
||||
* reference
|
||||
*/
|
||||
public CertificateApplyRecord(String alias) {
|
||||
this(DSL.name(alias), CERTIFICATE_APPLY_RECORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.certificate_apply_record</code> table
|
||||
* reference
|
||||
*/
|
||||
public CertificateApplyRecord(Name alias) {
|
||||
this(alias, CERTIFICATE_APPLY_RECORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>public.certificate_apply_record</code> table reference
|
||||
*/
|
||||
public CertificateApplyRecord() {
|
||||
this(DSL.name("certificate_apply_record"), null);
|
||||
}
|
||||
|
||||
public <O extends Record> CertificateApplyRecord(Table<O> child, ForeignKey<O, CertificateApplyRecordRecord> key) {
|
||||
super(child, key, CERTIFICATE_APPLY_RECORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema getSchema() {
|
||||
return aliased() ? null : Public.PUBLIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniqueKey<CertificateApplyRecordRecord> getPrimaryKey() {
|
||||
return Keys.CERTIFICATE_APPLY_RECORD_PKEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateApplyRecord as(String alias) {
|
||||
return new CertificateApplyRecord(DSL.name(alias), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateApplyRecord as(Name alias) {
|
||||
return new CertificateApplyRecord(alias, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateApplyRecord as(Table<?> alias) {
|
||||
return new CertificateApplyRecord(alias.getQualifiedName(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateApplyRecord rename(String name) {
|
||||
return new CertificateApplyRecord(DSL.name(name), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateApplyRecord rename(Name name) {
|
||||
return new CertificateApplyRecord(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateApplyRecord rename(Table<?> name) {
|
||||
return new CertificateApplyRecord(name.getQualifiedName(), null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row15 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Row15<String, String, String, String, Integer, Integer, String, String, String, String, String, Integer, LocalDateTime, String, String> fieldsRow() {
|
||||
return (Row15) super.fieldsRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Function15<? super String, ? super String, ? super String, ? super String, ? super Integer, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super String, ? super Integer, ? super LocalDateTime, ? super String, ? super String, ? extends U> from) {
|
||||
return convertFrom(Records.mapping(from));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Class,
|
||||
* Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Class<U> toType, Function15<? super String, ? super String, ? super String, ? super String, ? super Integer, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super String, ? super Integer, ? super LocalDateTime, ? super String, ? super String, ? extends U> from) {
|
||||
return convertFrom(toType, Records.mapping(from));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package jj.tech.paolu.repository.jooq.tables;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.function.Function;
|
||||
|
||||
import jj.tech.paolu.repository.jooq.Keys;
|
||||
import jj.tech.paolu.repository.jooq.Public;
|
||||
import jj.tech.paolu.repository.jooq.tables.records.CertificateDetailRecord;
|
||||
|
||||
import org.jooq.Field;
|
||||
import org.jooq.ForeignKey;
|
||||
import org.jooq.Function14;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Records;
|
||||
import org.jooq.Row14;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.SelectField;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.TableOptions;
|
||||
import org.jooq.UniqueKey;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.impl.TableImpl;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class CertificateDetail extends TableImpl<CertificateDetailRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>public.certificate_detail</code>
|
||||
*/
|
||||
public static final CertificateDetail CERTIFICATE_DETAIL = new CertificateDetail();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public Class<CertificateDetailRecord> getRecordType() {
|
||||
return CertificateDetailRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.id</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.certificate_apply_id</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> CERTIFICATE_APPLY_ID = createField(DSL.name("certificate_apply_id"), SQLDataType.VARCHAR(32).nullable(false), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.work_start_time</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, LocalDateTime> WORK_START_TIME = createField(DSL.name("work_start_time"), SQLDataType.LOCALDATETIME(6), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.work_end_time</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, LocalDateTime> WORK_END_TIME = createField(DSL.name("work_end_time"), SQLDataType.LOCALDATETIME(6), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.status</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, Integer> STATUS = createField(DSL.name("status"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.cert_file_content</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> CERT_FILE_CONTENT = createField(DSL.name("cert_file_content"), SQLDataType.VARCHAR(2048), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.is_up_chain</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, Integer> IS_UP_CHAIN = createField(DSL.name("is_up_chain"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.weid</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> WEID = createField(DSL.name("weid"), SQLDataType.VARCHAR(64), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.private_key_hex_str</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> PRIVATE_KEY_HEX_STR = createField(DSL.name("private_key_hex_str"), SQLDataType.VARCHAR(128), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.x509_serial_number</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> X509_SERIAL_NUMBER = createField(DSL.name("x509_serial_number"), SQLDataType.VARCHAR(256), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.x509_subject</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> X509_SUBJECT = createField(DSL.name("x509_subject"), SQLDataType.VARCHAR(256), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.x509_issuer</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> X509_ISSUER = createField(DSL.name("x509_issuer"), SQLDataType.VARCHAR(256), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.x509_public_key</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> X509_PUBLIC_KEY = createField(DSL.name("x509_public_key"), SQLDataType.VARCHAR(256), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.certificate_detail.x509_sig_alg_name</code>.
|
||||
*/
|
||||
public final TableField<CertificateDetailRecord, String> X509_SIG_ALG_NAME = createField(DSL.name("x509_sig_alg_name"), SQLDataType.VARCHAR(256), this, "");
|
||||
|
||||
private CertificateDetail(Name alias, Table<CertificateDetailRecord> aliased) {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private CertificateDetail(Name alias, Table<CertificateDetailRecord> aliased, Field<?>[] parameters) {
|
||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.certificate_detail</code> table reference
|
||||
*/
|
||||
public CertificateDetail(String alias) {
|
||||
this(DSL.name(alias), CERTIFICATE_DETAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.certificate_detail</code> table reference
|
||||
*/
|
||||
public CertificateDetail(Name alias) {
|
||||
this(alias, CERTIFICATE_DETAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>public.certificate_detail</code> table reference
|
||||
*/
|
||||
public CertificateDetail() {
|
||||
this(DSL.name("certificate_detail"), null);
|
||||
}
|
||||
|
||||
public <O extends Record> CertificateDetail(Table<O> child, ForeignKey<O, CertificateDetailRecord> key) {
|
||||
super(child, key, CERTIFICATE_DETAIL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema getSchema() {
|
||||
return aliased() ? null : Public.PUBLIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniqueKey<CertificateDetailRecord> getPrimaryKey() {
|
||||
return Keys.CERTIFICATE_DETAIL_PKEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateDetail as(String alias) {
|
||||
return new CertificateDetail(DSL.name(alias), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateDetail as(Name alias) {
|
||||
return new CertificateDetail(alias, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CertificateDetail as(Table<?> alias) {
|
||||
return new CertificateDetail(alias.getQualifiedName(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateDetail rename(String name) {
|
||||
return new CertificateDetail(DSL.name(name), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateDetail rename(Name name) {
|
||||
return new CertificateDetail(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public CertificateDetail rename(Table<?> name) {
|
||||
return new CertificateDetail(name.getQualifiedName(), null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row14 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Row14<String, String, LocalDateTime, LocalDateTime, Integer, String, Integer, String, String, String, String, String, String, String> fieldsRow() {
|
||||
return (Row14) super.fieldsRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Function14<? super String, ? super String, ? super LocalDateTime, ? super LocalDateTime, ? super Integer, ? super String, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? extends U> from) {
|
||||
return convertFrom(Records.mapping(from));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Class,
|
||||
* Function)}.
|
||||
*/
|
||||
public <U> SelectField<U> mapping(Class<U> toType, Function14<? super String, ? super String, ? super LocalDateTime, ? super LocalDateTime, ? super Integer, ? super String, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? super String, ? extends U> from) {
|
||||
return convertFrom(toType, Records.mapping(from));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user