xushili hace 2 años
commit
000d70fb12
Se han modificado 27 ficheros con 1385 adiciones y 0 borrados
  1. 37 0
      .gitignore
  2. 36 0
      build.gradle.kts
  3. BIN
      gradle/wrapper/gradle-wrapper.jar
  4. 5 0
      gradle/wrapper/gradle-wrapper.properties
  5. 240 0
      gradlew
  6. 91 0
      gradlew.bat
  7. 1 0
      settings.gradle.kts
  8. 15 0
      src/main/java/com/gyee/table/TableApp.java
  9. 48 0
      src/main/java/com/gyee/table/config/WebMvcConfig.java
  10. 52 0
      src/main/java/com/gyee/table/controller/TableHeaderController.java
  11. 204 0
      src/main/java/com/gyee/table/entity/TableHeader.java
  12. 240 0
      src/main/java/com/gyee/table/entity/TableHeaderColumn.java
  13. 19 0
      src/main/java/com/gyee/table/mapper/ObjectAllMapper.java
  14. 16 0
      src/main/java/com/gyee/table/mapper/TableHeaderColumnMapper.java
  15. 16 0
      src/main/java/com/gyee/table/mapper/TableHeaderMapper.java
  16. 13 0
      src/main/java/com/gyee/table/service/IObjectService.java
  17. 16 0
      src/main/java/com/gyee/table/service/ITableHeaderColumnService.java
  18. 20 0
      src/main/java/com/gyee/table/service/ITableHeaderService.java
  19. 16 0
      src/main/java/com/gyee/table/service/impl/ObjectServiceImpl.java
  20. 20 0
      src/main/java/com/gyee/table/service/impl/TableHeaderColumnServiceImpl.java
  21. 84 0
      src/main/java/com/gyee/table/service/impl/TableHeaderServiceImpl.java
  22. 151 0
      src/main/java/com/gyee/table/utils/IdWorker.java
  23. 14 0
      src/main/resources/application.yml
  24. 8 0
      src/main/resources/mappers/ObjectAllMapper.xml
  25. 5 0
      src/main/resources/mappers/TableHeaderColumnMapper.xml
  26. 5 0
      src/main/resources/mappers/TableHeaderMapper.xml
  27. 13 0
      src/test/java/com/gyee/table/TableApplicationTests.java

+ 37 - 0
.gitignore

@@ -0,0 +1,37 @@
+HELP.md
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/

+ 36 - 0
build.gradle.kts

@@ -0,0 +1,36 @@
+plugins {
+    java
+    id("org.springframework.boot") version "2.7.7"
+    id("io.spring.dependency-management") version "1.0.15.RELEASE"
+}
+
+group = "com.gyee"
+version = "0.0.1"
+java.sourceCompatibility = JavaVersion.VERSION_1_8
+
+configurations {
+    compileOnly {
+        extendsFrom(configurations.annotationProcessor.get())
+    }
+}
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    implementation("org.springframework.boot:spring-boot-starter")
+    compileOnly("org.projectlombok:lombok")
+    annotationProcessor("org.projectlombok:lombok")
+    testImplementation("org.springframework.boot:spring-boot-starter-test")
+
+    implementation("com.baomidou:mybatis-plus-boot-starter:3.5.3.1")
+    implementation("org.springframework.boot:spring-boot-starter-web")
+    implementation("com.alibaba:druid-spring-boot-starter:1.2.15")
+    implementation("mysql:mysql-connector-java:8.0.31")
+    implementation("com.alibaba.fastjson2:fastjson2:2.0.22")
+}
+
+tasks.withType<Test> {
+    useJUnitPlatform()
+}

BIN
gradle/wrapper/gradle-wrapper.jar


+ 5 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 240 - 0
gradlew

