Upload folder using huggingface_hub
Browse files- .gitattributes +7 -0
- .gitignore +41 -0
- .mvn/wrapper/MavenWrapperDownloader.java +117 -0
- .mvn/wrapper/maven-wrapper.jar +0 -0
- .mvn/wrapper/maven-wrapper.properties +2 -0
- API.md +97 -0
- LICENSE +21 -0
- README.md +178 -0
- README_CN.md +171 -0
- build.sh +37 -0
- img/auth/basicAuth.png +3 -0
- img/auth/basicAuthorization.png +0 -0
- img/auth/jwtAuth.png +3 -0
- img/auth/jwtAuthorization.png +3 -0
- img/auth/jwtLogin.png +0 -0
- img/crudapiweixin.jpeg +0 -0
- img/customer.png +3 -0
- img/relation.png +3 -0
- img/table.png +3 -0
- img/weixinqun.png +3 -0
- lib/crudapi.bat +3 -0
- lib/crudapi.xml +10 -0
- lib/download.sh +41 -0
- lib/install.bat +2 -0
- lib/restart.bat +2 -0
- lib/run.bat +3 -0
- lib/setJavaEnv.bat +7 -0
- lib/start.bat +2 -0
- lib/status.bat +2 -0
- lib/stop.bat +2 -0
- lib/uninstall.bat +2 -0
- mvnw +310 -0
- mvnw.cmd +182 -0
- pom.xml +190 -0
- settings.xml +36 -0
- src/main/java/cn/crudapi/example/CrudapiExampleApplication.java +24 -0
- src/main/java/cn/crudapi/example/Swagger2SpringBoot.java +114 -0
- src/main/java/cn/crudapi/example/config/DataSourceAspect.java +33 -0
- src/main/java/cn/crudapi/example/config/LoggingAspect.java +91 -0
- src/main/java/cn/crudapi/example/config/LoggingAspectConfiguration.java +19 -0
- src/main/java/cn/crudapi/example/config/WebConfig.java +39 -0
- src/main/resources/application-windows.properties +109 -0
- src/main/resources/application.properties +109 -0
- src/main/resources/schema.sql +1 -0
- src/main/resources/static/index.html +12 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
img/auth/basicAuth.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
img/auth/jwtAuth.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
img/auth/jwtAuthorization.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
img/customer.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
img/relation.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
img/table.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
img/weixinqun.png filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
HELP.md
|
| 2 |
+
target/
|
| 3 |
+
!.mvn/wrapper/maven-wrapper.jar
|
| 4 |
+
!**/src/main/**/target/
|
| 5 |
+
!**/src/test/**/target/
|
| 6 |
+
|
| 7 |
+
### STS ###
|
| 8 |
+
.apt_generated
|
| 9 |
+
.classpath
|
| 10 |
+
.factorypath
|
| 11 |
+
.project
|
| 12 |
+
.settings
|
| 13 |
+
.springBeans
|
| 14 |
+
.sts4-cache
|
| 15 |
+
|
| 16 |
+
### IntelliJ IDEA ###
|
| 17 |
+
.idea
|
| 18 |
+
*.iws
|
| 19 |
+
*.iml
|
| 20 |
+
*.ipr
|
| 21 |
+
|
| 22 |
+
### NetBeans ###
|
| 23 |
+
/nbproject/private/
|
| 24 |
+
/nbbuild/
|
| 25 |
+
/dist/
|
| 26 |
+
/nbdist/
|
| 27 |
+
/.nb-gradle/
|
| 28 |
+
build/
|
| 29 |
+
!**/src/main/**/build/
|
| 30 |
+
!**/src/test/**/build/
|
| 31 |
+
|
| 32 |
+
### VS Code ###
|
| 33 |
+
.vscode/
|
| 34 |
+
|
| 35 |
+
lib/*jar
|
| 36 |
+
lib/*.gz
|
| 37 |
+
|
| 38 |
+
src/main/resources/static/crudapi
|
| 39 |
+
src/main/resources/static/mapapi
|
| 40 |
+
|
| 41 |
+
*.exe
|
.mvn/wrapper/MavenWrapperDownloader.java
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2007-present the original author or authors.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
*
|
| 8 |
+
* https://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
*
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
import java.net.*;
|
| 17 |
+
import java.io.*;
|
| 18 |
+
import java.nio.channels.*;
|
| 19 |
+
import java.util.Properties;
|
| 20 |
+
|
| 21 |
+
public class MavenWrapperDownloader {
|
| 22 |
+
|
| 23 |
+
private static final String WRAPPER_VERSION = "0.5.6";
|
| 24 |
+
/**
|
| 25 |
+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
| 26 |
+
*/
|
| 27 |
+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
| 28 |
+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
| 32 |
+
* use instead of the default one.
|
| 33 |
+
*/
|
| 34 |
+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
| 35 |
+
".mvn/wrapper/maven-wrapper.properties";
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Path where the maven-wrapper.jar will be saved to.
|
| 39 |
+
*/
|
| 40 |
+
private static final String MAVEN_WRAPPER_JAR_PATH =
|
| 41 |
+
".mvn/wrapper/maven-wrapper.jar";
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Name of the property which should be used to override the default download url for the wrapper.
|
| 45 |
+
*/
|
| 46 |
+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
| 47 |
+
|
| 48 |
+
public static void main(String args[]) {
|
| 49 |
+
System.out.println("- Downloader started");
|
| 50 |
+
File baseDirectory = new File(args[0]);
|
| 51 |
+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
| 52 |
+
|
| 53 |
+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
| 54 |
+
// wrapperUrl parameter.
|
| 55 |
+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
| 56 |
+
String url = DEFAULT_DOWNLOAD_URL;
|
| 57 |
+
if(mavenWrapperPropertyFile.exists()) {
|
| 58 |
+
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
| 59 |
+
try {
|
| 60 |
+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
| 61 |
+
Properties mavenWrapperProperties = new Properties();
|
| 62 |
+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
| 63 |
+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
| 64 |
+
} catch (IOException e) {
|
| 65 |
+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
| 66 |
+
} finally {
|
| 67 |
+
try {
|
| 68 |
+
if(mavenWrapperPropertyFileInputStream != null) {
|
| 69 |
+
mavenWrapperPropertyFileInputStream.close();
|
| 70 |
+
}
|
| 71 |
+
} catch (IOException e) {
|
| 72 |
+
// Ignore ...
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
System.out.println("- Downloading from: " + url);
|
| 77 |
+
|
| 78 |
+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
| 79 |
+
if(!outputFile.getParentFile().exists()) {
|
| 80 |
+
if(!outputFile.getParentFile().mkdirs()) {
|
| 81 |
+
System.out.println(
|
| 82 |
+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
| 86 |
+
try {
|
| 87 |
+
downloadFileFromURL(url, outputFile);
|
| 88 |
+
System.out.println("Done");
|
| 89 |
+
System.exit(0);
|
| 90 |
+
} catch (Throwable e) {
|
| 91 |
+
System.out.println("- Error downloading");
|
| 92 |
+
e.printStackTrace();
|
| 93 |
+
System.exit(1);
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
| 98 |
+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
| 99 |
+
String username = System.getenv("MVNW_USERNAME");
|
| 100 |
+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
| 101 |
+
Authenticator.setDefault(new Authenticator() {
|
| 102 |
+
@Override
|
| 103 |
+
protected PasswordAuthentication getPasswordAuthentication() {
|
| 104 |
+
return new PasswordAuthentication(username, password);
|
| 105 |
+
}
|
| 106 |
+
});
|
| 107 |
+
}
|
| 108 |
+
URL website = new URL(urlString);
|
| 109 |
+
ReadableByteChannel rbc;
|
| 110 |
+
rbc = Channels.newChannel(website.openStream());
|
| 111 |
+
FileOutputStream fos = new FileOutputStream(destination);
|
| 112 |
+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
| 113 |
+
fos.close();
|
| 114 |
+
rbc.close();
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
}
|
.mvn/wrapper/maven-wrapper.jar
ADDED
|
Binary file (50.7 kB). View file
|
|
|
.mvn/wrapper/maven-wrapper.properties
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
|
| 2 |
+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
API.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# swagger api
|
| 2 |
+
https://demo.crudapi.cn/swagger-ui.html
|
| 3 |
+
|
| 4 |
+
# user
|
| 5 |
+
superadmin/1234567890
|
| 6 |
+
|
| 7 |
+
# login
|
| 8 |
+
## option 1: Cookie
|
| 9 |
+
|
| 10 |
+
### api
|
| 11 |
+
```
|
| 12 |
+
POST https://demo.crudapi.cn/api/auth/login
|
| 13 |
+
accept: application/json
|
| 14 |
+
content-type: application/x-www-form-urlencoded
|
| 15 |
+
username: superadmin
|
| 16 |
+
password: 1234567890
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
## option 2: Jwt token
|
| 20 |
+
### api
|
| 21 |
+
```
|
| 22 |
+
POST https://demo.crudapi.cn/api/auth/jwt/login
|
| 23 |
+
accept: application/json
|
| 24 |
+
content-type: application/x-www-form-urlencoded
|
| 25 |
+
username: superadmin
|
| 26 |
+
password: 1234567890
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
|
| 31 |
+
### get jwt token
|
| 32 |
+
get "token" field form response header: Bearer XXXXX
|
| 33 |
+
|
| 34 |
+
### set jwt token
|
| 35 |
+
#### set Bearer Token Type: Bearer XXXXX
|
| 36 |
+
Both "Bearer XXXXX" and "XXXX" is valid
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+
#### View Authorization
|
| 40 |
+
"Authorization" field of request header: Bearer XXXXX
|
| 41 |
+

|
| 42 |
+
|
| 43 |
+
## option 3: Basic Auth
|
| 44 |
+
|
| 45 |
+
### set Basic auth
|
| 46 |
+
#### set Basic Auth Type: superadmin/1234567890
|
| 47 |
+

|
| 48 |
+
|
| 49 |
+
#### View Authorization
|
| 50 |
+
"Authorization" field of request header: Basic c3VwZXJhZG1pbjoxMjM0NTY3ODkw
|
| 51 |
+

|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
# logout
|
| 56 |
+
GET https://demo.crudapi.cn/api/auth/logout
|
| 57 |
+
|
| 58 |
+
# create user
|
| 59 |
+
POST https://demo.crudapi.cn/api/business/user
|
| 60 |
+
```
|
| 61 |
+
{
|
| 62 |
+
"name": "testuser",
|
| 63 |
+
"username": "testuser",
|
| 64 |
+
"password": "testuser",
|
| 65 |
+
"enabled": true,
|
| 66 |
+
"accountNonExpired": true,
|
| 67 |
+
"accountNonLocked": true,
|
| 68 |
+
"credentialsNonExpired": true,
|
| 69 |
+
"fileId": null,
|
| 70 |
+
"avatar": null,
|
| 71 |
+
"roleLines": [{
|
| 72 |
+
"name": "业务数据角色",
|
| 73 |
+
"role": {
|
| 74 |
+
"id": 20,
|
| 75 |
+
"name": "业务数据角色",
|
| 76 |
+
},
|
| 77 |
+
"roleId": 20
|
| 78 |
+
}]
|
| 79 |
+
}
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
# curl example
|
| 83 |
+
get sequence by id
|
| 84 |
+
```bash
|
| 85 |
+
curl -u 'superadmin:1234567890' -X GET -H 'Content-Type: application/json' 'https://demo.crudapi.cn/api/metadata/sequences/1'
|
| 86 |
+
curl -H 'Authorization:Basic c3VwZXJhZG1pbjoxMjM0NTY3ODkw' -X GET -H 'Content-Type: application/json' 'https://demo.crudapi.cn/api/metadata/sequences/1'
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
create sequence
|
| 90 |
+
```bash
|
| 91 |
+
curl -u 'superadmin:1234567890' -X POST -H 'Content-Type: application/json' -d '{"currentTime":false,"sequenceType":"STRING","minValue":1,"maxValue":999999999,"nextValue":1,"incrementBy":1,"name":"orderCode","caption":"订单流水号","format":"SO_%9d"}' 'https://demo.crudapi.cn/api/metadata/sequences'
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
import excel data
|
| 95 |
+
```bash
|
| 96 |
+
curl -u 'superadmin:1234567890' -F "file=@product.xlsx" "https://demo.crudapi.cn/api/business/product/import"
|
| 97 |
+
```
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2021-present crudapi
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Second development demo
|
| 2 |
+
|
| 3 |
+
## Language
|
| 4 |
+
[中文](README_CN.md)
|
| 5 |
+
|
| 6 |
+
### crudapi👋
|
| 7 |
+
crudapi is a combination of crud and api, which stands for create, delete, update and retrieve interface. It is a zero-code product by configuring. crudapi allows you to focus on your business, save a lot of money, and improve your work efficiency by eliminating the tedious process of crud code. crudapi aims to make working with data easier and is free for everyone!
|
| 8 |
+
|
| 9 |
+
### 增删改查接口👋
|
| 10 |
+
crudapi是crud+api组合,表示增删改查接口,是一款零代码可配置的产品。使用crudapi可以告别枯燥无味的增删改查代码,让您更加专注业务,节约大量成本,从而提高工作效率。crudapi的目标是让处理数据变得更简单,所有人都可以免费使用!
|
| 11 |
+
|
| 12 |
+
## GIT地址
|
| 13 |
+
名称 | 类型 | 授权 | GitHub仓库 | Gitee仓库
|
| 14 |
+
--- | --- | --- | --- | ---
|
| 15 |
+
crudapi-admin-web | Vue Qusar源码 | 开源 | [crudapi-admin-web](https://github.com/crudapi/crudapi-admin-web) | [crudapi-admin-web](https://gitee.com/crudapi/crudapi-admin-web)
|
| 16 |
+
crudapi (main)| Java源码(1.0稳定版) | 开源 | [crudapi](https://github.com/crudapi/crudapi) | [crudapi](https://gitee.com/crudapi/crudapi)
|
| 17 |
+
crudapi (ft-crudapi-2)| Java源码(2.0开发中) | 开源 | [crudapi](https://github.com/crudapi/crudapi/tree/ft-crudapi-2) | [crudapi](https://gitee.com/crudapi/crudapi/tree/ft-crudapi-2)
|
| 18 |
+
crudapi-example| Java集成SDK Demo | 开源 | [crudapi-example](https://github.com/crudapi/crudapi-example) | [crudapi-example](https://gitee.com/crudapi/crudapi-example)
|
| 19 |
+
|
| 20 |
+
## Mysql
|
| 21 |
+
|
| 22 |
+
### Create database schema crudapi
|
| 23 |
+
|
| 24 |
+
### Config MySql properties
|
| 25 |
+
src/main/resources/application.properties
|
| 26 |
+
```bash
|
| 27 |
+
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
| 28 |
+
spring.datasource.url=jdbc:mysql://localhost:3306/crudapi?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
| 29 |
+
spring.datasource.username=root
|
| 30 |
+
spring.datasource.password=root
|
| 31 |
+
|
| 32 |
+
#auto create table by flyway
|
| 33 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mysql
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## Postgresql
|
| 37 |
+
### Create database schema crudapi.public
|
| 38 |
+
|
| 39 |
+
### Config Postgresql properties
|
| 40 |
+
src/main/resources/application.properties
|
| 41 |
+
```bash
|
| 42 |
+
spring.datasource.driverClassName=org.postgresql.Driver
|
| 43 |
+
spring.datasource.url=jdbc:postgresql://localhost:5432/crudapi
|
| 44 |
+
spring.datasource.username=postgres
|
| 45 |
+
spring.datasource.password=postgres
|
| 46 |
+
|
| 47 |
+
#auto create table by flyway
|
| 48 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/postsql
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Oracle
|
| 52 |
+
### Create database schema XEPDB1.crudapi
|
| 53 |
+
|
| 54 |
+
### Config Postgresql properties
|
| 55 |
+
src/main/resources/application.properties
|
| 56 |
+
```bash
|
| 57 |
+
spring.datasource.url=jdbc:oracle:thin:@//localhost:1521/XEPDB1
|
| 58 |
+
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
|
| 59 |
+
spring.datasource.username=crudapi
|
| 60 |
+
spring.datasource.password=crudapi
|
| 61 |
+
spring.datasource.initialization-mode=always
|
| 62 |
+
spring.datasource.schema=classpath:schema.sql
|
| 63 |
+
|
| 64 |
+
#auto create table by flyway
|
| 65 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/oracle
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## MS SQL Server
|
| 69 |
+
### Create database schema crudapi.dbo
|
| 70 |
+
|
| 71 |
+
### Config Postgresql properties
|
| 72 |
+
src/main/resources/application.properties
|
| 73 |
+
```bash
|
| 74 |
+
spring.datasource.url=jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=crudapi
|
| 75 |
+
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
| 76 |
+
spring.datasource.username=sa
|
| 77 |
+
spring.datasource.password=Mssql1433
|
| 78 |
+
|
| 79 |
+
#auto create table by flyway
|
| 80 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mssql
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
### download and install dependency package
|
| 85 |
+
```bash
|
| 86 |
+
cd lib
|
| 87 |
+
./download.sh
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
### Build
|
| 91 |
+
```bash
|
| 92 |
+
cd crudapi-example
|
| 93 |
+
mvn clean install -Dmaven.test.skip=true
|
| 94 |
+
|
| 95 |
+
#aliyun mirror
|
| 96 |
+
mvn clean install -Dmaven.test.skip=true -s settings.xml
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
### Run
|
| 100 |
+
```bash
|
| 101 |
+
cd crudapi-example
|
| 102 |
+
java -jar ./target/crudapi-example-1.6.2.jar
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
### Swagger
|
| 106 |
+
[http://127.0.0.1:8888/swagger-ui.html](http://127.0.0.1:8888/swagger-ui.html)
|
| 107 |
+
|
| 108 |
+
### Crudapi Admin Web
|
| 109 |
+
[http://127.0.0.1:8888/crudapi/](http://127.0.0.1:8888/crudapi/)
|
| 110 |
+
User and password
|
| 111 |
+
```
|
| 112 |
+
superadmin
|
| 113 |
+
1234567890
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
### API (developer)
|
| 117 |
+
[API](./API.md)
|
| 118 |
+
|
| 119 |
+
### Crudapi Admin Web (developer)
|
| 120 |
+
#### GitHub repo
|
| 121 |
+
[https://github.com/crudapi/crudapi-admin-web](https://github.com/crudapi/crudapi-admin-web)
|
| 122 |
+
|
| 123 |
+
#### Gitee repo
|
| 124 |
+
[https://gitee.com/crudapi/crudapi-admin-web](https://gitee.com/crudapi/crudapi-admin-web)
|
| 125 |
+
|
| 126 |
+
#### Config
|
| 127 |
+
update file quasar.conf.js, set devServer->proxy->target
|
| 128 |
+
quasar.conf.js
|
| 129 |
+
```javascript
|
| 130 |
+
devServer: {
|
| 131 |
+
https: false,
|
| 132 |
+
port: 8080,
|
| 133 |
+
open: true,
|
| 134 |
+
proxy: {
|
| 135 |
+
"/api/*": {
|
| 136 |
+
target: "http://127.0.0.1:8888",
|
| 137 |
+
changeOrigin: true
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
## Demo
|
| 144 |
+
Demo url:[https://demo.crudapi.cn/crudapi/](https://demo.crudapi.cn/crudapi/)
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Metadata table
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Table relation
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Bussiness Data
|
| 154 |
+
|
| 155 |
+
## Contact
|
| 156 |
+
#### Email
|
| 157 |
+
admin@crudapi.cn
|
| 158 |
+
|
| 159 |
+
#### QQ
|
| 160 |
+
1440737304
|
| 161 |
+
|
| 162 |
+
#### QQQun
|
| 163 |
+
632034576
|
| 164 |
+
|
| 165 |
+
#### Weixin
|
| 166 |
+
undefinedneqnull
|
| 167 |
+
|
| 168 |
+
<div align="left">
|
| 169 |
+
<img width = "200" src="./img/crudapiweixin.jpeg">
|
| 170 |
+
</div>
|
| 171 |
+
|
| 172 |
+
#### WeixinQun
|
| 173 |
+
<div align="left">
|
| 174 |
+
<img width = "200" src="./img/weixinqun.png">
|
| 175 |
+
</div>
|
| 176 |
+
|
| 177 |
+
If you have any questions, please contact us!
|
| 178 |
+
|
README_CN.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# crudapi二次开发demo
|
| 2 |
+
|
| 3 |
+
## 语言
|
| 4 |
+
[English](README.md)
|
| 5 |
+
|
| 6 |
+
### crudapi👋
|
| 7 |
+
crudapi is a combination of crud and api, which stands for create, delete, update and retrieve interface. It is a zero-code product by configuring. crudapi allows you to focus on your business, save a lot of money, and improve your work efficiency by eliminating the tedious process of crud code. crudapi aims to make working with data easier and is free for everyone!
|
| 8 |
+
|
| 9 |
+
### 增删改查接口👋
|
| 10 |
+
crudapi是crud+api组合,表示增删改查接口,是一款零代码可配置的产品。使用crudapi可以告别枯燥无味的增删改查代码,让您更加专注业务,节约大量成本,从而提高工作效率。crudapi的目标是让处理数据变得更简单,所有人都可以免费使用!
|
| 11 |
+
|
| 12 |
+
## GIT地址
|
| 13 |
+
名称 | 类型 | 授权 | GitHub仓库 | Gitee仓库
|
| 14 |
+
--- | --- | --- | --- | ---
|
| 15 |
+
crudapi-admin-web | Vue Qusar源码 | 开源 | [crudapi-admin-web](https://github.com/crudapi/crudapi-admin-web) | [crudapi-admin-web](https://gitee.com/crudapi/crudapi-admin-web)
|
| 16 |
+
crudapi (main)| Java源码(1.0稳定版) | 开源 | [crudapi](https://github.com/crudapi/crudapi) | [crudapi](https://gitee.com/crudapi/crudapi)
|
| 17 |
+
crudapi (ft-crudapi-2)| Java源码(2.0开发中) | 开源 | [crudapi](https://github.com/crudapi/crudapi/tree/ft-crudapi-2) | [crudapi](https://gitee.com/crudapi/crudapi/tree/ft-crudapi-2)
|
| 18 |
+
crudapi-example| Java集成SDK Demo | 开源 | [crudapi-example](https://github.com/crudapi/crudapi-example) | [crudapi-example](https://gitee.com/crudapi/crudapi-example)
|
| 19 |
+
|
| 20 |
+
## Mysql
|
| 21 |
+
### 创建数据库模式crudapi
|
| 22 |
+
|
| 23 |
+
### 配置数据库信息
|
| 24 |
+
src/main/resources/application.properties
|
| 25 |
+
```bash
|
| 26 |
+
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
| 27 |
+
spring.datasource.url=jdbc:mysql://localhost:3306/crudapi?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
| 28 |
+
spring.datasource.username=root
|
| 29 |
+
spring.datasource.password=root
|
| 30 |
+
|
| 31 |
+
#通过flyway自动创建表
|
| 32 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mysql
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Postgresql
|
| 36 |
+
### 新建数据库模式crudapi.public
|
| 37 |
+
|
| 38 |
+
### 配置数据库信息
|
| 39 |
+
src/main/resources/application.properties
|
| 40 |
+
```bash
|
| 41 |
+
spring.datasource.driverClassName=org.postgresql.Driver
|
| 42 |
+
spring.datasource.url=jdbc:postgresql://localhost:5432/crudapi
|
| 43 |
+
spring.datasource.username=postgres
|
| 44 |
+
spring.datasource.password=postgres
|
| 45 |
+
|
| 46 |
+
#通过flyway自动创建表
|
| 47 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/postsql
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Oracle
|
| 51 |
+
### 新建数据库模式XEPDB1.crudapi
|
| 52 |
+
|
| 53 |
+
### 配置数据库信息
|
| 54 |
+
src/main/resources/application.properties
|
| 55 |
+
```bash
|
| 56 |
+
spring.datasource.url=jdbc:oracle:thin:@//localhost:1521/XEPDB1
|
| 57 |
+
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
|
| 58 |
+
spring.datasource.username=crudapi
|
| 59 |
+
spring.datasource.password=crudapi
|
| 60 |
+
spring.datasource.initialization-mode=always
|
| 61 |
+
spring.datasource.schema=classpath:schema.sql
|
| 62 |
+
|
| 63 |
+
#通过flyway自动创建表
|
| 64 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/oracle
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## MS SQL Server
|
| 68 |
+
### 新建数据库模式crudapi.dbo
|
| 69 |
+
|
| 70 |
+
### 配置数据库信息
|
| 71 |
+
src/main/resources/application.properties
|
| 72 |
+
```bash
|
| 73 |
+
spring.datasource.url=jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=crudapi
|
| 74 |
+
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
| 75 |
+
spring.datasource.username=sa
|
| 76 |
+
spring.datasource.password=Mssql1433
|
| 77 |
+
|
| 78 |
+
#通过flyway自动创建表
|
| 79 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mssql
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
### 下载安装依赖包
|
| 83 |
+
```bash
|
| 84 |
+
cd lib
|
| 85 |
+
./download.sh
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
### 编译
|
| 89 |
+
```bash
|
| 90 |
+
cd crudapi-example
|
| 91 |
+
mvn clean install -Dmaven.test.skip=true
|
| 92 |
+
|
| 93 |
+
#阿里云 mirror
|
| 94 |
+
mvn clean install -Dmaven.test.skip=true -s settings.xml
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
### 运行
|
| 98 |
+
```bash
|
| 99 |
+
cd crudapi-example
|
| 100 |
+
java -jar ./target/crudapi-example-1.6.2.jar
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### swagger文档
|
| 104 |
+
[http://127.0.0.1:8888/swagger-ui.html](http://127.0.0.1:8888/swagger-ui.html)
|
| 105 |
+
|
| 106 |
+
### crudapi后台管理WEB
|
| 107 |
+
[http://127.0.0.1:8888/crudapi/](http://127.0.0.1:8888/crudapi/)
|
| 108 |
+
|
| 109 |
+
### API (二次开发)
|
| 110 |
+
[API](./API.md)
|
| 111 |
+
|
| 112 |
+
### crudapi后台管理WEB(二次开发)
|
| 113 |
+
#### GitHub仓库
|
| 114 |
+
[https://github.com/crudapi/crudapi-admin-web](https://github.com/crudapi/crudapi-admin-web)
|
| 115 |
+
|
| 116 |
+
#### Gitee仓库
|
| 117 |
+
[https://gitee.com/crudapi/crudapi-admin-web](https://gitee.com/crudapi/crudapi-admin-web)
|
| 118 |
+
|
| 119 |
+
#### 修改配置
|
| 120 |
+
修改quasar.conf.js文件中devServer->proxy->target
|
| 121 |
+
|
| 122 |
+
```javascript
|
| 123 |
+
devServer: {
|
| 124 |
+
https: false,
|
| 125 |
+
port: 8080,
|
| 126 |
+
open: true,
|
| 127 |
+
proxy: {
|
| 128 |
+
"/api/*": {
|
| 129 |
+
target: "http://127.0.0.1:8888",
|
| 130 |
+
changeOrigin: true
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
## 演示
|
| 137 |
+
演示地址:[https://demo.crudapi.cn/crudapi/](https://demo.crudapi.cn/crudapi/)
|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
表单对应不同的对象
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
表关系图显示不同对象之间的关系
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
业务数据操作
|
| 147 |
+
|
| 148 |
+
## 联系方式
|
| 149 |
+
#### 邮箱
|
| 150 |
+
admin@crudapi.cn
|
| 151 |
+
|
| 152 |
+
#### QQ
|
| 153 |
+
1440737304
|
| 154 |
+
|
| 155 |
+
#### QQ群
|
| 156 |
+
632034576
|
| 157 |
+
|
| 158 |
+
#### 微信
|
| 159 |
+
undefinedneqnull
|
| 160 |
+
|
| 161 |
+
<div align="left">
|
| 162 |
+
<img width = "200" src="./img/crudapiweixin.jpeg">
|
| 163 |
+
</div>
|
| 164 |
+
|
| 165 |
+
#### 微信群
|
| 166 |
+
<div align="left">
|
| 167 |
+
<img width = "200" src="./img/weixinqun.png">
|
| 168 |
+
</div>
|
| 169 |
+
|
| 170 |
+
如有任何问题,欢迎咨询和交流!
|
| 171 |
+
|
build.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
rm -rf dist
|
| 2 |
+
|
| 3 |
+
cd lib
|
| 4 |
+
./download.sh
|
| 5 |
+
cd ..
|
| 6 |
+
|
| 7 |
+
#export QUASAR_PUBLIC_PATH=mapapi
|
| 8 |
+
|
| 9 |
+
if [ -z "$QUASAR_PUBLIC_PATH" ]; then
|
| 10 |
+
echo "QUASAR_PUBLIC_PATH is empty, use crudapi"
|
| 11 |
+
rm -rf ../src/main/resources/static/crudapi
|
| 12 |
+
CRUDAPI_VERSION=1.6.2
|
| 13 |
+
tar -zxvf ./lib/crudapi-admin-web-$CRUDAPI_VERSION.tar.gz -C ./src/main/resources/static
|
| 14 |
+
else
|
| 15 |
+
echo "QUASAR_PUBLIC_PATH is not empty: $QUASAR_PUBLIC_PATH"
|
| 16 |
+
sed -i 's/crudapi/mapapi/g' ./src/main/resources/static/index.html
|
| 17 |
+
rm -rf ./src/main/resources/static/mapapi
|
| 18 |
+
cp -R ../crudapi-admin-web/dist/spa/mapapi ./src/main/resources/static
|
| 19 |
+
fi
|
| 20 |
+
|
| 21 |
+
mvn clean install
|
| 22 |
+
|
| 23 |
+
mkdir -p dist/crudapi
|
| 24 |
+
mkdir -p dist/crudapi/bin
|
| 25 |
+
mkdir -p dist/crudapi/oss/download
|
| 26 |
+
mkdir -p dist/crudapi/log
|
| 27 |
+
|
| 28 |
+
cp ./target/crudapi-example-1.6.2.jar ./dist/crudapi/bin/crudapi.jar
|
| 29 |
+
cp ./lib/WinSW-x64.exe ./dist/crudapi/bin/crudapi.exe
|
| 30 |
+
cp ./lib/crudapi.xml ./dist/crudapi/bin/crudapi.xml
|
| 31 |
+
cp ./lib/*.bat ./dist/crudapi/bin
|
| 32 |
+
cp ./src/main/resources/application-windows.properties ./dist/crudapi/bin/application.properties
|
| 33 |
+
|
| 34 |
+
cd dist
|
| 35 |
+
nowtime=`date +'%Y%m%d%H%M%S'`
|
| 36 |
+
tar -zcvf crudapi-${nowtime}.tar.gz crudapi
|
| 37 |
+
cd ..
|
img/auth/basicAuth.png
ADDED
|
Git LFS Details
|
img/auth/basicAuthorization.png
ADDED
|
img/auth/jwtAuth.png
ADDED
|
Git LFS Details
|
img/auth/jwtAuthorization.png
ADDED
|
Git LFS Details
|
img/auth/jwtLogin.png
ADDED
|
img/crudapiweixin.jpeg
ADDED
|
img/customer.png
ADDED
|
Git LFS Details
|
img/relation.png
ADDED
|
Git LFS Details
|
img/table.png
ADDED
|
Git LFS Details
|
img/weixinqun.png
ADDED
|
Git LFS Details
|
lib/crudapi.bat
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cd /d %~dp0
|
| 2 |
+
java -jar "crudapi.jar"
|
| 3 |
+
pause
|
lib/crudapi.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<service>
|
| 2 |
+
<id>crudapi</id>
|
| 3 |
+
<name>CRUDAPI</name>
|
| 4 |
+
<description>This service runs crudapi.</description>
|
| 5 |
+
<env name="CRUDAPI_HOME" value="%BASE%"/>
|
| 6 |
+
<executable>java</executable>
|
| 7 |
+
<arguments>-jar "%BASE%\crudapi.jar"</arguments>
|
| 8 |
+
<log mode="roll"></log>
|
| 9 |
+
<onfailure action="restart" />
|
| 10 |
+
</service>
|
lib/download.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
CRUDAPI_ADMIN_WEB_VERSION=1.6.2
|
| 2 |
+
CRUDAPI_VERSION=1.6.2
|
| 3 |
+
BASE_URL=https://download.crudapi.cn
|
| 4 |
+
|
| 5 |
+
CRUDAPI_ADMIN_WEB_GZ_URL=$BASE_URL/npm/crudapi-admin-web/$CRUDAPI_VERSION/crudapi-admin-web-$CRUDAPI_VERSION.tar.gz
|
| 6 |
+
CRUDAPI_CORE_JRA_URL=$BASE_URL/maven/crudapi/$CRUDAPI_VERSION/crudapi-core-$CRUDAPI_VERSION.jar
|
| 7 |
+
CRUDAPI_API_JRA_URL=$BASE_URL/maven/crudapi/$CRUDAPI_VERSION/crudapi-api-$CRUDAPI_VERSION.jar
|
| 8 |
+
CRUDAPI_SECURITY_JRA_URL=$BASE_URL/maven/crudapi/$CRUDAPI_VERSION/crudapi-security-$CRUDAPI_VERSION.jar
|
| 9 |
+
CRUDAPI_REST_JRA_URL=$BASE_URL/maven/crudapi/$CRUDAPI_VERSION/crudapi-rest-$CRUDAPI_VERSION.jar
|
| 10 |
+
CRUDAPI_WEIXIN_JRA_URL=$BASE_URL/maven/crudapi/$CRUDAPI_VERSION/crudapi-weixin-$CRUDAPI_VERSION.jar
|
| 11 |
+
CRUDAPI_WINSE_URL=$BASE_URL/exe/WinSW-x64.exe.tar.gz
|
| 12 |
+
|
| 13 |
+
echo "$CRUDAPI_ADMIN_WEB_GZ_URL"
|
| 14 |
+
echo "$CRUDAPI_CORE_JRA_URL"
|
| 15 |
+
echo "$CRUDAPI_API_JRA_URL"
|
| 16 |
+
echo "$CRUDAPI_SECURITY_JRA_URL"
|
| 17 |
+
echo "$CRUDAPI_REST_JRA_URL"
|
| 18 |
+
echo "$CRUDAPI_WEIXIN_JRA_URL"
|
| 19 |
+
echo "$CRUDAPI_WINSE_URL"
|
| 20 |
+
|
| 21 |
+
rm -rf *.gz
|
| 22 |
+
rm -rf *.jar
|
| 23 |
+
|
| 24 |
+
curl -k -O $CRUDAPI_ADMIN_WEB_GZ_URL
|
| 25 |
+
curl -k -O $CRUDAPI_CORE_JRA_URL
|
| 26 |
+
curl -k -O $CRUDAPI_API_JRA_URL
|
| 27 |
+
curl -k -O $CRUDAPI_SECURITY_JRA_URL
|
| 28 |
+
curl -k -O $CRUDAPI_REST_JRA_URL
|
| 29 |
+
curl -k -O $CRUDAPI_WEIXIN_JRA_URL
|
| 30 |
+
curl -k -O $CRUDAPI_WINSE_URL
|
| 31 |
+
|
| 32 |
+
ls *.gz
|
| 33 |
+
ls *.jar
|
| 34 |
+
|
| 35 |
+
mvn install:install-file -Dfile=crudapi-core-$CRUDAPI_VERSION.jar -DgroupId=cn.crudapi -DartifactId=crudapi-core -Dversion=$CRUDAPI_VERSION -Dpackaging=jar
|
| 36 |
+
mvn install:install-file -Dfile=crudapi-api-$CRUDAPI_VERSION.jar -DgroupId=cn.crudapi -DartifactId=crudapi-api -Dversion=$CRUDAPI_VERSION -Dpackaging=jar
|
| 37 |
+
mvn install:install-file -Dfile=crudapi-rest-$CRUDAPI_VERSION.jar -DgroupId=cn.crudapi -DartifactId=crudapi-rest -Dversion=$CRUDAPI_VERSION -Dpackaging=jar
|
| 38 |
+
mvn install:install-file -Dfile=crudapi-security-$CRUDAPI_VERSION.jar -DgroupId=cn.crudapi -DartifactId=crudapi-security -Dversion=$CRUDAPI_VERSION -Dpackaging=jar
|
| 39 |
+
mvn install:install-file -Dfile=crudapi-weixin-$CRUDAPI_VERSION.jar -DgroupId=cn.crudapi -DartifactId=crudapi-weixin -Dversion=$CRUDAPI_VERSION -Dpackaging=jar
|
| 40 |
+
|
| 41 |
+
tar -zxvf WinSW-x64.exe.tar.gz
|
lib/install.bat
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
crudapi install
|
| 2 |
+
pause
|
lib/restart.bat
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
crudapi restart
|
| 2 |
+
pause
|
lib/run.bat
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cd /d %~dp0
|
| 2 |
+
java -jar "crudapi.jar"
|
| 3 |
+
pause
|
lib/setJavaEnv.bat
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
echo %Path%
|
| 2 |
+
|
| 3 |
+
SETX /M JAVA_HOME "C:\Program Files\Java\jdk1.8.0_202"
|
| 4 |
+
|
| 5 |
+
SETX /M Path "C:\Program Files\Java\jdk1.8.0_202\bin;%Path%"
|
| 6 |
+
|
| 7 |
+
pause
|
lib/start.bat
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
crudapi start
|
| 2 |
+
pause
|
lib/status.bat
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
crudapi status
|
| 2 |
+
pause
|
lib/stop.bat
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
crudapi stop
|
| 2 |
+
pause
|
lib/uninstall.bat
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
crudapi uninstall
|
| 2 |
+
pause
|
mvnw
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# ----------------------------------------------------------------------------
|
| 3 |
+
# Licensed to the Apache Software Foundation (ASF) under one
|
| 4 |
+
# or more contributor license agreements. See the NOTICE file
|
| 5 |
+
# distributed with this work for additional information
|
| 6 |
+
# regarding copyright ownership. The ASF licenses this file
|
| 7 |
+
# to you under the Apache License, Version 2.0 (the
|
| 8 |
+
# "License"); you may not use this file except in compliance
|
| 9 |
+
# with the License. You may obtain a copy of the License at
|
| 10 |
+
#
|
| 11 |
+
# https://www.apache.org/licenses/LICENSE-2.0
|
| 12 |
+
#
|
| 13 |
+
# Unless required by applicable law or agreed to in writing,
|
| 14 |
+
# software distributed under the License is distributed on an
|
| 15 |
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 16 |
+
# KIND, either express or implied. See the License for the
|
| 17 |
+
# specific language governing permissions and limitations
|
| 18 |
+
# under the License.
|
| 19 |
+
# ----------------------------------------------------------------------------
|
| 20 |
+
|
| 21 |
+
# ----------------------------------------------------------------------------
|
| 22 |
+
# Maven Start Up Batch script
|
| 23 |
+
#
|
| 24 |
+
# Required ENV vars:
|
| 25 |
+
# ------------------
|
| 26 |
+
# JAVA_HOME - location of a JDK home dir
|
| 27 |
+
#
|
| 28 |
+
# Optional ENV vars
|
| 29 |
+
# -----------------
|
| 30 |
+
# M2_HOME - location of maven2's installed home dir
|
| 31 |
+
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
| 32 |
+
# e.g. to debug Maven itself, use
|
| 33 |
+
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
| 34 |
+
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
| 35 |
+
# ----------------------------------------------------------------------------
|
| 36 |
+
|
| 37 |
+
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
| 38 |
+
|
| 39 |
+
if [ -f /etc/mavenrc ] ; then
|
| 40 |
+
. /etc/mavenrc
|
| 41 |
+
fi
|
| 42 |
+
|
| 43 |
+
if [ -f "$HOME/.mavenrc" ] ; then
|
| 44 |
+
. "$HOME/.mavenrc"
|
| 45 |
+
fi
|
| 46 |
+
|
| 47 |
+
fi
|
| 48 |
+
|
| 49 |
+
# OS specific support. $var _must_ be set to either true or false.
|
| 50 |
+
cygwin=false;
|
| 51 |
+
darwin=false;
|
| 52 |
+
mingw=false
|
| 53 |
+
case "`uname`" in
|
| 54 |
+
CYGWIN*) cygwin=true ;;
|
| 55 |
+
MINGW*) mingw=true;;
|
| 56 |
+
Darwin*) darwin=true
|
| 57 |
+
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
| 58 |
+
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
| 59 |
+
if [ -z "$JAVA_HOME" ]; then
|
| 60 |
+
if [ -x "/usr/libexec/java_home" ]; then
|
| 61 |
+
export JAVA_HOME="`/usr/libexec/java_home`"
|
| 62 |
+
else
|
| 63 |
+
export JAVA_HOME="/Library/Java/Home"
|
| 64 |
+
fi
|
| 65 |
+
fi
|
| 66 |
+
;;
|
| 67 |
+
esac
|
| 68 |
+
|
| 69 |
+
if [ -z "$JAVA_HOME" ] ; then
|
| 70 |
+
if [ -r /etc/gentoo-release ] ; then
|
| 71 |
+
JAVA_HOME=`java-config --jre-home`
|
| 72 |
+
fi
|
| 73 |
+
fi
|
| 74 |
+
|
| 75 |
+
if [ -z "$M2_HOME" ] ; then
|
| 76 |
+
## resolve links - $0 may be a link to maven's home
|
| 77 |
+
PRG="$0"
|
| 78 |
+
|
| 79 |
+
# need this for relative symlinks
|
| 80 |
+
while [ -h "$PRG" ] ; do
|
| 81 |
+
ls=`ls -ld "$PRG"`
|
| 82 |
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
| 83 |
+
if expr "$link" : '/.*' > /dev/null; then
|
| 84 |
+
PRG="$link"
|
| 85 |
+
else
|
| 86 |
+
PRG="`dirname "$PRG"`/$link"
|
| 87 |
+
fi
|
| 88 |
+
done
|
| 89 |
+
|
| 90 |
+
saveddir=`pwd`
|
| 91 |
+
|
| 92 |
+
M2_HOME=`dirname "$PRG"`/..
|
| 93 |
+
|
| 94 |
+
# make it fully qualified
|
| 95 |
+
M2_HOME=`cd "$M2_HOME" && pwd`
|
| 96 |
+
|
| 97 |
+
cd "$saveddir"
|
| 98 |
+
# echo Using m2 at $M2_HOME
|
| 99 |
+
fi
|
| 100 |
+
|
| 101 |
+
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
| 102 |
+
if $cygwin ; then
|
| 103 |
+
[ -n "$M2_HOME" ] &&
|
| 104 |
+
M2_HOME=`cygpath --unix "$M2_HOME"`
|
| 105 |
+
[ -n "$JAVA_HOME" ] &&
|
| 106 |
+
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
| 107 |
+
[ -n "$CLASSPATH" ] &&
|
| 108 |
+
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
| 109 |
+
fi
|
| 110 |
+
|
| 111 |
+
# For Mingw, ensure paths are in UNIX format before anything is touched
|
| 112 |
+
if $mingw ; then
|
| 113 |
+
[ -n "$M2_HOME" ] &&
|
| 114 |
+
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
| 115 |
+
[ -n "$JAVA_HOME" ] &&
|
| 116 |
+
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
| 117 |
+
fi
|
| 118 |
+
|
| 119 |
+
if [ -z "$JAVA_HOME" ]; then
|
| 120 |
+
javaExecutable="`which javac`"
|
| 121 |
+
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
| 122 |
+
# readlink(1) is not available as standard on Solaris 10.
|
| 123 |
+
readLink=`which readlink`
|
| 124 |
+
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
| 125 |
+
if $darwin ; then
|
| 126 |
+
javaHome="`dirname \"$javaExecutable\"`"
|
| 127 |
+
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
| 128 |
+
else
|
| 129 |
+
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
| 130 |
+
fi
|
| 131 |
+
javaHome="`dirname \"$javaExecutable\"`"
|
| 132 |
+
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
| 133 |
+
JAVA_HOME="$javaHome"
|
| 134 |
+
export JAVA_HOME
|
| 135 |
+
fi
|
| 136 |
+
fi
|
| 137 |
+
fi
|
| 138 |
+
|
| 139 |
+
if [ -z "$JAVACMD" ] ; then
|
| 140 |
+
if [ -n "$JAVA_HOME" ] ; then
|
| 141 |
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
| 142 |
+
# IBM's JDK on AIX uses strange locations for the executables
|
| 143 |
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
| 144 |
+
else
|
| 145 |
+
JAVACMD="$JAVA_HOME/bin/java"
|
| 146 |
+
fi
|
| 147 |
+
else
|
| 148 |
+
JAVACMD="`which java`"
|
| 149 |
+
fi
|
| 150 |
+
fi
|
| 151 |
+
|
| 152 |
+
if [ ! -x "$JAVACMD" ] ; then
|
| 153 |
+
echo "Error: JAVA_HOME is not defined correctly." >&2
|
| 154 |
+
echo " We cannot execute $JAVACMD" >&2
|
| 155 |
+
exit 1
|
| 156 |
+
fi
|
| 157 |
+
|
| 158 |
+
if [ -z "$JAVA_HOME" ] ; then
|
| 159 |
+
echo "Warning: JAVA_HOME environment variable is not set."
|
| 160 |
+
fi
|
| 161 |
+
|
| 162 |
+
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
| 163 |
+
|
| 164 |
+
# traverses directory structure from process work directory to filesystem root
|
| 165 |
+
# first directory with .mvn subdirectory is considered project base directory
|
| 166 |
+
find_maven_basedir() {
|
| 167 |
+
|
| 168 |
+
if [ -z "$1" ]
|
| 169 |
+
then
|
| 170 |
+
echo "Path not specified to find_maven_basedir"
|
| 171 |
+
return 1
|
| 172 |
+
fi
|
| 173 |
+
|
| 174 |
+
basedir="$1"
|
| 175 |
+
wdir="$1"
|
| 176 |
+
while [ "$wdir" != '/' ] ; do
|
| 177 |
+
if [ -d "$wdir"/.mvn ] ; then
|
| 178 |
+
basedir=$wdir
|
| 179 |
+
break
|
| 180 |
+
fi
|
| 181 |
+
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
| 182 |
+
if [ -d "${wdir}" ]; then
|
| 183 |
+
wdir=`cd "$wdir/.."; pwd`
|
| 184 |
+
fi
|
| 185 |
+
# end of workaround
|
| 186 |
+
done
|
| 187 |
+
echo "${basedir}"
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
# concatenates all lines of a file
|
| 191 |
+
concat_lines() {
|
| 192 |
+
if [ -f "$1" ]; then
|
| 193 |
+
echo "$(tr -s '\n' ' ' < "$1")"
|
| 194 |
+
fi
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
| 198 |
+
if [ -z "$BASE_DIR" ]; then
|
| 199 |
+
exit 1;
|
| 200 |
+
fi
|
| 201 |
+
|
| 202 |
+
##########################################################################################
|
| 203 |
+
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
| 204 |
+
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
| 205 |
+
##########################################################################################
|
| 206 |
+
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
| 207 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 208 |
+
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
| 209 |
+
fi
|
| 210 |
+
else
|
| 211 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 212 |
+
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
| 213 |
+
fi
|
| 214 |
+
if [ -n "$MVNW_REPOURL" ]; then
|
| 215 |
+
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
| 216 |
+
else
|
| 217 |
+
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
| 218 |
+
fi
|
| 219 |
+
while IFS="=" read key value; do
|
| 220 |
+
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
| 221 |
+
esac
|
| 222 |
+
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
| 223 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 224 |
+
echo "Downloading from: $jarUrl"
|
| 225 |
+
fi
|
| 226 |
+
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
| 227 |
+
if $cygwin; then
|
| 228 |
+
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
| 229 |
+
fi
|
| 230 |
+
|
| 231 |
+
if command -v wget > /dev/null; then
|
| 232 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 233 |
+
echo "Found wget ... using wget"
|
| 234 |
+
fi
|
| 235 |
+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
| 236 |
+
wget "$jarUrl" -O "$wrapperJarPath"
|
| 237 |
+
else
|
| 238 |
+
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
| 239 |
+
fi
|
| 240 |
+
elif command -v curl > /dev/null; then
|
| 241 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 242 |
+
echo "Found curl ... using curl"
|
| 243 |
+
fi
|
| 244 |
+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
| 245 |
+
curl -o "$wrapperJarPath" "$jarUrl" -f
|
| 246 |
+
else
|
| 247 |
+
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
| 248 |
+
fi
|
| 249 |
+
|
| 250 |
+
else
|
| 251 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 252 |
+
echo "Falling back to using Java to download"
|
| 253 |
+
fi
|
| 254 |
+
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
| 255 |
+
# For Cygwin, switch paths to Windows format before running javac
|
| 256 |
+
if $cygwin; then
|
| 257 |
+
javaClass=`cygpath --path --windows "$javaClass"`
|
| 258 |
+
fi
|
| 259 |
+
if [ -e "$javaClass" ]; then
|
| 260 |
+
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
| 261 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 262 |
+
echo " - Compiling MavenWrapperDownloader.java ..."
|
| 263 |
+
fi
|
| 264 |
+
# Compiling the Java class
|
| 265 |
+
("$JAVA_HOME/bin/javac" "$javaClass")
|
| 266 |
+
fi
|
| 267 |
+
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
| 268 |
+
# Running the downloader
|
| 269 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 270 |
+
echo " - Running MavenWrapperDownloader.java ..."
|
| 271 |
+
fi
|
| 272 |
+
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
| 273 |
+
fi
|
| 274 |
+
fi
|
| 275 |
+
fi
|
| 276 |
+
fi
|
| 277 |
+
##########################################################################################
|
| 278 |
+
# End of extension
|
| 279 |
+
##########################################################################################
|
| 280 |
+
|
| 281 |
+
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
| 282 |
+
if [ "$MVNW_VERBOSE" = true ]; then
|
| 283 |
+
echo $MAVEN_PROJECTBASEDIR
|
| 284 |
+
fi
|
| 285 |
+
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
| 286 |
+
|
| 287 |
+
# For Cygwin, switch paths to Windows format before running java
|
| 288 |
+
if $cygwin; then
|
| 289 |
+
[ -n "$M2_HOME" ] &&
|
| 290 |
+
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
| 291 |
+
[ -n "$JAVA_HOME" ] &&
|
| 292 |
+
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
| 293 |
+
[ -n "$CLASSPATH" ] &&
|
| 294 |
+
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
| 295 |
+
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
| 296 |
+
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
| 297 |
+
fi
|
| 298 |
+
|
| 299 |
+
# Provide a "standardized" way to retrieve the CLI args that will
|
| 300 |
+
# work with both Windows and non-Windows executions.
|
| 301 |
+
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
| 302 |
+
export MAVEN_CMD_LINE_ARGS
|
| 303 |
+
|
| 304 |
+
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
| 305 |
+
|
| 306 |
+
exec "$JAVACMD" \
|
| 307 |
+
$MAVEN_OPTS \
|
| 308 |
+
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
| 309 |
+
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
| 310 |
+
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
mvnw.cmd
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@REM ----------------------------------------------------------------------------
|
| 2 |
+
@REM Licensed to the Apache Software Foundation (ASF) under one
|
| 3 |
+
@REM or more contributor license agreements. See the NOTICE file
|
| 4 |
+
@REM distributed with this work for additional information
|
| 5 |
+
@REM regarding copyright ownership. The ASF licenses this file
|
| 6 |
+
@REM to you under the Apache License, Version 2.0 (the
|
| 7 |
+
@REM "License"); you may not use this file except in compliance
|
| 8 |
+
@REM with the License. You may obtain a copy of the License at
|
| 9 |
+
@REM
|
| 10 |
+
@REM https://www.apache.org/licenses/LICENSE-2.0
|
| 11 |
+
@REM
|
| 12 |
+
@REM Unless required by applicable law or agreed to in writing,
|
| 13 |
+
@REM software distributed under the License is distributed on an
|
| 14 |
+
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 15 |
+
@REM KIND, either express or implied. See the License for the
|
| 16 |
+
@REM specific language governing permissions and limitations
|
| 17 |
+
@REM under the License.
|
| 18 |
+
@REM ----------------------------------------------------------------------------
|
| 19 |
+
|
| 20 |
+
@REM ----------------------------------------------------------------------------
|
| 21 |
+
@REM Maven Start Up Batch script
|
| 22 |
+
@REM
|
| 23 |
+
@REM Required ENV vars:
|
| 24 |
+
@REM JAVA_HOME - location of a JDK home dir
|
| 25 |
+
@REM
|
| 26 |
+
@REM Optional ENV vars
|
| 27 |
+
@REM M2_HOME - location of maven2's installed home dir
|
| 28 |
+
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
| 29 |
+
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
| 30 |
+
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
| 31 |
+
@REM e.g. to debug Maven itself, use
|
| 32 |
+
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
| 33 |
+
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
| 34 |
+
@REM ----------------------------------------------------------------------------
|
| 35 |
+
|
| 36 |
+
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
| 37 |
+
@echo off
|
| 38 |
+
@REM set title of command window
|
| 39 |
+
title %0
|
| 40 |
+
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
| 41 |
+
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
| 42 |
+
|
| 43 |
+
@REM set %HOME% to equivalent of $HOME
|
| 44 |
+
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
| 45 |
+
|
| 46 |
+
@REM Execute a user defined script before this one
|
| 47 |
+
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
| 48 |
+
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
| 49 |
+
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
| 50 |
+
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
| 51 |
+
:skipRcPre
|
| 52 |
+
|
| 53 |
+
@setlocal
|
| 54 |
+
|
| 55 |
+
set ERROR_CODE=0
|
| 56 |
+
|
| 57 |
+
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
| 58 |
+
@setlocal
|
| 59 |
+
|
| 60 |
+
@REM ==== START VALIDATION ====
|
| 61 |
+
if not "%JAVA_HOME%" == "" goto OkJHome
|
| 62 |
+
|
| 63 |
+
echo.
|
| 64 |
+
echo Error: JAVA_HOME not found in your environment. >&2
|
| 65 |
+
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
| 66 |
+
echo location of your Java installation. >&2
|
| 67 |
+
echo.
|
| 68 |
+
goto error
|
| 69 |
+
|
| 70 |
+
:OkJHome
|
| 71 |
+
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
| 72 |
+
|
| 73 |
+
echo.
|
| 74 |
+
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
| 75 |
+
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
| 76 |
+
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
| 77 |
+
echo location of your Java installation. >&2
|
| 78 |
+
echo.
|
| 79 |
+
goto error
|
| 80 |
+
|
| 81 |
+
@REM ==== END VALIDATION ====
|
| 82 |
+
|
| 83 |
+
:init
|
| 84 |
+
|
| 85 |
+
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
| 86 |
+
@REM Fallback to current working directory if not found.
|
| 87 |
+
|
| 88 |
+
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
| 89 |
+
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
| 90 |
+
|
| 91 |
+
set EXEC_DIR=%CD%
|
| 92 |
+
set WDIR=%EXEC_DIR%
|
| 93 |
+
:findBaseDir
|
| 94 |
+
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
| 95 |
+
cd ..
|
| 96 |
+
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
| 97 |
+
set WDIR=%CD%
|
| 98 |
+
goto findBaseDir
|
| 99 |
+
|
| 100 |
+
:baseDirFound
|
| 101 |
+
set MAVEN_PROJECTBASEDIR=%WDIR%
|
| 102 |
+
cd "%EXEC_DIR%"
|
| 103 |
+
goto endDetectBaseDir
|
| 104 |
+
|
| 105 |
+
:baseDirNotFound
|
| 106 |
+
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
| 107 |
+
cd "%EXEC_DIR%"
|
| 108 |
+
|
| 109 |
+
:endDetectBaseDir
|
| 110 |
+
|
| 111 |
+
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
| 112 |
+
|
| 113 |
+
@setlocal EnableExtensions EnableDelayedExpansion
|
| 114 |
+
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
| 115 |
+
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
| 116 |
+
|
| 117 |
+
:endReadAdditionalConfig
|
| 118 |
+
|
| 119 |
+
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
| 120 |
+
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
| 121 |
+
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
| 122 |
+
|
| 123 |
+
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
| 124 |
+
|
| 125 |
+
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
| 126 |
+
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
| 130 |
+
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
| 131 |
+
if exist %WRAPPER_JAR% (
|
| 132 |
+
if "%MVNW_VERBOSE%" == "true" (
|
| 133 |
+
echo Found %WRAPPER_JAR%
|
| 134 |
+
)
|
| 135 |
+
) else (
|
| 136 |
+
if not "%MVNW_REPOURL%" == "" (
|
| 137 |
+
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
| 138 |
+
)
|
| 139 |
+
if "%MVNW_VERBOSE%" == "true" (
|
| 140 |
+
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
| 141 |
+
echo Downloading from: %DOWNLOAD_URL%
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
powershell -Command "&{"^
|
| 145 |
+
"$webclient = new-object System.Net.WebClient;"^
|
| 146 |
+
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
| 147 |
+
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
| 148 |
+
"}"^
|
| 149 |
+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
| 150 |
+
"}"
|
| 151 |
+
if "%MVNW_VERBOSE%" == "true" (
|
| 152 |
+
echo Finished downloading %WRAPPER_JAR%
|
| 153 |
+
)
|
| 154 |
+
)
|
| 155 |
+
@REM End of extension
|
| 156 |
+
|
| 157 |
+
@REM Provide a "standardized" way to retrieve the CLI args that will
|
| 158 |
+
@REM work with both Windows and non-Windows executions.
|
| 159 |
+
set MAVEN_CMD_LINE_ARGS=%*
|
| 160 |
+
|
| 161 |
+
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
| 162 |
+
if ERRORLEVEL 1 goto error
|
| 163 |
+
goto end
|
| 164 |
+
|
| 165 |
+
:error
|
| 166 |
+
set ERROR_CODE=1
|
| 167 |
+
|
| 168 |
+
:end
|
| 169 |
+
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
| 170 |
+
|
| 171 |
+
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
| 172 |
+
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
| 173 |
+
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
| 174 |
+
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
| 175 |
+
:skipRcPost
|
| 176 |
+
|
| 177 |
+
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
| 178 |
+
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
| 179 |
+
|
| 180 |
+
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
| 181 |
+
|
| 182 |
+
exit /B %ERROR_CODE%
|
pom.xml
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| 3 |
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
| 4 |
+
<modelVersion>4.0.0</modelVersion>
|
| 5 |
+
<groupId>cn.crudapi</groupId>
|
| 6 |
+
<artifactId>crudapi-example</artifactId>
|
| 7 |
+
<version>1.6.2</version>
|
| 8 |
+
<name>crudapi-example</name>
|
| 9 |
+
<description>Demo project for crudapi</description>
|
| 10 |
+
<parent>
|
| 11 |
+
<groupId>org.springframework.boot</groupId>
|
| 12 |
+
<artifactId>spring-boot-starter-parent</artifactId>
|
| 13 |
+
<version>2.2.6.RELEASE</version>
|
| 14 |
+
<relativePath/> <!-- lookup parent from repository -->
|
| 15 |
+
</parent>
|
| 16 |
+
<properties>
|
| 17 |
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
| 18 |
+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
| 19 |
+
<java.version>1.8</java.version>
|
| 20 |
+
</properties>
|
| 21 |
+
<dependencies>
|
| 22 |
+
<dependency>
|
| 23 |
+
<groupId>org.springframework.boot</groupId>
|
| 24 |
+
<artifactId>spring-boot-starter</artifactId>
|
| 25 |
+
</dependency>
|
| 26 |
+
<dependency>
|
| 27 |
+
<groupId>org.springframework.boot</groupId>
|
| 28 |
+
<artifactId>spring-boot-starter-security</artifactId>
|
| 29 |
+
</dependency>
|
| 30 |
+
<dependency>
|
| 31 |
+
<groupId>org.springframework.boot</groupId>
|
| 32 |
+
<artifactId>spring-boot-starter-aop</artifactId>
|
| 33 |
+
</dependency>
|
| 34 |
+
<dependency>
|
| 35 |
+
<groupId>org.springframework.boot</groupId>
|
| 36 |
+
<artifactId>spring-boot-starter-web</artifactId>
|
| 37 |
+
</dependency>
|
| 38 |
+
<dependency>
|
| 39 |
+
<groupId>org.springframework.boot</groupId>
|
| 40 |
+
<artifactId>spring-boot-starter-jdbc</artifactId>
|
| 41 |
+
</dependency>
|
| 42 |
+
<dependency>
|
| 43 |
+
<groupId>mysql</groupId>
|
| 44 |
+
<artifactId>mysql-connector-java</artifactId>
|
| 45 |
+
<scope>runtime</scope>
|
| 46 |
+
</dependency>
|
| 47 |
+
<dependency>
|
| 48 |
+
<groupId>org.postgresql</groupId>
|
| 49 |
+
<artifactId>postgresql</artifactId>
|
| 50 |
+
<scope>runtime</scope>
|
| 51 |
+
</dependency>
|
| 52 |
+
<dependency>
|
| 53 |
+
<groupId>com.microsoft.sqlserver</groupId>
|
| 54 |
+
<artifactId>mssql-jdbc</artifactId>
|
| 55 |
+
<scope>runtime</scope>
|
| 56 |
+
</dependency>
|
| 57 |
+
<dependency>
|
| 58 |
+
<groupId>com.oracle.database.jdbc</groupId>
|
| 59 |
+
<artifactId>ojdbc8</artifactId>
|
| 60 |
+
<version>21.5.0.0</version>
|
| 61 |
+
<scope>runtime</scope>
|
| 62 |
+
</dependency>
|
| 63 |
+
<dependency>
|
| 64 |
+
<groupId>commons-codec</groupId>
|
| 65 |
+
<artifactId>commons-codec</artifactId>
|
| 66 |
+
</dependency>
|
| 67 |
+
<dependency>
|
| 68 |
+
<groupId>commons-io</groupId>
|
| 69 |
+
<artifactId>commons-io</artifactId>
|
| 70 |
+
<version>2.4</version>
|
| 71 |
+
</dependency>
|
| 72 |
+
<dependency>
|
| 73 |
+
<groupId>org.apache.commons</groupId>
|
| 74 |
+
<artifactId>commons-lang3</artifactId>
|
| 75 |
+
</dependency>
|
| 76 |
+
<dependency>
|
| 77 |
+
<groupId>org.apache.commons</groupId>
|
| 78 |
+
<artifactId>commons-collections4</artifactId>
|
| 79 |
+
<version>4.4</version>
|
| 80 |
+
</dependency>
|
| 81 |
+
<dependency>
|
| 82 |
+
<groupId>org.apache.commons</groupId>
|
| 83 |
+
<artifactId>commons-csv</artifactId>
|
| 84 |
+
<version>1.8</version>
|
| 85 |
+
</dependency>
|
| 86 |
+
<dependency>
|
| 87 |
+
<groupId>org.springframework.session</groupId>
|
| 88 |
+
<artifactId>spring-session-jdbc</artifactId>
|
| 89 |
+
</dependency>
|
| 90 |
+
<dependency>
|
| 91 |
+
<groupId>com.squareup.okhttp3</groupId>
|
| 92 |
+
<artifactId>okhttp</artifactId>
|
| 93 |
+
</dependency>
|
| 94 |
+
<dependency>
|
| 95 |
+
<groupId>org.springframework.security</groupId>
|
| 96 |
+
<artifactId>spring-security-jwt</artifactId>
|
| 97 |
+
<version>1.1.1.RELEASE</version>
|
| 98 |
+
</dependency>
|
| 99 |
+
<dependency>
|
| 100 |
+
<groupId>io.jsonwebtoken</groupId>
|
| 101 |
+
<artifactId>jjwt</artifactId>
|
| 102 |
+
<version>0.9.1</version>
|
| 103 |
+
</dependency>
|
| 104 |
+
<dependency>
|
| 105 |
+
<groupId>cn.hutool</groupId>
|
| 106 |
+
<artifactId>hutool-all</artifactId>
|
| 107 |
+
<version>5.5.6</version>
|
| 108 |
+
</dependency>
|
| 109 |
+
<dependency>
|
| 110 |
+
<groupId>com.github.penggle</groupId>
|
| 111 |
+
<artifactId>kaptcha</artifactId>
|
| 112 |
+
<version>2.3.2</version>
|
| 113 |
+
</dependency>
|
| 114 |
+
<dependency>
|
| 115 |
+
<groupId>org.jadira.usertype</groupId>
|
| 116 |
+
<artifactId>usertype.core</artifactId>
|
| 117 |
+
<version>7.0.0.CR1</version>
|
| 118 |
+
</dependency>
|
| 119 |
+
<dependency>
|
| 120 |
+
<groupId>joda-time</groupId>
|
| 121 |
+
<artifactId>joda-time</artifactId>
|
| 122 |
+
</dependency>
|
| 123 |
+
<dependency>
|
| 124 |
+
<groupId>com.fasterxml.jackson.datatype</groupId>
|
| 125 |
+
<artifactId>jackson-datatype-joda</artifactId>
|
| 126 |
+
</dependency>
|
| 127 |
+
<dependency>
|
| 128 |
+
<groupId>io.springfox</groupId>
|
| 129 |
+
<artifactId>springfox-swagger2</artifactId>
|
| 130 |
+
<version>2.9.2</version>
|
| 131 |
+
</dependency>
|
| 132 |
+
<dependency>
|
| 133 |
+
<groupId>io.springfox</groupId>
|
| 134 |
+
<artifactId>springfox-swagger-ui</artifactId>
|
| 135 |
+
<version>2.9.2</version>
|
| 136 |
+
</dependency>
|
| 137 |
+
<dependency>
|
| 138 |
+
<groupId>org.apache.poi</groupId>
|
| 139 |
+
<artifactId>poi</artifactId>
|
| 140 |
+
<version>5.0.0</version>
|
| 141 |
+
</dependency>
|
| 142 |
+
<dependency>
|
| 143 |
+
<groupId>org.apache.poi</groupId>
|
| 144 |
+
<artifactId>poi-ooxml</artifactId>
|
| 145 |
+
<version>5.0.0</version>
|
| 146 |
+
</dependency>
|
| 147 |
+
<dependency>
|
| 148 |
+
<groupId>org.freemarker</groupId>
|
| 149 |
+
<artifactId>freemarker</artifactId>
|
| 150 |
+
<version>2.3.31</version>
|
| 151 |
+
</dependency>
|
| 152 |
+
<dependency>
|
| 153 |
+
<groupId>org.flywaydb</groupId>
|
| 154 |
+
<artifactId>flyway-core</artifactId>
|
| 155 |
+
</dependency>
|
| 156 |
+
<dependency>
|
| 157 |
+
<groupId>cn.crudapi</groupId>
|
| 158 |
+
<artifactId>crudapi-core</artifactId>
|
| 159 |
+
<version>1.6.2</version>
|
| 160 |
+
</dependency>
|
| 161 |
+
<dependency>
|
| 162 |
+
<groupId>cn.crudapi</groupId>
|
| 163 |
+
<artifactId>crudapi-api</artifactId>
|
| 164 |
+
<version>1.6.2</version>
|
| 165 |
+
</dependency>
|
| 166 |
+
<dependency>
|
| 167 |
+
<groupId>cn.crudapi</groupId>
|
| 168 |
+
<artifactId>crudapi-security</artifactId>
|
| 169 |
+
<version>1.6.2</version>
|
| 170 |
+
</dependency>
|
| 171 |
+
<dependency>
|
| 172 |
+
<groupId>cn.crudapi</groupId>
|
| 173 |
+
<artifactId>crudapi-rest</artifactId>
|
| 174 |
+
<version>1.6.2</version>
|
| 175 |
+
</dependency>
|
| 176 |
+
<dependency>
|
| 177 |
+
<groupId>cn.crudapi</groupId>
|
| 178 |
+
<artifactId>crudapi-weixin</artifactId>
|
| 179 |
+
<version>1.6.2</version>
|
| 180 |
+
</dependency>
|
| 181 |
+
</dependencies>
|
| 182 |
+
<build>
|
| 183 |
+
<plugins>
|
| 184 |
+
<plugin>
|
| 185 |
+
<groupId>org.springframework.boot</groupId>
|
| 186 |
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
| 187 |
+
</plugin>
|
| 188 |
+
</plugins>
|
| 189 |
+
</build>
|
| 190 |
+
</project>
|
settings.xml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<settings>
|
| 2 |
+
<profiles>
|
| 3 |
+
<profile>
|
| 4 |
+
<id>aliyun</id>
|
| 5 |
+
<activation>
|
| 6 |
+
<activeByDefault>true</activeByDefault>
|
| 7 |
+
</activation>
|
| 8 |
+
<repositories>
|
| 9 |
+
<repository>
|
| 10 |
+
<id>aliyun</id>
|
| 11 |
+
<url>https://maven.aliyun.com/repository/public</url>
|
| 12 |
+
</repository>
|
| 13 |
+
</repositories>
|
| 14 |
+
<pluginRepositories>
|
| 15 |
+
<pluginRepository>
|
| 16 |
+
<id>aliyun-plugin</id>
|
| 17 |
+
<url>https://maven.aliyun.com/repository/public</url>
|
| 18 |
+
<releases>
|
| 19 |
+
<enabled>true</enabled>
|
| 20 |
+
</releases>
|
| 21 |
+
<snapshots>
|
| 22 |
+
<enabled>false</enabled>
|
| 23 |
+
</snapshots>
|
| 24 |
+
</pluginRepository>
|
| 25 |
+
</pluginRepositories>
|
| 26 |
+
</profile>
|
| 27 |
+
</profiles>
|
| 28 |
+
<mirrors>
|
| 29 |
+
<mirror>
|
| 30 |
+
<id>aliyunmaven</id>
|
| 31 |
+
<mirrorOf>*</mirrorOf>
|
| 32 |
+
<name>阿里云公共仓库</name>
|
| 33 |
+
<url>https://maven.aliyun.com/repository/public</url>
|
| 34 |
+
</mirror>
|
| 35 |
+
</mirrors>
|
| 36 |
+
</settings>
|
src/main/java/cn/crudapi/example/CrudapiExampleApplication.java
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package cn.crudapi.example;
|
| 2 |
+
|
| 3 |
+
import org.springframework.boot.SpringApplication;
|
| 4 |
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| 5 |
+
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
| 6 |
+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
| 7 |
+
import org.springframework.boot.web.servlet.ServletComponentScan;
|
| 8 |
+
import org.springframework.context.annotation.ComponentScan;
|
| 9 |
+
import org.springframework.scheduling.annotation.EnableAsync;
|
| 10 |
+
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
| 11 |
+
|
| 12 |
+
@ComponentScan({"cn.crudapi", "cn.crudapi.example"})
|
| 13 |
+
@ServletComponentScan(basePackages = {"cn.crudapi"})
|
| 14 |
+
@EntityScan("cn.crudapi.core.entity")
|
| 15 |
+
@EnableTransactionManagement
|
| 16 |
+
@EnableAsync
|
| 17 |
+
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
| 18 |
+
public class CrudapiExampleApplication {
|
| 19 |
+
|
| 20 |
+
public static void main(String[] args) {
|
| 21 |
+
SpringApplication.run(CrudapiExampleApplication.class, args);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
}
|
src/main/java/cn/crudapi/example/Swagger2SpringBoot.java
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package cn.crudapi.example;
|
| 2 |
+
|
| 3 |
+
import com.google.common.base.Predicate;
|
| 4 |
+
import org.springframework.context.annotation.Bean;
|
| 5 |
+
import org.springframework.context.annotation.Configuration;
|
| 6 |
+
import springfox.documentation.builders.ApiInfoBuilder;
|
| 7 |
+
import springfox.documentation.service.ApiInfo;
|
| 8 |
+
import springfox.documentation.service.Contact;
|
| 9 |
+
import springfox.documentation.spi.DocumentationType;
|
| 10 |
+
import springfox.documentation.spring.web.plugins.Docket;
|
| 11 |
+
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
| 12 |
+
|
| 13 |
+
import static springfox.documentation.builders.PathSelectors.*;
|
| 14 |
+
|
| 15 |
+
@Configuration
|
| 16 |
+
@EnableSwagger2
|
| 17 |
+
public class Swagger2SpringBoot {
|
| 18 |
+
@Bean
|
| 19 |
+
public Docket caMetadataApi() {
|
| 20 |
+
return new Docket(DocumentationType.SWAGGER_2)
|
| 21 |
+
.groupName("元数据")
|
| 22 |
+
.apiInfo(apiInfo())
|
| 23 |
+
.select()
|
| 24 |
+
.paths(caMetadataPaths())
|
| 25 |
+
.build();
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
@Bean
|
| 29 |
+
public Docket caBusinessApi() {
|
| 30 |
+
return new Docket(DocumentationType.SWAGGER_2)
|
| 31 |
+
.groupName("业务数据")
|
| 32 |
+
.apiInfo(apiInfo())
|
| 33 |
+
.select()
|
| 34 |
+
.paths(caBusinessPaths())
|
| 35 |
+
.build();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
@Bean
|
| 39 |
+
public Docket fileApi() {
|
| 40 |
+
return new Docket(DocumentationType.SWAGGER_2)
|
| 41 |
+
.groupName("文件管理")
|
| 42 |
+
.apiInfo(apiInfo())
|
| 43 |
+
.select()
|
| 44 |
+
.paths(filePaths())
|
| 45 |
+
.build();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
@Bean
|
| 49 |
+
public Docket userApi() {
|
| 50 |
+
return new Docket(DocumentationType.SWAGGER_2)
|
| 51 |
+
.groupName("用户")
|
| 52 |
+
.apiInfo(apiInfo())
|
| 53 |
+
.select()
|
| 54 |
+
.paths(userPaths())
|
| 55 |
+
.build();
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
@Bean
|
| 59 |
+
public Docket captchaApi() {
|
| 60 |
+
return new Docket(DocumentationType.SWAGGER_2)
|
| 61 |
+
.groupName("验证码")
|
| 62 |
+
.apiInfo(apiInfo())
|
| 63 |
+
.select()
|
| 64 |
+
.paths(captchaPaths())
|
| 65 |
+
.build();
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
@Bean
|
| 69 |
+
public Docket weixinApi() {
|
| 70 |
+
return new Docket(DocumentationType.SWAGGER_2)
|
| 71 |
+
.groupName("微信")
|
| 72 |
+
.apiInfo(apiInfo())
|
| 73 |
+
.select()
|
| 74 |
+
.paths(weixinPaths())
|
| 75 |
+
.build();
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
private Predicate<String> caMetadataPaths() {
|
| 80 |
+
return regex("/api/metadata.*");
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
private Predicate<String> caBusinessPaths() {
|
| 84 |
+
return regex("/api/business.*");
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
private Predicate<String> filePaths() {
|
| 88 |
+
return regex("/api/file.*");
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
private Predicate<String> weixinPaths() {
|
| 92 |
+
return regex("/api/weixin.*");
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
private Predicate<String> userPaths() {
|
| 96 |
+
return regex("/api/user.*");
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
private Predicate<String> captchaPaths() {
|
| 101 |
+
return regex("/api/captcha.*");
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
private ApiInfo apiInfo() {
|
| 105 |
+
return new ApiInfoBuilder()
|
| 106 |
+
.title("crudapi增删改查接口零代码产品")
|
| 107 |
+
.description("crudapi是crud+api组合,表示增删改查接口,是一款零代码产品。无需编程,通过配置元数据自动生成crud增删改查RESTful API,提供后台UI管理业务数据,支持Java SDK集成或Restful API集成。\n"
|
| 108 |
+
+ "使用crudapi可以告别枯燥无味的增删改查代码,让您更加专注业务,节约大量成本,从而提高工作效率。crudapi的目标是让处理数据变得更简单,所有人都可以免费使用!")
|
| 109 |
+
.termsOfServiceUrl("https://crudapi.cn")
|
| 110 |
+
.contact(new Contact("crudapi", "https://crudapi.cn", "admin@crudapi.cn"))
|
| 111 |
+
.version("1.0.0")
|
| 112 |
+
.build();
|
| 113 |
+
}
|
| 114 |
+
}
|
src/main/java/cn/crudapi/example/config/DataSourceAspect.java
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package cn.crudapi.example.config;
|
| 2 |
+
|
| 3 |
+
import org.aspectj.lang.ProceedingJoinPoint;
|
| 4 |
+
import org.aspectj.lang.annotation.Around;
|
| 5 |
+
import org.aspectj.lang.annotation.Aspect;
|
| 6 |
+
import org.aspectj.lang.annotation.Pointcut;
|
| 7 |
+
import org.slf4j.Logger;
|
| 8 |
+
import org.slf4j.LoggerFactory;
|
| 9 |
+
|
| 10 |
+
import cn.crudapi.core.datasource.config.DataSourceContextHolder;
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
@Aspect
|
| 14 |
+
public class DataSourceAspect {
|
| 15 |
+
private static final Logger log = LoggerFactory.getLogger(DataSourceAspect.class);
|
| 16 |
+
|
| 17 |
+
@Pointcut("within(cn.crudapi.api.controller..*)")
|
| 18 |
+
public void applicationPackagePointcut() {
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
@Around("applicationPackagePointcut()")
|
| 22 |
+
public Object dataSourceAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
| 23 |
+
String dataSource = DataSourceContextHolder.getHeaderDataSource();
|
| 24 |
+
log.info("DataSourceContextHolder setDataSource = " + dataSource);
|
| 25 |
+
DataSourceContextHolder.setDataSource(dataSource);
|
| 26 |
+
try {
|
| 27 |
+
return joinPoint.proceed();
|
| 28 |
+
} finally {
|
| 29 |
+
log.info("DataSourceContextHolder cleanDataSource");
|
| 30 |
+
DataSourceContextHolder.cleanDataSource();
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
}
|
src/main/java/cn/crudapi/example/config/LoggingAspect.java
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package cn.crudapi.example.config;
|
| 2 |
+
|
| 3 |
+
import java.util.Arrays;
|
| 4 |
+
|
| 5 |
+
import org.aspectj.lang.JoinPoint;
|
| 6 |
+
import org.aspectj.lang.ProceedingJoinPoint;
|
| 7 |
+
import org.aspectj.lang.annotation.AfterThrowing;
|
| 8 |
+
import org.aspectj.lang.annotation.Around;
|
| 9 |
+
import org.aspectj.lang.annotation.Aspect;
|
| 10 |
+
import org.aspectj.lang.annotation.Pointcut;
|
| 11 |
+
import org.slf4j.Logger;
|
| 12 |
+
import org.slf4j.LoggerFactory;
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Aspect for logging execution of service and repository Spring components.
|
| 17 |
+
*
|
| 18 |
+
* By default, it only runs with the "dev" profile.
|
| 19 |
+
*/
|
| 20 |
+
@Aspect
|
| 21 |
+
public class LoggingAspect {
|
| 22 |
+
private static final Logger log = LoggerFactory.getLogger(LoggingAspect.class);
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Pointcut that matches all repositories, services and Web REST endpoints.
|
| 26 |
+
*/
|
| 27 |
+
@Pointcut("within(@org.springframework.stereotype.Repository *)"
|
| 28 |
+
+ " || within(@org.springframework.stereotype.Service *)"
|
| 29 |
+
+ " || within(@org.springframework.web.bind.annotation.RestController *)")
|
| 30 |
+
public void springBeanPointcut() {
|
| 31 |
+
// Method is empty as this is just a Pointcut, the implementations are in the
|
| 32 |
+
// advices.
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Pointcut that matches all Spring beans in the application's main packages.
|
| 37 |
+
*/
|
| 38 |
+
@Pointcut("within(cn.crudapi.core.repository..*)"
|
| 39 |
+
+ " || within(cn.crudapi.core.service..*)"
|
| 40 |
+
+ " || within(cn.crudapi.api.controller..*)")
|
| 41 |
+
public void applicationPackagePointcut() {
|
| 42 |
+
// Method is empty as this is just a Pointcut, the implementations are in the
|
| 43 |
+
// advices.
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Advice that logs methods throwing exceptions.
|
| 48 |
+
*
|
| 49 |
+
* @param joinPoint
|
| 50 |
+
* join point for advice
|
| 51 |
+
* @param e
|
| 52 |
+
* exception
|
| 53 |
+
*/
|
| 54 |
+
@AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e")
|
| 55 |
+
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
| 56 |
+
log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'",
|
| 57 |
+
joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(),
|
| 58 |
+
e.getCause() != null ? e.getCause() : "NULL", e.getMessage(), e);
|
| 59 |
+
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Advice that logs when a method is entered and exited.
|
| 64 |
+
*
|
| 65 |
+
* @param joinPoint
|
| 66 |
+
* join point for advice
|
| 67 |
+
* @return result
|
| 68 |
+
* @throws Throwable
|
| 69 |
+
* throws IllegalArgumentException
|
| 70 |
+
*/
|
| 71 |
+
@Around("applicationPackagePointcut() && springBeanPointcut()")
|
| 72 |
+
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
| 73 |
+
if (log.isDebugEnabled()) {
|
| 74 |
+
log.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(),
|
| 75 |
+
joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs()));
|
| 76 |
+
}
|
| 77 |
+
try {
|
| 78 |
+
Object result = joinPoint.proceed();
|
| 79 |
+
if (log.isDebugEnabled()) {
|
| 80 |
+
log.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(),
|
| 81 |
+
joinPoint.getSignature().getName(), result);
|
| 82 |
+
}
|
| 83 |
+
return result;
|
| 84 |
+
} catch (IllegalArgumentException e) {
|
| 85 |
+
log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()),
|
| 86 |
+
joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
|
| 87 |
+
|
| 88 |
+
throw e;
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
}
|
src/main/java/cn/crudapi/example/config/LoggingAspectConfiguration.java
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package cn.crudapi.example.config;
|
| 2 |
+
|
| 3 |
+
import org.springframework.context.annotation.Bean;
|
| 4 |
+
import org.springframework.context.annotation.Configuration;
|
| 5 |
+
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
| 6 |
+
|
| 7 |
+
@Configuration
|
| 8 |
+
@EnableAspectJAutoProxy
|
| 9 |
+
public class LoggingAspectConfiguration {
|
| 10 |
+
@Bean
|
| 11 |
+
public LoggingAspect loggingAspect() {
|
| 12 |
+
return new LoggingAspect();
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
@Bean
|
| 16 |
+
public DataSourceAspect dataSourceAspect() {
|
| 17 |
+
return new DataSourceAspect();
|
| 18 |
+
}
|
| 19 |
+
}
|
src/main/java/cn/crudapi/example/config/WebConfig.java
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package cn.crudapi.example.config;
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
import org.apache.commons.lang3.StringUtils;
|
| 5 |
+
import org.slf4j.Logger;
|
| 6 |
+
import org.slf4j.LoggerFactory;
|
| 7 |
+
import org.springframework.beans.factory.annotation.Value;
|
| 8 |
+
import org.springframework.boot.web.server.ConfigurableWebServerFactory;
|
| 9 |
+
import org.springframework.boot.web.server.ErrorPage;
|
| 10 |
+
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
| 11 |
+
import org.springframework.context.annotation.Bean;
|
| 12 |
+
import org.springframework.context.annotation.Configuration;
|
| 13 |
+
import org.springframework.http.HttpStatus;
|
| 14 |
+
|
| 15 |
+
@Configuration
|
| 16 |
+
public class WebConfig {
|
| 17 |
+
private static final Logger log = LoggerFactory.getLogger(WebConfig.class);
|
| 18 |
+
|
| 19 |
+
@Value("${crudapi.publicPath}")
|
| 20 |
+
private String publicPath;
|
| 21 |
+
|
| 22 |
+
@Bean
|
| 23 |
+
public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer(){
|
| 24 |
+
log.info("webServerFactoryCustomizer");
|
| 25 |
+
|
| 26 |
+
if (StringUtils.isEmpty(publicPath)) {
|
| 27 |
+
publicPath = "crudapi";
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
String crudapiHomePage = "/" + publicPath + "/index.html";
|
| 31 |
+
|
| 32 |
+
log.info("crudapiHomePage {}", crudapiHomePage);
|
| 33 |
+
|
| 34 |
+
return factory -> {
|
| 35 |
+
ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, crudapiHomePage);
|
| 36 |
+
factory.addErrorPages(error404Page);
|
| 37 |
+
};
|
| 38 |
+
}
|
| 39 |
+
}
|
src/main/resources/application-windows.properties
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#basic
|
| 2 |
+
server.port=8888
|
| 3 |
+
spring.mvc.view.suffix=.html
|
| 4 |
+
spring.mvc.static-path-pattern=/**
|
| 5 |
+
spring.resources.static-locations=classpath:/templates/,classpath:/static/,file:${oss.file.path}
|
| 6 |
+
spring.mvc.throw-exception-if-no-handler-found=true
|
| 7 |
+
spring.resources.add-mappings=true
|
| 8 |
+
|
| 9 |
+
#jackson
|
| 10 |
+
spring.jackson.time-zone=Asia/Shanghai
|
| 11 |
+
spring.jackson.serialization.write-dates-as-timestamps=true
|
| 12 |
+
|
| 13 |
+
#log
|
| 14 |
+
#logging.level.root=trace
|
| 15 |
+
#logging.level.org.springframework.jdbc=trace
|
| 16 |
+
logging.file.path=D:\\work\\crudapi\\log
|
| 17 |
+
logging.level.cn.crudapi.service.aop.LoggingAspect=info
|
| 18 |
+
logging.file.max-history=10
|
| 19 |
+
logging.file.max-size=10MB
|
| 20 |
+
|
| 21 |
+
#session
|
| 22 |
+
spring.session.store-type=JDBC
|
| 23 |
+
spring.session.jdbc.cleanup-cron=0 * * * * *
|
| 24 |
+
spring.session.timeout=3600
|
| 25 |
+
server.servlet.session.timeout=3600
|
| 26 |
+
|
| 27 |
+
#user:superadmin/1234567890
|
| 28 |
+
spring.security.user.name=superadmin
|
| 29 |
+
spring.security.user.password=$2a$10$R9HWotqpXzmLOU0aYlFkquxcs0jq7f1raKHHnsbfT51gM9TF.2q7q
|
| 30 |
+
spring.security.user.roles=SUPER_ADMIN
|
| 31 |
+
|
| 32 |
+
#compression
|
| 33 |
+
server.compression.enabled=true
|
| 34 |
+
server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
|
| 35 |
+
server.compression.min-response-size=1024
|
| 36 |
+
server.http2.enabled=true
|
| 37 |
+
|
| 38 |
+
#file
|
| 39 |
+
spring.servlet.multipart.max-file-size=2048MB
|
| 40 |
+
spring.servlet.multipart.max-request-size=2048MB
|
| 41 |
+
oss.file.path=D:\\work\\crudapi\\oss
|
| 42 |
+
oss.upload.domain=http://localhost:8888
|
| 43 |
+
oss.upload.path=download
|
| 44 |
+
|
| 45 |
+
#job
|
| 46 |
+
job.file.cron=0 0 2 * * ?
|
| 47 |
+
job.weixin.cron=*/59 * * * * ?
|
| 48 |
+
|
| 49 |
+
crudapi.publicPath=crudapi
|
| 50 |
+
|
| 51 |
+
#ignoredUrls
|
| 52 |
+
secure.ignored.urls[0]=/api/captcha/sms
|
| 53 |
+
secure.ignored.urls[1]=/index.html
|
| 54 |
+
secure.ignored.urls[2]=/index.html/**
|
| 55 |
+
secure.ignored.urls[3]=/
|
| 56 |
+
secure.ignored.urls[4]=/api/business/config
|
| 57 |
+
secure.ignored.urls[5]=/**/mapapi
|
| 58 |
+
secure.ignored.urls[6]=/**/mapapi/
|
| 59 |
+
secure.ignored.urls[7]=/**/mapapi/**
|
| 60 |
+
|
| 61 |
+
#primary
|
| 62 |
+
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
| 63 |
+
spring.datasource.url=jdbc:mysql://localhost:3306/crudapi?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
| 64 |
+
spring.datasource.username=root
|
| 65 |
+
spring.datasource.password=root
|
| 66 |
+
|
| 67 |
+
##postgresql
|
| 68 |
+
#spring.datasource.hikari.data-sources[0].postgresql.driverClassName=org.postgresql.Driver
|
| 69 |
+
#spring.datasource.hikari.data-sources[0].postgresql.url=jdbc:postgresql://localhost:5432/crudapi
|
| 70 |
+
#spring.datasource.hikari.data-sources[0].postgresql.username=postgres
|
| 71 |
+
#spring.datasource.hikari.data-sources[0].postgresql.password=postgres
|
| 72 |
+
|
| 73 |
+
##sqlserver
|
| 74 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
| 75 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.url=jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=crudapi
|
| 76 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.username=sa
|
| 77 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.password=Mssql1433
|
| 78 |
+
|
| 79 |
+
###oracle
|
| 80 |
+
#spring.datasource.hikari.data-sources[2].oracle.url=jdbc:oracle:thin:@//localhost:1521/XEPDB1
|
| 81 |
+
#spring.datasource.hikari.data-sources[2].oracle.driverClassName=oracle.jdbc.OracleDriver
|
| 82 |
+
#spring.datasource.hikari.data-sources[2].oracle.username=crudapi
|
| 83 |
+
#spring.datasource.hikari.data-sources[2].oracle.password=crudapi
|
| 84 |
+
#spring.datasource.hikari.data-sources[2].oracle.initialization-mode=always
|
| 85 |
+
#spring.datasource.hikari.data-sources[2].oracle.schema=classpath:schema.sql
|
| 86 |
+
|
| 87 |
+
###mysql2
|
| 88 |
+
#spring.datasource.hikari.data-sources[3].mysql.driverClassName=com.mysql.cj.jdbc.Driver
|
| 89 |
+
#spring.datasource.hikari.data-sources[3].mysql.url=jdbc:mysql://localhost:3306/crudapi2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
| 90 |
+
#spring.datasource.hikari.data-sources[3].mysql.username=root
|
| 91 |
+
#spring.datasource.hikari.data-sources[3].mysql.password=root
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
#primary flyway
|
| 95 |
+
spring.flyway.enabled=true
|
| 96 |
+
spring.flyway.encoding=UTF-8
|
| 97 |
+
spring.flyway.clean-disabled=true
|
| 98 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mysql
|
| 99 |
+
#spring.flyway.locations=classpath:cn/crudapi/core/db/migration/postsql
|
| 100 |
+
#spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mssql
|
| 101 |
+
#spring.flyway.locations=classpath:cn/crudapi/core/db/migration/oracle
|
| 102 |
+
spring.flyway.table=crudapi_flyway_schema_history
|
| 103 |
+
spring.flyway.sql-migration-prefix=V
|
| 104 |
+
spring.flyway.sql-migration-separator=__
|
| 105 |
+
spring.flyway.sql-migration-suffixes=.sql
|
| 106 |
+
spring.flyway.validate-on-migrate=true
|
| 107 |
+
spring.flyway.baseline-on-migrate=true
|
| 108 |
+
spring.flyway.baseline-version=1.0.0
|
| 109 |
+
|
src/main/resources/application.properties
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#basic
|
| 2 |
+
server.port=8888
|
| 3 |
+
spring.mvc.view.suffix=.html
|
| 4 |
+
spring.mvc.static-path-pattern=/**
|
| 5 |
+
spring.resources.static-locations=classpath:/templates/,classpath:/static/,file:${oss.file.path}
|
| 6 |
+
spring.mvc.throw-exception-if-no-handler-found=true
|
| 7 |
+
spring.resources.add-mappings=true
|
| 8 |
+
|
| 9 |
+
#jackson
|
| 10 |
+
spring.jackson.time-zone=Asia/Shanghai
|
| 11 |
+
spring.jackson.serialization.write-dates-as-timestamps=true
|
| 12 |
+
|
| 13 |
+
#log
|
| 14 |
+
#logging.level.root=trace
|
| 15 |
+
#logging.level.org.springframework.jdbc=trace
|
| 16 |
+
logging.file.path=/var/log/cn/crudapi/example
|
| 17 |
+
logging.level.cn.crudapi.service.aop.LoggingAspect=info
|
| 18 |
+
logging.file.max-history=10
|
| 19 |
+
logging.file.max-size=10MB
|
| 20 |
+
|
| 21 |
+
#session
|
| 22 |
+
spring.session.store-type=JDBC
|
| 23 |
+
spring.session.jdbc.cleanup-cron=0 * * * * *
|
| 24 |
+
spring.session.timeout=3600
|
| 25 |
+
server.servlet.session.timeout=3600
|
| 26 |
+
|
| 27 |
+
#user:superadmin/1234567890
|
| 28 |
+
spring.security.user.name=superadmin
|
| 29 |
+
spring.security.user.password=$2a$10$R9HWotqpXzmLOU0aYlFkquxcs0jq7f1raKHHnsbfT51gM9TF.2q7q
|
| 30 |
+
spring.security.user.roles=SUPER_ADMIN
|
| 31 |
+
|
| 32 |
+
#compression
|
| 33 |
+
server.compression.enabled=true
|
| 34 |
+
server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
|
| 35 |
+
server.compression.min-response-size=1024
|
| 36 |
+
server.http2.enabled=true
|
| 37 |
+
|
| 38 |
+
#file
|
| 39 |
+
spring.servlet.multipart.max-file-size=2048MB
|
| 40 |
+
spring.servlet.multipart.max-request-size=2048MB
|
| 41 |
+
oss.file.path=/Users/crudapi/opt
|
| 42 |
+
oss.upload.domain=http://localhost:8888
|
| 43 |
+
oss.upload.path=download
|
| 44 |
+
|
| 45 |
+
#job
|
| 46 |
+
job.file.cron=0 0 2 * * ?
|
| 47 |
+
job.weixin.cron=*/59 * * * * ?
|
| 48 |
+
|
| 49 |
+
crudapi.publicPath=crudapi
|
| 50 |
+
|
| 51 |
+
#ignoredUrls
|
| 52 |
+
secure.ignored.urls[0]=/api/captcha/sms
|
| 53 |
+
secure.ignored.urls[1]=/index.html
|
| 54 |
+
secure.ignored.urls[2]=/index.html/**
|
| 55 |
+
secure.ignored.urls[3]=/
|
| 56 |
+
secure.ignored.urls[4]=/api/business/config
|
| 57 |
+
secure.ignored.urls[5]=/**/mapapi
|
| 58 |
+
secure.ignored.urls[6]=/**/mapapi/
|
| 59 |
+
secure.ignored.urls[7]=/**/mapapi/**
|
| 60 |
+
|
| 61 |
+
#primary
|
| 62 |
+
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
| 63 |
+
spring.datasource.url=jdbc:mysql://localhost:3306/crudapi?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
| 64 |
+
spring.datasource.username=root
|
| 65 |
+
spring.datasource.password=root
|
| 66 |
+
|
| 67 |
+
##postgresql
|
| 68 |
+
#spring.datasource.hikari.data-sources[0].postgresql.driverClassName=org.postgresql.Driver
|
| 69 |
+
#spring.datasource.hikari.data-sources[0].postgresql.url=jdbc:postgresql://localhost:5432/crudapi
|
| 70 |
+
#spring.datasource.hikari.data-sources[0].postgresql.username=postgres
|
| 71 |
+
#spring.datasource.hikari.data-sources[0].postgresql.password=postgres
|
| 72 |
+
|
| 73 |
+
##sqlserver
|
| 74 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
| 75 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.url=jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=crudapi
|
| 76 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.username=sa
|
| 77 |
+
#spring.datasource.hikari.data-sources[1].sqlserver.password=Mssql1433
|
| 78 |
+
|
| 79 |
+
###oracle
|
| 80 |
+
#spring.datasource.hikari.data-sources[2].oracle.url=jdbc:oracle:thin:@//localhost:1521/XEPDB1
|
| 81 |
+
#spring.datasource.hikari.data-sources[2].oracle.driverClassName=oracle.jdbc.OracleDriver
|
| 82 |
+
#spring.datasource.hikari.data-sources[2].oracle.username=crudapi
|
| 83 |
+
#spring.datasource.hikari.data-sources[2].oracle.password=crudapi
|
| 84 |
+
#spring.datasource.hikari.data-sources[2].oracle.initialization-mode=always
|
| 85 |
+
#spring.datasource.hikari.data-sources[2].oracle.schema=classpath:schema.sql
|
| 86 |
+
|
| 87 |
+
###mysql2
|
| 88 |
+
#spring.datasource.hikari.data-sources[3].mysql.driverClassName=com.mysql.cj.jdbc.Driver
|
| 89 |
+
#spring.datasource.hikari.data-sources[3].mysql.url=jdbc:mysql://localhost:3306/crudapi2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
| 90 |
+
#spring.datasource.hikari.data-sources[3].mysql.username=root
|
| 91 |
+
#spring.datasource.hikari.data-sources[3].mysql.password=root
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
#primary flyway
|
| 95 |
+
spring.flyway.enabled=true
|
| 96 |
+
spring.flyway.encoding=UTF-8
|
| 97 |
+
spring.flyway.clean-disabled=true
|
| 98 |
+
spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mysql
|
| 99 |
+
#spring.flyway.locations=classpath:cn/crudapi/core/db/migration/postsql
|
| 100 |
+
#spring.flyway.locations=classpath:cn/crudapi/core/db/migration/mssql
|
| 101 |
+
#spring.flyway.locations=classpath:cn/crudapi/core/db/migration/oracle
|
| 102 |
+
spring.flyway.table=crudapi_flyway_schema_history
|
| 103 |
+
spring.flyway.sql-migration-prefix=V
|
| 104 |
+
spring.flyway.sql-migration-separator=__
|
| 105 |
+
spring.flyway.sql-migration-suffixes=.sql
|
| 106 |
+
spring.flyway.validate-on-migrate=true
|
| 107 |
+
spring.flyway.baseline-on-migrate=true
|
| 108 |
+
spring.flyway.baseline-version=1.0.0
|
| 109 |
+
|
src/main/resources/schema.sql
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ALTER SESSION SET CURRENT_SCHEMA=crudapi
|
src/main/resources/static/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="zh-CN">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<title>crudapi</title>
|
| 6 |
+
</head>
|
| 7 |
+
<body>
|
| 8 |
+
<script>
|
| 9 |
+
window.location.href = '/crudapi/'
|
| 10 |
+
</script>
|
| 11 |
+
</body>
|
| 12 |
+
</html>
|