初始化 sk-matrix-service 项目

This commit is contained in:
Shikong 2023-05-07 20:03:47 +08:00
parent 7c52d7e2cf
commit 0b0da1c130
72 changed files with 9633 additions and 0 deletions

View File

@ -0,0 +1,98 @@
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

View File

@ -0,0 +1,10 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Zeppelin ignored files
/ZeppelinRemoteNotebooks/

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
</profile>
<profile name="Annotation profile for sk-matrix-service" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="D:/Repository/maven/org/mapstruct/mapstruct-processor/1.5.3.Final/mapstruct-processor-1.5.3.Final.jar" />
<entry name="D:/Repository/maven/org/mapstruct/mapstruct/1.5.3.Final/mapstruct-1.5.3.Final.jar" />
<entry name="D:/Repository/maven/org/projectlombok/lombok/1.18.24/lombok-1.18.24.jar" />
<entry name="D:/Repository/maven/org/springframework/boot/spring-boot-configuration-processor/3.0.1/spring-boot-configuration-processor-3.0.1.jar" />
</processorPath>
<module name="annotation" />
<module name="orm" />
<module name="api" />
<module name="common" />
<module name="starter" />
<module name="casbin" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="annotation" options="-parameters" />
<module name="api" options="-parameters" />
<module name="casbin" options="-parameters" />
<module name="common" options="-parameters" />
<module name="orm" options="-parameters" />
<module name="sk-matrix-service" options="-parameters" />
<module name="starter" options="-parameters" />
</option>
</component>
</project>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/annotation/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/annotation/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/casbin/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/orm/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/starter/src/main/java" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo1.maven.org/maven2/" />
</remote-repository>
</component>
</project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,45 @@
<?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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sk-matrix-service</artifactId>
<groupId>cn.skcks.matrix.v2</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>annotation</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,64 @@
package cn.skcks.matrix.v2.annotation.web;
import org.springframework.core.annotation.AliasFor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public @interface JsonMapping {
/**
* Alias for {@link RequestMapping#method}.
*/
@AliasFor(annotation = RequestMapping.class)
RequestMethod[] method() default {};
/**
* Alias for {@link RequestMapping#name}.
*/
@AliasFor(annotation = RequestMapping.class)
String name() default "";
/**
* Alias for {@link RequestMapping#value}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] value() default {};
/**
* Alias for {@link RequestMapping#path}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] path() default {};
/**
* Alias for {@link RequestMapping#params}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] params() default {};
/**
* Alias for {@link RequestMapping#headers}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] headers() default {};
/**
* Alias for {@link RequestMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = RequestMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,16 @@
package cn.skcks.matrix.v2.annotation.web.auth;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Shikong
*/
@Target({ElementType.METHOD,ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@SuppressWarnings({"unused"})
public @interface Auth {
boolean required() default true;
}

View File

@ -0,0 +1,16 @@
package cn.skcks.matrix.v2.annotation.web.auth;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Shikong
*/
@Target({ElementType.METHOD,ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@SuppressWarnings({"unused"})
public @interface UnAuth {
boolean required() default true;
}

View File

@ -0,0 +1,54 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.DELETE)
public @interface DeleteJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,54 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.GET)
public @interface GetJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,55 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.HEAD)
public @interface HeadJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,55 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.OPTIONS)
public @interface OptionsJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,54 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.PATCH)
public @interface PatchJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,54 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.POST)
public @interface PostJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,54 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.PUT)
public @interface PutJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,54 @@
package cn.skcks.matrix.v2.annotation.web.methods;
import cn.skcks.matrix.v2.annotation.web.JsonMapping;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMethod;
import java.lang.annotation.*;
/**
* @author Shikong
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonMapping(method = RequestMethod.TRACE)
public @interface TraceJson {
/**
* Alias for {@link JsonMapping#name}.
*/
@AliasFor(annotation = JsonMapping.class)
String name() default "";
/**
* Alias for {@link JsonMapping#value}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] value() default {};
/**
* Alias for {@link JsonMapping#path}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] path() default {};
/**
* Alias for {@link JsonMapping#params}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] params() default {};
/**
* Alias for {@link JsonMapping#headers}.
*/
@AliasFor(annotation = JsonMapping.class)
String[] headers() default {};
/**
* Alias for {@link JsonMapping#consumes}.
* @since 4.3.5
*/
@AliasFor(annotation = JsonMapping.class)
String[] consumes() default {};
}

View File

@ -0,0 +1,96 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>sk-matrix-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>api</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>annotation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- web容器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<!--SpringBoot 热重载-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--MapStruct-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,75 @@
package cn.skcks.matrix.v2.advice;
import cn.skcks.matrix.v2.utils.json.JsonResponse;
import jakarta.validation.ConstraintViolationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.Objects;
/**
* 全局异常处理类
*
* @author Shikong
*/
@RestControllerAdvice
public class ExceptionAdvice {
private final static Logger logger = LoggerFactory.getLogger(ExceptionAdvice.class);
@ExceptionHandler(MissingServletRequestParameterException.class)
public JsonResponse<String> MissingServletRequestParameterException(MissingServletRequestParameterException e) {
return JsonResponse.error(e.getMessage());
}
@ExceptionHandler(HttpMediaTypeNotSupportedException.class)
public JsonResponse<String> unsupportedMediaTypeException(Exception e) {
e.printStackTrace();
return JsonResponse.error(e.getMessage());
}
@ExceptionHandler(HttpMediaTypeNotAcceptableException.class)
public JsonResponse<String> httpMediaTypeNotAcceptableException(HttpMediaTypeNotAcceptableException e){
return JsonResponse.error(e.getMessage());
}
@ExceptionHandler(RuntimeException.class)
public JsonResponse<String> runtimeException(RuntimeException e) {
e.printStackTrace();
return JsonResponse.error(e.getMessage());
}
@ExceptionHandler(BindException.class)
public JsonResponse<String> handleValidationBindException(BindException e) {
return JsonResponse.error(Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage());
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public JsonResponse<String> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
return JsonResponse.error(Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage());
}
@ExceptionHandler(ConstraintViolationException.class)
public JsonResponse<String> handleConstraintViolationException(ConstraintViolationException e) {
return JsonResponse.error(Objects.requireNonNull(e.getMessage()));
}
@ExceptionHandler(HttpMessageNotReadableException.class)
public JsonResponse<String> handleHttpMessageNotReadableException(HttpMessageNotReadableException e){
logger.warn("{}", e.getMessage());
return JsonResponse.error("参数异常");
}
@ExceptionHandler(Exception.class)
public JsonResponse<String> exception(Exception e) {
e.printStackTrace();
return JsonResponse.error(e.getMessage());
}
}

View File

@ -0,0 +1,14 @@
package cn.skcks.matrix.v2.config.json;
import cn.skcks.matrix.v2.utils.json.JsonUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class JsonConfig {
@Bean
public ObjectMapper jacksonObjectMapper(){
return JsonUtils.mapper;
}
}

View File

@ -0,0 +1,53 @@
package cn.skcks.matrix.v2.config.swagger;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import lombok.Data;
import org.springdoc.core.customizers.OpenApiCustomizer;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Configuration;
import static org.springdoc.core.utils.Constants.ALL_PATTERN;
@Configuration
@Data
public class SwaggerConfig {
public static final Info INFO;
private static final License LICENSE;
static {
INFO = new Info()
.title("Matrix API")
.description("Matrix API description")
.version("2.0");
LICENSE = new License()
.name("Apache 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0.html");
INFO.license(LICENSE);
}
public static GroupedOpenApi api(String group, String path) {
return GroupedOpenApi.builder()
.group(group)
.pathsToMatch(path + ALL_PATTERN)
.addOpenApiCustomizer(openApi -> openApi.info(SwaggerConfig.INFO))
.addOpenApiCustomizer(authOpenApiDocs())
.build();
}
private static OpenApiCustomizer authOpenApiDocs(){
return openApi -> {
// swagger 全局添加 token 认证选项
openApi.addSecurityItem(new SecurityRequirement().addList("token"));
openApi.getComponents()
.addSecuritySchemes("token",
new SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.in(SecurityScheme.In.HEADER)
.name("token"));
};
}
}

View File

@ -0,0 +1,19 @@
package cn.skcks.matrix.v2.config.undertow;
import io.undertow.server.DefaultByteBufferPool;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.stereotype.Component;
@Component
public class UndertowWebSocketConfig implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
@Override
public void customize(UndertowServletWebServerFactory factory) {
factory.addDeploymentInfoCustomizers(deploymentInfo -> {
WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(false, 1024));
deploymentInfo.addServletContextAttribute("io.undertow.websockets.jsr.WebSocketDeploymentInfo", webSocketDeploymentInfo);
});
}
}

View File