@@ -0,0 +1,240 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+#   Gradle start up script for POSIX generated by Gradle.
+#
+#   Important for running:
+#
+#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+#       noncompliant, but you have some other compliant shell such as ksh or
+#       bash, then to run this script, type that shell name before the whole
+#       command line, like:
+#
+#           ksh Gradle
+#
+#       Busybox and similar reduced shells will NOT work, because this script
+#       requires all of these POSIX shell features:
+#         * functions;
+#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+#         * compound commands having a testable exit status, especially «case»;
+#         * various built-in commands including «command», «set», and «ulimit».
+#
+#   Important for patching:
+#
+#   (2) This script targets any POSIX shell, so it avoids extensions provided
+#       by Bash, Ksh, etc; in particular arrays are avoided.
+#
+#       The "traditional" practice of packing multiple parameters into a
+#       space-separated string is a well documented source of bugs and security
+#       problems, so this is (mostly) avoided, by progressively accumulating
+#       options in "$@", and eventually passing that to Java.
+#
+#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+#       see the in-line comments for details.
+#
+#       There are tweaks for specific operating systems such as AIX, CygWin,
+#       Darwin, MinGW, and NonStop.
+#
+#   (3) This script is generated from the Groovy template
+#       https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+#       within the Gradle project.
+#
+#       You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+    APP_HOME=${app_path%"${app_path##*/}"}  # leaves a trailing /; empty if no leading path
+    [ -h "$app_path" ]
+do
+    ls=$( ls -ld "$app_path" )
+    link=${ls#*' -> '}
+    case $link in             #(
+      /*)   app_path=$link ;; #(
+      *)    app_path=$APP_HOME$link ;;
+    esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+    echo "$*"
+} >&2
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in                #(
+  CYGWIN* )         cygwin=true  ;; #(
+  Darwin* )         darwin=true  ;; #(
+  MSYS* | MINGW* )  msys=true    ;; #(
+  NONSTOP* )        nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD=$JAVA_HOME/jre/sh/java
+    else
+        JAVACMD=$JAVA_HOME/bin/java
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD=java
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+    case $MAX_FD in #(
+      max*)
+        MAX_FD=$( ulimit -H -n ) ||
+            warn "Could not query maximum file descriptor limit"
+    esac
+    case $MAX_FD in  #(
+      '' | soft) :;; #(
+      *)
+        ulimit -n "$MAX_FD" ||
+            warn "Could not set maximum file descriptor limit to $MAX_FD"
+    esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+#   * args from the command line
+#   * the main class name
+#   * -classpath
+#   * -D...appname settings
+#   * --module-path (only if needed)
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+    APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+    CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+    JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    for arg do
+        if
+            case $arg in                                #(
+              -*)   false ;;                            # don't mess with options #(
+              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath
+                    [ -e "$t" ] ;;                      #(
+              *)    false ;;
+            esac
+        then
+            arg=$( cygpath --path --ignore --mixed "$arg" )
+        fi
+        # Roll the args list around exactly as many times as the number of
+        # args, so each arg winds up back in the position where it started, but
+        # possibly modified.
+        #
+        # NB: a `for` loop captures its iteration list before it begins, so
+        # changing the positional parameters here affects neither the number of
+        # iterations, nor the values presented in `arg`.
+        shift                   # remove old arg
+        set -- "$@" "$arg"      # push replacement arg
+    done
+fi
+
+# Collect all arguments for the java command;
+#   * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+#     shell script including quotes and variable substitutions, so put them in
+#     double quotes to make sure that they get re-expanded; and
+#   * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+        "-Dorg.gradle.appname=$APP_BASE_NAME" \
+        -classpath "$CLASSPATH" \
+        org.gradle.wrapper.GradleWrapperMain \
+        "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+    die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+#   readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+#   set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+        printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+        xargs -n1 |
+        sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+        tr '\n' ' '
+    )" '"$@"'
+
+exec "$JAVACMD" "$@"

+ 91 - 0
gradlew.bat

@@ -0,0 +1,91 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 1 - 0
settings.gradle.kts

@@ -0,0 +1 @@
+rootProject.name = "table"

+ 15 - 0
src/main/java/com/gyee/table/TableApp.java

@@ -0,0 +1,15 @@
+package com.gyee.table;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@MapperScan("com.gyee.table.mapper")
+public class TableApp {
+
+    public static void main(String[] args) {
+        SpringApplication.run(TableApp.class, args);
+    }
+
+}

+ 48 - 0
src/main/java/com/gyee/table/config/WebMvcConfig.java

@@ -0,0 +1,48 @@
+package com.gyee.table.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.nio.charset.Charset;
+import java.util.List;
+
+/**
+ * 拦截器
+ */
+@Configuration
+public class WebMvcConfig implements  WebMvcConfigurer  {
+
+	/** 解决跨域问题 **/
+	@Override
+	public void addCorsMappings(CorsRegistry registry){
+		// 设置允许跨域的路由
+        registry.addMapping("/**")
+			// 设置允许跨域请求的域名
+			.allowedOriginPatterns("*")
+			// 是否允许证书
+			.allowCredentials(true)
+			// 设置允许的方法
+			.allowedMethods("GET", "POST", "DELETE", "PUT")
+			// 设置允许的header属性
+			.allowedHeaders("*")
+				// 跨域允许时间
+			.maxAge(3600);
+	}
+
+	/*@Override
+	public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+		//解决中文乱码
+		StringHttpMessageConverter converter1 = new StringHttpMessageConverter(Charset.forName("UTF-8"));
+		converters.add(converter1);
+		//解决 添加解决中文乱码后 上述配置之后,返回json数据直接报错 500:no convertter for return value of type
+		MappingJackson2HttpMessageConverter converter2 = new MappingJackson2HttpMessageConverter();
+		converter2.setObjectMapper(new ObjectMapper());
+		converters.add(converter2);
+		WebMvcConfigurer.super.configureMessageConverters(converters);
+	}*/
+}

+ 52 - 0
src/main/java/com/gyee/table/controller/TableHeaderController.java

@@ -0,0 +1,52 @@
+package com.gyee.table.controller;
+
+import com.gyee.table.entity.TableHeaderColumn;
+import com.gyee.table.mapper.ObjectAllMapper;
+import com.gyee.table.service.ITableHeaderColumnService;
+import com.gyee.table.service.ITableHeaderService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-11
+ */
+@RestController
+@RequestMapping("/table")
+public class TableHeaderController {
+
+    @Resource
+    private ITableHeaderService tableHeaderService;
+    @Resource
+    private ITableHeaderColumnService tableHeaderColumnService;
+    @Resource
+    private ObjectAllMapper objectMapper;
+
+    @GetMapping("/header/{headername}")
+    private List<TableHeaderColumn> header(@PathVariable String headername){
+        List<TableHeaderColumn> header = tableHeaderService.getHeader(headername);
+        //tableHeaderColumnService.saveBatch(header);
+        return header;
+    }
+    @PostMapping("/data")
+    private List<LinkedHashMap<String, Object>> getData(@RequestBody Map map){
+        String sql = (String) map.get("sql");
+        List<LinkedHashMap<String, Object>> lm = objectMapper.selectAll(sql);
+        System.out.println();
+        return lm;
+    }
+
+    @GetMapping("/test")
+    private List<TableHeaderColumn> test(){
+        List<TableHeaderColumn> list = tableHeaderColumnService.list();
+        return list;
+    }
+}

+ 204 - 0
src/main/java/com/gyee/table/entity/TableHeader.java

@@ -0,0 +1,204 @@
+package com.gyee.table.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-11
+ */
+@TableName("table_header")
+public class TableHeader implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "tid", type = IdType.AUTO)
+    private Integer tid;
+
+    private String name;
+
+    private Long id;
+
+    private String type;
+
+    private String label;
+
+    private Short width;
+
+    private Short minwidth;
+
+    private String prop;
+
+    private String align;
+
+    private Boolean showoverflowtooltip;
+
+    private Boolean sortable;
+
+    private String operations;
+
+    private String children;
+
+    private Boolean showfilters;
+
+    private String filterstype;
+
+    private String filters;
+
+    public Integer getTid() {
+        return tid;
+    }
+
+    public void setTid(Integer tid) {
+        this.tid = tid;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public Short getWidth() {
+        return width;
+    }
+
+    public void setWidth(Short width) {
+        this.width = width;
+    }
+
+    public Short getMinwidth() {
+        return minwidth;
+    }
+
+    public void setMinwidth(Short minwidth) {
+        this.minwidth = minwidth;
+    }
+
+    public String getProp() {
+        return prop;
+    }
+
+    public void setProp(String prop) {
+        this.prop = prop;
+    }
+
+    public String getAlign() {
+        return align;
+    }
+
+    public void setAlign(String align) {
+        this.align = align;
+    }
+
+    public Boolean getShowoverflowtooltip() {
+        return showoverflowtooltip;
+    }
+
+    public void setShowoverflowtooltip(Boolean showoverflowtooltip) {
+        this.showoverflowtooltip = showoverflowtooltip;
+    }
+
+    public Boolean getSortable() {
+        return sortable;
+    }
+
+    public void setSortable(Boolean sortable) {
+        this.sortable = sortable;
+    }
+
+    public String getOperations() {
+        return operations;
+    }
+
+    public void setOperations(String operations) {
+        this.operations = operations;
+    }
+
+    public String getChildren() {
+        return children;
+    }
+
+    public void setChildren(String children) {
+        this.children = children;
+    }
+
+    public Boolean getShowfilters() {
+        return showfilters;
+    }
+
+    public void setShowfilters(Boolean showfilters) {
+        this.showfilters = showfilters;
+    }
+
+    public String getFilterstype() {
+        return filterstype;
+    }
+
+    public void setFilterstype(String filterstype) {
+        this.filterstype = filterstype;
+    }
+
+    public String getFilters() {
+        return filters;
+    }
+
+    public void setFilters(String filters) {
+        this.filters = filters;
+    }
+
+    @Override
+    public String toString() {
+        return "TableHeader{" +
+            "tid = " + tid +
+            ", name = " + name +
+            ", id = " + id +
+            ", type = " + type +
+            ", label = " + label +
+            ", width = " + width +
+            ", minwidth = " + minwidth +
+            ", prop = " + prop +
+            ", align = " + align +
+            ", showoverflowtooltip = " + showoverflowtooltip +
+            ", sortable = " + sortable +
+            ", operations = " + operations +
+            ", children = " + children +
+            ", showfilters = " + showfilters +
+            ", filterstype = " + filterstype +
+            ", filters = " + filters +
+        "}";
+    }
+}

+ 240 - 0
src/main/java/com/gyee/table/entity/TableHeaderColumn.java

@@ -0,0 +1,240 @@
+package com.gyee.table.entity;
+
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonRawValue;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-12
+ */
+@TableName("table_header_column")
+public class TableHeaderColumn implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(type = IdType.ASSIGN_ID)
+    private String id;
+
+    private String type;
+
+    private String label;
+
+    private String width;
+
+    private String minwidth;
+
+    private String prop;
+
+    private String align;
+
+    private Boolean showoverflowtooltip;
+
+    private Boolean sortable;
+
+    @TableField(exist = false)
+    private String[] operations;
+
+    @TableField(exist = false)
+    private String[] children;
+
+    private Boolean showfilters;
+
+    private String filterstype;
+
+    @TableField(exist = false)
+    private String[] filters;
+
+    private String formattype;
+
+    @TableField(exist = false)
+    private String[] format;
+
+    @JsonIgnore
+    private String operationstr;
+
+    @JsonIgnore
+    private String childrenstr;
+
+    @JsonIgnore
+    private String filterstr;
+
+    @JsonIgnore
+    private String formatstr;
+
+    @JsonIgnore
+    @TableField(exist = false)
+    private ObjectMapper mapper = new ObjectMapper();
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getWidth() {
+        return width;
+    }
+
+    public void setWidth(String width) {
+        this.width = width;
+    }
+
+    public String getMinwidth() {
+        return minwidth;
+    }
+
+    public void setMinwidth(String minwidth) {
+        this.minwidth = minwidth;
+    }
+
+    public String getProp() {
+        return prop;
+    }
+
+    public void setProp(String prop) {
+        this.prop = prop;
+    }
+
+    public String getAlign() {
+        return align;
+    }
+
+    public void setAlign(String align) {
+        this.align = align;
+    }
+
+    public Boolean getShowoverflowtooltip() {
+        return showoverflowtooltip;
+    }
+
+    public void setShowoverflowtooltip(Boolean showoverflowtooltip) {
+        this.showoverflowtooltip = showoverflowtooltip;
+    }
+
+    public Boolean getSortable() {
+        return sortable;
+    }
+
+    public void setSortable(Boolean sortable) {
+        this.sortable = sortable;
+    }
+
+    public Boolean getShowfilters() {
+        return showfilters;
+    }
+
+    public void setShowfilters(Boolean showfilters) {
+        this.showfilters = showfilters;
+    }
+
+    public String getFilterstype() {
+        return filterstype;
+    }
+
+    public void setFilterstype(String filterstype) {
+        this.filterstype = filterstype;
+    }
+
+    public String getFormattype() {
+        return formattype;
+    }
+
+    public void setFormattype(String formattype) {
+        this.formattype = formattype;
+    }
+
+    public String getOperationstr() {
+        return JSON.toJSONString(this.operations);
+    }
+
+    public void setOperationstr(String operationstr) {
+        this.operationstr = operationstr;
+    }
+
+    public String getChildrenstr() {
+        return JSON.toJSONString(this.children);
+    }
+
+    public void setChildrenstr(String childrenstr) {
+        this.childrenstr = childrenstr;
+    }
+
+    public String getFilterstr() {
+        return JSON.toJSONString(this.filters);
+    }
+
+    public void setFilterstr(String filterstr) {
+        this.filterstr = filterstr;
+    }
+
+    public String getFormatstr() {
+        return JSON.toJSONString(this.format);
+    }
+
+    public void setFormatstr(String formatstr) {
+        this.formatstr = formatstr;
+    }
+
+    public String[] getOperations() {
+        return JSON.parseObject(operationstr,String[].class);
+    }
+
+    public void setOperations(String[] operations) {
+        this.operations = operations;
+    }
+
+    public String[] getChildren() {
+        return JSON.parseObject(childrenstr,String[].class);
+    }
+
+    public void setChildren(String[] children) {
+        this.children = children;
+    }
+
+    public String[] getFilters() {
+        return JSON.parseObject(filterstr,String[].class);
+    }
+
+    public void setFilters(String[] filters) {
+        this.filters = filters;
+    }
+
+    public String[] getFormat() {
+        return JSON.parseObject(formatstr,String[].class);
+    }
+
+    public void setFormat(String[] format) {
+        this.format = format;
+    }
+}