@ -0,0 +1,76 @@
<?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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>sk-matrix-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>casbin</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.casbin</groupId>
<artifactId>casbin-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.casbin</groupId>
<artifactId>jcasbin</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jcasbin</artifactId>
<version>1.31.4</version>
</dependency>
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jdbc-adapter</artifactId>
<exclusions>
<exclusion>
<groupId>org.casbin</groupId>
<artifactId>jcasbin</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,218 @@
package cn.skcks.matrix.v2.casbin.adapter;
import cn.hutool.core.util.IdUtil;
import dev.failsafe.Failsafe;
import org.apache.commons.collections4.CollectionUtils;
import org.casbin.adapter.JDBCAdapter;
import org.casbin.jcasbin.model.Assertion;
import org.casbin.jcasbin.model.Model;
import javax.sql.DataSource;
import java.sql.*;
import java.util.List;
import java.util.Map;
public class CustomJDBCAdapter extends JDBCAdapter {
static class CasbinRule {
int id; // Fields reserved for compatibility with other adapters, and the primary key is automatically incremented.
String ptype;
String v0;
String v1;
String v2;
String v3;
String v4;
String v5;
public String[] toStringArray() {
return new String[]{ptype, v0, v1, v2, v3, v4, v5};
}
}
private final int batchSize = 1000;
public CustomJDBCAdapter(DataSource dataSource, boolean removePolicyFailed, String tableName, boolean autoCreateTable) throws Exception {
super(dataSource, removePolicyFailed, tableName, autoCreateTable);
}
@Override
protected void migrate() throws SQLException {
Statement stmt = conn.createStatement();
String sql = renderActualSql("CREATE TABLE IF NOT EXISTS casbin_rule(id bigint NOT NULL PRIMARY KEY auto_increment, ptype VARCHAR(100) NOT NULL, v0 VARCHAR(100), v1 VARCHAR(100), v2 VARCHAR(100), v3 VARCHAR(100), v4 VARCHAR(100), v5 VARCHAR(100))");
String productName = conn.getMetaData().getDatabaseProductName();
switch (productName) {
case "MySQL":
String hasTableSql = renderActualSql("SHOW TABLES LIKE 'casbin_rule';");
ResultSet rs = stmt.executeQuery(hasTableSql);
if (rs.next()) {
return;
}
break;
}
stmt.executeUpdate(sql);
}
private CasbinRule savePolicyLine(String ptype, List<String> rule) {
CasbinRule line = new CasbinRule();
line.ptype = ptype;
if (rule.size() > 0) {
line.v0 = rule.get(0);
}
if (rule.size() > 1) {
line.v1 = rule.get(1);
}
if (rule.size() > 2) {
line.v2 = rule.get(2);
}
if (rule.size() > 3) {
line.v3 = rule.get(3);
}
if (rule.size() > 4) {
line.v4 = rule.get(4);
}
if (rule.size() > 5) {
line.v5 = rule.get(5);
}
return line;
}
@Override
public void addPolicies(String sec, String ptype, List<List<String>> rules) {
if (CollectionUtils.isEmpty(rules)) {
return;
}
try (Connection conn = dataSource.getConnection()) {
String sql = renderActualSql("INSERT INTO casbin_rule (ptype,v0,v1,v2,v3,v4,v5,id) VALUES(?,?,?,?,?,?,?,?)");
Failsafe.with(retryPolicy).run(ctx -> {
if (ctx.isRetry()) {
retry(ctx);
}
conn.setAutoCommit(false);
int count = 0;
try (PreparedStatement ps = conn.prepareStatement(sql)) {
for (List<String> rule : rules) {
CasbinRule line = savePolicyLine(ptype, rule);
ps.setString(1, line.ptype);
ps.setString(2, line.v0);
ps.setString(3, line.v1);
ps.setString(4, line.v2);
ps.setString(5, line.v3);
ps.setString(6, line.v4);
ps.setString(7, line.v5);
ps.setString(8, IdUtil.getSnowflakeNextIdStr());
ps.addBatch();
if (++count == batchSize) {
count = 0;
ps.executeBatch();
ps.clearBatch();
}
}
if (count != 0) {
ps.executeBatch();
}
conn.commit();
} catch (SQLException e) {
conn.rollback();
e.printStackTrace();
throw e;
} finally {
conn.setAutoCommit(true);
}
});
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
@Override
public void savePolicy(Model model) {
String cleanSql = renderActualSql("delete from casbin_rule");
String addSql = renderActualSql("INSERT INTO casbin_rule (ptype,v0,v1,v2,v3,v4,v5,id) VALUES(?,?,?,?,?,?,?,?)");
try (Connection conn = dataSource.getConnection()) {
Failsafe.with(retryPolicy).run(ctx -> {
if (ctx.isRetry()) {
retry(ctx);
}
conn.setAutoCommit(false);
int count = 0;
try (Statement statement = conn.createStatement(); PreparedStatement ps = conn.prepareStatement(addSql)) {
statement.execute(cleanSql);
for (Map.Entry<String, Assertion> entry : model.model.get("p").entrySet()) {
String ptype = entry.getKey();
Assertion ast = entry.getValue();
for (List<String> rule : ast.policy) {
CasbinRule line = savePolicyLine(ptype, rule);
ps.setString(1, line.ptype);
ps.setString(2, line.v0);
ps.setString(3, line.v1);
ps.setString(4, line.v2);
ps.setString(5, line.v3);
ps.setString(6, line.v4);
ps.setString(7, line.v5);
ps.setString(8, IdUtil.getSnowflakeNextIdStr());
ps.addBatch();
if (++count == batchSize) {
count = 0;
ps.executeBatch();
ps.clearBatch();
}
}
}
for (Map.Entry<String, Assertion> entry : model.model.get("g").entrySet()) {
String ptype = entry.getKey();
Assertion ast = entry.getValue();
for (List<String> rule : ast.policy) {
CasbinRule line = savePolicyLine(ptype, rule);
ps.setString(1, line.ptype);
ps.setString(2, line.v0);
ps.setString(3, line.v1);
ps.setString(4, line.v2);
ps.setString(5, line.v3);
ps.setString(6, line.v4);
ps.setString(7, line.v5);
ps.setString(8, IdUtil.getSnowflakeNextIdStr());
ps.addBatch();
if (++count == batchSize) {
count = 0;
ps.executeBatch();
ps.clearBatch();
}
}
}
if (count != 0) {
ps.executeBatch();
}
conn.commit();
} catch (SQLException e) {
conn.rollback();
e.printStackTrace();
throw e;
} finally {
conn.setAutoCommit(true);
}
});
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,31 @@
package cn.skcks.matrix.v2.casbin.config;
import cn.skcks.matrix.v2.casbin.adapter.CustomJDBCAdapter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
import org.casbin.jcasbin.persist.Adapter;
import org.casbin.spring.boot.autoconfigure.properties.CasbinDataSourceInitializationMode;
import org.casbin.spring.boot.autoconfigure.properties.CasbinExceptionProperties;
import org.casbin.spring.boot.autoconfigure.properties.CasbinProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@Slf4j
@Configuration
@RequiredArgsConstructor
@ConditionalOnClass(ShardingSphereDataSource.class)
public class CasbinConfig {
private final ShardingSphereDataSource dataSource;
@Primary
@Bean
public Adapter autoConfigJdbcAdapter(CasbinProperties properties, CasbinExceptionProperties exceptionProperties) throws Exception {
CasbinDataSourceInitializationMode initializeSchema = properties.getInitializeSchema();
boolean autoCreateTable = initializeSchema == CasbinDataSourceInitializationMode.CREATE;
String tableName = properties.getTableName();
return new CustomJDBCAdapter(dataSource,exceptionProperties.isRemovePolicyFailed(),tableName, autoCreateTable);
}
}

View File

@ -0,0 +1,14 @@
[request_definition]
r = identity, system, api, act
[policy_definition]
p = identity, system, api, act
[role_definition]
g = _, _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.identity, p.identity, r.system) && r.system == p.system && keyMatch3(r.api, p.api) && regexMatch(r.act, p.act)

View File

@ -0,0 +1,82 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>sk-matrix-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--mybatis 分页器插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<exclusions>
<exclusion>
<artifactId>lettuce-core</artifactId>
<groupId>io.lettuce</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,106 @@
package cn.skcks.matrix.v2.utils.base91;
import java.io.ByteArrayOutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
public class Base91 {
private static final float AVERAGE_ENCODING_RATIO = 1.2297f;
private static final int BASE = 91;
private static final char[] ENCODING_TABLE = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';',
'<', '=', '>', '?', '@', '[', ']', '^', '_', '`', '{', '|', '}', '~',
'"'};
private static final int[] DECODING_TABLE;
static {
int[] charts = new int[255];
Arrays.fill(charts, -1);
for (int i = 0; i < ENCODING_TABLE.length; i++) {
charts[ENCODING_TABLE[i]] = i;
}
DECODING_TABLE = charts;
}
public static String encodeString(String str, Charset charset) {
return encode(str.getBytes(charset));
}
public static String encodeString(String str) {
return encode(str.getBytes(StandardCharsets.UTF_8));
}
public static String encode(byte[] bytes) {
int ebq = 0;
int en = 0;
StringBuilder buffer = new StringBuilder();
for (int b : bytes) {
ebq |= (b & 255) << en;
en += 8;
if (en > 13) {
int ev = ebq & 8191;
if (ev > 88) {
ebq >>= 13;
en -= 13;
} else {
ev = ebq & 16383;
ebq >>= 14;
en -= 14;
}
buffer.append(ENCODING_TABLE[ev % BASE]);
buffer.append(ENCODING_TABLE[ev / BASE]);
}
}
if (en > 0) {
buffer.append(ENCODING_TABLE[ebq % BASE]);
if (en > 7 || ebq > 90) {
buffer.append(ENCODING_TABLE[ebq / BASE]);
}
}
return buffer.toString();
}
public static byte[] decode(String str) {
byte[] data = str.getBytes(StandardCharsets.UTF_8);
int dbq = 0, dn = 0, dv = -1;
int estimatedSize = Math.round(data.length / AVERAGE_ENCODING_RATIO);
ByteArrayOutputStream buffer = new ByteArrayOutputStream(estimatedSize);
for (byte datum : data) {
if (dv == -1)
dv = DECODING_TABLE[datum];
else {
dv += DECODING_TABLE[datum] * BASE;
dbq |= dv << dn;
dn += (dv & 8191) > 88 ? 13 : 14;
do {
buffer.write(dbq);
dbq >>= 8;
dn -= 8;
} while (dn > 7);
dv = -1;
}
}
if (dv != -1) {
buffer.write((dbq | dv << dn));
}
return buffer.toByteArray();
}
public static String decodeString(String str) {
return new String(decode(str), StandardCharsets.UTF_8);
}
public static String decodeString(String str, Charset charset) {
return new String(decode(str), charset);
}
}

View File

@ -0,0 +1,48 @@
package cn.skcks.matrix.v2.utils.json;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@SuppressWarnings("unused")
@Schema(title = "返回结果")
public class JsonResponse<T> {
@Schema(title = "状态码")
private int code;
@Schema(title = "响应消息")
private String msg;
@Schema(title = "响应数据")
private T data;
public JsonResponse(int code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public static <T> JsonResponse<T> success(T data) {
return JsonResponse.build(data, ResponseStatus.OK);
}
public static <T> JsonResponse<T> success(T data, String message) {
return JsonResponse.build(data, ResponseStatus.OK.getCode(), message);
}
public static <T> JsonResponse<T> error(T data) {
return JsonResponse.build(data, ResponseStatus.INTERNAL_SERVER_ERROR);
}
public static <T> JsonResponse<T> error(T data, String message) {
return JsonResponse.build(data, ResponseStatus.INTERNAL_SERVER_ERROR.getCode(), message);
}
public static <T> JsonResponse<T> build(T data, ResponseStatus status) {
return new JsonResponse<>(status.getCode(), status.getMessage(), data);
}
public static <T> JsonResponse<T> build(T data, int status, String msg) {
return new JsonResponse<>(status, msg, data);
}
}

View File

@ -0,0 +1,81 @@
package cn.skcks.matrix.v2.utils.json;
import com.fasterxml.jackson.core.json.JsonReadFeature;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@SuppressWarnings("unused")
public class JsonUtils {
public static final ObjectMapper mapper;
public static final ObjectMapper compressMapper;
static {
mapper = new ObjectMapper();
compressMapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
compressMapper.disable(SerializationFeature.INDENT_OUTPUT);
// 返回内容中 不含 值为 null 的字段
// mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
compressMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
// 如果json中有新增的字段并且是实体类类中不存在的不报错
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
compressMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
compressMapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
// 允许出现特殊字符和转义符
mapper.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true);
compressMapper.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true);
// 允许出现单引号
mapper.configure(JsonReadFeature.ALLOW_SINGLE_QUOTES.mappedFeature(), true);
compressMapper.configure(JsonReadFeature.ALLOW_SINGLE_QUOTES.mappedFeature(), true);
}
public static <T> T parse(String json, Class<T> clazz) {
try {
return mapper.readValue(json, clazz);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static <T> T parse(String json, TypeReference<T> clazz) {
try {
return mapper.readValue(json, clazz);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String toCompressJson(Object obj) {
try {
return compressMapper.writeValueAsString(obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String toJson(Object obj) {
try {
return mapper.writeValueAsString(obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static <T> T convert(Object object, Class<T> clazz) {
return JsonUtils.parse(JsonUtils.toJson(object), clazz);
}
}

View File

@ -0,0 +1,60 @@
package cn.skcks.matrix.v2.utils.json;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
@SuppressWarnings("unused")
public enum ResponseStatus {
UNKNOWN(-1, "Unknown"),
UNDEFINED(0, "Undefined"),
OK(200, "OK"),
CREATED(201, "Created"),
ACCEPTED(202, "Accepted"),
NO_CONTENT(204, "No Content"),
MOVED_PERMANENTLY(301, "Moved Permanently"),
FOUND(302, "Found"),
SEE_OTHER(303, "See Other"),
NOT_MODIFIED(304, "Not Modified"),
TEMPORARY_REDIRECT(307, "Temporary Redirect"),
BAD_REQUEST(400, "Bad Request"),
UNAUTHORIZED(401, "Unauthorized"),
FORBIDDEN(403, "Forbidden"),
NOT_FOUND(404, "Not Found"),
METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
NOT_ACCEPTABLE(406, "Not Acceptable"),
REQUEST_TIMEOUT(408, "Request Timeout"),
CONFLICT(409, "Conflict"),
GONE(410, "Gone"),
LENGTH_REQUIRED(411, "Length Required"),
PRECONDITION_FAILED(412, "Precondition Failed"),
PAYLOAD_TOO_LARGE(413, "Payload Too Large"),
URI_TOO_LONG(414, "URI Too Long"),
UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"),
RANGE_NOT_SATISFIABLE(416, "Range Not Satisfiable"),
EXPECTATION_FAILED(417, "Expectation Failed"),
TOO_MANY_REQUESTS(429, "Too Many Requests"),
INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
NOT_IMPLEMENTED(501, "Not Implemented"),
BAD_GATEWAY(502, "Bad Gateway"),
SERVICE_UNAVAILABLE(503, "Service Unavailable");
private final int code;
private final String message;
public static ResponseStatus getByCode(int code) {
for (ResponseStatus status : values()) {
if (status.getCode() == code) {
return status;
}
}
return null;
}
public static ResponseStatus valueOf(int code) {
return getByCode(code);
}
}

View File

@ -0,0 +1,39 @@
package cn.skcks.matrix.v2.utils.page;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
@AllArgsConstructor
@NoArgsConstructor
@Data
@SuppressWarnings({"unused"})
@Schema(title = "分页数据")
public class PageWrapper<T> {
@Schema(title = "数据")
private Collection<T> data;
@Schema(title = "页码")
private long page;
@Schema(title = "每页大小")
private long pageSize;
@Schema(title = "总页数")
private long pageTotal;
@Schema(title = "数据总数")
private long total;
public static <T> PageWrapper<T> of(Collection<T> data, long page, long pageSize, long pageTotal, long total) {
return new PageWrapper<>(data, page, pageSize, pageTotal, total);
}
public static <T> PageWrapper<T> of(PageInfo<T> pageInfo) {
return new PageWrapper<>(pageInfo.getList(),
pageInfo.getPageNum(),
pageInfo.getPageSize(),
pageInfo.getPages(),
pageInfo.getTotal());
}
}

View File

@ -0,0 +1,9 @@
_____ _ _ _
/ ____| | (_) |
| (___ | |__ _| | _____ _ __ __ _ ___ __ ___ __ _ ___
\___ \| '_ \| | |/ / _ \| '_ \ / _` | / _/ / |/ /__ _/ /_____(_)_ __ / /
____) | | | | | < (_) | | | | (_| | / / / /|_/ / _ `/ __/ __/ /\ \ / / /
|_____/|_| |_|_|_|\_\___/|_| |_|\__, | / / /_/ /_/\_,_/\__/_/ /_//_\_\ / /
__/ | /__/ /__/
|___/

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>logback</contextName>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<!--<property name="log.path" value="./log/business_Log" />-->
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">-->
<!-- <level>INFO</level>-->
<!-- </filter>-->
<!-- <withJansi>true</withJansi>-->
<encoder>
<!--<pattern>%d %p (%file:%line\)- %m%n</pattern>-->
<!--格式化输出:%d:表示日期 %thread:表示线程名 %-5level:级别从左显示5个字符宽度 %msg:日志消息 %n:是换行符-->
<pattern>%red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %yellow(at %class.%method) (%file:%line\) - %cyan(%msg%n)</pattern>
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %magenta(%-5level) %green([%-50.50class]) >>> %cyan(%msg) %n</pattern>-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--&lt;!&ndash;输出到文件&ndash;&gt;-->
<!--<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">-->
<!-- <level>INFO</level>-->
<!-- </filter>-->
<!-- <file>${log.path}/logback.log</file>-->
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
<!-- <fileNamePattern>${log.path}/logback-%d{yyyy-MM-dd-HH-mm}.log</fileNamePattern>-->
<!-- <maxHistory>365</maxHistory>-->
<!-- &lt;!&ndash; <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">&ndash;&gt;-->
<!-- &lt;!&ndash; <maxFileSize>100kB</maxFileSize>&ndash;&gt;-->
<!-- &lt;!&ndash; </timeBasedFileNamingAndTriggeringPolicy>&ndash;&gt;-->
<!-- </rollingPolicy>-->
<!-- <encoder>-->
<!-- &lt;!&ndash;格式化输出:%d:表示日期 %thread:表示线程名 %-5level:级别从左显示5个字符宽度 %msg:日志消息 %n:是换行符&ndash;&gt;-->
<!-- <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>-->
<!-- <charset>UTF-8</charset>-->
<!-- </encoder>-->
<!--</appender>-->
<!-- 如果appender里没有限定日志级别那么root可以统一设置如果没有配置那么控制台和文件不会输出任何日志这里root的level不做限制-->
<root level="INFO">
<!-- 允许控制台输出-->
<appender-ref ref="console" />
<!--&lt;!&ndash; 允许文件输出&ndash;&gt;-->
<!--<appender-ref ref="file" />-->
</root>
<!-- <logger name="cn.skcks.study.springcloud.kafka.producer.controller" level="DEBUG" />-->
</configuration>

View File

@ -0,0 +1,2 @@
### 从数据库生成 Java Bean
利用 mybatis-generator 插件实现

View File

@ -0,0 +1,154 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>sk-matrix-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>orm</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>casbin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<!-- 使用druid连接池需要加dbcp依赖 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
</dependency>
<!--<dependency>-->
<!-- <groupId>org.apache.shardingsphere</groupId>-->
<!-- <artifactId>sharding-jdbc-spring-boot-starter</artifactId>-->
<!-- <version>4.1.1</version>-->
<!--</dependency>-->
<!--Mybatis-DynamicSQL-->
<dependency>
<groupId>org.mybatis.dynamic-sql</groupId>
<artifactId>mybatis-dynamic-sql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>${mybatis-generator-maven-plugin.version}</version>
<configuration>
<!--配置文件的位置-->
<configurationFile>src/main/resources/config/generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,107 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.mapper;
import cn.skcks.matrix.v2.orm.mybatis.basic.model.CasbinRule;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;
public interface CasbinRuleMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table casbin_rule
*
* @mbg.generated
*/
@Delete({
"delete from casbin_rule",
"where id = #{id,jdbcType=INTEGER}"
})
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table casbin_rule
*
* @mbg.generated
*/
@Insert({
"insert into casbin_rule (id, ptype, ",
"v0, v1, v2, ",
"v3, v4, v5)",
"values (#{id,jdbcType=INTEGER}, #{ptype,jdbcType=VARCHAR}, ",
"#{v0,jdbcType=VARCHAR}, #{v1,jdbcType=VARCHAR}, #{v2,jdbcType=VARCHAR}, ",
"#{v3,jdbcType=VARCHAR}, #{v4,jdbcType=VARCHAR}, #{v5,jdbcType=VARCHAR})"
})
int insert(CasbinRule row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table casbin_rule
*
* @mbg.generated
*/
@Select({
"select",
"id, ptype, v0, v1, v2, v3, v4, v5",
"from casbin_rule",
"where id = #{id,jdbcType=INTEGER}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="ptype", property="ptype", jdbcType=JdbcType.VARCHAR),
@Result(column="v0", property="v0", jdbcType=JdbcType.VARCHAR),
@Result(column="v1", property="v1", jdbcType=JdbcType.VARCHAR),
@Result(column="v2", property="v2", jdbcType=JdbcType.VARCHAR),
@Result(column="v3", property="v3", jdbcType=JdbcType.VARCHAR),
@Result(column="v4", property="v4", jdbcType=JdbcType.VARCHAR),
@Result(column="v5", property="v5", jdbcType=JdbcType.VARCHAR)
})
CasbinRule selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table casbin_rule
*
* @mbg.generated
*/
@Select({
"select",
"id, ptype, v0, v1, v2, v3, v4, v5",
"from casbin_rule"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="ptype", property="ptype", jdbcType=JdbcType.VARCHAR),
@Result(column="v0", property="v0", jdbcType=JdbcType.VARCHAR),
@Result(column="v1", property="v1", jdbcType=JdbcType.VARCHAR),
@Result(column="v2", property="v2", jdbcType=JdbcType.VARCHAR),
@Result(column="v3", property="v3", jdbcType=JdbcType.VARCHAR),
@Result(column="v4", property="v4", jdbcType=JdbcType.VARCHAR),
@Result(column="v5", property="v5", jdbcType=JdbcType.VARCHAR)
})
List<CasbinRule> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table casbin_rule
*
* @mbg.generated
*/
@Update({
"update casbin_rule",
"set ptype = #{ptype,jdbcType=VARCHAR},",
"v0 = #{v0,jdbcType=VARCHAR},",
"v1 = #{v1,jdbcType=VARCHAR},",
"v2 = #{v2,jdbcType=VARCHAR},",
"v3 = #{v3,jdbcType=VARCHAR},",
"v4 = #{v4,jdbcType=VARCHAR},",
"v5 = #{v5,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=INTEGER}"
})
int updateByPrimaryKey(CasbinRule row);
}

View File

@ -0,0 +1,166 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.mapper;
import cn.skcks.matrix.v2.orm.mybatis.basic.model.LocationRecord;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;
public interface LocationRecordMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table location_record
*
* @mbg.generated
*/
@Delete({
"delete from location_record",
"where id = #{id,jdbcType=VARCHAR}"
})
int deleteByPrimaryKey(String id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table location_record
*
* @mbg.generated
*/
@Insert({
"insert into location_record (id, callback_time, ",
"location_time, location_type, ",
"latitude, longitude, ",
"accuracy, altitude, ",
"bearing, speed, country, ",
"province, city, ",
"district, street, ",
"street_number, city_code, ",
"ad_code, address, ",
"description, user_id)",
"values (#{id,jdbcType=VARCHAR}, #{callbackTime,jdbcType=TIMESTAMP}, ",
"#{locationTime,jdbcType=TIMESTAMP}, #{locationType,jdbcType=INTEGER}, ",
"#{latitude,jdbcType=DOUBLE}, #{longitude,jdbcType=DOUBLE}, ",
"#{accuracy,jdbcType=DOUBLE}, #{altitude,jdbcType=DOUBLE}, ",
"#{bearing,jdbcType=DOUBLE}, #{speed,jdbcType=DOUBLE}, #{country,jdbcType=VARCHAR}, ",
"#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, ",
"#{district,jdbcType=VARCHAR}, #{street,jdbcType=VARCHAR}, ",
"#{streetNumber,jdbcType=VARCHAR}, #{cityCode,jdbcType=VARCHAR}, ",
"#{adCode,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ",
"#{description,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT})"
})
int insert(LocationRecord row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table location_record
*
* @mbg.generated
*/
@Select({
"select",
"id, callback_time, location_time, location_type, latitude, longitude, accuracy, ",
"altitude, bearing, speed, country, province, city, district, street, street_number, ",
"city_code, ad_code, address, description, user_id",
"from location_record",
"where id = #{id,jdbcType=VARCHAR}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="callback_time", property="callbackTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="location_time", property="locationTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="location_type", property="locationType", jdbcType=JdbcType.INTEGER),
@Result(column="latitude", property="latitude", jdbcType=JdbcType.DOUBLE),
@Result(column="longitude", property="longitude", jdbcType=JdbcType.DOUBLE),
@Result(column="accuracy", property="accuracy", jdbcType=JdbcType.DOUBLE),
@Result(column="altitude", property="altitude", jdbcType=JdbcType.DOUBLE),
@Result(column="bearing", property="bearing", jdbcType=JdbcType.DOUBLE),
@Result(column="speed", property="speed", jdbcType=JdbcType.DOUBLE),
@Result(column="country", property="country", jdbcType=JdbcType.VARCHAR),
@Result(column="province", property="province", jdbcType=JdbcType.VARCHAR),
@Result(column="city", property="city", jdbcType=JdbcType.VARCHAR),
@Result(column="district", property="district", jdbcType=JdbcType.VARCHAR),
@Result(column="street", property="street", jdbcType=JdbcType.VARCHAR),
@Result(column="street_number", property="streetNumber", jdbcType=JdbcType.VARCHAR),
@Result(column="city_code", property="cityCode", jdbcType=JdbcType.VARCHAR),
@Result(column="ad_code", property="adCode", jdbcType=JdbcType.VARCHAR),
@Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT)
})
LocationRecord selectByPrimaryKey(String id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table location_record
*
* @mbg.generated
*/
@Select({
"select",
"id, callback_time, location_time, location_type, latitude, longitude, accuracy, ",
"altitude, bearing, speed, country, province, city, district, street, street_number, ",
"city_code, ad_code, address, description, user_id",
"from location_record"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="callback_time", property="callbackTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="location_time", property="locationTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="location_type", property="locationType", jdbcType=JdbcType.INTEGER),
@Result(column="latitude", property="latitude", jdbcType=JdbcType.DOUBLE),
@Result(column="longitude", property="longitude", jdbcType=JdbcType.DOUBLE),
@Result(column="accuracy", property="accuracy", jdbcType=JdbcType.DOUBLE),
@Result(column="altitude", property="altitude", jdbcType=JdbcType.DOUBLE),
@Result(column="bearing", property="bearing", jdbcType=JdbcType.DOUBLE),
@Result(column="speed", property="speed", jdbcType=JdbcType.DOUBLE),
@Result(column="country", property="country", jdbcType=JdbcType.VARCHAR),
@Result(column="province", property="province", jdbcType=JdbcType.VARCHAR),
@Result(column="city", property="city", jdbcType=JdbcType.VARCHAR),
@Result(column="district", property="district", jdbcType=JdbcType.VARCHAR),
@Result(column="street", property="street", jdbcType=JdbcType.VARCHAR),
@Result(column="street_number", property="streetNumber", jdbcType=JdbcType.VARCHAR),
@Result(column="city_code", property="cityCode", jdbcType=JdbcType.VARCHAR),
@Result(column="ad_code", property="adCode", jdbcType=JdbcType.VARCHAR),
@Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT)
})
List<LocationRecord> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table location_record
*
* @mbg.generated
*/
@Update({
"update location_record",
"set callback_time = #{callbackTime,jdbcType=TIMESTAMP},",
"location_time = #{locationTime,jdbcType=TIMESTAMP},",
"location_type = #{locationType,jdbcType=INTEGER},",
"latitude = #{latitude,jdbcType=DOUBLE},",
"longitude = #{longitude,jdbcType=DOUBLE},",
"accuracy = #{accuracy,jdbcType=DOUBLE},",
"altitude = #{altitude,jdbcType=DOUBLE},",
"bearing = #{bearing,jdbcType=DOUBLE},",
"speed = #{speed,jdbcType=DOUBLE},",
"country = #{country,jdbcType=VARCHAR},",
"province = #{province,jdbcType=VARCHAR},",
"city = #{city,jdbcType=VARCHAR},",
"district = #{district,jdbcType=VARCHAR},",
"street = #{street,jdbcType=VARCHAR},",
"street_number = #{streetNumber,jdbcType=VARCHAR},",
"city_code = #{cityCode,jdbcType=VARCHAR},",
"ad_code = #{adCode,jdbcType=VARCHAR},",
"address = #{address,jdbcType=VARCHAR},",
"description = #{description,jdbcType=VARCHAR},",
"user_id = #{userId,jdbcType=BIGINT}",
"where id = #{id,jdbcType=VARCHAR}"
})
int updateByPrimaryKey(LocationRecord row);
}

View File

@ -0,0 +1,100 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.mapper;
import cn.skcks.matrix.v2.orm.mybatis.basic.model.Role;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;
public interface RoleMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table role
*
* @mbg.generated
*/
@Delete({
"delete from role",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table role
*
* @mbg.generated
*/
@Insert({
"insert into role (id, role, ",
"name, system_id, ",
"active)",
"values (#{id,jdbcType=BIGINT}, #{role,jdbcType=VARCHAR}, ",
"#{name,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, ",
"#{active,jdbcType=BIT})"
})
int insert(Role row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table role
*
* @mbg.generated
*/
@Select({
"select",
"id, role, name, system_id, active",
"from role",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="role", property="role", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="system_id", property="systemId", jdbcType=JdbcType.VARCHAR),
@Result(column="active", property="active", jdbcType=JdbcType.BIT)
})
Role selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table role
*
* @mbg.generated
*/
@Select({
"select",
"id, role, name, system_id, active",
"from role"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="role", property="role", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="system_id", property="systemId", jdbcType=JdbcType.VARCHAR),
@Result(column="active", property="active", jdbcType=JdbcType.BIT)
})
List<Role> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table role
*
* @mbg.generated
*/
@Update({
"update role",
"set role = #{role,jdbcType=VARCHAR},",
"name = #{name,jdbcType=VARCHAR},",
"system_id = #{systemId,jdbcType=VARCHAR},",
"active = #{active,jdbcType=BIT}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(Role row);
}

View File

@ -0,0 +1,118 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.mapper;
import cn.skcks.matrix.v2.orm.mybatis.basic.model.User;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;
public interface UserMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
*/
@Delete({
"delete from user",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
*/
@Insert({
"insert into user (id, user_name, ",
"password, salt, ",
"email, phone_number, ",
"description, create_time, ",
"update_time)",
"values (#{id,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR}, ",
"#{password,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR}, ",
"#{email,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR}, ",
"#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP})"
})
int insert(User row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
*/
@Select({
"select",
"id, user_name, password, salt, email, phone_number, description, create_time, ",
"update_time",
"from user",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR),
@Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
@Result(column="salt", property="salt", jdbcType=JdbcType.VARCHAR),
@Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
@Result(column="phone_number", property="phoneNumber", jdbcType=JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
})
User selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
*/
@Select({
"select",
"id, user_name, password, salt, email, phone_number, description, create_time, ",
"update_time",
"from user"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR),
@Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
@Result(column="salt", property="salt", jdbcType=JdbcType.VARCHAR),
@Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
@Result(column="phone_number", property="phoneNumber", jdbcType=JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
})
List<User> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
*/
@Update({
"update user",
"set user_name = #{userName,jdbcType=VARCHAR},",
"password = #{password,jdbcType=VARCHAR},",
"salt = #{salt,jdbcType=VARCHAR},",
"email = #{email,jdbcType=VARCHAR},",
"phone_number = #{phoneNumber,jdbcType=VARCHAR},",
"description = #{description,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(User row);
}

View File

@ -0,0 +1,272 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.model;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table casbin_rule
*/
public class CasbinRule {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.ptype
*
* @mbg.generated
*/
private String ptype;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.v0
*
* @mbg.generated
*/
private String v0;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.v1
*
* @mbg.generated
*/
private String v1;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.v2
*
* @mbg.generated
*/
private String v2;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.v3
*
* @mbg.generated
*/
private String v3;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.v4
*
* @mbg.generated
*/
private String v4;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column casbin_rule.v5
*
* @mbg.generated
*/
private String v5;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.id
*
* @return the value of casbin_rule.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.id
*
* @param id the value for casbin_rule.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.ptype
*
* @return the value of casbin_rule.ptype
*
* @mbg.generated
*/
public String getPtype() {
return ptype;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.ptype
*
* @param ptype the value for casbin_rule.ptype
*
* @mbg.generated
*/
public void setPtype(String ptype) {
this.ptype = ptype == null ? null : ptype.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.v0
*
* @return the value of casbin_rule.v0
*
* @mbg.generated
*/
public String getV0() {
return v0;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.v0
*
* @param v0 the value for casbin_rule.v0
*
* @mbg.generated
*/
public void setV0(String v0) {
this.v0 = v0 == null ? null : v0.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.v1
*
* @return the value of casbin_rule.v1
*
* @mbg.generated
*/
public String getV1() {
return v1;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.v1
*
* @param v1 the value for casbin_rule.v1
*
* @mbg.generated
*/
public void setV1(String v1) {
this.v1 = v1 == null ? null : v1.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.v2
*
* @return the value of casbin_rule.v2
*
* @mbg.generated
*/
public String getV2() {
return v2;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.v2
*
* @param v2 the value for casbin_rule.v2
*
* @mbg.generated
*/
public void setV2(String v2) {
this.v2 = v2 == null ? null : v2.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.v3
*
* @return the value of casbin_rule.v3
*
* @mbg.generated
*/
public String getV3() {
return v3;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.v3
*
* @param v3 the value for casbin_rule.v3
*
* @mbg.generated
*/
public void setV3(String v3) {
this.v3 = v3 == null ? null : v3.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.v4
*
* @return the value of casbin_rule.v4
*
* @mbg.generated
*/
public String getV4() {
return v4;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.v4
*
* @param v4 the value for casbin_rule.v4
*
* @mbg.generated
*/
public void setV4(String v4) {
this.v4 = v4 == null ? null : v4.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column casbin_rule.v5
*
* @return the value of casbin_rule.v5
*
* @mbg.generated
*/
public String getV5() {
return v5;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column casbin_rule.v5
*
* @param v5 the value for casbin_rule.v5
*
* @mbg.generated
*/
public void setV5(String v5) {
this.v5 = v5 == null ? null : v5.trim();
}
}

View File

@ -0,0 +1,703 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.model;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table location_record
*/
public class LocationRecord {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.id
*
* @mbg.generated
*/
private String id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.callback_time
*
* @mbg.generated
*/
private Date callbackTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.location_time
*
* @mbg.generated
*/
private Date locationTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.location_type
*
* @mbg.generated
*/
private Integer locationType;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.latitude
*
* @mbg.generated
*/
private Double latitude;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.longitude
*
* @mbg.generated
*/
private Double longitude;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.accuracy
*
* @mbg.generated
*/
private Double accuracy;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.altitude
*
* @mbg.generated
*/
private Double altitude;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.bearing
*
* @mbg.generated
*/
private Double bearing;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.speed
*
* @mbg.generated
*/
private Double speed;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.country
*
* @mbg.generated
*/
private String country;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.province
*
* @mbg.generated
*/
private String province;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.city
*
* @mbg.generated
*/
private String city;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.district
*
* @mbg.generated
*/
private String district;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.street
*
* @mbg.generated
*/
private String street;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.street_number
*
* @mbg.generated
*/
private String streetNumber;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.city_code
*
* @mbg.generated
*/
private String cityCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.ad_code
*
* @mbg.generated
*/
private String adCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.address
*
* @mbg.generated
*/
private String address;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.description
*
* @mbg.generated
*/
private String description;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column location_record.user_id
*
* @mbg.generated
*/
private Long userId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.id
*
* @return the value of location_record.id
*
* @mbg.generated
*/
public String getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.id
*
* @param id the value for location_record.id
*
* @mbg.generated
*/
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.callback_time
*
* @return the value of location_record.callback_time
*
* @mbg.generated
*/
public Date getCallbackTime() {
return callbackTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.callback_time
*
* @param callbackTime the value for location_record.callback_time
*
* @mbg.generated
*/
public void setCallbackTime(Date callbackTime) {
this.callbackTime = callbackTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.location_time
*
* @return the value of location_record.location_time
*
* @mbg.generated
*/
public Date getLocationTime() {
return locationTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.location_time
*
* @param locationTime the value for location_record.location_time
*
* @mbg.generated
*/
public void setLocationTime(Date locationTime) {
this.locationTime = locationTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.location_type
*
* @return the value of location_record.location_type
*
* @mbg.generated
*/
public Integer getLocationType() {
return locationType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.location_type
*
* @param locationType the value for location_record.location_type
*
* @mbg.generated
*/
public void setLocationType(Integer locationType) {
this.locationType = locationType;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.latitude
*
* @return the value of location_record.latitude
*
* @mbg.generated
*/
public Double getLatitude() {
return latitude;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.latitude
*
* @param latitude the value for location_record.latitude
*
* @mbg.generated
*/
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.longitude
*
* @return the value of location_record.longitude
*
* @mbg.generated
*/
public Double getLongitude() {
return longitude;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.longitude
*
* @param longitude the value for location_record.longitude
*
* @mbg.generated
*/
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.accuracy
*
* @return the value of location_record.accuracy
*
* @mbg.generated
*/
public Double getAccuracy() {
return accuracy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.accuracy
*
* @param accuracy the value for location_record.accuracy
*
* @mbg.generated
*/
public void setAccuracy(Double accuracy) {
this.accuracy = accuracy;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.altitude
*
* @return the value of location_record.altitude
*
* @mbg.generated
*/
public Double getAltitude() {
return altitude;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.altitude
*
* @param altitude the value for location_record.altitude
*
* @mbg.generated
*/
public void setAltitude(Double altitude) {
this.altitude = altitude;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.bearing
*
* @return the value of location_record.bearing
*
* @mbg.generated
*/
public Double getBearing() {
return bearing;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.bearing
*
* @param bearing the value for location_record.bearing
*
* @mbg.generated
*/
public void setBearing(Double bearing) {
this.bearing = bearing;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.speed
*
* @return the value of location_record.speed
*
* @mbg.generated
*/
public Double getSpeed() {
return speed;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.speed
*
* @param speed the value for location_record.speed
*
* @mbg.generated
*/
public void setSpeed(Double speed) {
this.speed = speed;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.country
*
* @return the value of location_record.country
*
* @mbg.generated
*/
public String getCountry() {
return country;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.country
*
* @param country the value for location_record.country
*
* @mbg.generated
*/
public void setCountry(String country) {
this.country = country == null ? null : country.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.province
*
* @return the value of location_record.province
*
* @mbg.generated
*/
public String getProvince() {
return province;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.province
*
* @param province the value for location_record.province
*
* @mbg.generated
*/
public void setProvince(String province) {
this.province = province == null ? null : province.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.city
*
* @return the value of location_record.city
*
* @mbg.generated
*/
public String getCity() {
return city;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.city
*
* @param city the value for location_record.city
*
* @mbg.generated
*/
public void setCity(String city) {
this.city = city == null ? null : city.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.district
*
* @return the value of location_record.district
*
* @mbg.generated
*/
public String getDistrict() {
return district;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.district
*
* @param district the value for location_record.district
*
* @mbg.generated
*/
public void setDistrict(String district) {
this.district = district == null ? null : district.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.street
*
* @return the value of location_record.street
*
* @mbg.generated
*/
public String getStreet() {
return street;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.street
*
* @param street the value for location_record.street
*
* @mbg.generated
*/
public void setStreet(String street) {
this.street = street == null ? null : street.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.street_number
*
* @return the value of location_record.street_number
*
* @mbg.generated
*/
public String getStreetNumber() {
return streetNumber;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.street_number
*
* @param streetNumber the value for location_record.street_number
*
* @mbg.generated
*/
public void setStreetNumber(String streetNumber) {
this.streetNumber = streetNumber == null ? null : streetNumber.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.city_code
*
* @return the value of location_record.city_code
*
* @mbg.generated
*/
public String getCityCode() {
return cityCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.city_code
*
* @param cityCode the value for location_record.city_code
*
* @mbg.generated
*/
public void setCityCode(String cityCode) {
this.cityCode = cityCode == null ? null : cityCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.ad_code
*
* @return the value of location_record.ad_code
*
* @mbg.generated
*/
public String getAdCode() {
return adCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.ad_code
*
* @param adCode the value for location_record.ad_code
*
* @mbg.generated
*/
public void setAdCode(String adCode) {
this.adCode = adCode == null ? null : adCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.address
*
* @return the value of location_record.address
*
* @mbg.generated
*/
public String getAddress() {
return address;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.address
*
* @param address the value for location_record.address
*
* @mbg.generated
*/
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.description
*
* @return the value of location_record.description
*
* @mbg.generated
*/
public String getDescription() {
return description;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.description
*
* @param description the value for location_record.description
*
* @mbg.generated
*/
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column location_record.user_id
*
* @return the value of location_record.user_id
*
* @mbg.generated
*/
public Long getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column location_record.user_id
*
* @param userId the value for location_record.user_id
*
* @mbg.generated
*/
public void setUserId(Long userId) {
this.userId = userId;
}
}

View File

@ -0,0 +1,179 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.model;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table role
*/
public class Role {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column role.id
*
* @mbg.generated
*/
private Long id;
/**
* Database Column Remarks:
* 角色
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column role.role
*
* @mbg.generated
*/
private String role;
/**
* Database Column Remarks:
* 角色名
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column role.name
*
* @mbg.generated
*/
private String name;
/**
* Database Column Remarks:
* 所属系统
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column role.system_id
*
* @mbg.generated
*/
private String systemId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column role.active
*
* @mbg.generated
*/
private Boolean active;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column role.id
*
* @return the value of role.id
*
* @mbg.generated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column role.id
*
* @param id the value for role.id
*
* @mbg.generated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column role.role
*
* @return the value of role.role
*
* @mbg.generated
*/
public String getRole() {
return role;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column role.role
*
* @param role the value for role.role
*
* @mbg.generated
*/
public void setRole(String role) {
this.role = role == null ? null : role.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column role.name
*
* @return the value of role.name
*
* @mbg.generated
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column role.name
*
* @param name the value for role.name
*
* @mbg.generated
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column role.system_id
*
* @return the value of role.system_id
*
* @mbg.generated
*/
public String getSystemId() {
return systemId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column role.system_id
*
* @param systemId the value for role.system_id
*
* @mbg.generated
*/
public void setSystemId(String systemId) {
this.systemId = systemId == null ? null : systemId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column role.active
*
* @return the value of role.active
*
* @mbg.generated
*/
public Boolean getActive() {
return active;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column role.active
*
* @param active the value for role.active
*
* @mbg.generated
*/
public void setActive(Boolean active) {
this.active = active;
}
}

View File

@ -0,0 +1,311 @@
package cn.skcks.matrix.v2.orm.mybatis.basic.model;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table user
*/
public class User {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.id
*
* @mbg.generated
*/
private Long id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.user_name
*
* @mbg.generated
*/
private String userName;
/**
* Database Column Remarks:
* 加密后的密码
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.password
*
* @mbg.generated
*/
private String password;
/**
* Database Column Remarks:
* 加密密钥
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.salt
*
* @mbg.generated
*/
private String salt;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.email
*
* @mbg.generated
*/
private String email;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.phone_number
*
* @mbg.generated
*/
private String phoneNumber;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.description
*
* @mbg.generated
*/
private String description;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user.update_time
*
* @mbg.generated
*/
private Date updateTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.id
*
* @return the value of user.id
*
* @mbg.generated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.id
*
* @param id the value for user.id
*
* @mbg.generated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.user_name
*
* @return the value of user.user_name
*
* @mbg.generated
*/
public String getUserName() {
return userName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.user_name
*
* @param userName the value for user.user_name
*
* @mbg.generated
*/
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.password
*
* @return the value of user.password
*
* @mbg.generated
*/
public String getPassword() {
return password;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.password
*
* @param password the value for user.password
*
* @mbg.generated
*/
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.salt
*
* @return the value of user.salt
*
* @mbg.generated
*/
public String getSalt() {
return salt;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.salt
*
* @param salt the value for user.salt
*
* @mbg.generated
*/
public void setSalt(String salt) {
this.salt = salt == null ? null : salt.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.email
*
* @return the value of user.email
*
* @mbg.generated
*/
public String getEmail() {
return email;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.email
*
* @param email the value for user.email
*
* @mbg.generated
*/
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.phone_number
*
* @return the value of user.phone_number
*
* @mbg.generated
*/
public String getPhoneNumber() {
return phoneNumber;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.phone_number
*
* @param phoneNumber the value for user.phone_number
*
* @mbg.generated
*/
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber == null ? null : phoneNumber.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.description
*
* @return the value of user.description
*
* @mbg.generated
*/
public String getDescription() {
return description;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.description
*
* @param description the value for user.description
*
* @mbg.generated
*/
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.create_time
*
* @return the value of user.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.create_time
*
* @param createTime the value for user.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user.update_time
*
* @return the value of user.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user.update_time
*
* @param updateTime the value for user.update_time
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,58 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import java.sql.JDBCType;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.AliasableSqlTable;
import org.mybatis.dynamic.sql.SqlColumn;
public final class CasbinRuleDynamicSqlSupport {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
public static final CasbinRule casbinRule = new CasbinRule();
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.id")
public static final SqlColumn<Integer> id = casbinRule.id;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.ptype")
public static final SqlColumn<String> ptype = casbinRule.ptype;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v0")
public static final SqlColumn<String> v0 = casbinRule.v0;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v1")
public static final SqlColumn<String> v1 = casbinRule.v1;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v2")
public static final SqlColumn<String> v2 = casbinRule.v2;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v3")
public static final SqlColumn<String> v3 = casbinRule.v3;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v4")
public static final SqlColumn<String> v4 = casbinRule.v4;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v5")
public static final SqlColumn<String> v5 = casbinRule.v5;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
public static final class CasbinRule extends AliasableSqlTable<CasbinRule> {
public final SqlColumn<Integer> id = column("id", JDBCType.INTEGER);
public final SqlColumn<String> ptype = column("ptype", JDBCType.VARCHAR);
public final SqlColumn<String> v0 = column("v0", JDBCType.VARCHAR);
public final SqlColumn<String> v1 = column("v1", JDBCType.VARCHAR);
public final SqlColumn<String> v2 = column("v2", JDBCType.VARCHAR);
public final SqlColumn<String> v3 = column("v3", JDBCType.VARCHAR);
public final SqlColumn<String> v4 = column("v4", JDBCType.VARCHAR);
public final SqlColumn<String> v5 = column("v5", JDBCType.VARCHAR);
public CasbinRule() {
super("casbin_rule", CasbinRule::new);
}
}
}

View File

@ -0,0 +1,195 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import static cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper.CasbinRuleDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
import cn.skcks.matrix.v2.orm.mybatis.dynamic.model.CasbinRule;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
@Mapper
public interface CasbinRuleMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<CasbinRule>, CommonUpdateMapper {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
BasicColumn[] selectList = BasicColumn.columnList(id, ptype, v0, v1, v2, v3, v4, v5);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="CasbinRuleResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="ptype", property="ptype", jdbcType=JdbcType.VARCHAR),
@Result(column="v0", property="v0", jdbcType=JdbcType.VARCHAR),
@Result(column="v1", property="v1", jdbcType=JdbcType.VARCHAR),
@Result(column="v2", property="v2", jdbcType=JdbcType.VARCHAR),
@Result(column="v3", property="v3", jdbcType=JdbcType.VARCHAR),
@Result(column="v4", property="v4", jdbcType=JdbcType.VARCHAR),
@Result(column="v5", property="v5", jdbcType=JdbcType.VARCHAR)
})
List<CasbinRule> selectMany(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("CasbinRuleResult")
Optional<CasbinRule> selectOne(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, casbinRule, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, casbinRule, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int deleteByPrimaryKey(Integer id_) {
return delete(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int insert(CasbinRule row) {
return MyBatis3Utils.insert(this::insert, row, casbinRule, c ->
c.map(id).toProperty("id")
.map(ptype).toProperty("ptype")
.map(v0).toProperty("v0")
.map(v1).toProperty("v1")
.map(v2).toProperty("v2")
.map(v3).toProperty("v3")
.map(v4).toProperty("v4")
.map(v5).toProperty("v5")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int insertMultiple(Collection<CasbinRule> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, casbinRule, c ->
c.map(id).toProperty("id")
.map(ptype).toProperty("ptype")
.map(v0).toProperty("v0")
.map(v1).toProperty("v1")
.map(v2).toProperty("v2")
.map(v3).toProperty("v3")
.map(v4).toProperty("v4")
.map(v5).toProperty("v5")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int insertSelective(CasbinRule row) {
return MyBatis3Utils.insert(this::insert, row, casbinRule, c ->
c.map(id).toPropertyWhenPresent("id", row::getId)
.map(ptype).toPropertyWhenPresent("ptype", row::getPtype)
.map(v0).toPropertyWhenPresent("v0", row::getV0)
.map(v1).toPropertyWhenPresent("v1", row::getV1)
.map(v2).toPropertyWhenPresent("v2", row::getV2)
.map(v3).toPropertyWhenPresent("v3", row::getV3)
.map(v4).toPropertyWhenPresent("v4", row::getV4)
.map(v5).toPropertyWhenPresent("v5", row::getV5)
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default Optional<CasbinRule> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, casbinRule, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default List<CasbinRule> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, casbinRule, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default List<CasbinRule> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, casbinRule, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default Optional<CasbinRule> selectByPrimaryKey(Integer id_) {
return selectOne(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, casbinRule, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
static UpdateDSL<UpdateModel> updateAllColumns(CasbinRule row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalTo(row::getId)
.set(ptype).equalTo(row::getPtype)
.set(v0).equalTo(row::getV0)
.set(v1).equalTo(row::getV1)
.set(v2).equalTo(row::getV2)
.set(v3).equalTo(row::getV3)
.set(v4).equalTo(row::getV4)
.set(v5).equalTo(row::getV5);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
static UpdateDSL<UpdateModel> updateSelectiveColumns(CasbinRule row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalToWhenPresent(row::getId)
.set(ptype).equalToWhenPresent(row::getPtype)
.set(v0).equalToWhenPresent(row::getV0)
.set(v1).equalToWhenPresent(row::getV1)
.set(v2).equalToWhenPresent(row::getV2)
.set(v3).equalToWhenPresent(row::getV3)
.set(v4).equalToWhenPresent(row::getV4)
.set(v5).equalToWhenPresent(row::getV5);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int updateByPrimaryKey(CasbinRule row) {
return update(c ->
c.set(ptype).equalTo(row::getPtype)
.set(v0).equalTo(row::getV0)
.set(v1).equalTo(row::getV1)
.set(v2).equalTo(row::getV2)
.set(v3).equalTo(row::getV3)
.set(v4).equalTo(row::getV4)
.set(v5).equalTo(row::getV5)
.where(id, isEqualTo(row::getId))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: casbin_rule")
default int updateByPrimaryKeySelective(CasbinRule row) {
return update(c ->
c.set(ptype).equalToWhenPresent(row::getPtype)
.set(v0).equalToWhenPresent(row::getV0)
.set(v1).equalToWhenPresent(row::getV1)
.set(v2).equalToWhenPresent(row::getV2)
.set(v3).equalToWhenPresent(row::getV3)
.set(v4).equalToWhenPresent(row::getV4)
.set(v5).equalToWhenPresent(row::getV5)
.where(id, isEqualTo(row::getId))
);
}
}

View File

@ -0,0 +1,124 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import java.sql.JDBCType;
import java.util.Date;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.AliasableSqlTable;
import org.mybatis.dynamic.sql.SqlColumn;
public final class LocationRecordDynamicSqlSupport {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
public static final LocationRecord locationRecord = new LocationRecord();
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.id")
public static final SqlColumn<String> id = locationRecord.id;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.callback_time")
public static final SqlColumn<Date> callbackTime = locationRecord.callbackTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_time")
public static final SqlColumn<Date> locationTime = locationRecord.locationTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_type")
public static final SqlColumn<Integer> locationType = locationRecord.locationType;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.latitude")
public static final SqlColumn<Double> latitude = locationRecord.latitude;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.longitude")
public static final SqlColumn<Double> longitude = locationRecord.longitude;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.accuracy")
public static final SqlColumn<Double> accuracy = locationRecord.accuracy;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.altitude")
public static final SqlColumn<Double> altitude = locationRecord.altitude;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.bearing")
public static final SqlColumn<Double> bearing = locationRecord.bearing;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.speed")
public static final SqlColumn<Double> speed = locationRecord.speed;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.country")
public static final SqlColumn<String> country = locationRecord.country;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.province")
public static final SqlColumn<String> province = locationRecord.province;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city")
public static final SqlColumn<String> city = locationRecord.city;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.district")
public static final SqlColumn<String> district = locationRecord.district;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street")
public static final SqlColumn<String> street = locationRecord.street;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street_number")
public static final SqlColumn<String> streetNumber = locationRecord.streetNumber;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city_code")
public static final SqlColumn<String> cityCode = locationRecord.cityCode;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.ad_code")
public static final SqlColumn<String> adCode = locationRecord.adCode;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.address")
public static final SqlColumn<String> address = locationRecord.address;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.description")
public static final SqlColumn<String> description = locationRecord.description;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.user_id")
public static final SqlColumn<Long> userId = locationRecord.userId;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
public static final class LocationRecord extends AliasableSqlTable<LocationRecord> {
public final SqlColumn<String> id = column("id", JDBCType.VARCHAR);
public final SqlColumn<Date> callbackTime = column("callback_time", JDBCType.TIMESTAMP);
public final SqlColumn<Date> locationTime = column("location_time", JDBCType.TIMESTAMP);
public final SqlColumn<Integer> locationType = column("location_type", JDBCType.INTEGER);
public final SqlColumn<Double> latitude = column("latitude", JDBCType.DOUBLE);
public final SqlColumn<Double> longitude = column("longitude", JDBCType.DOUBLE);
public final SqlColumn<Double> accuracy = column("accuracy", JDBCType.DOUBLE);
public final SqlColumn<Double> altitude = column("altitude", JDBCType.DOUBLE);
public final SqlColumn<Double> bearing = column("bearing", JDBCType.DOUBLE);
public final SqlColumn<Double> speed = column("speed", JDBCType.DOUBLE);
public final SqlColumn<String> country = column("country", JDBCType.VARCHAR);
public final SqlColumn<String> province = column("province", JDBCType.VARCHAR);
public final SqlColumn<String> city = column("city", JDBCType.VARCHAR);
public final SqlColumn<String> district = column("district", JDBCType.VARCHAR);
public final SqlColumn<String> street = column("street", JDBCType.VARCHAR);
public final SqlColumn<String> streetNumber = column("street_number", JDBCType.VARCHAR);
public final SqlColumn<String> cityCode = column("city_code", JDBCType.VARCHAR);
public final SqlColumn<String> adCode = column("ad_code", JDBCType.VARCHAR);
public final SqlColumn<String> address = column("address", JDBCType.VARCHAR);
public final SqlColumn<String> description = column("description", JDBCType.VARCHAR);
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
public LocationRecord() {
super("location_record", LocationRecord::new);
}
}
}

View File

@ -0,0 +1,298 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
import cn.skcks.matrix.v2.orm.mybatis.dynamic.model.LocationRecord;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
@Mapper
public interface LocationRecordMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<LocationRecord>, CommonUpdateMapper {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
BasicColumn[] selectList = BasicColumn.columnList(LocationRecordDynamicSqlSupport.id, LocationRecordDynamicSqlSupport.callbackTime, LocationRecordDynamicSqlSupport.locationTime, LocationRecordDynamicSqlSupport.locationType, LocationRecordDynamicSqlSupport.latitude, LocationRecordDynamicSqlSupport.longitude, LocationRecordDynamicSqlSupport.accuracy, LocationRecordDynamicSqlSupport.altitude, LocationRecordDynamicSqlSupport.bearing, LocationRecordDynamicSqlSupport.speed, LocationRecordDynamicSqlSupport.country, LocationRecordDynamicSqlSupport.province, LocationRecordDynamicSqlSupport.city, LocationRecordDynamicSqlSupport.district, LocationRecordDynamicSqlSupport.street, LocationRecordDynamicSqlSupport.streetNumber, LocationRecordDynamicSqlSupport.cityCode, LocationRecordDynamicSqlSupport.adCode, LocationRecordDynamicSqlSupport.address, LocationRecordDynamicSqlSupport.description, LocationRecordDynamicSqlSupport.userId);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="LocationRecordResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
@Result(column="callback_time", property="callbackTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="location_time", property="locationTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="location_type", property="locationType", jdbcType=JdbcType.INTEGER),
@Result(column="latitude", property="latitude", jdbcType=JdbcType.DOUBLE),
@Result(column="longitude", property="longitude", jdbcType=JdbcType.DOUBLE),
@Result(column="accuracy", property="accuracy", jdbcType=JdbcType.DOUBLE),
@Result(column="altitude", property="altitude", jdbcType=JdbcType.DOUBLE),
@Result(column="bearing", property="bearing", jdbcType=JdbcType.DOUBLE),
@Result(column="speed", property="speed", jdbcType=JdbcType.DOUBLE),
@Result(column="country", property="country", jdbcType=JdbcType.VARCHAR),
@Result(column="province", property="province", jdbcType=JdbcType.VARCHAR),
@Result(column="city", property="city", jdbcType=JdbcType.VARCHAR),
@Result(column="district", property="district", jdbcType=JdbcType.VARCHAR),
@Result(column="street", property="street", jdbcType=JdbcType.VARCHAR),
@Result(column="street_number", property="streetNumber", jdbcType=JdbcType.VARCHAR),
@Result(column="city_code", property="cityCode", jdbcType=JdbcType.VARCHAR),
@Result(column="ad_code", property="adCode", jdbcType=JdbcType.VARCHAR),
@Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT)
})
List<LocationRecord> selectMany(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("LocationRecordResult")
Optional<LocationRecord> selectOne(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, LocationRecordDynamicSqlSupport.locationRecord, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, LocationRecordDynamicSqlSupport.locationRecord, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int deleteByPrimaryKey(String id_) {
return delete(c ->
c.where(LocationRecordDynamicSqlSupport.id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int insert(LocationRecord row) {
return MyBatis3Utils.insert(this::insert, row, LocationRecordDynamicSqlSupport.locationRecord, c ->
c.map(LocationRecordDynamicSqlSupport.id).toProperty("id")
.map(LocationRecordDynamicSqlSupport.callbackTime).toProperty("callbackTime")
.map(LocationRecordDynamicSqlSupport.locationTime).toProperty("locationTime")
.map(LocationRecordDynamicSqlSupport.locationType).toProperty("locationType")
.map(LocationRecordDynamicSqlSupport.latitude).toProperty("latitude")
.map(LocationRecordDynamicSqlSupport.longitude).toProperty("longitude")
.map(LocationRecordDynamicSqlSupport.accuracy).toProperty("accuracy")
.map(LocationRecordDynamicSqlSupport.altitude).toProperty("altitude")
.map(LocationRecordDynamicSqlSupport.bearing).toProperty("bearing")
.map(LocationRecordDynamicSqlSupport.speed).toProperty("speed")
.map(LocationRecordDynamicSqlSupport.country).toProperty("country")
.map(LocationRecordDynamicSqlSupport.province).toProperty("province")
.map(LocationRecordDynamicSqlSupport.city).toProperty("city")
.map(LocationRecordDynamicSqlSupport.district).toProperty("district")
.map(LocationRecordDynamicSqlSupport.street).toProperty("street")
.map(LocationRecordDynamicSqlSupport.streetNumber).toProperty("streetNumber")
.map(LocationRecordDynamicSqlSupport.cityCode).toProperty("cityCode")
.map(LocationRecordDynamicSqlSupport.adCode).toProperty("adCode")
.map(LocationRecordDynamicSqlSupport.address).toProperty("address")
.map(LocationRecordDynamicSqlSupport.description).toProperty("description")
.map(LocationRecordDynamicSqlSupport.userId).toProperty("userId")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int insertMultiple(Collection<LocationRecord> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, LocationRecordDynamicSqlSupport.locationRecord, c ->
c.map(LocationRecordDynamicSqlSupport.id).toProperty("id")
.map(LocationRecordDynamicSqlSupport.callbackTime).toProperty("callbackTime")
.map(LocationRecordDynamicSqlSupport.locationTime).toProperty("locationTime")
.map(LocationRecordDynamicSqlSupport.locationType).toProperty("locationType")
.map(LocationRecordDynamicSqlSupport.latitude).toProperty("latitude")
.map(LocationRecordDynamicSqlSupport.longitude).toProperty("longitude")
.map(LocationRecordDynamicSqlSupport.accuracy).toProperty("accuracy")
.map(LocationRecordDynamicSqlSupport.altitude).toProperty("altitude")
.map(LocationRecordDynamicSqlSupport.bearing).toProperty("bearing")
.map(LocationRecordDynamicSqlSupport.speed).toProperty("speed")
.map(LocationRecordDynamicSqlSupport.country).toProperty("country")
.map(LocationRecordDynamicSqlSupport.province).toProperty("province")
.map(LocationRecordDynamicSqlSupport.city).toProperty("city")
.map(LocationRecordDynamicSqlSupport.district).toProperty("district")
.map(LocationRecordDynamicSqlSupport.street).toProperty("street")
.map(LocationRecordDynamicSqlSupport.streetNumber).toProperty("streetNumber")
.map(LocationRecordDynamicSqlSupport.cityCode).toProperty("cityCode")
.map(LocationRecordDynamicSqlSupport.adCode).toProperty("adCode")
.map(LocationRecordDynamicSqlSupport.address).toProperty("address")
.map(LocationRecordDynamicSqlSupport.description).toProperty("description")
.map(LocationRecordDynamicSqlSupport.userId).toProperty("userId")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int insertSelective(LocationRecord row) {
return MyBatis3Utils.insert(this::insert, row, LocationRecordDynamicSqlSupport.locationRecord, c ->
c.map(LocationRecordDynamicSqlSupport.id).toPropertyWhenPresent("id", row::getId)
.map(LocationRecordDynamicSqlSupport.callbackTime).toPropertyWhenPresent("callbackTime", row::getCallbackTime)
.map(LocationRecordDynamicSqlSupport.locationTime).toPropertyWhenPresent("locationTime", row::getLocationTime)
.map(LocationRecordDynamicSqlSupport.locationType).toPropertyWhenPresent("locationType", row::getLocationType)
.map(LocationRecordDynamicSqlSupport.latitude).toPropertyWhenPresent("latitude", row::getLatitude)
.map(LocationRecordDynamicSqlSupport.longitude).toPropertyWhenPresent("longitude", row::getLongitude)
.map(LocationRecordDynamicSqlSupport.accuracy).toPropertyWhenPresent("accuracy", row::getAccuracy)
.map(LocationRecordDynamicSqlSupport.altitude).toPropertyWhenPresent("altitude", row::getAltitude)
.map(LocationRecordDynamicSqlSupport.bearing).toPropertyWhenPresent("bearing", row::getBearing)
.map(LocationRecordDynamicSqlSupport.speed).toPropertyWhenPresent("speed", row::getSpeed)
.map(LocationRecordDynamicSqlSupport.country).toPropertyWhenPresent("country", row::getCountry)
.map(LocationRecordDynamicSqlSupport.province).toPropertyWhenPresent("province", row::getProvince)
.map(LocationRecordDynamicSqlSupport.city).toPropertyWhenPresent("city", row::getCity)
.map(LocationRecordDynamicSqlSupport.district).toPropertyWhenPresent("district", row::getDistrict)
.map(LocationRecordDynamicSqlSupport.street).toPropertyWhenPresent("street", row::getStreet)
.map(LocationRecordDynamicSqlSupport.streetNumber).toPropertyWhenPresent("streetNumber", row::getStreetNumber)
.map(LocationRecordDynamicSqlSupport.cityCode).toPropertyWhenPresent("cityCode", row::getCityCode)
.map(LocationRecordDynamicSqlSupport.adCode).toPropertyWhenPresent("adCode", row::getAdCode)
.map(LocationRecordDynamicSqlSupport.address).toPropertyWhenPresent("address", row::getAddress)
.map(LocationRecordDynamicSqlSupport.description).toPropertyWhenPresent("description", row::getDescription)
.map(LocationRecordDynamicSqlSupport.userId).toPropertyWhenPresent("userId", row::getUserId)
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default Optional<LocationRecord> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, LocationRecordDynamicSqlSupport.locationRecord, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default List<LocationRecord> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, LocationRecordDynamicSqlSupport.locationRecord, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default List<LocationRecord> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, LocationRecordDynamicSqlSupport.locationRecord, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default Optional<LocationRecord> selectByPrimaryKey(String id_) {
return selectOne(c ->
c.where(LocationRecordDynamicSqlSupport.id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, LocationRecordDynamicSqlSupport.locationRecord, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
static UpdateDSL<UpdateModel> updateAllColumns(LocationRecord row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(LocationRecordDynamicSqlSupport.id).equalTo(row::getId)
.set(LocationRecordDynamicSqlSupport.callbackTime).equalTo(row::getCallbackTime)
.set(LocationRecordDynamicSqlSupport.locationTime).equalTo(row::getLocationTime)
.set(LocationRecordDynamicSqlSupport.locationType).equalTo(row::getLocationType)
.set(LocationRecordDynamicSqlSupport.latitude).equalTo(row::getLatitude)
.set(LocationRecordDynamicSqlSupport.longitude).equalTo(row::getLongitude)
.set(LocationRecordDynamicSqlSupport.accuracy).equalTo(row::getAccuracy)
.set(LocationRecordDynamicSqlSupport.altitude).equalTo(row::getAltitude)
.set(LocationRecordDynamicSqlSupport.bearing).equalTo(row::getBearing)
.set(LocationRecordDynamicSqlSupport.speed).equalTo(row::getSpeed)
.set(LocationRecordDynamicSqlSupport.country).equalTo(row::getCountry)
.set(LocationRecordDynamicSqlSupport.province).equalTo(row::getProvince)
.set(LocationRecordDynamicSqlSupport.city).equalTo(row::getCity)
.set(LocationRecordDynamicSqlSupport.district).equalTo(row::getDistrict)
.set(LocationRecordDynamicSqlSupport.street).equalTo(row::getStreet)
.set(LocationRecordDynamicSqlSupport.streetNumber).equalTo(row::getStreetNumber)
.set(LocationRecordDynamicSqlSupport.cityCode).equalTo(row::getCityCode)
.set(LocationRecordDynamicSqlSupport.adCode).equalTo(row::getAdCode)
.set(LocationRecordDynamicSqlSupport.address).equalTo(row::getAddress)
.set(LocationRecordDynamicSqlSupport.description).equalTo(row::getDescription)
.set(LocationRecordDynamicSqlSupport.userId).equalTo(row::getUserId);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
static UpdateDSL<UpdateModel> updateSelectiveColumns(LocationRecord row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(LocationRecordDynamicSqlSupport.id).equalToWhenPresent(row::getId)
.set(LocationRecordDynamicSqlSupport.callbackTime).equalToWhenPresent(row::getCallbackTime)
.set(LocationRecordDynamicSqlSupport.locationTime).equalToWhenPresent(row::getLocationTime)
.set(LocationRecordDynamicSqlSupport.locationType).equalToWhenPresent(row::getLocationType)
.set(LocationRecordDynamicSqlSupport.latitude).equalToWhenPresent(row::getLatitude)
.set(LocationRecordDynamicSqlSupport.longitude).equalToWhenPresent(row::getLongitude)
.set(LocationRecordDynamicSqlSupport.accuracy).equalToWhenPresent(row::getAccuracy)
.set(LocationRecordDynamicSqlSupport.altitude).equalToWhenPresent(row::getAltitude)
.set(LocationRecordDynamicSqlSupport.bearing).equalToWhenPresent(row::getBearing)
.set(LocationRecordDynamicSqlSupport.speed).equalToWhenPresent(row::getSpeed)
.set(LocationRecordDynamicSqlSupport.country).equalToWhenPresent(row::getCountry)
.set(LocationRecordDynamicSqlSupport.province).equalToWhenPresent(row::getProvince)
.set(LocationRecordDynamicSqlSupport.city).equalToWhenPresent(row::getCity)
.set(LocationRecordDynamicSqlSupport.district).equalToWhenPresent(row::getDistrict)
.set(LocationRecordDynamicSqlSupport.street).equalToWhenPresent(row::getStreet)
.set(LocationRecordDynamicSqlSupport.streetNumber).equalToWhenPresent(row::getStreetNumber)
.set(LocationRecordDynamicSqlSupport.cityCode).equalToWhenPresent(row::getCityCode)
.set(LocationRecordDynamicSqlSupport.adCode).equalToWhenPresent(row::getAdCode)
.set(LocationRecordDynamicSqlSupport.address).equalToWhenPresent(row::getAddress)
.set(LocationRecordDynamicSqlSupport.description).equalToWhenPresent(row::getDescription)
.set(LocationRecordDynamicSqlSupport.userId).equalToWhenPresent(row::getUserId);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int updateByPrimaryKey(LocationRecord row) {
return update(c ->
c.set(LocationRecordDynamicSqlSupport.callbackTime).equalTo(row::getCallbackTime)
.set(LocationRecordDynamicSqlSupport.locationTime).equalTo(row::getLocationTime)
.set(LocationRecordDynamicSqlSupport.locationType).equalTo(row::getLocationType)
.set(LocationRecordDynamicSqlSupport.latitude).equalTo(row::getLatitude)
.set(LocationRecordDynamicSqlSupport.longitude).equalTo(row::getLongitude)
.set(LocationRecordDynamicSqlSupport.accuracy).equalTo(row::getAccuracy)
.set(LocationRecordDynamicSqlSupport.altitude).equalTo(row::getAltitude)
.set(LocationRecordDynamicSqlSupport.bearing).equalTo(row::getBearing)
.set(LocationRecordDynamicSqlSupport.speed).equalTo(row::getSpeed)
.set(LocationRecordDynamicSqlSupport.country).equalTo(row::getCountry)
.set(LocationRecordDynamicSqlSupport.province).equalTo(row::getProvince)
.set(LocationRecordDynamicSqlSupport.city).equalTo(row::getCity)
.set(LocationRecordDynamicSqlSupport.district).equalTo(row::getDistrict)
.set(LocationRecordDynamicSqlSupport.street).equalTo(row::getStreet)
.set(LocationRecordDynamicSqlSupport.streetNumber).equalTo(row::getStreetNumber)
.set(LocationRecordDynamicSqlSupport.cityCode).equalTo(row::getCityCode)
.set(LocationRecordDynamicSqlSupport.adCode).equalTo(row::getAdCode)
.set(LocationRecordDynamicSqlSupport.address).equalTo(row::getAddress)
.set(LocationRecordDynamicSqlSupport.description).equalTo(row::getDescription)
.set(LocationRecordDynamicSqlSupport.userId).equalTo(row::getUserId)
.where(LocationRecordDynamicSqlSupport.id, isEqualTo(row::getId))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: location_record")
default int updateByPrimaryKeySelective(LocationRecord row) {
return update(c ->
c.set(LocationRecordDynamicSqlSupport.callbackTime).equalToWhenPresent(row::getCallbackTime)
.set(LocationRecordDynamicSqlSupport.locationTime).equalToWhenPresent(row::getLocationTime)
.set(LocationRecordDynamicSqlSupport.locationType).equalToWhenPresent(row::getLocationType)
.set(LocationRecordDynamicSqlSupport.latitude).equalToWhenPresent(row::getLatitude)
.set(LocationRecordDynamicSqlSupport.longitude).equalToWhenPresent(row::getLongitude)
.set(LocationRecordDynamicSqlSupport.accuracy).equalToWhenPresent(row::getAccuracy)
.set(LocationRecordDynamicSqlSupport.altitude).equalToWhenPresent(row::getAltitude)
.set(LocationRecordDynamicSqlSupport.bearing).equalToWhenPresent(row::getBearing)
.set(LocationRecordDynamicSqlSupport.speed).equalToWhenPresent(row::getSpeed)
.set(LocationRecordDynamicSqlSupport.country).equalToWhenPresent(row::getCountry)
.set(LocationRecordDynamicSqlSupport.province).equalToWhenPresent(row::getProvince)
.set(LocationRecordDynamicSqlSupport.city).equalToWhenPresent(row::getCity)
.set(LocationRecordDynamicSqlSupport.district).equalToWhenPresent(row::getDistrict)
.set(LocationRecordDynamicSqlSupport.street).equalToWhenPresent(row::getStreet)
.set(LocationRecordDynamicSqlSupport.streetNumber).equalToWhenPresent(row::getStreetNumber)
.set(LocationRecordDynamicSqlSupport.cityCode).equalToWhenPresent(row::getCityCode)
.set(LocationRecordDynamicSqlSupport.adCode).equalToWhenPresent(row::getAdCode)
.set(LocationRecordDynamicSqlSupport.address).equalToWhenPresent(row::getAddress)
.set(LocationRecordDynamicSqlSupport.description).equalToWhenPresent(row::getDescription)
.set(LocationRecordDynamicSqlSupport.userId).equalToWhenPresent(row::getUserId)
.where(LocationRecordDynamicSqlSupport.id, isEqualTo(row::getId))
);
}
}

View File

@ -0,0 +1,48 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import java.sql.JDBCType;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.AliasableSqlTable;
import org.mybatis.dynamic.sql.SqlColumn;
public final class RoleDynamicSqlSupport {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
public static final Role role = new Role();
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.id")
public static final SqlColumn<Long> id = role.id;
/**
* Database Column Remarks:
* 角色名
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.name")
public static final SqlColumn<String> name = role.name;
/**
* Database Column Remarks:
* 所属系统
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.system_id")
public static final SqlColumn<String> systemId = role.systemId;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.active")
public static final SqlColumn<Boolean> active = role.active;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
public static final class Role extends AliasableSqlTable<Role> {
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
public final SqlColumn<String> role = column("role", JDBCType.VARCHAR);
public final SqlColumn<String> name = column("name", JDBCType.VARCHAR);
public final SqlColumn<String> systemId = column("system_id", JDBCType.VARCHAR);
public final SqlColumn<Boolean> active = column("active", JDBCType.BIT);
public Role() {
super("role", Role::new);
}
}
}

View File

@ -0,0 +1,170 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
import cn.skcks.matrix.v2.orm.mybatis.dynamic.model.Role;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
@Mapper
public interface RoleMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<Role>, CommonUpdateMapper {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
BasicColumn[] selectList = BasicColumn.columnList(RoleDynamicSqlSupport.id, RoleDynamicSqlSupport.role.role, RoleDynamicSqlSupport.name, RoleDynamicSqlSupport.systemId, RoleDynamicSqlSupport.active);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="RoleResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="role", property="role", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="system_id", property="systemId", jdbcType=JdbcType.VARCHAR),
@Result(column="active", property="active", jdbcType=JdbcType.BIT)
})
List<Role> selectMany(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("RoleResult")
Optional<Role> selectOne(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, RoleDynamicSqlSupport.role, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, RoleDynamicSqlSupport.role, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int deleteByPrimaryKey(Long id_) {
return delete(c ->
c.where(RoleDynamicSqlSupport.id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int insert(Role row) {
return MyBatis3Utils.insert(this::insert, row, RoleDynamicSqlSupport.role, c ->
c.map(RoleDynamicSqlSupport.id).toProperty("id")
.map(RoleDynamicSqlSupport.role.role).toProperty("role")
.map(RoleDynamicSqlSupport.name).toProperty("name")
.map(RoleDynamicSqlSupport.systemId).toProperty("systemId")
.map(RoleDynamicSqlSupport.active).toProperty("active")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int insertMultiple(Collection<Role> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, RoleDynamicSqlSupport.role, c ->
c.map(RoleDynamicSqlSupport.id).toProperty("id")
.map(RoleDynamicSqlSupport.role.role).toProperty("role")
.map(RoleDynamicSqlSupport.name).toProperty("name")
.map(RoleDynamicSqlSupport.systemId).toProperty("systemId")
.map(RoleDynamicSqlSupport.active).toProperty("active")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int insertSelective(Role row) {
return MyBatis3Utils.insert(this::insert, row, RoleDynamicSqlSupport.role, c ->
c.map(RoleDynamicSqlSupport.id).toPropertyWhenPresent("id", row::getId)
.map(RoleDynamicSqlSupport.role.role).toPropertyWhenPresent("role", row::getRole)
.map(RoleDynamicSqlSupport.name).toPropertyWhenPresent("name", row::getName)
.map(RoleDynamicSqlSupport.systemId).toPropertyWhenPresent("systemId", row::getSystemId)
.map(RoleDynamicSqlSupport.active).toPropertyWhenPresent("active", row::getActive)
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default Optional<Role> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, RoleDynamicSqlSupport.role, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default List<Role> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, RoleDynamicSqlSupport.role, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default List<Role> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, RoleDynamicSqlSupport.role, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default Optional<Role> selectByPrimaryKey(Long id_) {
return selectOne(c ->
c.where(RoleDynamicSqlSupport.id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, RoleDynamicSqlSupport.role, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
static UpdateDSL<UpdateModel> updateAllColumns(Role row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(RoleDynamicSqlSupport.id).equalTo(row::getId)
.set(RoleDynamicSqlSupport.role.role).equalTo(row::getRole)
.set(RoleDynamicSqlSupport.name).equalTo(row::getName)
.set(RoleDynamicSqlSupport.systemId).equalTo(row::getSystemId)
.set(RoleDynamicSqlSupport.active).equalTo(row::getActive);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
static UpdateDSL<UpdateModel> updateSelectiveColumns(Role row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(RoleDynamicSqlSupport.id).equalToWhenPresent(row::getId)
.set(RoleDynamicSqlSupport.role.role).equalToWhenPresent(row::getRole)
.set(RoleDynamicSqlSupport.name).equalToWhenPresent(row::getName)
.set(RoleDynamicSqlSupport.systemId).equalToWhenPresent(row::getSystemId)
.set(RoleDynamicSqlSupport.active).equalToWhenPresent(row::getActive);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int updateByPrimaryKey(Role row) {
return update(c ->
c.set(RoleDynamicSqlSupport.role.role).equalTo(row::getRole)
.set(RoleDynamicSqlSupport.name).equalTo(row::getName)
.set(RoleDynamicSqlSupport.systemId).equalTo(row::getSystemId)
.set(RoleDynamicSqlSupport.active).equalTo(row::getActive)
.where(RoleDynamicSqlSupport.id, isEqualTo(row::getId))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: role")
default int updateByPrimaryKeySelective(Role row) {
return update(c ->
c.set(RoleDynamicSqlSupport.role.role).equalToWhenPresent(row::getRole)
.set(RoleDynamicSqlSupport.name).equalToWhenPresent(row::getName)
.set(RoleDynamicSqlSupport.systemId).equalToWhenPresent(row::getSystemId)
.set(RoleDynamicSqlSupport.active).equalToWhenPresent(row::getActive)
.where(RoleDynamicSqlSupport.id, isEqualTo(row::getId))
);
}
}

View File

@ -0,0 +1,72 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import java.sql.JDBCType;
import java.util.Date;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.AliasableSqlTable;
import org.mybatis.dynamic.sql.SqlColumn;
public final class UserDynamicSqlSupport {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
public static final User user = new User();
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.id")
public static final SqlColumn<Long> id = user.id;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.user_name")
public static final SqlColumn<String> userName = user.userName;
/**
* Database Column Remarks:
* 加密后的密码
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.password")
public static final SqlColumn<String> password = user.password;
/**
* Database Column Remarks:
* 加密密钥
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.salt")
public static final SqlColumn<String> salt = user.salt;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.email")
public static final SqlColumn<String> email = user.email;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.phone_number")
public static final SqlColumn<String> phoneNumber = user.phoneNumber;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.description")
public static final SqlColumn<String> description = user.description;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.create_time")
public static final SqlColumn<Date> createTime = user.createTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.update_time")
public static final SqlColumn<Date> updateTime = user.updateTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
public static final class User extends AliasableSqlTable<User> {
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
public final SqlColumn<String> userName = column("user_name", JDBCType.VARCHAR);
public final SqlColumn<String> password = column("password", JDBCType.VARCHAR);
public final SqlColumn<String> salt = column("salt", JDBCType.VARCHAR);
public final SqlColumn<String> email = column("email", JDBCType.VARCHAR);
public final SqlColumn<String> phoneNumber = column("phone_number", JDBCType.VARCHAR);
public final SqlColumn<String> description = column("description", JDBCType.VARCHAR);
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
public User() {
super("user", User::new);
}
}
}

View File

@ -0,0 +1,201 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper;
import static cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper.UserDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
import cn.skcks.matrix.v2.orm.mybatis.dynamic.model.User;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper;
import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
@Mapper
public interface UserMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<User>, CommonUpdateMapper {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
BasicColumn[] selectList = BasicColumn.columnList(id, userName, password, salt, email, phoneNumber, description, createTime, updateTime);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="UserResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR),
@Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
@Result(column="salt", property="salt", jdbcType=JdbcType.VARCHAR),
@Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
@Result(column="phone_number", property="phoneNumber", jdbcType=JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
})
List<User> selectMany(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("UserResult")
Optional<User> selectOne(SelectStatementProvider selectStatement);
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, user, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, user, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int deleteByPrimaryKey(Long id_) {
return delete(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int insert(User row) {
return MyBatis3Utils.insert(this::insert, row, user, c ->
c.map(id).toProperty("id")
.map(userName).toProperty("userName")
.map(password).toProperty("password")
.map(salt).toProperty("salt")
.map(email).toProperty("email")
.map(phoneNumber).toProperty("phoneNumber")
.map(description).toProperty("description")
.map(createTime).toProperty("createTime")
.map(updateTime).toProperty("updateTime")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int insertMultiple(Collection<User> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, user, c ->
c.map(id).toProperty("id")
.map(userName).toProperty("userName")
.map(password).toProperty("password")
.map(salt).toProperty("salt")
.map(email).toProperty("email")
.map(phoneNumber).toProperty("phoneNumber")
.map(description).toProperty("description")
.map(createTime).toProperty("createTime")
.map(updateTime).toProperty("updateTime")
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int insertSelective(User row) {
return MyBatis3Utils.insert(this::insert, row, user, c ->
c.map(id).toPropertyWhenPresent("id", row::getId)
.map(userName).toPropertyWhenPresent("userName", row::getUserName)
.map(password).toPropertyWhenPresent("password", row::getPassword)
.map(salt).toPropertyWhenPresent("salt", row::getSalt)
.map(email).toPropertyWhenPresent("email", row::getEmail)
.map(phoneNumber).toPropertyWhenPresent("phoneNumber", row::getPhoneNumber)
.map(description).toPropertyWhenPresent("description", row::getDescription)
.map(createTime).toPropertyWhenPresent("createTime", row::getCreateTime)
.map(updateTime).toPropertyWhenPresent("updateTime", row::getUpdateTime)
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default Optional<User> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, user, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default List<User> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, user, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default List<User> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, user, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default Optional<User> selectByPrimaryKey(Long id_) {
return selectOne(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, user, completer);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
static UpdateDSL<UpdateModel> updateAllColumns(User row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalTo(row::getId)
.set(userName).equalTo(row::getUserName)
.set(password).equalTo(row::getPassword)
.set(salt).equalTo(row::getSalt)
.set(email).equalTo(row::getEmail)
.set(phoneNumber).equalTo(row::getPhoneNumber)
.set(description).equalTo(row::getDescription)
.set(createTime).equalTo(row::getCreateTime)
.set(updateTime).equalTo(row::getUpdateTime);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
static UpdateDSL<UpdateModel> updateSelectiveColumns(User row, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalToWhenPresent(row::getId)
.set(userName).equalToWhenPresent(row::getUserName)
.set(password).equalToWhenPresent(row::getPassword)
.set(salt).equalToWhenPresent(row::getSalt)
.set(email).equalToWhenPresent(row::getEmail)
.set(phoneNumber).equalToWhenPresent(row::getPhoneNumber)
.set(description).equalToWhenPresent(row::getDescription)
.set(createTime).equalToWhenPresent(row::getCreateTime)
.set(updateTime).equalToWhenPresent(row::getUpdateTime);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int updateByPrimaryKey(User row) {
return update(c ->
c.set(userName).equalTo(row::getUserName)
.set(password).equalTo(row::getPassword)
.set(salt).equalTo(row::getSalt)
.set(email).equalTo(row::getEmail)
.set(phoneNumber).equalTo(row::getPhoneNumber)
.set(description).equalTo(row::getDescription)
.set(createTime).equalTo(row::getCreateTime)
.set(updateTime).equalTo(row::getUpdateTime)
.where(id, isEqualTo(row::getId))
);
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: user")
default int updateByPrimaryKeySelective(User row) {
return update(c ->
c.set(userName).equalToWhenPresent(row::getUserName)
.set(password).equalToWhenPresent(row::getPassword)
.set(salt).equalToWhenPresent(row::getSalt)
.set(email).equalToWhenPresent(row::getEmail)
.set(phoneNumber).equalToWhenPresent(row::getPhoneNumber)
.set(description).equalToWhenPresent(row::getDescription)
.set(createTime).equalToWhenPresent(row::getCreateTime)
.set(updateTime).equalToWhenPresent(row::getUpdateTime)
.where(id, isEqualTo(row::getId))
);
}
}

View File

@ -0,0 +1,114 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.model;
import javax.annotation.Generated;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table casbin_rule
*/
public class CasbinRule {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.id")
private Integer id;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.ptype")
private String ptype;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v0")
private String v0;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v1")
private String v1;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v2")
private String v2;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v3")
private String v3;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v4")
private String v4;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v5")
private String v5;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.id")
public Integer getId() {
return id;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.id")
public void setId(Integer id) {
this.id = id;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.ptype")
public String getPtype() {
return ptype;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.ptype")
public void setPtype(String ptype) {
this.ptype = ptype == null ? null : ptype.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v0")
public String getV0() {
return v0;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v0")
public void setV0(String v0) {
this.v0 = v0 == null ? null : v0.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v1")
public String getV1() {
return v1;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v1")
public void setV1(String v1) {
this.v1 = v1 == null ? null : v1.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v2")
public String getV2() {
return v2;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v2")
public void setV2(String v2) {
this.v2 = v2 == null ? null : v2.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v3")
public String getV3() {
return v3;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v3")
public void setV3(String v3) {
this.v3 = v3 == null ? null : v3.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v4")
public String getV4() {
return v4;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v4")
public void setV4(String v4) {
this.v4 = v4 == null ? null : v4.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v5")
public String getV5() {
return v5;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: casbin_rule.v5")
public void setV5(String v5) {
this.v5 = v5 == null ? null : v5.trim();
}
}

View File

@ -0,0 +1,284 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.model;
import java.util.Date;
import javax.annotation.Generated;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table location_record
*/
public class LocationRecord {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.id")
private String id;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.callback_time")
private Date callbackTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_time")
private Date locationTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_type")
private Integer locationType;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.latitude")
private Double latitude;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.longitude")
private Double longitude;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.accuracy")
private Double accuracy;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.altitude")
private Double altitude;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.bearing")
private Double bearing;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.speed")
private Double speed;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.country")
private String country;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.province")
private String province;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city")
private String city;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.district")
private String district;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street")
private String street;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street_number")
private String streetNumber;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city_code")
private String cityCode;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.ad_code")
private String adCode;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.address")
private String address;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.description")
private String description;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.user_id")
private Long userId;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.id")
public String getId() {
return id;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.id")
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.callback_time")
public Date getCallbackTime() {
return callbackTime;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.callback_time")
public void setCallbackTime(Date callbackTime) {
this.callbackTime = callbackTime;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_time")
public Date getLocationTime() {
return locationTime;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_time")
public void setLocationTime(Date locationTime) {
this.locationTime = locationTime;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_type")
public Integer getLocationType() {
return locationType;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.location_type")
public void setLocationType(Integer locationType) {
this.locationType = locationType;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.latitude")
public Double getLatitude() {
return latitude;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.latitude")
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.longitude")
public Double getLongitude() {
return longitude;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.longitude")
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.accuracy")
public Double getAccuracy() {
return accuracy;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.accuracy")
public void setAccuracy(Double accuracy) {
this.accuracy = accuracy;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.altitude")
public Double getAltitude() {
return altitude;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.altitude")
public void setAltitude(Double altitude) {
this.altitude = altitude;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.bearing")
public Double getBearing() {
return bearing;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.bearing")
public void setBearing(Double bearing) {
this.bearing = bearing;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.speed")
public Double getSpeed() {
return speed;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.speed")
public void setSpeed(Double speed) {
this.speed = speed;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.country")
public String getCountry() {
return country;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.country")
public void setCountry(String country) {
this.country = country == null ? null : country.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.province")
public String getProvince() {
return province;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.province")
public void setProvince(String province) {
this.province = province == null ? null : province.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city")
public String getCity() {
return city;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city")
public void setCity(String city) {
this.city = city == null ? null : city.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.district")
public String getDistrict() {
return district;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.district")
public void setDistrict(String district) {
this.district = district == null ? null : district.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street")
public String getStreet() {
return street;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street")
public void setStreet(String street) {
this.street = street == null ? null : street.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street_number")
public String getStreetNumber() {
return streetNumber;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.street_number")
public void setStreetNumber(String streetNumber) {
this.streetNumber = streetNumber == null ? null : streetNumber.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city_code")
public String getCityCode() {
return cityCode;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.city_code")
public void setCityCode(String cityCode) {
this.cityCode = cityCode == null ? null : cityCode.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.ad_code")
public String getAdCode() {
return adCode;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.ad_code")
public void setAdCode(String adCode) {
this.adCode = adCode == null ? null : adCode.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.address")
public String getAddress() {
return address;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.address")
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.description")
public String getDescription() {
return description;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.description")
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.user_id")
public Long getUserId() {
return userId;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: location_record.user_id")
public void setUserId(Long userId) {
this.userId = userId;
}
}

View File

@ -0,0 +1,87 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.model;
import javax.annotation.Generated;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table role
*/
public class Role {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.id")
private Long id;
/**
* Database Column Remarks:
* 角色
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.role")
private String role;
/**
* Database Column Remarks:
* 角色名
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.name")
private String name;
/**
* Database Column Remarks:
* 所属系统
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.system_id")
private String systemId;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.active")
private Boolean active;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.id")
public Long getId() {
return id;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.id")
public void setId(Long id) {
this.id = id;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.role")
public String getRole() {
return role;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.role")
public void setRole(String role) {
this.role = role == null ? null : role.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.name")
public String getName() {
return name;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.name")
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.system_id")
public String getSystemId() {
return systemId;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.system_id")
public void setSystemId(String systemId) {
this.systemId = systemId == null ? null : systemId.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.active")
public Boolean getActive() {
return active;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: role.active")
public void setActive(Boolean active) {
this.active = active;
}
}

View File

@ -0,0 +1,136 @@
package cn.skcks.matrix.v2.orm.mybatis.dynamic.model;
import java.util.Date;
import javax.annotation.Generated;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table user
*/
public class User {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.id")
private Long id;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.user_name")
private String userName;
/**
* Database Column Remarks:
* 加密后的密码
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.password")
private String password;
/**
* Database Column Remarks:
* 加密密钥
*/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.salt")
private String salt;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.email")
private String email;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.phone_number")
private String phoneNumber;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.description")
private String description;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.create_time")
private Date createTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.update_time")
private Date updateTime;
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.id")
public Long getId() {
return id;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.id")
public void setId(Long id) {
this.id = id;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.user_name")
public String getUserName() {
return userName;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.user_name")
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.password")
public String getPassword() {
return password;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.password")
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.salt")
public String getSalt() {
return salt;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.salt")
public void setSalt(String salt) {
this.salt = salt == null ? null : salt.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.email")
public String getEmail() {
return email;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.email")
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.phone_number")
public String getPhoneNumber() {
return phoneNumber;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.phone_number")
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber == null ? null : phoneNumber.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.description")
public String getDescription() {
return description;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.description")
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.create_time")
public Date getCreateTime() {
return createTime;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.create_time")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.update_time")
public Date getUpdateTime() {
return updateTime;
}
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: user.update_time")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,12 @@
package cn.skcks.matrix.v2.orm.mybatis.operation;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OperateTableMapper {
// int createNewTable(@Param("tableName")String tableName);
void createUserTable();
void createRoleTable();
void createLocationRecordTable();
}

View File

@ -0,0 +1,66 @@
<?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="cn.skcks.matrix.v2.orm.mybatis.operation.OperateTableMapper">
<update id="createUserTable">
CREATE TABLE IF NOT EXISTS `user`
(
`id` bigint NOT NULL,
`user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '加密后的密码',
`salt` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '加密密钥',
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`phone_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;
</update>
<update id="createRoleTable">
CREATE TABLE IF NOT EXISTS `role`
(
`id` bigint NOT NULL,
`role` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色',
`name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名',
`system_id` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '所属系统',
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;
</update>
<update id="createLocationRecordTable">
CREATE TABLE IF NOT EXISTS `location_record` (
`id` varchar(255) NOT NULL,
`callback_time` datetime DEFAULT NULL,
`location_time` datetime DEFAULT NULL,
`location_type` int DEFAULT NULL,
`latitude` double DEFAULT NULL,
`longitude` double DEFAULT NULL,
`accuracy` double DEFAULT NULL,
`altitude` double DEFAULT NULL,
`bearing` double DEFAULT NULL,
`speed` double DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`province` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`district` varchar(255) DEFAULT NULL,
`street` varchar(255) DEFAULT NULL,
`street_number` varchar(255) DEFAULT NULL,
`city_code` varchar(255) DEFAULT NULL,
`ad_code` varchar(255) DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`user_id` bigint NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;
</update>
</mapper>

View File

@ -0,0 +1,76 @@
spring:
profiles:
active: default
---
spring:
shardingsphere:
props:
sql-show: true
sql:
show: true
datasource:
names: ds
ds:
# type: com.zaxxer.hikari.HikariDataSource
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 12341234
url: jdbc:mysql://10.10.10.200:3306/matrix_v2?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# jdbc-url: jdbc:mysql://10.10.10.100:3306/matrix?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
rules:
sharding:
# tables:
# user:
# actual-data-nodes: ds.user_$->{0..2}
# table-strategy:
# standard:
# sharding-column: id
# sharding-algorithm-name: user-id
auto-tables:
user:
actual-data-sources: ds
sharding-strategy:
standard:
sharding-column: id
sharding-algorithm-name: user-id
sharding-algorithms:
user-id:
# 内置分片算法
type: MOD
props:
sharding-count: 3
config:
activate:
on-profile: default
# 行内表达式
# type: INLINE
# props:
# algorithm-expression: user_$->{id % 3}
# mode:
# type: Standalone
---
spring:
config:
activate:
on-profile: pre-dev
shardingsphere:
enabled: false
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 12341234
url: jdbc:mysql://10.10.10.200:3306/matrix_schema_v2?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
sql:
init:
mode: ALWAYS
schema-locations:
- classpath:schema/*.sql
username: root
password: 12341234

View File

@ -0,0 +1,402 @@
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!-- 配置生成器 -->
<generatorConfiguration>
<!-- 可以用于加载配置项或者配置文件,在整个配置文件中就可以使用${propertyKey}的方式来引用配置项
resource配置资源加载地址使用resourceMBG从classpath开始找比如com/myproject/generatorConfig.properties
url配置资源加载地质使用URL的方式比如file:///C:/myfolder/generatorConfig.properties.
注意,两个属性只能选址一个;
另外如果使用了mybatis-generator-maven-plugin那么在pom.xml中定义的properties都可以直接在generatorConfig.xml中使用
<properties resource="" url="" />
-->
<!-- 在MBG工作的时候需要额外加载的依赖包
location属性指明加载jar/zip包的全路径
<classPathEntry location="/Program Files/IBM/SQLLIB/java/db2java.zip" />
-->
<!--
context:生成一组对象的环境
id:必选上下文id用于在生成错误时提示
defaultModelType:指定生成对象的样式
1conditional类似hierarchical
2flat所有内容主键blob等全部生成在一个对象中
3hierarchical主键生成一个XXKey对象(key class)Blob等单独生成一个对象其他简单属性在一个对象中(record class)
targetRuntime:
1MyBatis3默认的值生成基于MyBatis3.x以上版本的内容包括XXXBySample
2MyBatis3Simple类似MyBatis3只是不生成XXXBySample
introspectedColumnImpl类全限定名用于扩展MBG
-->
<context id="mysql" defaultModelType="hierarchical" targetRuntime="MyBatis3Simple" >
<!-- 自动识别数据库关键字默认false如果设置为true根据SqlReservedWords中定义的关键字列表
一般保留默认值遇到数据库关键字Java关键字使用columnOverride覆盖
-->
<property name="autoDelimitKeywords" value="false"/>
<!-- 生成的Java文件的编码 -->
<property name="javaFileEncoding" value="UTF-8"/>
<!-- 格式化java代码 -->
<property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
<!-- 格式化XML代码 -->
<property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>
<!-- beginningDelimiter和endingDelimiter指明数据库的用于标记数据库对象名的符号比如ORACLE就是双引号MYSQL默认是`反引号; -->
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<commentGenerator>
<!--自动生成的文件中 注释不包含时间-->
<property name="suppressDate" value="true"/>
<!--添加数据库中字段/列的注释-->
<property name="addRemarkComments" value="true"/>
</commentGenerator>
<!-- 必须要有的,使用这个配置链接数据库
@TODO:是否可以扩展
-->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://10.10.10.200:3306/matrix_schema_v2" userId="root" password="12341234">
<!-- 这里面可以设置property属性每一个property属性都设置到配置的Driver上 -->
<!-- Mysql8 驱动 api会查出其他库同名的表 故需要添加此配置-->
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
<!-- java类型处理器
用于处理DB中的类型到Java中的类型默认使用JavaTypeResolverDefaultImpl
注意一点默认会先尝试使用IntegerLongShort等来对应DECIMAL和 NUMERIC数据类型
-->
<javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl">
<!--
true使用BigDecimal对应DECIMAL和 NUMERIC数据类型
false默认,
scale>0;length>18使用BigDecimal;
scale=0;length[10,18]使用Long
scale=0;length[5,9]使用Integer
scale=0;length<5使Short
-->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- java模型创建器是必须要的元素
负责1key类见context的defaultModelType2java类3查询类
targetPackage生成的类要放的包真实的包受enableSubPackages属性控制
targetProject目标项目指定一个存在的目录下生成的内容会放到指定目录中如果目录不存在MBG不会自动建目录
-->
<javaModelGenerator targetPackage="cn.skcks.matrix.v2.orm.mybatis.basic.model" targetProject="src/main/java">
<!-- for MyBatis3/MyBatis3Simple
自动为每一个生成的类创建一个构造方法构造方法包含了所有的field而不是使用setter
-->
<property name="constructorBased" value="false"/>
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
<!-- for MyBatis3 / MyBatis3Simple
是否创建一个不可变的类如果为true
那么MBG会创建一个没有setter方法的类取而代之的是类似constructorBased的类
-->
<property name="immutable" value="false"/>
<!-- 设置一个根对象,
如果设置了这个根对象那么生成的keyClass或者recordClass会继承这个类在Table的rootClass属性中可以覆盖该选项
注意如果在key class或者record class中有root class相同的属性MBG就不会重新生成这些属性了包括
1属性名相同类型相同有相同的getter/setter方法
-->
<!--<property name="rootClass" value="cn.skcks.matrix.v2.orm.mybatis.domain.BaseDomain"/>-->
<!-- 设置是否在getter方法中对String类型字段调用trim()方法 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成SQL map的XML文件生成器
注意在Mybatis3之后我们可以使用mapper.xml文件+Mapper接口或者不用mapper接口
或者只使用Mapper接口+Annotation所以如果 javaClientGenerator配置中配置了需要生成XML的话这个元素就必须配置
targetPackage/targetProject:同javaModelGenerator
-->
<sqlMapGenerator targetPackage="cn.skcks.matrix.v2.orm.mybatis.basic.mapper" targetProject="src/main/resources">
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 对于mybatis来说即生成Mapper接口注意如果没有配置该元素那么默认不会生成Mapper接口
targetPackage/targetProject:同javaModelGenerator
type选择怎么生成mapper接口在MyBatis3/MyBatis3Simple下
1ANNOTATEDMAPPER会生成使用Mapper接口+Annotation的方式创建SQL生成在annotation中不会生成对应的XML
2MIXEDMAPPER使用混合配置会生成Mapper接口并适当添加合适的Annotation但是XML会生成在XML中
3XMLMAPPER会生成Mapper接口接口完全依赖XML
注意如果context是MyBatis3Simple只支持ANNOTATEDMAPPER和XMLMAPPER
-->
<javaClientGenerator targetPackage="cn.skcks.matrix.v2.orm.mybatis.basic.mapper" type="ANNOTATEDMAPPER" targetProject="src/main/java">
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
<!-- 可以为所有生成的接口添加一个父接口但是MBG只负责生成不负责检查
<property name="rootInterface" value=""/>
-->
</javaClientGenerator>
<!-- 选择一个table来生成相关文件可以有一个或多个table必须要有table元素
选择的table会生成一下文件
1SQL map文件
2生成一个主键类
3除了BLOB和主键的其他字段的类
4包含BLOB的类
5一个用户生成动态查询的条件类selectByExample, deleteByExample可选
6Mapper接口可选
tableName必要要生成对象的表名
注意大小写敏感问题。正常情况下MBG会自动的去识别数据库标识符的大小写敏感度在一般情况下MBG会
根据设置的schemacatalog或tablename去查询数据表按照下面的流程
1如果schemacatalog或tablename中有空格那么设置的是什么格式就精确的使用指定的大小写格式去查询
2否则如果数据库的标识符使用大写的那么MBG自动把表名变成大写再查找
3否则如果数据库的标识符使用小写的那么MBG自动把表名变成小写再查找
4否则使用指定的大小写格式查询
另外的,如果在创建表的时候,使用的""把数据库对象规定大小写,就算数据库标识符是使用的大写,在这种情况下也会使用给定的大小写来创建表名;
这个时候请设置delimitIdentifiers="true"即可保留大小写格式;
可选:
1schema数据库的schema
2catalog数据库的catalog
3alias为数据表设置的别名如果设置了alias那么生成的所有的SELECT SQL语句中列名会变成alias_actualColumnName
4domainObjectName生成的domain类的名字如果不设置直接使用表名作为domain类的名字可以设置为somepck.domainName那么会自动把domainName类再放到somepck包里面
5enableInsert默认true指定是否生成insert语句
6enableSelectByPrimaryKey默认true指定是否生成按照主键查询对象的语句就是getById或get
7enableSelectByExample默认trueMyBatis3Simple为false指定是否生成动态查询语句
8enableUpdateByPrimaryKey默认true指定是否生成按照主键修改对象的语句即update)
9enableDeleteByPrimaryKey默认true指定是否生成按照主键删除对象的语句即delete
10enableDeleteByExample默认trueMyBatis3Simple为false指定是否生成动态删除语句
11enableCountByExample默认trueMyBatis3Simple为false指定是否生成动态查询总条数语句用于分页的总条数查询
12enableUpdateByExample默认trueMyBatis3Simple为false指定是否生成动态修改语句只修改对象中不为空的属性
13modelType参考context元素的defaultModelType相当于覆盖
14delimitIdentifiers参考tableName的解释注意默认的delimitIdentifiers是双引号如果类似MYSQL这样的数据库使用的是`反引号那么还需要设置context的beginningDelimiter和endingDelimiter属性
15delimitAllColumns设置是否所有生成的SQL中的列名都使用标识符引起来。默认为falsedelimitIdentifiers参考context的属性
注意table里面很多参数都是对javaModelGeneratorcontext等元素的默认属性的一个复写
-->
<table tableName="%">
<!-- 参考 javaModelGenerator 的 constructorBased属性-->
<property name="constructorBased" value="false"/>
<!-- 默认为false如果设置为true在生成的SQL中table名字不会加上catalog或schema -->
<property name="ignoreQualifiersAtRuntime" value="false"/>
<!-- 参考 javaModelGenerator 的 immutable 属性 -->
<property name="immutable" value="false"/>
<!-- 指定是否只生成domain类如果设置为true只生成domain类如果还配置了sqlMapGenerator那么在mapper XML文件中只生成resultMap元素 -->
<property name="modelOnly" value="false"/>
<!-- 参考 javaModelGenerator 的 rootClass 属性
<property name="rootClass" value=""/>
-->
<!-- 参考javaClientGenerator 的 rootInterface 属性
<property name="rootInterface" value=""/>
-->
<!-- 如果设置了runtimeCatalog那么在生成的SQL中使用该指定的catalog而不是table元素上的catalog
<property name="runtimeCatalog" value=""/>
-->
<!-- 如果设置了runtimeSchema那么在生成的SQL中使用该指定的schema而不是table元素上的schema
<property name="runtimeSchema" value=""/>
-->
<!-- 如果设置了runtimeTableName那么在生成的SQL中使用该指定的tablename而不是table元素上的tablename
<property name="runtimeTableName" value=""/>
-->
<!-- 注意该属性只针对MyBatis3Simple有用
如果选择的runtime是MyBatis3Simple那么会生成一个SelectAll方法如果指定了selectAllOrderByClause那么会在该SQL中添加指定的这个order条件
-->
<!--<property name="selectAllOrderByClause" value="age desc,username asc"/>-->
<!-- 如果设置为true生成的model类会直接使用column本身的名字而不会再使用驼峰命名方法比如BORN_DATE生成的属性名字就是BORN_DATE,而不会是bornDate -->
<property name="useActualColumnNames" value="false"/>
<!-- generatedKey用于生成生成主键的方法
如果设置了该元素MBG会在生成的<insert>元素中生成一条正确的<selectKey>元素,该元素可选
column:主键的列名;
sqlStatement要生成的selectKey语句有以下可选项
Cloudscape:相当于selectKey的SQL为 VALUES IDENTITY_VAL_LOCAL()
DB2 :相当于selectKey的SQL为 VALUES IDENTITY_VAL_LOCAL()
DB2_MF :相当于selectKey的SQL为SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1
Derby :相当于selectKey的SQL为VALUES IDENTITY_VAL_LOCAL()
HSQLDB :相当于selectKey的SQL为CALL IDENTITY()
Informix :相当于selectKey的SQL为select dbinfo('sqlca.sqlerrd1') from systables where tabid=1
MySql :相当于selectKey的SQL为SELECT LAST_INSERT_ID()
SqlServer :相当于selectKey的SQL为SELECT SCOPE_IDENTITY()
SYBASE :相当于selectKey的SQL为SELECT @@IDENTITY
JDBC :相当于在生成的insert元素上添加useGeneratedKeys="true"和keyProperty属性
<generatedKey column="" sqlStatement=""/>
-->
<!--
该元素会在根据表中列名计算对象属性名之前先重命名列名,非常适合用于表中的列都有公用的前缀字符串的时候,
比如列名为CUST_ID,CUST_NAME,CUST_EMAIL,CUST_ADDRESS等
那么就可以设置searchString为"^CUST_"并使用空白替换那么生成的Customer对象中的属性名称就不是
custId,custName等而是先被替换为ID,NAME,EMAIL,然后变成属性idnameemail
注意MBG是使用java.util.regex.Matcher.replaceAll来替换searchString和replaceString的
如果使用了columnOverride元素该属性无效
<columnRenamingRule searchString="" replaceString=""/>
-->
<!-- 用来修改表中某个列的属性MBG会使用修改后的列来生成domain的属性
column:要重新设置的列名;
注意一个table元素中可以有多个columnOverride元素哈~
-->
<!--<columnOverride column="username">-->
<!-- 使用property属性来指定列要生成的属性名称 -->
<!--<property name="property" value="userName"/>-->
<!-- javaType用于指定生成的domain的属性类型使用类型的全限定名
<property name="javaType" value=""/>
-->
<!-- jdbcType用于指定该列的JDBC类型
<property name="jdbcType" value=""/>
-->
<!-- typeHandler 用于指定该列使用到的TypeHandler如果要指定配置类型处理器的全限定名
注意mybatis中不会生成到mybatis-config.xml中的typeHandler
只会生成类似where id = #{id,jdbcType=BIGINT,typeHandler=cn.skcks.matrix.v2.orm.mybatis.MyTypeHandler}的参数描述
<property name="jdbcType" value=""/>
-->
<!-- 参考table元素的delimitAllColumns配置默认为false
<property name="delimitedColumnName" value=""/>
-->
<!--</columnOverride>-->
<!-- ignoreColumn设置一个MGB忽略的列如果设置了改列那么在生成的domain中生成的SQL中都不会有该列出现
column:指定要忽略的列的名字;
delimitedColumnName参考table元素的delimitAllColumns配置默认为false
注意一个table元素中可以有多个ignoreColumn元素
<ignoreColumn column="deptId" delimitedColumnName=""/>
-->
</table>
<!-- <table tableName="weather" domainObjectName="weather.">-->
<!-- &lt;!&ndash; 参考 javaModelGenerator 的 constructorBased属性&ndash;&gt;-->
<!-- <property name="constructorBased" value="false"/>-->
<!-- &lt;!&ndash; 默认为false如果设置为true在生成的SQL中table名字不会加上catalog或schema &ndash;&gt;-->
<!-- <property name="ignoreQualifiersAtRuntime" value="false"/>-->
<!-- &lt;!&ndash; 参考 javaModelGenerator 的 immutable 属性 &ndash;&gt;-->
<!-- <property name="immutable" value="false"/>-->
<!-- &lt;!&ndash; 指定是否只生成domain类如果设置为true只生成domain类如果还配置了sqlMapGenerator那么在mapper XML文件中只生成resultMap元素 &ndash;&gt;-->
<!-- <property name="modelOnly" value="false"/>-->
<!-- <property name="useActualColumnNames" value="false"/>-->
<!-- </table>-->
</context>
<context id="dynamic-mysql" defaultModelType="hierarchical" targetRuntime="MyBatis3DynamicSql" >
<!-- 自动识别数据库关键字默认false如果设置为true根据SqlReservedWords中定义的关键字列表
一般保留默认值遇到数据库关键字Java关键字使用columnOverride覆盖
-->
<property name="autoDelimitKeywords" value="false"/>
<!-- 生成的Java文件的编码 -->
<property name="javaFileEncoding" value="UTF-8"/>
<!-- 格式化java代码 -->
<property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
<!-- 格式化XML代码 -->
<property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>
<!-- beginningDelimiter和endingDelimiter指明数据库的用于标记数据库对象名的符号比如ORACLE就是双引号MYSQL默认是`反引号; -->
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<commentGenerator>
<!--自动生成的文件中 注释不包含时间-->
<property name="suppressDate" value="true"/>
<!--添加数据库中字段/列的注释-->
<property name="addRemarkComments" value="true"/>
</commentGenerator>
<!-- 必须要有的,使用这个配置链接数据库
@TODO:是否可以扩展
-->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://10.10.10.200:3306/matrix_schema_v2" userId="root" password="12341234">
<!-- 这里面可以设置property属性每一个property属性都设置到配置的Driver上 -->
<!-- Mysql8 驱动 api会查出其他库同名的表 故需要添加此配置-->
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
<!-- java类型处理器
用于处理DB中的类型到Java中的类型默认使用JavaTypeResolverDefaultImpl
注意一点默认会先尝试使用IntegerLongShort等来对应DECIMAL和 NUMERIC数据类型
-->
<javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl">
<!--
true使用BigDecimal对应DECIMAL和 NUMERIC数据类型
false默认,
scale>0;length>18使用BigDecimal;
scale=0;length[10,18]使用Long
scale=0;length[5,9]使用Integer
scale=0;length<5使Short
-->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- java模型创建器是必须要的元素
负责1key类见context的defaultModelType2java类3查询类
targetPackage生成的类要放的包真实的包受enableSubPackages属性控制
targetProject目标项目指定一个存在的目录下生成的内容会放到指定目录中如果目录不存在MBG不会自动建目录
-->
<javaModelGenerator targetPackage="cn.skcks.matrix.v2.orm.mybatis.dynamic.model" targetProject="src/main/java">
<property name="constructorBased" value="false"/>
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
<property name="immutable" value="false"/>
<!-- 设置一个根对象,
如果设置了这个根对象那么生成的keyClass或者recordClass会继承这个类在Table的rootClass属性中可以覆盖该选项
注意如果在key class或者record class中有root class相同的属性MBG就不会重新生成这些属性了包括
1属性名相同类型相同有相同的getter/setter方法
-->
<!--<property name="rootClass" value="cn.skcks.matrix.v2.orm.mybatis.domain.BaseDomain"/>-->
<!-- 设置是否在getter方法中对String类型字段调用trim()方法 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<sqlMapGenerator targetPackage="cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper" targetProject="src/main/resources">
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<javaClientGenerator targetPackage="cn.skcks.matrix.v2.orm.mybatis.dynamic.mapper" type="ANNOTATEDMAPPER" targetProject="src/main/java">
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<table tableName="%">
<!-- 参考 javaModelGenerator 的 constructorBased属性-->
<property name="constructorBased" value="false"/>
<!-- 默认为false如果设置为true在生成的SQL中table名字不会加上catalog或schema -->
<property name="ignoreQualifiersAtRuntime" value="false"/>
<!-- 参考 javaModelGenerator 的 immutable 属性 -->
<property name="immutable" value="false"/>
<!-- 指定是否只生成domain类如果设置为true只生成domain类如果还配置了sqlMapGenerator那么在mapper XML文件中只生成resultMap元素 -->
<property name="modelOnly" value="false"/>
<property name="useActualColumnNames" value="false"/>
</table>
<!-- <table tableName="weather" domainObjectName="weather.DynamicWeather">-->
<!-- &lt;!&ndash; 参考 javaModelGenerator 的 constructorBased属性&ndash;&gt;-->
<!-- <property name="constructorBased" value="false"/>-->
<!-- &lt;!&ndash; 默认为false如果设置为true在生成的SQL中table名字不会加上catalog或schema &ndash;&gt;-->
<!-- <property name="ignoreQualifiersAtRuntime" value="false"/>-->
<!-- &lt;!&ndash; 参考 javaModelGenerator 的 immutable 属性 &ndash;&gt;-->
<!-- <property name="immutable" value="false"/>-->
<!-- &lt;!&ndash; 指定是否只生成domain类如果设置为true只生成domain类如果还配置了sqlMapGenerator那么在mapper XML文件中只生成resultMap元素 &ndash;&gt;-->
<!-- <property name="modelOnly" value="false"/>-->
<!-- <property name="useActualColumnNames" value="false"/>-->
<!-- </table>-->
</context>
</generatorConfiguration>

View File

@ -0,0 +1,26 @@
CREATE TABLE IF NOT EXISTS `location_record` (
`id` varchar(255) NOT NULL,
`callback_time` datetime DEFAULT NULL,
`location_time` datetime DEFAULT NULL,
`location_type` int DEFAULT NULL,
`latitude` double DEFAULT NULL,
`longitude` double DEFAULT NULL,
`accuracy` double DEFAULT NULL,
`altitude` double DEFAULT NULL,
`bearing` double DEFAULT NULL,
`speed` double DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`province` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`district` varchar(255) DEFAULT NULL,
`street` varchar(255) DEFAULT NULL,
`street_number` varchar(255) DEFAULT NULL,
`city_code` varchar(255) DEFAULT NULL,
`ad_code` varchar(255) DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`user_id` bigint NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

View File

@ -0,0 +1,11 @@
CREATE TABLE IF NOT EXISTS `role`
(
`id` bigint NOT NULL,
`role` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色',
`name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名',
`system_id` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '所属系统',
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

View File

@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS `user` (
`id` bigint NOT NULL,
`user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '加密后的密码',
`salt` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '加密密钥',
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`phone_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

View File

@ -0,0 +1,18 @@
package cn.skcks.matrix.v2.orm.mybatis;
import org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
// 生成 schema 元数据
@ActiveProfiles("pre-dev")
@SpringBootApplication(exclude = ShardingSphereAutoConfiguration.class)
@SpringBootTest(classes = {GenerateSchemaTest.class})
public class GenerateSchemaTest {
@Test
void contextLoads(){
}
}

View File

@ -0,0 +1,279 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>sk-matrix-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modules>
<module>common</module>
<module>annotation</module>
<module>starter</module>
<module>orm</module>
<module>casbin</module>
<module>api</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<springboot.version>3.0.1</springboot.version>
<org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
<lombok.version>1.18.24</lombok.version>
<flyway.version>7.7.3</flyway.version>
<mysql.version>8.0.31</mysql.version>
<mybatis.version>3.0.1</mybatis.version>
<mybatis-dynamic.version>1.4.1</mybatis-dynamic.version>
<mybatis-generator-maven-plugin.version>1.4.1</mybatis-generator-maven-plugin.version>
<druid.version>1.2.15</druid.version>
<snakeyaml.version>1.33</snakeyaml.version>
<hutool.version>5.8.11</hutool.version>
<pagehelper.version>1.4.6</pagehelper.version>
<tomcat-dbcp.version>10.1.4</tomcat-dbcp.version>
<shardingsphere.version>5.2.1</shardingsphere.version>
<junit.version>5.9.0</junit.version>
<springdoc.version>2.0.2</springdoc.version>
<swagger-annotations-jakarta.version>2.2.7</swagger-annotations-jakarta.version>
<casbin.version>0.6.0</casbin.version>
<casbin-jdbc-adapter.version>2.4.0</casbin-jdbc-adapter.version>
<pagehelper.version>1.4.6</pagehelper.version>
</properties>
<dependencyManagement>
<dependencies>
<!--ShardingSphere 5.x -->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
<!-- ShardingSphere 和 druid连接池 需要加添加此dbcp依赖 -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>${tomcat-dbcp.version}</version>
</dependency>
<!--mybatis 分页器插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<!--hutool-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<!--snakeyaml-->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
<!--MapStruct-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
<scope>compile</scope>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!--Mybatis-DynamicSQL-->
<dependency>
<groupId>org.mybatis.dynamic-sql</groupId>
<artifactId>mybatis-dynamic-sql</artifactId>
<version>${mybatis-dynamic.version}</version>
</dependency>
<!-- Druid 数据连接池依赖 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springboot.version}</version>
<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>
<version>${springboot.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-common -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-common</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.casbin/casbin-spring-boot-starter -->
<dependency>
<groupId>org.casbin</groupId>
<artifactId>casbin-spring-boot-starter</artifactId>
<version>${casbin.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.casbin/jdbc-adapter -->
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jdbc-adapter</artifactId>
<version>${casbin-jdbc-adapter.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>${mybatis-generator-maven-plugin.version}</version>
<configuration>
<!--配置文件的位置-->
<configurationFile>src/main/resources/config/generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.flywaydb</groupId>-->
<!-- <artifactId>flyway-maven-plugin</artifactId>-->
<!-- <version>${flyway.version}</version>-->
<!-- <dependencies>-->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- <version>${mysql.version}</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- </plugin>-->
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${springboot.version}</version>
</path>
<!-- other annotation processors -->
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1,64 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>sk-matrix-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>starter</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>cn.skcks.matrix.v2</groupId>
<artifactId>api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
<version>${springboot.version}</version>
</dependency>
<!--SpringBoot 热重载-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!--编译时创建候选对象的静态列表来提高大型应用程序的启动性能 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-indexer</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,12 @@
package cn.skcks.matrix.v2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication(exclude= DataSourceAutoConfiguration.class)
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class,args);
}
}

View File

@ -0,0 +1,107 @@
spring:
profiles:
active: default
---
server:
port: 45680
jwt:
generate-key-pair-every-time: false
expire: 24h
# publicCacheKey: jwt-public
# privateCacheKey: jwt-paivate
spring:
h2:
console:
enabled: false
data:
redis:
database: 0
host: 10.10.10.200
port: 16379
password: 12341234
jedis:
pool:
min-idle: 0
max-active: 8
max-idle: 8
max-wait: -1ms
connect-timeout: 30000ms
shardingsphere:
props:
sql-simple: false
sql-show: true
datasource:
names: ds
ds:
# type: com.zaxxer.hikari.HikariDataSource
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 12341234
url: jdbc:mysql://10.10.10.200:3306/matrix?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# jdbc-url: jdbc:mysql://10.10.10.100:3306/matrix?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
rules:
sharding:
# tables:
# user:
# actual-data-nodes: ds.user_$->{0..2}
# table-strategy:
# standard:
# sharding-column: id
# sharding-algorithm-name: user-id
auto-tables:
user:
actual-data-sources: ds
sharding-strategy:
standard:
sharding-column: id
sharding-algorithm-name: general-id
casbin_rule:
actual-data-sources: ds
sharding-strategy:
standard:
sharding-column: id
sharding-algorithm-name: general-id
sharding-algorithms:
general-id:
# 内置分片算法
type: MOD
props:
sharding-count: 3
config:
activate:
on-profile: default
# 行内表达式
# type: INLINE
# props:
# algorithm-expression: user_$->{id % 3}
# mode:
# type: Standalone
casbin:
enable-casbin: true
auto-save: true
initializeSchema: create
storeType: jdbc
model: classpath:casbin/model.conf
springdoc:
api-docs:
# path: /api/docs
# 在线文档JSON格式数据
enabled: true
groups:
enabled: true
swagger-ui:
# 在线 Swagger UI
enabled: true
# 默认访问路径 /swagger-ui.html
# path: /swagger-ui.html
# layout: BaseLayout
doc-expansion: list
layout: StandaloneLayout
filter: true