+ 19 - 0
src/main/java/com/gyee/table/mapper/ObjectAllMapper.java

@@ -0,0 +1,19 @@
+package com.gyee.table.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-12
+ */
+@Mapper
+public interface ObjectAllMapper {
+    List<LinkedHashMap<String, Object>> selectAll(String sql);
+}

+ 16 - 0
src/main/java/com/gyee/table/mapper/TableHeaderColumnMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.table.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.table.entity.TableHeaderColumn;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-12
+ */
+public interface TableHeaderColumnMapper extends BaseMapper<TableHeaderColumn> {
+
+}

+ 16 - 0
src/main/java/com/gyee/table/mapper/TableHeaderMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.table.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.table.entity.TableHeader;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-11
+ */
+public interface TableHeaderMapper extends BaseMapper<TableHeader> {
+
+}

+ 13 - 0
src/main/java/com/gyee/table/service/IObjectService.java

@@ -0,0 +1,13 @@
+package com.gyee.table.service;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-11
+ */
+public interface IObjectService {
+
+}

+ 16 - 0
src/main/java/com/gyee/table/service/ITableHeaderColumnService.java

@@ -0,0 +1,16 @@
+package com.gyee.table.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.table.entity.TableHeaderColumn;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-12
+ */
+public interface ITableHeaderColumnService extends IService<TableHeaderColumn> {
+
+}

+ 20 - 0
src/main/java/com/gyee/table/service/ITableHeaderService.java

@@ -0,0 +1,20 @@
+package com.gyee.table.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.table.entity.TableHeader;
+import com.gyee.table.entity.TableHeaderColumn;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-11
+ */
+public interface ITableHeaderService extends IService<TableHeader> {
+
+    List<TableHeaderColumn> getHeader(String headername);
+}

+ 16 - 0
src/main/java/com/gyee/table/service/impl/ObjectServiceImpl.java

@@ -0,0 +1,16 @@
+package com.gyee.table.service.impl;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-11
+ */
+@Service
+public class ObjectServiceImpl {
+
+}

+ 20 - 0
src/main/java/com/gyee/table/service/impl/TableHeaderColumnServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.table.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.table.entity.TableHeaderColumn;
+import com.gyee.table.mapper.TableHeaderColumnMapper;
+import com.gyee.table.service.ITableHeaderColumnService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-12
+ */
+@Service
+public class TableHeaderColumnServiceImpl extends ServiceImpl<TableHeaderColumnMapper, TableHeaderColumn> implements ITableHeaderColumnService {
+
+}

+ 84 - 0
src/main/java/com/gyee/table/service/impl/TableHeaderServiceImpl.java

@@ -0,0 +1,84 @@
+package com.gyee.table.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gyee.table.entity.TableHeader;
+import com.gyee.table.entity.TableHeaderColumn;
+import com.gyee.table.mapper.TableHeaderMapper;
+import com.gyee.table.service.ITableHeaderService;
+import com.gyee.table.utils.IdWorker;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-01-11
+ */
+@Service
+public class TableHeaderServiceImpl extends ServiceImpl<TableHeaderMapper, TableHeader> implements ITableHeaderService {
+
+    // 列类型
+    private String[] llx = {"index", "operations",""};
+    // 列对齐方式
+    private String[] ldqfs = {"left", "center", "right"};
+    // 列是否溢出隐藏\开启排序\开启筛选
+    private Boolean[] arrayb = {true,false};
+    // 列筛选的类型
+    private String[] lsxlx = {"basic", "current"};
+    private Random random = new Random();
+    private ObjectMapper objectMapper=new ObjectMapper();
+    private String[] kun = {};
+
+    @Resource
+    private IdWorker idWorker;
+
+    @Override
+    public List<TableHeaderColumn> getHeader(String headername) {
+        List<TableHeaderColumn> tableHeaderColumns = new ArrayList<>();
+        int j = random.nextInt(15) + 3;
+        for (int i = 0; i < j; i++) {
+            TableHeaderColumn thc = new TableHeaderColumn();
+            //thc.setId(idWorker.nextIdStr());
+            thc.setType(llx[random.nextInt(3)]);
+            thc.setLabel("新表头");
+            thc.setWidth("");
+            thc.setMinwidth("");
+            thc.setAlign(ldqfs[random.nextInt(3)]);
+            thc.setShowoverflowtooltip(arrayb[random.nextInt(2)]);
+            thc.setSortable(arrayb[random.nextInt(2)]);
+            thc.setOperations(kun);
+            thc.setChildren(kun);
+            thc.setShowfilters(arrayb[random.nextInt(2)]);
+            thc.setFilterstype(lsxlx[random.nextInt(2)]);
+            thc.setFormat(kun);
+            thc.setFormattype("");
+
+            if("".equals(thc.getType()) && Arrays.equals(kun,thc.getChildren())){
+                thc.setProp("newtableheader");
+            }else {
+                thc.setProp("");
+            }
+
+            String[] nihao = {"你好"};
+            String s = "";
+            try {
+                s = objectMapper.writeValueAsString(nihao);
+            } catch (JsonProcessingException e) {
+                e.printStackTrace();
+            }
+            thc.setFilters("current".equals(thc.getFilterstype())?nihao:kun);
+            tableHeaderColumns.add(thc);
+        }
+        return tableHeaderColumns;
+    }
+}

+ 151 - 0
src/main/java/com/gyee/table/utils/IdWorker.java

@@ -0,0 +1,151 @@
+package com.gyee.table.utils;
+
+import org.springframework.stereotype.Component;
+
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+
+//雪花算法代码实现
+@Component
+public class IdWorker {
+    // 时间起始标记点,作为基准,一般取系统的最近时间(一旦确定不能变动)
+    private final static long twepoch = 1673490532716L;
+    // 机器标识位数
+    private final static long workerIdBits = 5L;
+    // 数据中心标识位数
+    private final static long datacenterIdBits = 5L;
+    // 机器ID最大值
+    private final static long maxWorkerId = -1L ^ (-1L << workerIdBits);
+    // 数据中心ID最大值
+    private final static long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
+    // 毫秒内自增位
+    private final static long sequenceBits = 12L;
+    // 机器ID偏左移12位
+    private final static long workerIdShift = sequenceBits;
+    // 数据中心ID左移17位
+    private final static long datacenterIdShift = sequenceBits + workerIdBits;
+    // 时间毫秒左移22位
+    private final static long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
+
+    private final static long sequenceMask = -1L ^ (-1L << sequenceBits);
+    /* 上次生产id时间戳 */
+    private static long lastTimestamp = -1L;
+    // 0,并发控制
+    private long sequence = 0L;
+
+    private final long workerId;
+    // 数据标识id部分
+    private final long datacenterId;
+
+    public IdWorker(){
+        this.datacenterId = getDatacenterId(maxDatacenterId);
+        this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
+    }
+    /**
+     * @param workerId
+     *            工作机器ID
+     * @param datacenterId
+     *            序列号
+     */
+    public IdWorker(long workerId, long datacenterId) {
+        if (workerId > maxWorkerId || workerId < 0) {
+            throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
+        }
+        if (datacenterId > maxDatacenterId || datacenterId < 0) {
+            throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
+        }
+        this.workerId = workerId;
+        this.datacenterId = datacenterId;
+    }
+    /**
+     * 获取下一个ID
+     *
+     * @return
+     */
+    public synchronized long nextId() {
+        long timestamp = timeGen();
+        if (timestamp < lastTimestamp) {
+            throw new RuntimeException(String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
+        }
+
+        if (lastTimestamp == timestamp) {
+            // 当前毫秒内,则+1
+            sequence = (sequence + 1) & sequenceMask;
+            if (sequence == 0) {
+                // 当前毫秒内计数满了,则等待下一秒
+                timestamp = tilNextMillis(lastTimestamp);
+            }
+        } else {
+            sequence = 0L;
+        }
+        lastTimestamp = timestamp;
+        // ID偏移组合生成最终的ID,并返回ID
+        long nextId = ((timestamp - twepoch) << timestampLeftShift)
+                | (datacenterId << datacenterIdShift)
+                | (workerId << workerIdShift) | sequence;
+
+        return nextId;
+    }
+
+    public String nextIdStr(){
+        return String.valueOf(this.nextId());
+    }
+
+    private long tilNextMillis(final long lastTimestamp) {
+        long timestamp = this.timeGen();
+        while (timestamp <= lastTimestamp) {
+            timestamp = this.timeGen();
+        }
+        return timestamp;
+    }
+
+    private long timeGen() {
+        return System.currentTimeMillis();
+    }
+
+    /**
+     * <p>
+     * 获取 maxWorkerId
+     * </p>
+     */
+    protected static long getMaxWorkerId(long datacenterId, long maxWorkerId) {
+        StringBuffer mpid = new StringBuffer();
+        mpid.append(datacenterId);
+        String name = ManagementFactory.getRuntimeMXBean().getName();
+        if (!name.isEmpty()) {
+            /*
+             * GET jvmPid
+             */
+            mpid.append(name.split("@")[0]);
+        }
+        /*
+         * MAC + PID 的 hashcode 获取16个低位
+         */
+        return (mpid.toString().hashCode() & 0xffff) % (maxWorkerId + 1);
+    }
+
+    /**
+     * <p>
+     * 数据标识id部分
+     * </p>
+     */
+    protected static long getDatacenterId(long maxDatacenterId) {
+        long id = 0L;
+        try {
+            InetAddress ip = InetAddress.getLocalHost();
+            NetworkInterface network = NetworkInterface.getByInetAddress(ip);
+            if (network == null) {
+                id = 1L;
+            } else {
+                byte[] mac = network.getHardwareAddress();
+                id = ((0x000000FF & (long) mac[mac.length - 1])
+                        | (0x0000FF00 & (((long) mac[mac.length - 2]) << 8))) >> 6;
+                id = id % (maxDatacenterId + 1);
+            }
+        } catch (Exception e) {
+            System.out.println(" getDatacenterId: " + e.getMessage());
+        }
+        return id;
+    }
+}

+ 14 - 0
src/main/resources/application.yml

@@ -0,0 +1,14 @@
+
+spring:
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    #url: jdbc:mysql://49.234.50.218:3306/list
+    url: jdbc:mysql://124.70.18.168:3306/configuration_software?default-character-set=utf8
+    #url: jdbc:mysql://192.168.1.69/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
+    username: root
+    password: 123456
+    type: com.alibaba.druid.pool.DruidDataSource
+
+mybatis-plus:
+  typeAliasesPackage: com.gyee.table.entity
+  mapper-locations: classpath:mappers/*.xml

+ 8 - 0
src/main/resources/mappers/ObjectAllMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.table.mapper.ObjectAllMapper">
+
+    <select id="selectAll" resultType="java.util.LinkedHashMap">
+        ${sql}
+    </select>
+</mapper>

+ 5 - 0
src/main/resources/mappers/TableHeaderColumnMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.table.mapper.TableHeaderColumnMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mappers/TableHeaderMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.table.mapper.TableHeaderMapper">
+
+</mapper>

+ 13 - 0
src/test/java/com/gyee/table/TableApplicationTests.java

@@ -0,0 +1,13 @@
+package com.gyee.table;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class TableApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}