项目初始化

This commit is contained in:
wangyan 2022-04-25 15:37:43 +08:00
commit d9897564e5
476 changed files with 88563 additions and 0 deletions

33
.gitignore vendored Normal file
View File

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

118
.mvn/wrapper/MavenWrapperDownloader.java vendored Normal file
View File

@ -0,0 +1,118 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

BIN
.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

2
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

25
README.md Normal file
View File

@ -0,0 +1,25 @@
# 吉林省农业资源薪资平台
# 创建项目必须要做的事
1. 基于`jeecg_base_2.4_java`项目的后台开发版。所有新项目以此为基准检出
2. 基于此git创建项目后更改`pom.xml`中的`artifactId`和`description`
# 常见问题
### 启动类
`com.nd.QnModuleApplication`
### 权限
将`org.jeecg.config.shiro.ShiroConfig.java.bak`去除后缀`.bak`
注意,如果`jeecg_base_2.4_java`中的`org.jeecg.config.shiro.ShiroConfig.java`与本项目的不一致,将会导致`jeecg_base_2.4_java`中的更改丢失

3
build.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
call mvn clean package
pause

9
db/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM mysql:8.0.19
MAINTAINER jeecgos@163.com
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY ./jeecgboot-mysql-5.7.sql /docker-entrypoint-initdb.d

4241
db/nyzy_jeecg_db.sql Normal file

File diff suppressed because one or more lines are too long

310
mvnw vendored Normal file
View File

@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

182
mvnw.cmd vendored Normal file
View File

@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

261
pom.xml Normal file
View File

@ -0,0 +1,261 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nyzy</groupId>
<artifactId>nyzy</artifactId>
<version>0.0.1</version>
<name>nyzy</name>
<description>吉林省农业资源薪资平台</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.5.RELEASE</version>
<relativePath/>
</parent>
<properties>
<jeecgboot.version>2.4.0</jeecgboot.version>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-cloud.version>Hoxton.SR8</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.3.RELEASE</spring-cloud-alibaba.version>
<xxl-job-core.version>2.2.0</xxl-job-core.version>
<fastjson.version>1.2.75</fastjson.version>
<knife4j-spring-boot-starter.version>2.0.4</knife4j-spring-boot-starter.version>
<knife4j-spring-ui.version>2.0.4</knife4j-spring-ui.version>
<postgresql.version>42.2.6</postgresql.version>
<ojdbc6.version>11.2.0.3</ojdbc6.version>
<sqljdbc4.version>4.0</sqljdbc4.version>
<mysql-connector-java.version>8.0.21</mysql-connector-java.version>
<dynamic-datasource-spring-boot-starter.version>3.2.0</dynamic-datasource-spring-boot-starter.version>
<hutool-all.version>5.3.8</hutool-all.version>
<redisson.version>3.13.6</redisson.version>
<commons-beanutils.version>1.9.4</commons-beanutils.version>
<guava.version>29.0-jre</guava.version>
<mybatis-plus.version>3.4.1</mybatis-plus.version>
<druid.version>1.1.22</druid.version>
<commons.version>2.6</commons.version>
<aliyun-java-sdk-dysmsapi.version>1.0.0</aliyun-java-sdk-dysmsapi.version>
<aliyun.oss.version>3.6.0</aliyun.oss.version>
<shiro.version>1.7.0</shiro.version>
<java-jwt.version>3.11.0</java-jwt.version>
<shiro-redis.version>3.1.0</shiro-redis.version>
<codegenerate.version>1.2.5</codegenerate.version>
<autopoi-web.version>1.2.2</autopoi-web.version>
<minio.version>4.0.0</minio.version>
<justauth-spring-boot-starter.version>1.3.2</justauth-spring-boot-starter.version>
<dom4j.version>1.6.1</dom4j.version>
<qiniu-java-sdk.version>7.2.23</qiniu-java-sdk.version>
<pinyin4j.version>2.5.1</pinyin4j.version>
<com.jimureport.version>1.1.01</com.jimureport.version>
</properties>
<distributionManagement>
<repository>
<id>local</id>
<name>jeecg Repository</name>
<url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url>
</repository>
<snapshotRepository>
<id>jeecg</id>
<name>161 Snapshot Repository</name>
<url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>aliyun</id>
<name>aliyun Repository</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jeecg</id>
<name>jeecg Repository</name>
<url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- json -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.8</version>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
<!-- 基础system-api 模块-->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-local-api</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<!-- system 模块-->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-module-system</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- 指定JDK编译版本-->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
-->
<!-- 打包跳过测试 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- 避免font文件的二进制文件格式压缩破坏 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.ttc</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.ttc</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.json</include>
<include>**/*.ftl</include>
<include>**/*.ttc</include>
</includes>
</resource>
</resources>
</build>
<!-- 环境 -->
<profiles>
<!-- 开发 -->
<profile>
<id>dev</id>
<activation>
<!--默认激活配置-->
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!--当前环境-->
<profile.name>dev</profile.name>
<!--配置文件前缀-->
<prefix.name>jeecg</prefix.name>
<!--Nacos配置中心地址-->
<config.server-addr>127.0.0.1:8848</config.server-addr>
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID不能使用名称,默认为空-->
<config.namespace/>
<!--Nacos配置分组名称-->
<config.group>DEFAULT_GROUP</config.group>
<!--Nacos服务发现地址-->
<discovery.server-addr>127.0.0.1:8848</discovery.server-addr>
</properties>
</profile>
<!-- 测试 -->
<profile>
<id>test</id>
<properties>
<!--当前环境-->
<profile.name>test</profile.name>
<!--配置文件前缀-->
<prefix.name>jeecg</prefix.name>
<!--Nacos配置中心地址-->
<config.server-addr>127.0.0.1:8848</config.server-addr>
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID不能使用名称,默认为空-->
<config.namespace/>
<!--Nacos配置分组名称-->
<config.group>DEFAULT_GROUP</config.group>
<!--Nacos服务发现地址-->
<discovery.server-addr>127.0.0.1:8848</discovery.server-addr>
</properties>
</profile>
<!-- 生产 -->
<profile>
<id>prod</id>
<properties>
<!--当前环境,生产环境为空-->
<profile.name>prod</profile.name>
<!--配置文件前缀-->
<prefix.name>jeecg</prefix.name>
<!--Nacos配置中心地址-->
<config.server-addr>127.0.0.1:8848</config.server-addr>
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID不能使用名称,默认为空-->
<config.namespace/>
<!--Nacos配置分组名称-->
<config.group>DEFAULT_GROUP</config.group>
<!--Nacos服务发现地址-->
<discovery.server-addr>127.0.0.1:8848</discovery.server-addr>
</properties>
</profile>
</profiles>
</project>

3
rebuild.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
call mvn clean package
pause

7
run.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off & title "编译中。请稍等" & color 17
call mvn clean package
title "编译完成,正在启动。。。" & color B0
rem java -jar jenkins.war httpPort=9999
for /f "delims=" %%i in ('dir target\*.jar /b ') do @set jarPath=%%i
java -jar -Xms1024m -Xmx1536m -XX:PermSize=128M -XX:MaxPermSize=256M -Dspring.profiles.active=dev ./target/%jarPath%
pause

9
runWar.bat Normal file
View File

@ -0,0 +1,9 @@
@echo off & title "编译中。请稍等" & color 17
run 打包前.bat
call mvn clean package
run 打包后.bat
title "编译完成,正在启动。。。" & color B0
rem java -jar jenkins.war httpPort=9999
for /f "delims=" %%i in ('dir target\*.war /b ') do @set jarPath=%%i
java -jar -Xms1024m -Xmx1536m -XX:PermSize=128M -XX:MaxPermSize=256M -Dspring.profiles.active=dev ./target/%jarPath% httpPort=8080
pause

View File

@ -0,0 +1,47 @@
package com.nd;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import lombok.extern.slf4j.Slf4j;
/**
* 单体启动类采用此类启动项目为单体模式
*/
@Slf4j
@SpringBootApplication
@ComponentScan(basePackages = {"org.jeecg","com.nd"})
//@EnableAutoConfiguration(exclude={org.activiti.spring.boot.SecurityAutoConfiguration.class})
public class ModuleApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ModuleApplication.class);
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(ModuleApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
log.info("\n----------------------------------------------------------\n\t" +
"Application Jeecg-Boot is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
}

View File

@ -0,0 +1,216 @@
package com.nd.gateway.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.nd.gateway.entity.GatewayColumn;
import com.nd.gateway.service.IGatewayColumnService;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.nd.gateway.entity.GatewayArticle;
import com.nd.gateway.service.IGatewayArticleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 门户-文章
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Api(tags="门户-文章")
@RestController
@RequestMapping("/gateway/gatewayArticle")
@Slf4j
public class GatewayArticleController extends JeecgController<GatewayArticle, IGatewayArticleService> {
@Autowired
private IGatewayArticleService gatewayArticleService;
@Autowired
private IGatewayColumnService gatewayColumnService;
/**
* 分页列表查询
*
* @param gatewayArticle
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "门户-文章-分页列表查询")
@ApiOperation(value="门户-文章-分页列表查询", notes="门户-文章-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(GatewayArticle gatewayArticle,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<GatewayArticle> queryWrapper = QueryGenerator.initQueryWrapper(gatewayArticle, req.getParameterMap());
Page<GatewayArticle> page = new Page<GatewayArticle>(pageNo, pageSize);
IPage<GatewayArticle> pageList = gatewayArticleService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param gatewayArticle
* @return
*/
@AutoLog(value = "门户-文章-添加")
@ApiOperation(value="门户-文章-添加", notes="门户-文章-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody GatewayArticle gatewayArticle) {
gatewayArticleService.save(gatewayArticle);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param gatewayArticle
* @return
*/
@AutoLog(value = "门户-文章-编辑")
@ApiOperation(value="门户-文章-编辑", notes="门户-文章-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody GatewayArticle gatewayArticle) {
gatewayArticleService.updateById(gatewayArticle);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "门户-文章-通过id删除")
@ApiOperation(value="门户-文章-通过id删除", notes="门户-文章-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
gatewayArticleService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "门户-文章-批量删除")
@ApiOperation(value="门户-文章-批量删除", notes="门户-文章-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.gatewayArticleService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "门户-文章-通过id查询")
@ApiOperation(value="门户-文章-通过id查询", notes="门户-文章-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
GatewayArticle gatewayArticle = gatewayArticleService.getById(id);
if(gatewayArticle==null) {
return Result.error("未找到对应数据");
}
return Result.OK(gatewayArticle);
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "门户-文章-通过id查询,带栏目")
@ApiOperation(value="门户-文章-通过id查询,带栏目", notes="门户-文章-通过id查询,带栏目")
@GetMapping(value = "/queryArticleById")
public Result<?> queryArticleById(@RequestParam(name="id",required=true) String id) {
GatewayArticle gatewayArticle = gatewayArticleService.getById(id);
if(gatewayArticle != null && StringUtils.isNotBlank(gatewayArticle.getColumnId())){
//如果有栏目ID则反着查询出当前栏目和父级栏目和父级下的全部栏目列表
QueryWrapper<GatewayColumn> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",gatewayArticle.getColumnId());
queryWrapper.eq("is_enable","Y");
queryWrapper.last("limit 1");
gatewayArticle.setCurrentGatewayColumn(gatewayColumnService.getOne(queryWrapper));
if(gatewayArticle.getCurrentGatewayColumn() != null){
queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",gatewayArticle.getCurrentGatewayColumn().getParent());
queryWrapper.eq("is_enable","Y");
queryWrapper.last("limit 1");
gatewayArticle.setParentGatewayColumn(gatewayColumnService.getOne(queryWrapper));
queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent",gatewayArticle.getCurrentGatewayColumn().getParent());
queryWrapper.eq("is_enable","Y");
gatewayArticle.setGatewayColumnList(gatewayColumnService.list(queryWrapper));
}
}
if(gatewayArticle==null) {
return Result.error("未找到对应数据");
}
return Result.OK(gatewayArticle);
}
/**
* 导出excel
*
* @param request
* @param gatewayArticle
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, GatewayArticle gatewayArticle) {
return super.exportXls(request, gatewayArticle, GatewayArticle.class, "门户-文章");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, GatewayArticle.class);
}
}

View File

@ -0,0 +1,192 @@
package com.nd.gateway.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.nd.gateway.entity.GatewayColumn;
import com.nd.gateway.service.IGatewayColumnService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 门户-栏目
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Api(tags="门户-栏目")
@RestController
@RequestMapping("/gateway/gatewayColumn")
@Slf4j
public class GatewayColumnController extends JeecgController<GatewayColumn, IGatewayColumnService> {
@Autowired
private IGatewayColumnService gatewayColumnService;
/**
* 分页列表查询
*
* @param gatewayColumn
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "门户-栏目-分页列表查询")
@ApiOperation(value="门户-栏目-分页列表查询", notes="门户-栏目-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(GatewayColumn gatewayColumn,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<GatewayColumn> queryWrapper = QueryGenerator.initQueryWrapper(gatewayColumn, req.getParameterMap());
//有id没有pid查询pid等于次ID的和id等于次ID的
// queryWrapper.and(StringUtils.isNotBlank(gatewayColumn.getFid())&&StringUtils.isBlank(gatewayColumn.getFpid()),x->
// x.eq("parent",gatewayColumn.getFid())
// .or()
// .eq("id",gatewayColumn.getFid())
// );
//没有id有pid查询pid等于次ID的和id等于次ID的
queryWrapper.and(StringUtils.isBlank(gatewayColumn.getFid())&&StringUtils.isNotBlank(gatewayColumn.getFpid()),x->
x.eq("parent",gatewayColumn.getFpid())
.or()
.eq("id",gatewayColumn.getFpid())
);
// queryWrapper.and(StringUtils.isNotBlank(gatewayColumn.getFid())&&StringUtils.isNotBlank(gatewayColumn.getFpid()), x->
// x.eq("parent",gatewayColumn.getFpid())
// .or()
// .eq("id",gatewayColumn.getFid())
// );
Page<GatewayColumn> page = new Page<GatewayColumn>(pageNo, pageSize);
IPage<GatewayColumn> pageList = gatewayColumnService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param gatewayColumn
* @return
*/
@AutoLog(value = "门户-栏目-添加")
@ApiOperation(value="门户-栏目-添加", notes="门户-栏目-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody GatewayColumn gatewayColumn) {
gatewayColumnService.save(gatewayColumn);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param gatewayColumn
* @return
*/
@AutoLog(value = "门户-栏目-编辑")
@ApiOperation(value="门户-栏目-编辑", notes="门户-栏目-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody GatewayColumn gatewayColumn) {
gatewayColumnService.updateById(gatewayColumn);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "门户-栏目-通过id删除")
@ApiOperation(value="门户-栏目-通过id删除", notes="门户-栏目-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
gatewayColumnService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "门户-栏目-批量删除")
@ApiOperation(value="门户-栏目-批量删除", notes="门户-栏目-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.gatewayColumnService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "门户-栏目-通过id查询")
@ApiOperation(value="门户-栏目-通过id查询", notes="门户-栏目-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
GatewayColumn gatewayColumn = gatewayColumnService.getById(id);
if(gatewayColumn==null) {
return Result.error("未找到对应数据");
}
return Result.OK(gatewayColumn);
}
/**
* 导出excel
*
* @param request
* @param gatewayColumn
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, GatewayColumn gatewayColumn) {
return super.exportXls(request, gatewayColumn, GatewayColumn.class, "门户-栏目");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, GatewayColumn.class);
}
}

View File

@ -0,0 +1,171 @@
package com.nd.gateway.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.nd.gateway.entity.GatewayLinks;
import com.nd.gateway.service.IGatewayLinksService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 门户-友情链接快速导航
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Api(tags="门户-友情链接,快速导航")
@RestController
@RequestMapping("/gateway/gatewayLinks")
@Slf4j
public class GatewayLinksController extends JeecgController<GatewayLinks, IGatewayLinksService> {
@Autowired
private IGatewayLinksService gatewayLinksService;
/**
* 分页列表查询
*
* @param gatewayLinks
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "门户-友情链接,快速导航-分页列表查询")
@ApiOperation(value="门户-友情链接,快速导航-分页列表查询", notes="门户-友情链接,快速导航-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(GatewayLinks gatewayLinks,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<GatewayLinks> queryWrapper = QueryGenerator.initQueryWrapper(gatewayLinks, req.getParameterMap());
Page<GatewayLinks> page = new Page<GatewayLinks>(pageNo, pageSize);
IPage<GatewayLinks> pageList = gatewayLinksService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param gatewayLinks
* @return
*/
@AutoLog(value = "门户-友情链接,快速导航-添加")
@ApiOperation(value="门户-友情链接,快速导航-添加", notes="门户-友情链接,快速导航-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody GatewayLinks gatewayLinks) {
gatewayLinksService.save(gatewayLinks);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param gatewayLinks
* @return
*/
@AutoLog(value = "门户-友情链接,快速导航-编辑")
@ApiOperation(value="门户-友情链接,快速导航-编辑", notes="门户-友情链接,快速导航-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody GatewayLinks gatewayLinks) {
gatewayLinksService.updateById(gatewayLinks);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "门户-友情链接,快速导航-通过id删除")
@ApiOperation(value="门户-友情链接,快速导航-通过id删除", notes="门户-友情链接,快速导航-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
gatewayLinksService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "门户-友情链接,快速导航-批量删除")
@ApiOperation(value="门户-友情链接,快速导航-批量删除", notes="门户-友情链接,快速导航-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.gatewayLinksService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "门户-友情链接,快速导航-通过id查询")
@ApiOperation(value="门户-友情链接,快速导航-通过id查询", notes="门户-友情链接,快速导航-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
GatewayLinks gatewayLinks = gatewayLinksService.getById(id);
if(gatewayLinks==null) {
return Result.error("未找到对应数据");
}
return Result.OK(gatewayLinks);
}
/**
* 导出excel
*
* @param request
* @param gatewayLinks
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, GatewayLinks gatewayLinks) {
return super.exportXls(request, gatewayLinks, GatewayLinks.class, "门户-友情链接,快速导航");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, GatewayLinks.class);
}
}

View File

@ -0,0 +1,156 @@
package com.nd.gateway.controller;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import com.nd.gateway.entity.I18nConfig;
import com.nd.gateway.service.II18nConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 国际化配置
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
@Api(tags="国际化配置")
@RestController
@RequestMapping("/gateway/i18nConfig")
@Slf4j
public class I18nConfigController extends JeecgController<I18nConfig, II18nConfigService> {
@Autowired
private II18nConfigService i18nConfigService;
/**
* 分页列表查询
*
* @param i18NConfig
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "国际化配置-分页列表查询")
@ApiOperation(value="国际化配置-分页列表查询", notes="国际化配置-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(I18nConfig i18NConfig,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<I18nConfig> queryWrapper = QueryGenerator.initQueryWrapper(i18NConfig, req.getParameterMap());
Page<I18nConfig> page = new Page<I18nConfig>(pageNo, pageSize);
IPage<I18nConfig> pageList = i18nConfigService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param i18NConfig
* @return
*/
@AutoLog(value = "国际化配置-添加")
@ApiOperation(value="国际化配置-添加", notes="国际化配置-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody I18nConfig i18NConfig) {
i18nConfigService.save(i18NConfig);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param i18NConfig
* @return
*/
@AutoLog(value = "国际化配置-编辑")
@ApiOperation(value="国际化配置-编辑", notes="国际化配置-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody I18nConfig i18NConfig) {
i18nConfigService.updateById(i18NConfig);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "国际化配置-通过id删除")
@ApiOperation(value="国际化配置-通过id删除", notes="国际化配置-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
i18nConfigService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "国际化配置-批量删除")
@ApiOperation(value="国际化配置-批量删除", notes="国际化配置-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.i18nConfigService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "国际化配置-通过id查询")
@ApiOperation(value="国际化配置-通过id查询", notes="国际化配置-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
I18nConfig i18NConfig = i18nConfigService.getById(id);
if(i18NConfig ==null) {
return Result.error("未找到对应数据");
}
return Result.OK(i18NConfig);
}
/**
* 导出excel
*
* @param request
* @param i18NConfig
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, I18nConfig i18NConfig) {
return super.exportXls(request, i18NConfig, I18nConfig.class, "国际化配置");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, I18nConfig.class);
}
}

View File

@ -0,0 +1,171 @@
package com.nd.gateway.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.nd.gateway.entity.gatewayCommon;
import com.nd.gateway.service.IgatewayCommonService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 基本信息表
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
@Api(tags="基本信息表")
@RestController
@RequestMapping("/gateway/gatewayCommon")
@Slf4j
public class gatewayCommonController extends JeecgController<gatewayCommon, IgatewayCommonService> {
@Autowired
private IgatewayCommonService gatewayCommonService;
/**
* 分页列表查询
*
* @param gatewayCommon
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "基本信息表-分页列表查询")
@ApiOperation(value="基本信息表-分页列表查询", notes="基本信息表-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(gatewayCommon gatewayCommon,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<gatewayCommon> queryWrapper = QueryGenerator.initQueryWrapper(gatewayCommon, req.getParameterMap());
Page<gatewayCommon> page = new Page<gatewayCommon>(pageNo, pageSize);
IPage<gatewayCommon> pageList = gatewayCommonService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param gatewayCommon
* @return
*/
@AutoLog(value = "基本信息表-添加")
@ApiOperation(value="基本信息表-添加", notes="基本信息表-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody gatewayCommon gatewayCommon) {
gatewayCommonService.save(gatewayCommon);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param gatewayCommon
* @return
*/
@AutoLog(value = "基本信息表-编辑")
@ApiOperation(value="基本信息表-编辑", notes="基本信息表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody gatewayCommon gatewayCommon) {
gatewayCommonService.updateById(gatewayCommon);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "基本信息表-通过id删除")
@ApiOperation(value="基本信息表-通过id删除", notes="基本信息表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
gatewayCommonService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "基本信息表-批量删除")
@ApiOperation(value="基本信息表-批量删除", notes="基本信息表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.gatewayCommonService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "基本信息表-通过id查询")
@ApiOperation(value="基本信息表-通过id查询", notes="基本信息表-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
gatewayCommon gatewayCommon = gatewayCommonService.getById(id);
if(gatewayCommon==null) {
return Result.error("未找到对应数据");
}
return Result.OK(gatewayCommon);
}
/**
* 导出excel
*
* @param request
* @param gatewayCommon
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, gatewayCommon gatewayCommon) {
return super.exportXls(request, gatewayCommon, gatewayCommon.class, "基本信息表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, gatewayCommon.class);
}
}

View File

@ -0,0 +1,152 @@
package com.nd.gateway.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 门户-文章
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Data
@TableName("tqd_gateway_article")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="tqd_gateway_article对象", description="门户-文章")
public class GatewayArticle implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**标题*/
@Excel(name = "标题", width = 15)
@ApiModelProperty(value = "标题")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String title;
/**标题-英文版*/
@Excel(name = "标题-英文版", width = 15)
@ApiModelProperty(value = "标题-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String titleen;
/**文章类型*/
@Excel(name = "文章类型", width = 15)
@ApiModelProperty(value = "文章类型")
@Dict(dicCode = "gateway_article_type")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String type;
/**分类-栏目表ID*/
@Excel(name = "分类-栏目表ID", width = 15)
@ApiModelProperty(value = "分类-栏目表ID")
@Dict(dictTable = "tqd_gateway_column",dicCode = "id",dicText = "name")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String columnId;
/**封面图url*/
@Excel(name = "封面图url", width = 15)
@ApiModelProperty(value = "封面图url")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String cover;
/**封面图url--英文版*/
@Excel(name = "封面图url--英文版", width = 15)
@ApiModelProperty(value = "封面图url--英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String coveren;
/**作者*/
@Excel(name = "作者", width = 15)
@ApiModelProperty(value = "作者")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String author;
/**作者-英文版*/
@Excel(name = "作者-英文版", width = 15)
@ApiModelProperty(value = "作者-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String authoren;
/**来源*/
@Excel(name = "来源", width = 15)
@ApiModelProperty(value = "来源")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String source;
/**来源-英文版*/
@Excel(name = "来源-英文版", width = 15)
@ApiModelProperty(value = "来源-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String sourceen;
/**文章内容*/
@Excel(name = "文章内容", width = 15)
@ApiModelProperty(value = "文章内容")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String content;
/**文章内容-英文版*/
@Excel(name = "文章内容-英文版", width = 15)
@ApiModelProperty(value = "文章内容-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String contenten;
/**附件*/
@Excel(name = "附件", width = 15)
@ApiModelProperty(value = "附件")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String files;
/**附件-英文版*/
@Excel(name = "附件-英文版", width = 15)
@ApiModelProperty(value = "附件-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String filesen;
/**是否发布(Y:是N:否)*/
@Excel(name = "是否发布(Y:是N:否)", width = 15)
@ApiModelProperty(value = "是否发布")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String isRelease;
/**
* 父级栏目对象
*/
@TableField(exist = false)
private GatewayColumn parentGatewayColumn;
/**
* 当前栏目对象
*/
@TableField(exist = false)
private GatewayColumn currentGatewayColumn;
/**
* 当前父级栏目下的所有子栏目
*/
@TableField(exist = false)
private List<GatewayColumn> gatewayColumnList;
}

View File

@ -0,0 +1,99 @@
package com.nd.gateway.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 门户-栏目
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Data
@TableName("tqd_gateway_column")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="tqd_gateway_column对象", description="门户-栏目")
public class GatewayColumn implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String name;
/**名称-英文版*/
@Excel(name = "名称-英文版", width = 15)
@ApiModelProperty(value = "名称-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String nameen;
/**类型*/
@Excel(name = "类型", width = 15, dicCode = "gateway_column_type")
@Dict(dicCode = "gateway_column_type")
@ApiModelProperty(value = "类型")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String type;
/**上级ID 0为顶级*/
@Excel(name = "上级ID 0为顶级", width = 15)
@ApiModelProperty(value = "上级ID 0为顶级")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String parent;
/**是否启用*/
@Excel(name = "是否启用", width = 15)
@ApiModelProperty(value = "是否启用")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String isEnable;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String sort;
/**图标*/
@Excel(name = "图标", width = 15)
@ApiModelProperty(value = "图标")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String icon;
//查询父ID
@TableField(exist = false)
private String fpid;
//查询ID
@TableField(exist = false)
private String fid;
}

View File

@ -0,0 +1,100 @@
package com.nd.gateway.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 门户-友情链接快速导航
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Data
@TableName("tqd_gateway_links")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="tqd_gateway_links对象", description="门户-友情链接,快速导航")
public class GatewayLinks implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String name;
/**类型(显示在哪)*/
@Excel(name = "类型(显示在哪)", width = 15)
@ApiModelProperty(value = "类型(显示在哪)")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String type;
/**链接*/
@Excel(name = "链接", width = 15)
@ApiModelProperty(value = "链接")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String url;
/**链接-英文版*/
@Excel(name = "链接-英文版", width = 15)
@ApiModelProperty(value = "链接-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String urlen;
/**标题*/
@Excel(name = "标题", width = 15)
@ApiModelProperty(value = "标题")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String title;
/**标题-英文版*/
@Excel(name = "标题-英文版", width = 15)
@ApiModelProperty(value = "标题-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String titleen;
/**logo url*/
@Excel(name = "logo url", width = 15)
@ApiModelProperty(value = "logo url")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String logo;
/**logo url-英文版*/
@Excel(name = "logo url-英文版", width = 15)
@ApiModelProperty(value = "logo url-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String logoen;
/**是否启用*/
@Excel(name = "是否启用", width = 15)
@ApiModelProperty(value = "是否启用")
private java.lang.String isEnable;
}

View File

@ -0,0 +1,71 @@
package com.nd.gateway.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 国际化配置
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
@Data
@TableName("tqc_i18n_config")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="tqc_i18n_config对象", description="国际化配置")
public class I18nConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**语言标识*/
@Excel(name = "语言标识", width = 15)
@ApiModelProperty(value = "语言标识")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String identification;
/**显示名称*/
@Excel(name = "显示名称", width = 15)
@ApiModelProperty(value = "显示名称")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String name;
/**国际化JSON*/
@Excel(name = "国际化JSON", width = 15)
@ApiModelProperty(value = "国际化JSON")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String i18nJson;
/**是否启用(Y:是,N:否),同一个标识只能有一个启用的*/
@Excel(name = "是否启用", width = 15)
@ApiModelProperty(value = "是否启用")
private java.lang.String isEnable;
}

View File

@ -0,0 +1,135 @@
package com.nd.gateway.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 基本信息表
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
@Data
@TableName("tqc_gateway_common")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="tqc_gateway_common对象", description="基本信息表")
public class gatewayCommon implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**邮箱*/
@Excel(name = "邮箱", width = 15)
@ApiModelProperty(value = "邮箱")
private java.lang.String mailbox;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**门户头部logo*/
@Excel(name = "门户头部logo", width = 15)
@ApiModelProperty(value = "门户头部logo")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String heardLogoUrl;
/**门户头部logo-英文版*/
@Excel(name = "门户头部logo-英文版", width = 15)
@ApiModelProperty(value = "门户头部logo-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String heardLogoUrlen;
/**门户尾部logo*/
@Excel(name = "门户尾部logo", width = 15)
@ApiModelProperty(value = "门户尾部logo")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String footerLogoUrl;
/**门户尾部logo-英文版*/
@Excel(name = "门户尾部logo-英文版", width = 15)
@ApiModelProperty(value = "门户尾部logo-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String footerLogoUrlen;
/**版权所有*/
@Excel(name = "版权所有", width = 15)
@ApiModelProperty(value = "版权所有")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String copyright;
/**版权所有-英文版*/
@Excel(name = "版权所有-英文版", width = 15)
@ApiModelProperty(value = "版权所有-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String copyrighten;
/**邮箱-英文版*/
@Excel(name = "邮箱-英文版", width = 15)
@ApiModelProperty(value = "邮箱-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String mailboxen;
/**地址*/
@Excel(name = "地址", width = 15)
@ApiModelProperty(value = "地址")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String address;
/**地址-英文版*/
@Excel(name = "地址-英文版", width = 15)
@ApiModelProperty(value = "地址-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String addressen;
/**备案号*/
@Excel(name = "备案号", width = 15)
@ApiModelProperty(value = "备案号")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String recordNumber;
/**备案号-英文版*/
@Excel(name = "备案号-英文版", width = 15)
@ApiModelProperty(value = "备案号-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String recordNumberen;
/**官方微信*/
@Excel(name = "官方微信", width = 15)
@ApiModelProperty(value = "官方微信")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String wechatUrl;
/**官方微信-英文版*/
@Excel(name = "官方微信-英文版", width = 15)
@ApiModelProperty(value = "官方微信-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String wechatUrlen;
/**学校主页地址*/
@Excel(name = "学校主页地址", width = 15)
@ApiModelProperty(value = "学校主页地址")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String homepageUrl;
/**学校主页地址-英文版*/
@Excel(name = "学校主页地址-英文版", width = 15)
@ApiModelProperty(value = "学校主页地址-英文版")
@TableField(updateStrategy= FieldStrategy.IGNORED)
private java.lang.String homepageUrlen;
}

View File

@ -0,0 +1,17 @@
package com.nd.gateway.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nd.gateway.entity.GatewayArticle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 门户-文章
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
public interface GatewayArticleMapper extends BaseMapper<GatewayArticle> {
}

View File

@ -0,0 +1,17 @@
package com.nd.gateway.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nd.gateway.entity.GatewayColumn;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 门户-栏目
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
public interface GatewayColumnMapper extends BaseMapper<GatewayColumn> {
}

View File

@ -0,0 +1,17 @@
package com.nd.gateway.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nd.gateway.entity.GatewayLinks;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 门户-友情链接快速导航
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
public interface GatewayLinksMapper extends BaseMapper<GatewayLinks> {
}

View File

@ -0,0 +1,14 @@
package com.nd.gateway.mapper;
import com.nd.gateway.entity.I18nConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 国际化配置
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
public interface I18nConfigMapper extends BaseMapper<I18nConfig> {
}

View File

@ -0,0 +1,17 @@
package com.nd.gateway.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nd.gateway.entity.gatewayCommon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 基本信息表
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
public interface gatewayCommonMapper extends BaseMapper<gatewayCommon> {
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,14 @@
package com.nd.gateway.service;
import com.nd.gateway.entity.GatewayArticle;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 门户-文章
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
public interface IGatewayArticleService extends IService<GatewayArticle> {
}

View File

@ -0,0 +1,14 @@
package com.nd.gateway.service;
import com.nd.gateway.entity.GatewayColumn;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 门户-栏目
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
public interface IGatewayColumnService extends IService<GatewayColumn> {
}

View File

@ -0,0 +1,14 @@
package com.nd.gateway.service;
import com.nd.gateway.entity.GatewayLinks;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 门户-友情链接快速导航
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
public interface IGatewayLinksService extends IService<GatewayLinks> {
}

View File

@ -0,0 +1,14 @@
package com.nd.gateway.service;
import com.nd.gateway.entity.I18nConfig;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 国际化配置
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
public interface II18nConfigService extends IService<I18nConfig> {
}

View File

@ -0,0 +1,14 @@
package com.nd.gateway.service;
import com.nd.gateway.entity.gatewayCommon;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 基本信息表
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
public interface IgatewayCommonService extends IService<gatewayCommon> {
}

View File

@ -0,0 +1,19 @@
package com.nd.gateway.service.impl;
import com.nd.gateway.entity.GatewayArticle;
import com.nd.gateway.mapper.GatewayArticleMapper;
import com.nd.gateway.service.IGatewayArticleService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 门户-文章
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Service
public class GatewayArticleServiceImpl extends ServiceImpl<GatewayArticleMapper, GatewayArticle> implements IGatewayArticleService {
}

View File

@ -0,0 +1,19 @@
package com.nd.gateway.service.impl;
import com.nd.gateway.entity.GatewayColumn;
import com.nd.gateway.mapper.GatewayColumnMapper;
import com.nd.gateway.service.IGatewayColumnService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 门户-栏目
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Service
public class GatewayColumnServiceImpl extends ServiceImpl<GatewayColumnMapper, GatewayColumn> implements IGatewayColumnService {
}

View File

@ -0,0 +1,19 @@
package com.nd.gateway.service.impl;
import com.nd.gateway.entity.GatewayLinks;
import com.nd.gateway.mapper.GatewayLinksMapper;
import com.nd.gateway.service.IGatewayLinksService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 门户-友情链接快速导航
* @Author: jeecg-boot
* @Date: 2022-03-26
* @Version: V1.0
*/
@Service
public class GatewayLinksServiceImpl extends ServiceImpl<GatewayLinksMapper, GatewayLinks> implements IGatewayLinksService {
}

View File

@ -0,0 +1,19 @@
package com.nd.gateway.service.impl;
import com.nd.gateway.entity.I18nConfig;
import com.nd.gateway.mapper.I18nConfigMapper;
import com.nd.gateway.service.II18nConfigService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 国际化配置
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
@Service
public class I18NConfigServiceImpl extends ServiceImpl<I18nConfigMapper, I18nConfig> implements II18nConfigService {
}

View File

@ -0,0 +1,19 @@
package com.nd.gateway.service.impl;
import com.nd.gateway.entity.gatewayCommon;
import com.nd.gateway.mapper.gatewayCommonMapper;
import com.nd.gateway.service.IgatewayCommonService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 基本信息表
* @Author: jeecg-boot
* @Date: 2022-03-24
* @Version: V1.0
*/
@Service
public class gatewayCommonServiceImpl extends ServiceImpl<gatewayCommonMapper, gatewayCommon> implements IgatewayCommonService {
}

View File

@ -0,0 +1,19 @@
package org.jeecg;
import org.jeecgframework.codegenerate.window.CodeWindow;
/**
* @Title: 单表代码生成器入口
* GUI模式已弃用请转移Online模式进行代码生成
* @Author 张代浩
* @site www.jeecg.com
* @Version:V1.0.1
*/
public class JeecgOneGUI {
/** 详细使用手册: http://doc.jeecg.com/2043919 */
public static void main(String[] args) {
new CodeWindow().pack();
}
}

View File

@ -0,0 +1,70 @@
package org.jeecg;
import java.util.ArrayList;
import java.util.List;
import org.jeecgframework.codegenerate.generate.impl.CodeGenerateOneToMany;
import org.jeecgframework.codegenerate.generate.pojo.onetomany.MainTableVo;
import org.jeecgframework.codegenerate.generate.pojo.onetomany.SubTableVo;
/**
* 代码生成器入口一对多
* GUI模式已弃用请转移Online模式进行代码生成
* @Author 张代浩
* @site www.jeecg.org
*
*/
public class JeecgOneToMainUtil {
/**
* 一对多(父子表)数据模型生成方法
* @param args
*/
public static void main(String[] args) {
//第一步设置主表配置
MainTableVo mainTable = new MainTableVo();
mainTable.setTableName("jeecg_order_main");//表名
mainTable.setEntityName("GuiTestOrderMain"); //实体名
mainTable.setEntityPackage("gui"); //包名
mainTable.setFtlDescription("GUI订单管理"); //描述
//第二步设置子表集合配置
List<SubTableVo> subTables = new ArrayList<SubTableVo>();
//[1].子表一
SubTableVo po = new SubTableVo();
po.setTableName("jeecg_order_customer");//表名
po.setEntityName("GuiTestOrderCustom"); //实体名
po.setEntityPackage("gui"); //包名
po.setFtlDescription("客户明细"); //描述
//子表外键参数配置
/*说明:
* a) 子表引用主表主键ID作为外键外键字段必须以_ID结尾;
* b) 主表和子表的外键字段名字必须相同除主键ID外;
* c) 多个外键字段采用逗号分隔;
*/
po.setForeignKeys(new String[]{"order_id"});
subTables.add(po);
//[2].子表二
SubTableVo po2 = new SubTableVo();
po2.setTableName("jeecg_order_ticket"); //表名
po2.setEntityName("GuiTestOrderTicket"); //实体名
po2.setEntityPackage("gui"); //包名
po2.setFtlDescription("产品明细"); //描述
//子表外键参数配置
/*说明:
* a) 子表引用主表主键ID作为外键外键字段必须以_ID结尾;
* b) 主表和子表的外键字段名字必须相同除主键ID外;
* c) 多个外键字段采用逗号分隔;
*/
po2.setForeignKeys(new String[]{"order_id"});
subTables.add(po2);
mainTable.setSubTables(subTables);
//第三步一对多(父子表)数据模型,代码生成
try {
new CodeGenerateOneToMany(mainTable,subTables).generateCodeFile(null);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,164 @@
package org.jeecg.common.aspect;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.jeecg.common.api.CommonAPI;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Description: 字典aop类
* @Author: dangzhenghui
* @Date: 2019-3-17 21:50
* @Version: 1.0
*/
@Aspect
@Component
@Slf4j
public class DictAspect {
@Autowired
private CommonAPI commonAPI;
// 定义切点Pointcut
@Pointcut("execution(public * org.jeecg.modules..*.*Controller.*(..)) ||execution(public * com.qnsoft..*.*Controller.*(..))||execution(public * com.nd..*.*Controller.*(..))")
public void excudeService() {
}
@Around("excudeService()")
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
long time1=System.currentTimeMillis();
Object result = pjp.proceed();
long time2=System.currentTimeMillis();
log.debug("获取JSON数据 耗时:"+(time2-time1)+"ms");
long start=System.currentTimeMillis();
this.parseDictText(result);
long end=System.currentTimeMillis();
log.debug("解析注入JSON数据 耗时"+(end-start)+"ms");
return result;
}
/**
* 本方法针对返回对象为Result 的IPage的分页列表数据进行动态字典注入
* 字典注入实现 通过对实体类添加注解@dict 来标识需要的字典内容,字典分为单字典code即可 table字典 code table text配合使用与原来jeecg的用法相同
* 示例为SysUser 字段为sex 添加了注解@Dict(dicCode = "sex") 会在字典服务立马查出来对应的text 然后在请求list的时候将这个字典text已字段名称加_dictText形式返回到前端
* 例输入当前返回值的就会多出一个sex_dictText字段
* {
* sex:1,
* sex_dictText:""
* }
* 前端直接取值sext_dictText在table里面无需再进行前端的字典转换了
* customRender:function (text) {
* if(text==1){
* return "";
* }else if(text==2){
* return "";
* }else{
* return text;
* }
* }
* 目前vue是这么进行字典渲染到table上的多了就很麻烦了 这个直接在服务端渲染完成前端可以直接用
* @param result
*/
private void parseDictText(Object result) {
if (result instanceof Result) {
if (((Result) result).getResult() instanceof IPage) {
List<JSONObject> items = new ArrayList<>();
for (Object record : ((IPage) ((Result) result).getResult()).getRecords()) {
ObjectMapper mapper = new ObjectMapper();
String json="{}";
try {
//解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
json = mapper.writeValueAsString(record);
} catch (JsonProcessingException e) {
log.error("json解析失败"+e.getMessage(),e);
}
JSONObject item = JSONObject.parseObject(json);
//update-begin--Author:scott -- Date:20190603 ----for解决继承实体字段无法翻译问题------
//for (Field field : record.getClass().getDeclaredFields()) {
for (Field field : oConvertUtils.getAllFields(record)) {
//update-end--Author:scott -- Date:20190603 ----for解决继承实体字段无法翻译问题------
if (field.getAnnotation(Dict.class) != null) {
String code = field.getAnnotation(Dict.class).dicCode();
String text = field.getAnnotation(Dict.class).dicText();
String table = field.getAnnotation(Dict.class).dictTable();
String key = String.valueOf(item.get(field.getName()));
//翻译字典值对应的txt
String textValue = translateDictValue(code, text, table, key);
log.debug(" 字典Val : "+ textValue);
log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+" "+ textValue);
item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
}
//date类型默认转换string格式化日期
if (field.getType().getName().equals("java.util.Date")&&field.getAnnotation(JsonFormat.class)==null&&item.get(field.getName())!=null){
SimpleDateFormat aDate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
}
}
items.add(item);
}
((IPage) ((Result) result).getResult()).setRecords(items);
}
}
}
/**
* 翻译字典文本
* @param code
* @param text
* @param table
* @param key
* @return
*/
private String translateDictValue(String code, String text, String table, String key) {
if(oConvertUtils.isEmpty(key)) {
return null;
}
StringBuffer textValue=new StringBuffer();
String[] keys = key.split(",");
for (String k : keys) {
String tmpValue = null;
log.debug(" 字典 key : "+ k);
if (k.trim().length() == 0) {
continue; //跳过循环
}
if (!StringUtils.isEmpty(table)){
log.debug("--DictAspect------dicTable="+ table+" ,dicText= "+text+" ,dicCode="+code);
tmpValue= commonAPI.translateDictFromTable(table,text,code,k.trim());
}else {
tmpValue = commonAPI.translateDict(code, k.trim());
}
if (tmpValue != null) {
if (!"".equals(textValue.toString())) {
textValue.append(",");
}
textValue.append(tmpValue);
}
}
return textValue.toString();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
package org.jeecg.common.system.query;
import org.jeecg.common.util.oConvertUtils;
/**
* Query 规则 常量
* @Author Scott
* @Date 2019年02月14日
*/
public enum QueryRuleEnum {
GT(">","gt","大于"),
GE(">=","ge","大于等于"),
LT("<","lt","小于"),
LE("<=","le","小于等于"),
EQ("=","eq","等于"),
NE("!=","ne","不等于"),
IN("IN","in","包含"),
LIKE("LIKE","like","全模糊"),
LEFT_LIKE("LEFT_LIKE","left_like","左模糊"),
RIGHT_LIKE("RIGHT_LIKE","right_like","右模糊"),
SQL_RULES("USE_SQL_RULES","ext","自定义SQL片段"),
//qn补充
EQ_NULL("EQ_NULL","eq_null","等于null"),
NOT_NULL("NOT_NULL","not_null","不等于null"),
EQ_EMPTY("EQ_EMPTY","eq_empty","等空串"),
NOT_EMPTY("NOT_EMPTY","not_empty","不等于空串"),
EQ_BLANK("EQ_BLANK","eq_blank","等于空串或null"),
NOT_BLANK("NOT_BLANK","not_blank","不等于空串和null");
// private static final String EQ_NULL = "!!null";
// private static final String NOT_NULL = "!!!null";
// private static final String EQ_EMPTY = "!!";
// private static final String NOT_EMPTY = "!!!";
// private static final String EQ_BLANK = "!!BLANK";
// private static final String NOT_BLANK = "!!!BLANK";
private String value;
private String condition;
private String msg;
QueryRuleEnum(String value, String condition, String msg){
this.value = value;
this.condition = condition;
this.msg = msg;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
public static QueryRuleEnum getByValue(String value){
if(oConvertUtils.isEmpty(value)) {
return null;
}
for(QueryRuleEnum val :values()){
if (val.getValue().equals(value) || val.getCondition().equals(value)){
return val;
}
}
return null;
}
}

View File

@ -0,0 +1,208 @@
package org.jeecg.common.system.util;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.common.base.Joiner;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.DataBaseConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.SysUserCacheInfo;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;
/**
* @Author Scott
* @Date 2018-07-12 14:23
* @Desc JWT工具类
**/
public class JwtUtil {
// Token过期时间30分钟用户登录过期时间是此时间的两倍以token在reids缓存时间为准
// public static final long EXPIRE_TIME = 24 * 60 * 60 * 1000;//*分钟**毫秒 //24小时
public static final long EXPIRE_TIME = 30 * 60 * 1000;;//分钟**毫秒 //30分钟
/**
* 校验token是否正确
*
* @param token 密钥
* @param secret 用户的密码
* @return 是否正确
*/
public static boolean verify(String token, String username, String secret) {
try {
// 根据密码生成JWT效验器
Algorithm algorithm = Algorithm.HMAC256(secret);
JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
// 效验TOKEN
DecodedJWT jwt = verifier.verify(token);
return true;
} catch (Exception exception) {
return false;
}
}
/**
* 获得token中的信息无需secret解密也能获得
*
* @return token中包含的用户名
*/
public static String getUsername(String token) {
try {
DecodedJWT jwt = JWT.decode(token);
return jwt.getClaim("username").asString();
} catch (JWTDecodeException e) {
return null;
}
}
/**
* 生成签名,5min后过期
*
* @param username 用户名
* @param secret 用户的密码
* @return 加密的token
*/
public static String sign(String username, String secret) {
Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
Algorithm algorithm = Algorithm.HMAC256(secret);
// 附带username信息
return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
}
/**
* 根据request中的token获取用户账号
*
* @param request
* @return
* @throws JeecgBootException
*/
public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
String accessToken = request.getHeader("X-Access-Token");
String username = getUsername(accessToken);
if (oConvertUtils.isEmpty(username)) {
throw new JeecgBootException("未获取到用户");
}
return username;
}
/**
* 从session中获取变量
* @param key
* @return
*/
public static String getSessionData(String key) {
//${myVar}%
//得到${} 后面的值
String moshi = "";
if(key.indexOf("}")!=-1){
moshi = key.substring(key.indexOf("}")+1);
}
String returnValue = null;
if (key.contains("#{")) {
key = key.substring(2,key.indexOf("}"));
}
if (oConvertUtils.isNotEmpty(key)) {
HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
returnValue = (String) session.getAttribute(key);
}
//结果加上${} 后面的值
if(returnValue!=null){returnValue = returnValue + moshi;}
return returnValue;
}
/**
* 从当前用户中获取变量
* @param key
* @param user
* @return
*/
//TODO 急待改造 sckjkdsjsfjdk
public static String getUserSystemData(String key,SysUserCacheInfo user) {
if(user==null) {
user = JeecgDataAutorUtils.loadUserInfo();
}
//#{sys_user_code}%
// 获取登录用户信息
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String moshi = "";
if(key.indexOf("}")!=-1){
moshi = key.substring(key.indexOf("}")+1);
}
String returnValue = null;
//针对特殊标示处理#{sysOrgCode}判断替换
if (key.contains("#{")) {
key = key.substring(2,key.indexOf("}"));
} else {
key = key;
}
//替换为系统登录用户帐号
if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
if(user==null) {
returnValue = sysUser.getUsername();
}else {
returnValue = user.getSysUserCode();
}
}
//替换为系统登录用户真实名字
else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
if(user==null) {
returnValue = sysUser.getRealname();
}else {
returnValue = user.getSysUserName();
}
}
//替换为系统用户登录所使用的机构编码
else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
if(user==null) {
returnValue = sysUser.getOrgCode();
}else {
returnValue = user.getSysOrgCode();
}
}
//替换为系统用户所拥有的所有机构编码
else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) {
if(user==null){
//TODO 暂时使用用户登录部门存在逻辑缺陷不是用户所拥有的部门
returnValue = sysUser.getOrgCode();
}else{
if(user.isOneDepart()) {
returnValue = user.getSysMultiOrgCode().get(0);
}else {
returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
}
}
}
//替换为当前系统时间(年月日)
else if (key.equals(DataBaseConstant.SYS_DATE)|| key.toLowerCase().equals(DataBaseConstant.SYS_DATE_TABLE)) {
returnValue = DateUtils.formatDate();
}
//替换为当前系统时间年月日时分秒
else if (key.equals(DataBaseConstant.SYS_TIME)|| key.toLowerCase().equals(DataBaseConstant.SYS_TIME_TABLE)) {
returnValue = DateUtils.now();
}
//流程状态默认值默认未发起
else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.toLowerCase().equals(DataBaseConstant.BPM_STATUS_TABLE)) {
returnValue = "1";
}
if(returnValue!=null){returnValue = returnValue + moshi;}
return returnValue;
}
// public static void main(String[] args) {
// String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NjUzMzY1MTMsInVzZXJuYW1lIjoiYWRtaW4ifQ.xjhud_tWCNYBOg_aRlMgOdlZoWFFKB_givNElHNw3X0";
// System.out.println(JwtUtil.getUsername(token));
// }
}

View File

@ -0,0 +1,10 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
// 禁止该类打成war包必要的
//
package org.jeecg.config;
public class WebSocketConfig {
}

View File

@ -0,0 +1,14 @@
package org.jeecg.config.mybatis;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
/**
* 单数据源配置jeecg.datasource.open = false时生效
* @Author zhoujf
*
*/
@Configuration
@MapperScan(value={"org.jeecg.modules.**.mapper*","com.nd.**.mapper*"})
public class MybatisPlusSaasConfig {
}

View File

@ -0,0 +1,262 @@
package org.jeecg.config.shiro;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
import org.apache.shiro.mgt.DefaultSubjectDAO;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.crazycake.shiro.IRedisManager;
import org.crazycake.shiro.RedisCacheManager;
import org.crazycake.shiro.RedisClusterManager;
import org.crazycake.shiro.RedisManager;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.shiro.ShiroRealm;
import org.jeecg.config.shiro.filters.JwtFilter;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.util.StringUtils;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import javax.annotation.Resource;
import javax.servlet.Filter;
import java.util.*;
/**
* @author: Scott
* @date: 2018/2/7
* @description: shiro 配置类
*/
@Slf4j
@Configuration
public class ShiroConfig {
@Value("${jeecg.shiro.excludeUrls}")
private String excludeUrls;
@Resource
LettuceConnectionFactory lettuceConnectionFactory;
@Autowired
private Environment env;
/**
* Filter Chain定义说明
*
* 1一个URL可以配置多个Filter使用逗号分隔
* 2当设置多个过滤器时全部验证通过才视为通过
* 3部分过滤器可指定参数如permsroles
*/
@Bean("shiroFilter")
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 拦截器
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
if(oConvertUtils.isNotEmpty(excludeUrls)){
String[] permissionUrl = excludeUrls.split(",");
for(String url : permissionUrl){
filterChainDefinitionMap.put(url,"anon");
}
}
// 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录
filterChainDefinitionMap.put("/customer/**", "anon"); //婚恋网用户
filterChainDefinitionMap.put("/hl/**", "anon"); //婚恋网用户
filterChainDefinitionMap.put("/sys/common/upload", "anon"); //文件上传
filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/checkCaptcha", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除
filterChainDefinitionMap.put("/sys/mLogin", "anon"); //登录接口排除
filterChainDefinitionMap.put("/sys/logout", "anon"); //登出接口排除
filterChainDefinitionMap.put("/sys/thirdLogin/**", "anon"); //第三方登录
filterChainDefinitionMap.put("/sys/getEncryptedString", "anon"); //获取加密串
filterChainDefinitionMap.put("/sys/sms", "anon");//短信验证码
filterChainDefinitionMap.put("/sys/phoneLogin", "anon");//手机登录
filterChainDefinitionMap.put("/sys/user/checkOnlyUser", "anon");//校验用户是否存在
filterChainDefinitionMap.put("/sys/user/register", "anon");//用户注册
filterChainDefinitionMap.put("/sys/user/querySysUser", "anon");//根据手机号获取用户信息
filterChainDefinitionMap.put("/sys/user/phoneVerification", "anon");//用户忘记密码验证手机号
filterChainDefinitionMap.put("/sys/user/passwordChange", "anon");//用户更改密码
filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码
filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token
filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
//filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
//filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
filterChainDefinitionMap.put("/", "anon");
filterChainDefinitionMap.put("/doc.html", "anon");
filterChainDefinitionMap.put("/**/*.js", "anon");
filterChainDefinitionMap.put("/**/*.css", "anon");
filterChainDefinitionMap.put("/**/*.html", "anon");
filterChainDefinitionMap.put("/**/*.svg", "anon");
filterChainDefinitionMap.put("/**/*.pdf", "anon");
filterChainDefinitionMap.put("/**/*.jpg", "anon");
filterChainDefinitionMap.put("/**/*.png", "anon");
filterChainDefinitionMap.put("/**/*.ico", "anon");
// update-begin--Author:sunjianlei Date:20190813 for排除字体格式的后缀
filterChainDefinitionMap.put("/**/*.ttf", "anon");
filterChainDefinitionMap.put("/**/*.woff", "anon");
filterChainDefinitionMap.put("/**/*.woff2", "anon");
// update-begin--Author:sunjianlei Date:20190813 for排除字体格式的后缀
filterChainDefinitionMap.put("/druid/**", "anon");
filterChainDefinitionMap.put("/swagger-ui.html", "anon");
filterChainDefinitionMap.put("/swagger**/**", "anon");
filterChainDefinitionMap.put("/webjars/**", "anon");
filterChainDefinitionMap.put("/v2/**", "anon");
//积木报表排除
filterChainDefinitionMap.put("/jmreport/**", "anon");
filterChainDefinitionMap.put("/**/*.js.map", "anon");
filterChainDefinitionMap.put("/**/*.css.map", "anon");
//测试示例
filterChainDefinitionMap.put("/test/jeecgDemo/rabbitMqClientTest/**", "anon"); //MQ测试
filterChainDefinitionMap.put("/test/bigScreen/**", "anon"); //大屏模板例子
//filterChainDefinitionMap.put("/test/jeecgDemo/html", "anon"); //模板页面
//filterChainDefinitionMap.put("/test/jeecgDemo/redis/**", "anon"); //redis测试
//websocket排除
filterChainDefinitionMap.put("/websocket/**", "anon");//系统通知和公告
filterChainDefinitionMap.put("/vxeSocket/**", "anon");//JVxeTable无痕刷新示例
// filterChainDefinitionMap.put("/gateway/**/list", "jwt");
filterChainDefinitionMap.put("/gateway/**/add", "jwt");//禁止可修改的免登陆
filterChainDefinitionMap.put("/gateway/**/edit", "jwt");//禁止可修改的免登陆
filterChainDefinitionMap.put("/gateway/**/delete", "jwt");//禁止可修改的免登陆
filterChainDefinitionMap.put("/gateway/**/deleteBatch", "jwt");//禁止可修改的免登陆
//前台免登陆
filterChainDefinitionMap.put("/gateway/**/", "anon");//前台免登陆
//性能监控 TODO 存在安全漏洞
//filterChainDefinitionMap.put("/actuator/**", "anon");
// 添加自己的过滤器并且取名为jwt
Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
//如果cloudServer为空 则说明是单体 需要加载跨域配置
Object cloudServer = env.getProperty(CommonConstant.CLOUD_SERVER_KEY);
filterMap.put("jwt", new JwtFilter(cloudServer==null));
shiroFilterFactoryBean.setFilters(filterMap);
// <!-- 过滤链定义从上向下顺序执行一般将/**放在最为下边
filterChainDefinitionMap.put("/**", "jwt");
// 未授权界面返回JSON
shiroFilterFactoryBean.setUnauthorizedUrl("/sys/common/403");
shiroFilterFactoryBean.setLoginUrl("/sys/common/403");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
@Bean("securityManager")
public DefaultWebSecurityManager securityManager(ShiroRealm myRealm) {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(myRealm);
/*
* 关闭shiro自带的session详情见文档
* http://shiro.apache.org/session-management.html#SessionManagement-
* StatelessApplications%28Sessionless%29
*/
DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
securityManager.setSubjectDAO(subjectDAO);
//自定义缓存实现,使用redis
securityManager.setCacheManager(redisCacheManager());
return securityManager;
}
/**
* 下面的代码是添加注解支持
* @return
*/
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
/**
* 解决重复代理问题 github#994
* 添加前缀判断 不匹配 任何Advisor
*/
defaultAdvisorAutoProxyCreator.setUsePrefix(true);
defaultAdvisorAutoProxyCreator.setAdvisorBeanNamePrefix("_no_advisor");
return defaultAdvisorAutoProxyCreator;
}
@Bean
public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
advisor.setSecurityManager(securityManager);
return advisor;
}
/**
* cacheManager 缓存 redis实现
* 使用的是shiro-redis开源插件
*
* @return
*/
public RedisCacheManager redisCacheManager() {
log.info("===============(1)创建缓存管理器RedisCacheManager");
RedisCacheManager redisCacheManager = new RedisCacheManager();
redisCacheManager.setRedisManager(redisManager());
//redis中针对不同用户缓存(此处的id需要对应user实体中的id字段,用于唯一标识)
redisCacheManager.setPrincipalIdFieldName("id");
//用户权限信息缓存时间
redisCacheManager.setExpire(200000);
return redisCacheManager;
}
/**
* 配置shiro redisManager
* 使用的是shiro-redis开源插件
*
* @return
*/
@Bean
public IRedisManager redisManager() {
log.info("===============(2)创建RedisManager,连接Redis..");
IRedisManager manager;
// redis 单机支持在集群为空或者集群无机器时候使用 add by jzyadmin@163.com
if (lettuceConnectionFactory.getClusterConfiguration() == null || lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().isEmpty()) {
RedisManager redisManager = new RedisManager();
redisManager.setHost(lettuceConnectionFactory.getHostName());
redisManager.setPort(lettuceConnectionFactory.getPort());
redisManager.setTimeout(0);
if (!StringUtils.isEmpty(lettuceConnectionFactory.getPassword())) {
redisManager.setPassword(lettuceConnectionFactory.getPassword());
}
manager = redisManager;
}else{
// redis 集群支持优先使用集群配置 add by jzyadmin@163.com
RedisClusterManager redisManager = new RedisClusterManager();
Set<HostAndPort> portSet = new HashSet<>();
lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().forEach(node -> portSet.add(new HostAndPort(node.getHost() , node.getPort())));
JedisCluster jedisCluster = new JedisCluster(portSet);
redisManager.setJedisCluster(jedisCluster);
manager = redisManager;
}
return manager;
}
}

View File

@ -0,0 +1,401 @@
package org.jeecg.modules.system.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.RestUtil;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLDecoder;
/**
* <p>
* 用户表 前端控制器
* </p>
*
* @Author scott
* @since 2018-12-20
*/
@Slf4j
@RestController
@RequestMapping("/sys/common")
public class CommonController {
@Autowired
private ISysBaseAPI sysBaseAPI;
@Value(value = "${jeecg.path.upload}")
private String uploadpath;
/**
* 本地local miniominio 阿里alioss
*/
@Value(value="${jeecg.uploadType}")
private String uploadType;
/**
* @Author 政辉
* @return
*/
@GetMapping("/403")
public Result<?> noauth() {
return Result.error("没有权限,请联系管理员授权");
}
/**
* 文件上传统一方法
* @param request
* @param response
* @return
* @throws IOException
*/
@PostMapping(value = "/upload")
public Result<?> upload(HttpServletRequest request, HttpServletResponse response) throws IOException {
Result<?> result = new Result<>();
String savePath = "";
String bizPath = request.getParameter("biz");
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
if(oConvertUtils.isEmpty(bizPath)){
if(CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)){
//未指定目录则用阿里云默认目录 upload
bizPath = "upload";
//result.setMessage("使用阿里云文件上传时,必须添加目录!");
//result.setSuccess(false);
//return result;
}else{
bizPath = "";
}
}
if(CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){
//update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传
savePath = this.uploadLocal(file,bizPath);
//update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传
/** 富文本编辑器及markdown本地上传时采用返回链接方式
//针对jeditor编辑器如何使 lcaol模式采用 base64格式存储
String jeditor = request.getParameter("jeditor");
if(oConvertUtils.isNotEmpty(jeditor)){
result.setMessage(CommonConstant.UPLOAD_TYPE_LOCAL);
result.setSuccess(true);
return result;
}else{
savePath = this.uploadLocal(file,bizPath);
}
*/
}else{
//update-begin-author:taoyan date:20200814 for:文件上传改造
savePath = CommonUtils.upload(file, bizPath, uploadType);
//update-end-author:taoyan date:20200814 for:文件上传改造
}
//图片压缩方法
if(StringUtils.isNotBlank(savePath)){
String extensionName = savePath.substring(savePath.lastIndexOf(".")+1);
extensionName = extensionName.toLowerCase();
if(org.apache.commons.lang3.StringUtils.equalsAny(extensionName,"jpg","jpeg","png")){
Thumbnails.of(uploadpath+"/"+savePath).scale(1f).outputQuality(0.5f).toFile(uploadpath+"/"+savePath);
}
}
if(oConvertUtils.isNotEmpty(savePath)){
result.setMessage(savePath);
result.setSuccess(true);
}else {
result.setMessage("上传失败!");
result.setSuccess(false);
}
return result;
}
/**
* 本地文件上传
* @param mf 文件
* @param bizPath 自定义路径
* @return
*/
private String uploadLocal(MultipartFile mf,String bizPath){
try {
String ctxPath = uploadpath;
String fileName = null;
File file = new File(ctxPath + File.separator + bizPath + File.separator );
if (!file.exists()) {
file.mkdirs();// 创建文件根目录
}
String orgName = mf.getOriginalFilename();// 获取文件名
orgName = CommonUtils.getFileName(orgName);
if(orgName.indexOf(".")!=-1){
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
}else{
fileName = orgName+ "_" + System.currentTimeMillis();
}
String savePath = file.getPath() + File.separator + fileName;
File savefile = new File(savePath);
FileCopyUtils.copy(mf.getBytes(), savefile);
String dbpath = null;
if(oConvertUtils.isNotEmpty(bizPath)){
dbpath = bizPath + File.separator + fileName;
}else{
dbpath = fileName;
}
if (dbpath.contains("\\")) {
dbpath = dbpath.replace("\\", "/");
}
return dbpath;
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return "";
}
// @PostMapping(value = "/upload2")
// public Result<?> upload2(HttpServletRequest request, HttpServletResponse response) {
// Result<?> result = new Result<>();
// try {
// String ctxPath = uploadpath;
// String fileName = null;
// String bizPath = "files";
// String tempBizPath = request.getParameter("biz");
// if(oConvertUtils.isNotEmpty(tempBizPath)){
// bizPath = tempBizPath;
// }
// String nowday = new SimpleDateFormat("yyyyMMdd").format(new Date());
// File file = new File(ctxPath + File.separator + bizPath + File.separator + nowday);
// if (!file.exists()) {
// file.mkdirs();// 创建文件根目录
// }
// MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
// MultipartFile mf = multipartRequest.getFile("file");// 获取上传文件对象
// String orgName = mf.getOriginalFilename();// 获取文件名
// fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
// String savePath = file.getPath() + File.separator + fileName;
// File savefile = new File(savePath);
// FileCopyUtils.copy(mf.getBytes(), savefile);
// String dbpath = bizPath + File.separator + nowday + File.separator + fileName;
// if (dbpath.contains("\\")) {
// dbpath = dbpath.replace("\\", "/");
// }
// result.setMessage(dbpath);
// result.setSuccess(true);
// } catch (IOException e) {
// result.setSuccess(false);
// result.setMessage(e.getMessage());
// log.error(e.getMessage(), e);
// }
// return result;
// }
/**
* 预览图片&下载文件
* 请求地址http://localhost:8080/common/static/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg}
*
* @param request
* @param response
*/
@GetMapping(value = "/static/**")
public void view(HttpServletRequest request, HttpServletResponse response) {
// ISO-8859-1 ==> UTF-8 进行编码转换
String imgPath = extractPathFromPattern(request);
if(oConvertUtils.isEmpty(imgPath) || imgPath=="null"){
return;
}
// 其余处理略
InputStream inputStream = null;
OutputStream outputStream = null;
try {
imgPath = imgPath.replace("..", "");
if (imgPath.endsWith(",")) {
imgPath = imgPath.substring(0, imgPath.length() - 1);
}
String filePath = uploadpath + File.separator + imgPath;
File file = new File(filePath);
if(!file.exists()){
response.setStatus(404);
throw new RuntimeException("文件不存在..");
}
response.setContentType("application/force-download");// 设置强制下载不打开
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1"));
inputStream = new BufferedInputStream(new FileInputStream(filePath));
outputStream = response.getOutputStream();
byte[] buf = new byte[1024];
int len;
while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len);
}
response.flushBuffer();
} catch (IOException e) {
log.error("预览文件失败" + e.getMessage());
response.setStatus(404);
e.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
}
}
// /**
// * 下载文件
// * 请求地址http://localhost:8080/common/download/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg}
// *
// * @param request
// * @param response
// * @throws Exception
// */
// @GetMapping(value = "/download/**")
// public void download(HttpServletRequest request, HttpServletResponse response) throws Exception {
// // ISO-8859-1 ==> UTF-8 进行编码转换
// String filePath = extractPathFromPattern(request);
// // 其余处理略
// InputStream inputStream = null;
// OutputStream outputStream = null;
// try {
// filePath = filePath.replace("..", "");
// if (filePath.endsWith(",")) {
// filePath = filePath.substring(0, filePath.length() - 1);
// }
// String localPath = uploadpath;
// String downloadFilePath = localPath + File.separator + filePath;
// File file = new File(downloadFilePath);
// if (file.exists()) {
// response.setContentType("application/force-download");// 设置强制下载不打开            
// response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1"));
// inputStream = new BufferedInputStream(new FileInputStream(file));
// outputStream = response.getOutputStream();
// byte[] buf = new byte[1024];
// int len;
// while ((len = inputStream.read(buf)) > 0) {
// outputStream.write(buf, 0, len);
// }
// response.flushBuffer();
// }
//
// } catch (Exception e) {
// log.info("文件下载失败" + e.getMessage());
// // e.printStackTrace();
// } finally {
// if (inputStream != null) {
// try {
// inputStream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (outputStream != null) {
// try {
// outputStream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
//
// }
/**
* @功能pdf预览Iframe
* @param modelAndView
* @return
*/
@RequestMapping("/pdf/pdfPreviewIframe")
public ModelAndView pdfPreviewIframe(ModelAndView modelAndView) {
modelAndView.setViewName("pdfPreviewIframe");
return modelAndView;
}
/**
* 把指定URL后的字符串全部截断当成参数
* 这么做是为了防止URL中包含中文或者特殊字符/匹配不了的问题
* @param request
* @return
*/
private static String extractPathFromPattern(final HttpServletRequest request) {
String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path);
}
/**
* 中转HTTP请求解决跨域问题
*
* @param url 必填请求地址
* @return
*/
@RequestMapping("/transitRESTful")
public Result transitRESTful(@RequestParam("url") String url, HttpServletRequest request) {
try {
ServletServerHttpRequest httpRequest = new ServletServerHttpRequest(request);
// 中转请求methodbody
HttpMethod method = httpRequest.getMethod();
JSONObject params;
try {
params = JSON.parseObject(JSON.toJSONString(httpRequest.getBody()));
} catch (Exception e) {
params = new JSONObject();
}
// 中转请求问号参数
JSONObject variables = JSON.parseObject(JSON.toJSONString(request.getParameterMap()));
variables.remove("url");
// headers 里传递Token
String token = TokenUtils.getTokenByRequest(request);
HttpHeaders headers = new HttpHeaders();
headers.set("X-Access-Token", token);
// 发送请求
String httpURL = URLDecoder.decode(url, "UTF-8");
ResponseEntity<String> response = RestUtil.request(httpURL, method, headers , variables, params, String.class);
// 封装返回结果
Result<Object> result = new Result<>();
int statusCode = response.getStatusCodeValue();
result.setCode(statusCode);
result.setSuccess(statusCode == 200);
String responseBody = response.getBody();
try {
// 尝试将返回结果转为JSON
Object json = JSON.parse(responseBody);
result.setResult(json);
} catch (Exception e) {
// 转成JSON失败直接返回原始数据
result.setResult(responseBody);
}
return result;
} catch (Exception e) {
log.debug("中转HTTP请求失败", e);
return Result.error(e.getMessage());
}
}
}

View File

@ -0,0 +1,284 @@
server:
port: 8890
tomcat:
max-swallow-size: -1
error:
include-exception: true
include-stacktrace: ALWAYS
include-message: ALWAYS
servlet:
context-path: /gjc
compression:
enabled: true
min-response-size: 1024
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
management:
endpoints:
web:
exposure:
include: metrics,httptrace
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
mail:
host: smtp.exmail.qq.com
username: xiuzhiming@surfbird.cn
password: ??
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
## quartz定时任务,采用数据库方式
quartz:
job-store-type: jdbc
initialize-schema: embedded
#设置自动启动,默认为 true
auto-startup: true
#启动时更新己存在的Job
overwrite-existing-jobs: true
properties:
org:
quartz:
scheduler:
instanceName: MyScheduler
instanceId: AUTO
jobStore:
class: org.quartz.impl.jdbcjobstore.JobStoreTX
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
misfireThreshold: 60000
clusterCheckinInterval: 10000
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 10
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
#json 时间戳统一转换
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
jpa:
open-in-view: false
activiti:
check-process-definitions: false
#启用作业执行器
async-executor-activate: false
#启用异步执行器
job-executor-activate: false
aop:
proxy-target-class: true
#配置freemarker
freemarker:
# 设置模板后缀名
suffix: .ftl
# 设置文档类型
content-type: text/html
# 设置页面编码格式
charset: UTF-8
# 设置页面缓存
cache: false
prefer-file-system-access: false
# 设置ftl文件路径
template-loader-path:
- classpath:/templates
# 设置静态文件路径js,css等
mvc:
static-path-pattern: /**
resource:
static-locations: classpath:/static/,classpath:/public/
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
druid:
stat-view-servlet:
enabled: true
loginUsername: admin
loginPassword: 123456
allow:
web-stat-filter:
enabled: true
dynamic:
druid: # 全局druid参数绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat,wall,slf4j
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/ndgjc_jeecg_db?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: admin
driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
#username: root
#password: root
#driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
redis:
database: 5
host: 127.0.0.1
lettuce:
pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
shutdown-timeout: 100ms
password: ''
port: 6379
#mybatis plus 设置
mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:com/nd/**/xml/*Mapper.xml
global-config:
# 关闭MP3.0自带的banner
banner: false
db-config:
#主键类型
id-type: ASSIGN_ID
# 默认数据库表下划线命名
table-underline: true
configuration:
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls: true
#jeecg专用配置
jeecg :
# 本地local\Miniominio\阿里云alioss
uploadType: local
path :
#文件上传根目录 设置
upload: D://opt//upFiles
#webapp文件路径
webapp: D://opt//webapp
shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储配置
oss:
endpoint: oss-cn-beijing.aliyuncs.com
accessKey: ??
secretKey: ??
bucketName: jeecgos
staticDomain: ??
# ElasticSearch 6设置
elasticsearch:
cluster-name: jeecg-ES
cluster-nodes: 127.0.0.1:9200
check-enabled: false
# 表单设计器配置
desform:
# 主题颜色(仅支持 16进制颜色代码
theme-color: "#1890ff"
# 文件、图片上传方式可选项qiniu七牛云、system跟随系统配置
upload-type: system
# 在线预览文件服务器地址配置
file-view-domain: 127.0.0.1:8012
# minio文件上传
minio:
minio_url: http://minio.jeecg.com
minio_name: ??
minio_pass: ??
bucketName: otatest
#大屏报表参数设置
jmreport:
mode: dev
#是否需要校验token
is_verify_token: false
#必须校验方法
verify_methods: remove,delete,save,add,update
#Wps在线文档
wps:
domain: https://wwo.wps.cn/office/
appid: ??
appsecret: ??
#xxl-job配置
xxljob:
enabled: false
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
appname: ${spring.application.name}
accessToken: ''
address: 127.0.0.1:30007
ip: 127.0.0.1
port: 30007
logPath: logs/jeecg/job/jobhandler/
logRetentionDays: 30
#自定义路由配置 yml nacos database
route:
config:
data-id: jeecg-gateway-router
group: DEFAULT_GROUP
data-type: yml
#分布式锁配置
redisson:
address: 127.0.0.1:6379
password:
type: STANDALONE
enabled: true
#cas单点登录
cas:
prefixUrl: http://cas.example.org:8443/cas
#Mybatis输出sql日志
logging:
level:
org.jeecg.modules.system.mapper : info
#enable swagger
swagger:
enable: true
production: false
basic:
enable: false
username: jeecg
password: jeecg1314
#第三方登录
justauth:
enabled: true
type:
GITHUB:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
WECHAT_ENTERPRISE:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
agent-id: 1000002
DINGTALK:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
WECHAT_OPEN:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
cache:
type: default
prefix: 'demo::'
timeout: 1h

View File

@ -0,0 +1,284 @@
server:
port: 8890
tomcat:
max-swallow-size: -1
error:
include-exception: true
include-stacktrace: ALWAYS
include-message: ALWAYS
servlet:
context-path: /gjc
compression:
enabled: true
min-response-size: 1024
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
management:
endpoints:
web:
exposure:
include: metrics,httptrace
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
mail:
host: smtp.163.com
username: jeecgos@163.com
password: ??
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
## quartz定时任务,采用数据库方式
quartz:
job-store-type: jdbc
initialize-schema: embedded
#设置自动启动,默认为 true
auto-startup: true
#启动时更新己存在的Job
overwrite-existing-jobs: true
properties:
org:
quartz:
scheduler:
instanceName: MyScheduler
instanceId: AUTO
jobStore:
class: org.quartz.impl.jdbcjobstore.JobStoreTX
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
misfireThreshold: 60000
clusterCheckinInterval: 10000
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 10
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
#json 时间戳统一转换
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
jpa:
open-in-view: false
activiti:
check-process-definitions: false
#启用作业执行器
async-executor-activate: false
#启用异步执行器
job-executor-activate: false
aop:
proxy-target-class: true
#配置freemarker
freemarker:
# 设置模板后缀名
suffix: .ftl
# 设置文档类型
content-type: text/html
# 设置页面编码格式
charset: UTF-8
# 设置页面缓存
cache: false
prefer-file-system-access: false
# 设置ftl文件路径
template-loader-path:
- classpath:/templates
# 设置静态文件路径js,css等
mvc:
static-path-pattern: /**
resource:
static-locations: classpath:/static/,classpath:/public/
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
druid:
stat-view-servlet:
enabled: true
loginUsername: admin
loginPassword: 123456
allow:
web-stat-filter:
enabled: true
dynamic:
druid: # 全局druid参数绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 5
maxActive: 1000
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat,wall,slf4j
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/ndgjc_jeecg_db?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
#username: root
#password: root
#driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
redis:
database: 9
host: 127.0.0.1
lettuce:
pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
shutdown-timeout: 100ms
password: ''
port: 6379
#mybatis plus 设置
mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:com/nd/**/xml/*Mapper.xml
global-config:
# 关闭MP3.0自带的banner
banner: false
db-config:
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
id-type: ASSIGN_ID
# 默认数据库表下划线命名
table-underline: true
configuration:
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls: true
#jeecg专用配置
jeecg :
# 本地local\Miniominio\阿里云alioss
uploadType: alioss
path :
#文件上传根目录 设置
upload: D://opt//gjc//upFiles
#webapp文件路径
webapp: D://opt//gjc//webapp
shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
#阿里云oss存储配置
oss:
endpoint: oss-cn-beijing.aliyuncs.com
accessKey: ??
secretKey: ??
bucketName: jeecgos
staticDomain: https://static.jeecg.com
# ElasticSearch 设置
elasticsearch:
cluster-name: jeecg-ES
cluster-nodes: 111.225.222.176:9200
check-enabled: true
# 表单设计器配置
desform:
# 主题颜色(仅支持 16进制颜色代码
theme-color: "#1890ff"
# 文件、图片上传方式可选项qiniu七牛云、system跟随系统配置
upload-type: system
# 在线预览文件服务器地址配置
file-view-domain: http://fileview.jeecg.com
# minio文件上传
minio:
minio_url: http://minio.jeecg.com
minio_name: ??
minio_pass: ??
bucketName: otatest
#大屏报表参数设置
jmreport:
mode: prod
#是否需要校验token
is_verify_token: true
#必须校验方法
verify_methods: remove,delete,save,add,update
#Wps在线文档
wps:
domain: https://wwo.wps.cn/office/
appid: ??
appsecret: ??
#xxl-job配置
xxljob:
enabled: false
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
appname: ${spring.application.name}
accessToken: ''
address: 127.0.0.1:30007
ip: 127.0.0.1
port: 30007
logPath: logs/jeecg/job/jobhandler/
logRetentionDays: 30
#自定义路由配置 yml nacos database
route:
config:
data-id: jeecg-gateway-router
group: DEFAULT_GROUP
data-type: yml
#分布式锁配置
redisson:
address: 127.0.0.1:6379
password:
type: STANDALONE
enabled: true
#cas单点登录
cas:
prefixUrl: http://cas.example.org:8443/cas
#Mybatis输出sql日志
logging:
level:
org.jeecg.modules.system.mapper : debug
#enable swagger
swagger:
enable: false
production: false
basic:
enable: false
username: jeecg
password: jeecg1314
#第三方登录
justauth:
enabled: true
type:
GITHUB:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
WECHAT_ENTERPRISE:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
agent-id: 1000002
DINGTALK:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
WECHAT_OPEN:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
cache:
type: default
prefix: 'demo::'
timeout: 1h

View File

@ -0,0 +1,284 @@
server:
port: 8080
tomcat:
max-swallow-size: -1
error:
include-exception: true
include-stacktrace: ALWAYS
include-message: ALWAYS
servlet:
context-path: /jeecg-boot
compression:
enabled: true
min-response-size: 1024
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
management:
endpoints:
web:
exposure:
include: metrics,httptrace
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
mail:
host: smtp.163.com
username: jeecgos@163.com
password: ??
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
## quartz定时任务,采用数据库方式
quartz:
job-store-type: jdbc
initialize-schema: embedded
#设置自动启动,默认为 true
auto-startup: true
#启动时更新己存在的Job
overwrite-existing-jobs: true
properties:
org:
quartz:
scheduler:
instanceName: MyScheduler
instanceId: AUTO
jobStore:
class: org.quartz.impl.jdbcjobstore.JobStoreTX
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
misfireThreshold: 60000
clusterCheckinInterval: 10000
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 10
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
#json 时间戳统一转换
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
aop:
proxy-target-class: true
activiti:
check-process-definitions: false
#启用作业执行器
async-executor-activate: false
#启用异步执行器
job-executor-activate: false
jpa:
open-in-view: false
#配置freemarker
freemarker:
# 设置模板后缀名
suffix: .ftl
# 设置文档类型
content-type: text/html
# 设置页面编码格式
charset: UTF-8
# 设置页面缓存
cache: false
prefer-file-system-access: false
# 设置ftl文件路径
template-loader-path:
- classpath:/templates
# 设置静态文件路径js,css等
mvc:
static-path-pattern: /**
resource:
static-locations: classpath:/static/,classpath:/public/
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
druid:
stat-view-servlet:
enabled: true
loginUsername: admin
loginPassword: 123456
allow:
web-stat-filter:
enabled: true
dynamic:
druid: # 全局druid参数绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat,wall,slf4j
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
master:
url: jdbc:mysql://127.0.0.1:3307/ndgjc_jeecg_db?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
#username: root
#password: root
#driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
redis:
database: 3
host: 127.0.0.1
lettuce:
pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
shutdown-timeout: 100ms
password: ''
port: 6379
#mybatis plus 设置
mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:com/nd/**/xml/*Mapper.xml
global-config:
# 关闭MP3.0自带的banner
banner: false
db-config:
#主键类型
id-type: ASSIGN_ID
# 默认数据库表下划线命名
table-underline: true
configuration:
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls: true
#jeecg专用配置
jeecg :
# 本地local\Miniominio\阿里云alioss
uploadType: local
path :
#文件上传根目录 设置
upload: D://opt//upFiles
#webapp文件路径
webapp: D://opt//webapp
shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储配置
oss:
endpoint: oss-cn-beijing.aliyuncs.com
accessKey: ??
secretKey: ??
bucketName: jeecgos
staticDomain: https://static.jeecg.com
# ElasticSearch 设置
elasticsearch:
cluster-name: jeecg-ES
cluster-nodes: http://fileview.jeecg.com
check-enabled: false
# 表单设计器配置
desform:
# 主题颜色(仅支持 16进制颜色代码
theme-color: "#1890ff"
# 文件、图片上传方式可选项qiniu七牛云、system跟随系统配置
upload-type: system
# 在线预览文件服务器地址配置
file-view-domain: http://127.0.0.1:8012
# minio文件上传
minio:
minio_url: http://minio.jeecg.com
minio_name: ??
minio_pass: ??
bucketName: otatest
#大屏报表参数设置
jmreport:
mode: prod
#是否需要校验token
is_verify_token: false
#必须校验方法
verify_methods: remove,delete,save,add,update
#Wps在线文档
wps:
domain: https://wwo.wps.cn/office/
appid: ??
appsecret: ??
#xxl-job配置
xxljob:
enabled: false
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
appname: ${spring.application.name}
accessToken: ''
address: 127.0.0.1:30007
ip: 127.0.0.1
port: 30007
logPath: logs/jeecg/job/jobhandler/
logRetentionDays: 30
#自定义路由配置 yml nacos database
route:
config:
data-id: jeecg-gateway-router
group: DEFAULT_GROUP
data-type: yml
#分布式锁配置
redisson:
address: 127.0.0.1:6379
password:
type: STANDALONE
enabled: true
#Mybatis输出sql日志
logging:
level:
org.jeecg.modules.system.mapper : debug
#cas单点登录
cas:
prefixUrl: http://cas.example.org:8443/cas
#enable swagger
swagger:
enable: true
production: false
basic:
enable: false
username: jeecg
password: jeecg1314
#第三方登录
justauth:
enabled: true
type:
GITHUB:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
WECHAT_ENTERPRISE:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
agent-id: 1000002
DINGTALK:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
WECHAT_OPEN:
client-id: ??
client-secret: ??
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
cache:
type: default
prefix: 'demo::'
timeout: 1h

View File

@ -0,0 +1,5 @@
spring:
application:
name: jeecg-system
profiles:
active: dev

View File

@ -0,0 +1,5 @@
spring:
application:
name: jeecg-system
profiles:
active: prod

View File

@ -0,0 +1,11 @@
${AnsiColor.BRIGHT_BLUE}
____ _ __________ __________
/ __ \ / |/ / __/ __ \/ __/_ __/
/ /_/ / / /\ \/ /_/ / _/ / /
\___\_\/_/|_/___/\____/_/ /_/
${AnsiColor.BRIGHT_GREEN}
Jeecg Boot Version: 2.4.0
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
${AnsiColor.BLACK}

View File

@ -0,0 +1,98 @@
<#---->
<#-- freemarker 的一些工具方法 -->
<#---->
<#-- 驼峰转其他字符 -->
<#-- @param str 待转换的文本 -->
<#-- @param character 要转换成的字符 -->
<#-- @param case 转换大小写normal 不转换lower 小写upper 大写) -->
<#function camelToChar(str, character, case='normal')>
<#assign text=str?replace("([a-z])([A-Z]+)","$1${character}$2","r")/>
<#if case=="upper">
<#return text?upper_case>
<#elseif case=="lower">
<#return text?lower_case>
<#else>
<#return text>
</#if>
</#function>
<#---->
<#-- 驼峰转下划线 -->
<#function camelToDashed(str, case='normal')>
<#return camelToChar(str, "_", case)>
</#function>
<#---->
<#-- 驼峰转横线 -->
<#function camelToHorizontal(str, case='normal')>
<#return camelToChar(str, "-", case)>
</#function>
<#---->
<#-- 获取 v-model 属性 -->
<#function getVModel po,suffix="">
<#return "v-model=\"queryParam.${po.fieldName}${suffix}\"">
</#function>
<#-- 获取 placeholder 属性 -->
<#function getPlaceholder po,prefix,fillComment=true>
<#if fillComment>
<#return "placeholder=\"${prefix}${po.filedComment}\"">
<#else>
<#return "placeholder=\"${prefix}\"">
</#if>
</#function>
<#-- ** 判断某字段是否配置了校验 * -->
<#function poHasCheck po>
<#if (po.fieldValidType!'')?trim?length gt 0 || po.nullable == 'N'>
<#if po.fieldName != 'id'>
<#if po.nullable == 'N'
|| po.fieldValidType == '*'
|| po.fieldValidType == 'only'
|| po.fieldValidType == 'n6-16'
|| po.fieldValidType == '*6-16'
|| po.fieldValidType == 's6-18'
|| po.fieldValidType == 'url'
|| po.fieldValidType == 'e'
|| po.fieldValidType == 'm'
|| po.fieldValidType == 'p'
|| po.fieldValidType == 's'
|| po.fieldValidType == 'n'
|| po.fieldValidType == 'z'
|| po.fieldValidType == 'money'
>
<#return true>
</#if>
</#if>
<#elseif po.defaultVal??>
<#return true>
</#if>
<#return false>
</#function>
<#-- ** 如果配置了校验就显示 validatorRules * -->
<#function autoWriteRules po>
<#if poHasCheck(po)>
<#return ", validatorRules.${po.fieldName}">
<#else>
<#return "">
</#if>
</#function>
<#-- ** 高级查询生成 * -->
<#function superQueryFieldList po>
<#if po.classType=="popup">
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}', popup:{code:'${po.dictTable}',field:'${po.dictField?split(',')[0]}',orgFields:'${po.dictField?split(',')[0]}',destFields:'${po.dictText?split(',')[0]}'}}">
<#elseif po.classType=="sel_user" || po.classType=="sel_depart" || po.classType=="datetime" || po.classType=="date" || po.classType=="pca" || po.classType=="switch">
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#else>
<#if po.dictTable?? && po.dictTable!="" && po.classType!="sel_tree" && po.classType!="cat_tree" && po.classType!="link_down">
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}',dictCode:'${po.dictTable},${po.dictText},${po.dictField}'}">
<#elseif po.dictField?? && po.classType!="sel_tree" && po.classType!="cat_tree" && po.classType!="link_down">
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}',dictCode:'${po.dictField}'}">
<#elseif po.fieldDbType=="Text">
<#return "{type:'string',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#elseif po.fieldDbType=="Blob">
<#return "{type:'byte',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#elseif po.fieldDbType=="BigDecimal" || po.fieldDbType=="double">
<#return "{type:'number',value:'${po.fieldName}',text:'${po.filedComment}'}">
<#else>
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}'}">
</#if>
</#if>
</#function>

View File

@ -0,0 +1,63 @@
<#include "../utils.ftl">
<#if po.isShow == 'Y' && poHasCheck(po)>
<#if po.fieldName != 'id'>
${po.fieldName}: {
<#if po.defaultVal??>
<#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int">
initialValue:${po.defaultVal},
<#else>
initialValue:"${po.defaultVal}",
</#if>
</#if>
rules: [
<#assign fieldValidType = po.fieldValidType!''>
<#-- 非空校验 -->
<#if po.nullable == 'N' || fieldValidType == '*'>
{ required: true, message: '请输入${po.filedComment}!'},
<#elseif fieldValidType!=''>
{ required: false},
</#if>
<#-- 唯一校验 -->
<#if fieldValidType == 'only'>
{ validator: (rule, value, callback) => validateDuplicateValue('${tableName}', '${po.fieldDbName}', value, this.model.id, callback)},
<#-- 6到16位数字 -->
<#elseif fieldValidType == 'n6-16'>
{ pattern: /\d{6,18}/, message: '请输入6到16位数字!'},
<#-- 6到16位任意字符 -->
<#elseif fieldValidType == '*6-16'>
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
<#-- 6到18位字符串 -->
<#elseif fieldValidType == 's6-18'>
{ pattern: /^.{6,18}$/, message: '请输入6到18位任意字符!'},
<#-- 网址 -->
<#elseif fieldValidType == 'url'>
{ pattern: /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/, message: '请输入正确的网址!'},
<#-- 电子邮件 -->
<#elseif fieldValidType == 'e'>
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
<#-- 手机号码 -->
<#elseif fieldValidType == 'm'>
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
<#-- 邮政编码 -->
<#elseif fieldValidType == 'p'>
{ pattern: /^[1-9]\d{5}$/, message: '请输入正确的邮政编码!'},
<#-- 字母 -->
<#elseif fieldValidType == 's'>
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
<#-- 数字 -->
<#elseif fieldValidType == 'n'>
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
<#-- 整数 -->
<#elseif fieldValidType == 'z'>
{ pattern: /^-?\d+$/, message: '请输入整数!'},
<#-- 金额 -->
<#elseif fieldValidType == 'money'>
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
<#-- 无校验 -->
<#else>
<#t>
</#if>
]
},
</#if>
</#if>

View File

@ -0,0 +1,5 @@
validatorRules: {
<#list columns as po>
<#include "core.ftl">
</#list>
},

View File

@ -0,0 +1,5 @@
validatorRules: {
<#list sub.colums as po>
<#include "core.ftl">
</#list>
},

View File

@ -0,0 +1,180 @@
package ${bussiPackage}.${entityPackage}.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
<#assign bpm_flag=false>
<#list originalColumns as po>
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Api(tags="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> {
@Autowired
private I${entityName}Service ${entityName?uncap_first}Service;
/**
* 分页列表查询
*
* @param ${entityName?uncap_first}
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param ${entityName?uncap_first}
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
<#if bpm_flag>
${entityName?uncap_first}.setBpmStatus("1");
</#if>
${entityName?uncap_first}Service.save(${entityName?uncap_first});
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param ${entityName?uncap_first}
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
if(${entityName?uncap_first}==null) {
return Result.error("未找到对应数据");
}
return Result.OK(${entityName?uncap_first});
}
/**
* 导出excel
*
* @param request
* @param ${entityName?uncap_first}
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ${entityName}.class);
}
}

View File

@ -0,0 +1,116 @@
package ${bussiPackage}.${entityPackage}.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Data
@TableName("${tableName}")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
<#if po.classType='sel_user'>
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
<#elseif po.classType='sel_depart'>
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
<#if po.dictTable?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
</#if>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ASSIGN_ID)
<#else>
<#if po.fieldDbType =='Date'>
<#if po.classType=='date'>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>
<#if list_field_dictCode?length gt 1>
@Dict(${list_field_dictCode?substring(2)})
</#if>
<#-- <#if po.classType!='popup'>
<#if po.dictTable?default("")?trim?length gt 1>
@Dict(dicCode="${po.dictField}",dicText="${po.dictText}",dictTable="${po.dictTable}")
<#elseif po.dictField?default("")?trim?length gt 1>
@Dict(dicCode="${po.dictField}")
</#if>
</#if>-->
</#if>
<#if po.fieldDbType=='Blob'>
private transient java.lang.String ${po.fieldName}String;
private byte[] ${po.fieldName};
public byte[] get${po.fieldName?cap_first}(){
if(${po.fieldName}String==null){
return null;
}
try {
return ${po.fieldName}String.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
public String get${po.fieldName?cap_first}String(){
if(${po.fieldName}==null || ${po.fieldName}.length==0){
return "";
}
try {
return new String(${po.fieldName},"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return "";
}
<#else>
@ApiModelProperty(value = "${po.filedComment}")
private ${po.fieldType} ${po.fieldName};
</#if>
</#list>
}

View File

@ -0,0 +1,17 @@
package ${bussiPackage}.${entityPackage}.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
</mapper>

View File

@ -0,0 +1,14 @@
package ${bussiPackage}.${entityPackage}.service;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface I${entityName}Service extends IService<${entityName}> {
}

View File

@ -0,0 +1,19 @@
package ${bussiPackage}.${entityPackage}.service.impl;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Service
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
}

View File

@ -0,0 +1,512 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<#assign query_field_no=0>
<#assign query_field_select=false>
<#assign query_field_date=false>
<#assign list_need_dict=false>
<#assign list_need_category=false>
<#assign query_field_pca=false>
<#assign list_need_pca=false>
<#assign query_flag=false>
<#assign query_inp=false>
<#assign query_popup=false>
<#assign query_sel_user=false>
<#assign query_sel_dep=false>
<#assign query_sel_multi=false>
<#assign query_sel_cat=false>
<#assign query_sel_search=false>
<#assign query_switch=false>
<#assign list_need_switch=false>
<#assign bpm_flag=false>
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
<#if po.isQuery=='Y'>
<#assign query_flag=true>
<#if query_field_no==2>
<template v-if="toggleSearchStatus">
</#if>
<#assign query_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign query_field_dictCode="${po.dictField}">
</#if>
<#if po.queryMode=='single'>
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
<#if po.classType=='sel_search'>
<#assign query_sel_search=true>
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
<#elseif po.classType=='sel_user'>
<#assign query_sel_user=true>
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='switch'>
<#assign query_switch=true>
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> query></j-switch>
<#elseif po.classType=='sel_depart'>
<#assign query_sel_dep=true>
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='list_multi'>
<#assign query_sel_multi=true>
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='cat_tree'>
<#assign query_sel_cat=true>
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
<#elseif po.classType=='date'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
<#elseif po.classType=='datetime'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
<#elseif po.classType=='pca'>
<#assign query_field_pca=true>
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
<#elseif po.classType=='popup'>
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#assign query_field_select=true>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
<#if po.dictTable?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
<#elseif po.dictField?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
</#if>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
<#else>
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
<#if po.classType=='date'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
<#elseif po.classType=='datetime'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
</#if>
<#assign query_field_no=query_field_no+1>
</#if>
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
<#assign list_need_dict=true>
</#if>
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
<#assign list_need_category=true>
</#if>
<#if po.classType=='pca'>
<#assign list_need_pca=true>
</#if>
<#if po.classType=='switch'>
<#assign list_need_switch=true>
</#if>
</#list>
<#-- 结束循环 -->
<#t>
<#if query_field_no gt 2>
</template>
</#if>
<#if query_flag>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
</a-col>
</#if>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
<#if tableVo.extendParams.scroll=='1'>
:scroll="{x:true}"
</#if>
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<#if list_need_pca>
<template slot="pcaSlot" slot-scope="text">
<div>{{ getPcaText(text) }}</div>
</template>
</#if>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<#if bpm_flag>
<a-menu-item v-if="record.bpmStatus === '1'">
<a @click="startProcess(record)">发起流程</a>
</a-menu-item>
</#if>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"></${Format.humpToShortbar(entityName)}-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ${entityName}Modal from './modules/${entityName}Modal'
<#if bpm_flag>
import { postAction } from '@/api/manage'
</#if>
<#if query_field_select>
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
</#if>
<#if query_field_date>
import JDate from '@/components/jeecg/JDate.vue'
</#if>
<#if list_need_category>
import { loadCategoryData } from '@/api/api'
</#if>
<#if list_need_dict>
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
</#if>
<#if query_field_pca>
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
</#if>
<#if list_need_pca>
import Area from '@/components/_util/Area'
</#if>
<#if query_inp>
import JInput from '@comp/jeecg/JInput'
</#if>
<#if query_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if query_sel_dep>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if query_sel_multi>
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
</#if>
<#if query_sel_cat>
import JCategorySelect from '@comp/jeecg/JCategorySelect'
</#if>
<#if query_sel_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
<#if query_switch>
import JSwitch from '@/components/jeecg/JSwitch'
</#if>
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
export default {
name: '${entityName}List',
mixins:[JeecgListMixin, mixinDevice],
components: {
<#if query_field_select>
JDictSelectTag,
</#if>
<#if query_field_date>
JDate,
</#if>
<#if query_field_pca>
JAreaLinkage,
</#if>
<#if query_inp>
JInput,
</#if>
<#if query_sel_user>
JSelectUserByDep,
</#if>
<#if query_sel_dep>
JSelectDepart,
</#if>
<#if query_sel_multi>
JMultiSelectTag,
</#if>
<#if query_sel_cat>
JCategorySelect,
</#if>
<#if query_sel_search>
JSearchSelectTag,
</#if>
<#if query_switch>
JSwitch,
</#if>
${entityName}Modal,
JSuperQuery,
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
<#assign showColNum=0>
<#list columns as po>
<#if po.isShowList =='Y' && po.fieldName !='id'>
<#assign showColNum=showColNum+1>
{
title:'${po.filedComment}',
align:"center",
<#if po.sort=='Y'>
sorter: true,
</#if>
<#if po.classType=='date'>
dataIndex: '${po.fieldName}',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
<#elseif po.fieldDbType=='Blob'>
dataIndex: '${po.fieldName}String'
<#elseif po.classType=='umeditor'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'htmlSlot'}
<#elseif po.classType=='pca'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'pcaSlot'}
<#elseif po.classType=='file'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'fileSlot'}
<#elseif po.classType=='image'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'imgSlot'}
<#elseif po.classType=='switch'>
dataIndex: '${po.fieldName}',
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : ''),
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
<#if list_need_category>
dataIndex: '${po.fieldName}',
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
<#else>
dataIndex: '${po.fieldName}',
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
</#if>
<#else>
dataIndex: '${po.fieldName}'
</#if>
},
</#if>
</#list>
{
title: '操作',
dataIndex: 'action',
align:"center",
<#if tableVo.extendParams.scroll=='1'>
fixed:"right",
width:147,
</#if>
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
},
<#if bpm_flag>
//代码生成后需手动设置流程编码
flowCode: 'dev_${tableName}_001',
</#if>
dictOptions:{},
<#if list_need_pca>
pcaData:'',
</#if>
superFieldList:[],
}
},
created() {
<#if list_need_pca>
this.pcaData = new Area()
</#if>
<#if list_need_switch>
<#list columns as po>
<#if po.classType=='switch'>
<#if po.dictField?default("")?trim?length gt 1>
<#assign switch_extend_arr=po.dictField?eval>
<#else>
<#assign switch_extend_arr=['Y','N']>
</#if>
<#list switch_extend_arr as a>
<#if a_index == 0>
<#assign switch_extend_arr1=a>
<#else>
<#assign switch_extend_arr2=a>
</#if>
</#list>
this.$set(this.dictOptions, '${po.fieldName}', [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
</#if>
</#list>
</#if>
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
},
},
methods: {
<#if list_need_pca>
getPcaText(code){
return this.pcaData.getText(code);
},
</#if>
<#if bpm_flag>
startProcess(record){
this.$confirm({
title:'提示',
content:'确认提交流程吗?',
onOk:()=>{
let params = {
flowCode: this.flowCode,
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrlMobile: ''
}
postAction(this.url.startProcess, params).then(res=>{
if(res.success){
this.$message.success(res.message);
this.loadData();
this.onClearSelected();
}else{
this.$message.warning(res.message);
}
}).catch((e)=>{
this.$message.warning('不识别的请求!');
})
}
})
},
</#if>
initDictConfig(){
<#list columns as po>
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
<#if po.classType=='cat_tree' && list_need_category==true>
loadCategoryData({code:'${po.dictField?default("")}'}).then((res) => {
if (res.success) {
this.$set(this.dictOptions, '${po.fieldName}', res.result)
}
})
</#if>
</#if>
</#list>
},
getSuperFieldList(){
<#include "/common/utils.ftl">
let fieldList=[];
<#list columns as po>
fieldList.push(${superQueryFieldList(po)})
</#list>
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

View File

@ -0,0 +1,343 @@
<#--<#include "../../../../../../../common/utils.ftl">-->
<#include "/common/utils.ftl">
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form :form="form" slot="detail">
<a-row>
<#assign form_date = false>
<#assign form_select = false>
<#assign form_select_multi = false>
<#assign form_select_search = false>
<#assign form_popup = false>
<#assign form_sel_depart = false>
<#assign form_sel_user = false>
<#assign form_file = false>
<#assign form_image = false>
<#assign form_editor = false>
<#assign form_cat_tree = false>
<#assign form_cat_back = "">
<#assign form_pca = false>
<#assign form_md = false>
<#assign form_switch=false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum==2>
<#assign form_span = 12>
<#elseif tableVo.fieldRowNum==3>
<#assign form_span = 8>
<#elseif tableVo.fieldRowNum==4>
<#assign form_span = 6>
</#if>
<#list columns as po>
<#if po.isShow =='Y' && po.fieldName != 'id'>
<#assign form_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictField}">
</#if>
<a-col :span="${form_span}">
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
<#if po.classType =='date'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='datetime'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='popup'>
<#assign form_popup=true>
<j-popup
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
:trigger-change="true"
org-fields="${po.dictField}"
dest-fields="${Format.underlineToHump(po.dictText)}"
code="${po.dictTable}"
@callback="popupCallback"
<#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi <#if po.readonly=='Y'>disabled</#if> />
<#elseif po.classType =='switch'>
<#assign form_switch=true>
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
<#elseif po.classType =='pca'>
<#assign form_pca=true>
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if> />
<#elseif po.classType =='markdown'>
<#assign form_md=true>
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
<#elseif po.classType =='password'>
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='sel_user'>
<#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='sel_search'>
<#assign form_select_search = true>
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if> />
<#elseif po.classType=='cat_tree'>
<#assign form_cat_tree = true>
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if> <#if po.readonly=='Y'>disabled</#if>/>
<#if po.dictText?default("")?trim?length gt 1>
<#assign form_cat_back = "${po.dictText}">
</#if>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='file'>
<#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
<#elseif po.classType=='image'>
<#assign form_image = true>
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
<#elseif po.classType=='umeditor'>
<#assign form_editor = true>
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.fieldDbType=='Blob'>
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
<#else>
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if> ></a-input>
</#if>
</a-form-item>
</a-col>
</#if>
</#list>
<#if form_cat_tree && form_cat_back?length gt 1>
<a-form-item v-show="false">
<a-input v-decorator="['${form_cat_back}']"></a-input>
</a-form-item>
</#if>
<a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">
<a-button @click="submitForm">提 交</a-button>
</a-col>
</a-row>
</a-form>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
<#if form_date>
import JDate from '@/components/jeecg/JDate'
</#if>
<#if form_file>
import JUpload from '@/components/jeecg/JUpload'
</#if>
<#if form_image>
import JImageUpload from '@/components/jeecg/JImageUpload'
</#if>
<#if form_sel_depart>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if form_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if form_select>
import JDictSelectTag from "@/components/dict/JDictSelectTag"
</#if>
<#if form_select_multi>
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
</#if>
<#if form_select_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
<#if form_editor>
import JEditor from '@/components/jeecg/JEditor'
</#if>
<#if form_cat_tree>
import JCategorySelect from '@/components/jeecg/JCategorySelect'
</#if>
<#if form_pca>
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
</#if>
<#if form_md>
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
</#if>
<#if form_switch==true >
import JSwitch from '@/components/jeecg/JSwitch'
</#if>
export default {
name: '${entityName}Form',
components: {
JFormContainer,
<#if form_date>
JDate,
</#if>
<#if form_file>
JUpload,
</#if>
<#if form_image>
JImageUpload,
</#if>
<#if form_sel_depart>
JSelectDepart,
</#if>
<#if form_sel_user>
JSelectUserByDep,
</#if>
<#if form_select>
JDictSelectTag,
</#if>
<#if form_select_multi>
JMultiSelectTag,
</#if>
<#if form_select_search>
JSearchSelectTag,
</#if>
<#if form_editor>
JEditor,
</#if>
<#if form_pca>
JAreaLinkage,
</#if>
<#if form_cat_tree>
JCategorySelect,
</#if>
<#if form_md>
JMarkdownEditor,
</#if>
<#if form_switch==true >
JSwitch,
</#if>
},
props: {
//流程表单data
formData: {
type: Object,
default: ()=>{},
required: false
},
//表单模式true流程表单 false普通表单
formBpm: {
type: Boolean,
default: false,
required: false
},
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
<#include "/common/validatorRulesTemplate/main.ftl">
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById"
}
}
},
computed: {
formDisabled(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return false
}
return true
}
return this.disabled
},
showFlowSubmitButton(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return true
}
}
return false
}
},
created () {
//如果是流程中表单则需要加载流程表单data
this.showFlowData();
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
})
},
//渲染流程表单数据
showFlowData(){
if(this.formBpm === true){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
}
});
}
},
submitForm () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
console.log("表单提交数据",formData)
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
popupCallback(row){
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
},
<#if form_cat_tree>
handleCategoryChange(value,backObj){
this.form.setFieldsValue(backObj)
}
</#if>
}
}
</script>

View File

@ -0,0 +1,70 @@
<#--<#include "../../../../../../../common/utils.ftl">-->
<#include "/common/utils.ftl">
<#assign modal_width = 800>
<#if tableVo.fieldRowNum==2>
<#assign modal_width = 896>
<#elseif tableVo.fieldRowNum==3>
<#assign modal_width = 1024>
<#elseif tableVo.fieldRowNum==4>
<#assign modal_width = 1280>
</#if>
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></${Format.humpToShortbar(entityName)}-form>
</j-modal>
</template>
<script>
import ${entityName}Form from './${entityName}Form'
export default {
name: '${entityName}Modal',
components: {
${entityName}Form
},
data () {
return {
title:'',
width:${modal_width},
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

View File

@ -0,0 +1,92 @@
<#include "/common/utils.ftl">
<#assign modal_width = 800>
<#if tableVo.fieldRowNum==2>
<#assign modal_width = 896>
<#elseif tableVo.fieldRowNum==3>
<#assign modal_width = 1024>
<#elseif tableVo.fieldRowNum==4>
<#assign modal_width = 1280>
</#if>
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
:visible="visible">
<${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${Format.humpToShortbar(entityName)}-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import ${entityName}Form from './${entityName}Form'
export default {
name: '${entityName}Modal',
components: {
${entityName}Form
},
data () {
return {
title:"操作",
width:${modal_width},
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

View File

@ -0,0 +1,280 @@
package ${bussiPackage}.${entityPackage}.controller;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.vo.${entityName}Page;
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service;
</#list>
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
<#assign bpm_flag=false>
<#list originalColumns as po>
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Api(tags="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller {
@Autowired
private I${entityName}Service ${entityName?uncap_first}Service;
<#list subTables as sub>
@Autowired
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
</#list>
/**
* 分页列表查询
*
* @param ${entityName?uncap_first}
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param ${entityName?uncap_first}Page
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
<#if bpm_flag>
${entityName?uncap_first}.setBpmStatus("1");
</#if>
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param ${entityName?uncap_first}Page
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
${entityName} ${entityName?uncap_first}Entity = ${entityName?uncap_first}Service.getById(${entityName?uncap_first}.getId());
if(${entityName?uncap_first}Entity==null) {
return Result.error("未找到对应数据");
}
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.delMain(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
if(${entityName?uncap_first}==null) {
return Result.error("未找到对应数据");
}
return Result.OK(${entityName?uncap_first});
}
<#list subTables as sub>
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "${sub.ftlDescription}通过主表ID查询")
@ApiOperation(value="${sub.ftlDescription}主表ID查询", notes="${sub.ftlDescription}-通主表ID查询")
@GetMapping(value = "/query${sub.entityName}ByMainId")
public Result<?> query${sub.entityName}ListByMainId(@RequestParam(name="id",required=true) String id) {
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(id);
return Result.OK(${sub.entityName?uncap_first}List);
}
</#list>
/**
* 导出excel
*
* @param request
* @param ${entityName?uncap_first}
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
// Step.1 组装查询条件查询数据
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//Step.2 获取导出数据
List<${entityName}> queryList = ${entityName?uncap_first}Service.list(queryWrapper);
// 过滤选中数据
String selections = request.getParameter("selections");
List<${entityName}> ${entityName?uncap_first}List = new ArrayList<${entityName}>();
if(oConvertUtils.isEmpty(selections)) {
${entityName?uncap_first}List = queryList;
}else {
List<String> selectionList = Arrays.asList(selections.split(","));
${entityName?uncap_first}List = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
}
// Step.3 组装pageList
List<${entityName}Page> pageList = new ArrayList<${entityName}Page>();
for (${entityName} main : ${entityName?uncap_first}List) {
${entityName}Page vo = new ${entityName}Page();
BeanUtils.copyProperties(main, vo);
<#list subTables as sub>
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(main.getId());
vo.set${sub.entityName}List(${sub.entityName?uncap_first}List);
</#list>
pageList.add(vo);
}
// Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<${entityName}Page> list = ExcelImportUtil.importExcel(file.getInputStream(), ${entityName}Page.class, params);
for (${entityName}Page page : list) {
${entityName} po = new ${entityName}();
BeanUtils.copyProperties(page, po);
${entityName?uncap_first}Service.saveMain(po, <#list subTables as sub>page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.OK("文件导入失败!");
}
}

View File

@ -0,0 +1,103 @@
package ${bussiPackage}.${entityPackage}.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
@Data
@TableName("${tableName}")
public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
<#if po.classType='sel_user'>
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
<#elseif po.classType='sel_depart'>
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
<#if po.dictTable?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
</#if>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ASSIGN_ID)
<#else>
<#if po.fieldDbType =='Date'>
<#if po.classType=='date'>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>
<#if list_field_dictCode?length gt 1>
@Dict(${list_field_dictCode?substring(2)})
</#if>
</#if>
<#if po.fieldDbType=='Blob'>
private transient java.lang.String ${po.fieldName}String;
private byte[] ${po.fieldName};
public byte[] get${po.fieldName?cap_first}(){
if(${po.fieldName}String==null){
return null;
}
try {
return ${po.fieldName}String.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
public String get${po.fieldName?cap_first}String(){
if(${po.fieldName}==null || ${po.fieldName}.length==0){
return "";
}
try {
return new String(${po.fieldName},"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return "";
}
<#else>
@ApiModelProperty(value = "${po.filedComment}")
private ${po.fieldType} ${po.fieldName};
</#if>
</#list>
}

View File

@ -0,0 +1,72 @@
<#list subTables as subTab>
#segment#${subTab.entityName}.java
package ${bussiPackage}.${entityPackage}.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
@Data
@TableName("${subTab.tableName}")
public class ${subTab.entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#list subTab.originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
<#if po.classType='sel_user'>
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
<#elseif po.classType='sel_depart'>
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
<#if po.dictTable?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
</#if>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ASSIGN_ID)
<#else>
<#if po.fieldDbType =='Date'>
<#if po.classType=='date'>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>
</#if>
@ApiModelProperty(value = "${po.filedComment}")
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
</#list>
}
</#list>

View File

@ -0,0 +1,17 @@
package ${bussiPackage}.${entityPackage}.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
}

View File

@ -0,0 +1,22 @@
<#list subTables as subTab>
#segment#${subTab.entityName}Mapper.java
package ${bussiPackage}.${entityPackage}.mapper;
import java.util.List;
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> {
public boolean deleteByMainId(@Param("mainId") String mainId);
public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId);
}
</#list>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
</mapper>

View File

@ -0,0 +1,26 @@
<#list subTables as subTab>
<#assign originalForeignKeys = subTab.originalForeignKeys>
#segment#${subTab.entityName}Mapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM ${subTab.tableName}
WHERE
<#list originalForeignKeys as key>
${key} = ${r'#'}{mainId} <#rt/>
</#list>
</delete>
<select id="selectByMainId" parameterType="java.lang.String" resultType="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
SELECT *
FROM ${subTab.tableName}
WHERE
<#list originalForeignKeys as key>
${key} = ${r'#'}{mainId} <#rt/>
</#list>
</select>
</mapper>
</#list>

View File

@ -0,0 +1,42 @@
package ${bussiPackage}.${entityPackage}.service;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface I${entityName}Service extends IService<${entityName}> {
/**
* 添加一对多
*
*/
public void saveMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) ;
/**
* 修改一对多
*
*/
public void updateMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>);
/**
* 删除一对多
*/
public void delMain (String id);
/**
* 批量删除一对多
*/
public void delBatchMain (Collection<? extends Serializable> idList);
}

View File

@ -0,0 +1,19 @@
<#list subTables as subTab>
#segment#I${subTab.entityName}Service.java
package ${bussiPackage}.${entityPackage}.service;
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> {
public List<${subTab.entityName}> selectByMainId(String mainId);
}
</#list>

View File

@ -0,0 +1,105 @@
package ${bussiPackage}.${entityPackage}.service.impl;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.mapper.${sub.entityName}Mapper;
</#list>
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Service
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
@Autowired
private ${entityName}Mapper ${entityName?uncap_first}Mapper;
<#list subTables as sub>
@Autowired
private ${sub.entityName}Mapper ${sub.entityName?uncap_first}Mapper;
</#list>
@Override
@Transactional
public void saveMain(${entityName} ${entityName?uncap_first}, <#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) {
${entityName?uncap_first}Mapper.insert(${entityName?uncap_first});
<#list subTables as sub>
if(${sub.entityName?uncap_first}List!=null && ${sub.entityName?uncap_first}List.size()>0) {
for(${sub.entityName} entity:${sub.entityName?uncap_first}List) {
<#list sub.foreignKeys as key>
//外键设置
<#if key?lower_case?index_of("${primaryKeyField}")!=-1>
entity.set${key?cap_first}(${entityName?uncap_first}.get${primaryKeyField?cap_first}());
<#else>
entity.set${key?cap_first}(${entityName?uncap_first}.get${key}());
</#if>
</#list>
${sub.entityName?uncap_first}Mapper.insert(entity);
}
}
</#list>
}
@Override
@Transactional
public void updateMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) {
${entityName?uncap_first}Mapper.updateById(${entityName?uncap_first});
//1.先删除子表数据
<#list subTables as sub>
${sub.entityName?uncap_first}Mapper.deleteByMainId(${entityName?uncap_first}.getId());
</#list>
//2.子表数据重新插入
<#list subTables as sub>
if(${sub.entityName?uncap_first}List!=null && ${sub.entityName?uncap_first}List.size()>0) {
for(${sub.entityName} entity:${sub.entityName?uncap_first}List) {
<#list sub.foreignKeys as key>
//外键设置
<#if key?lower_case?index_of("${primaryKeyField}")!=-1>
entity.set${key?cap_first}(${entityName?uncap_first}.get${primaryKeyField?cap_first}());
<#else>
entity.set${key?cap_first}(${entityName?uncap_first}.get${key}());
</#if>
</#list>
${sub.entityName?uncap_first}Mapper.insert(entity);
}
}
</#list>
}
@Override
@Transactional
public void delMain(String id) {
<#list subTables as sub>
${sub.entityName?uncap_first}Mapper.deleteByMainId(id);
</#list>
${entityName?uncap_first}Mapper.deleteById(id);
}
@Override
@Transactional
public void delBatchMain(Collection<? extends Serializable> idList) {
for(Serializable id:idList) {
<#list subTables as sub>
${sub.entityName?uncap_first}Mapper.deleteByMainId(id.toString());
</#list>
${entityName?uncap_first}Mapper.deleteById(id);
}
}
}

View File

@ -0,0 +1,30 @@
<#list subTables as subTab>
#segment#${subTab.entityName}ServiceImpl.java
package ${bussiPackage}.${entityPackage}.service.impl;
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
import ${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper;
import ${bussiPackage}.${entityPackage}.service.I${subTab.entityName}Service;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Service
public class ${subTab.entityName}ServiceImpl extends ServiceImpl<${subTab.entityName}Mapper, ${subTab.entityName}> implements I${subTab.entityName}Service {
@Autowired
private ${subTab.entityName}Mapper ${subTab.entityName?uncap_first}Mapper;
@Override
public List<${subTab.entityName}> selectByMainId(String mainId) {
return ${subTab.entityName?uncap_first}Mapper.selectByMainId(mainId);
}
}
</#list>

View File

@ -0,0 +1,80 @@
package ${bussiPackage}.${entityPackage}.vo;
import java.util.List;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Data
@ApiModel(value="${tableName}Page对象", description="${tableVo.ftlDescription}")
public class ${entityName}Page {
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
<#if po.classType='sel_user'>
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
<#elseif po.classType='sel_depart'>
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
<#if po.dictTable?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
</#if>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
<#else>
<#if po.fieldDbType =='Date'>
<#if po.classType=='date'>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>
<#if list_field_dictCode?length gt 1>
@Dict(${list_field_dictCode?substring(2)})
</#if>
</#if>
@ApiModelProperty(value = "${po.filedComment}")
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
</#list>
<#list subTables as sub>
@ExcelCollection(name="${sub.ftlDescription}")
@ApiModelProperty(value = "${sub.ftlDescription}")
private List<${sub.entityName}> ${sub.entityName?uncap_first}List;
</#list>
}

View File

@ -0,0 +1,474 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<#assign query_field_no=0>
<#assign query_field_select=false>
<#assign query_field_date=false>
<#assign list_need_dict=false>
<#assign list_need_category=false>
<#assign query_field_pca=false>
<#assign list_need_pca=false>
<#assign query_flag=false>
<#assign query_inp=false>
<#assign query_popup=false>
<#assign query_sel_user=false>
<#assign query_sel_dep=false>
<#assign query_sel_multi=false>
<#assign query_sel_cat=false>
<#assign query_sel_search=false>
<#assign bpm_flag=false>
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
<#if po.isQuery=='Y'>
<#assign query_flag=true>
<#if query_field_no==2>
<template v-if="toggleSearchStatus">
</#if>
<#assign query_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign query_field_dictCode="${po.dictField}">
</#if>
<#if po.queryMode=='single'>
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
<#if po.classType=='sel_search'>
<#assign query_sel_search=true>
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
<#elseif po.classType=='sel_user'>
<#assign query_sel_user=true>
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='sel_depart'>
<#assign query_sel_dep=true>
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='list_multi'>
<#assign query_sel_multi=true>
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='cat_tree'>
<#assign query_sel_cat=true>
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
<#elseif po.classType=='date'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
<#elseif po.classType=='datetime'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
<#elseif po.classType=='pca'>
<#assign query_field_pca=true>
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
<#elseif po.classType=='popup'>
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#assign query_field_select=true>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
<#if po.dictTable?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
<#elseif po.dictField?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
</#if>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
<#else>
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
<#if po.classType=='date'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
<#elseif po.classType=='datetime'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
</#if>
<#assign query_field_no=query_field_no+1>
</#if>
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
<#assign list_need_dict=true>
</#if>
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
<#assign list_need_category=true>
</#if>
<#if po.classType=='pca'>
<#assign list_need_pca=true>
</#if>
</#list>
<#-- 结束循环 -->
<#t>
<#if query_field_no gt 2>
</template>
</#if>
<#if query_flag>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
</a-col>
</#if>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
class="j-table-force-nowrap"
:scroll="{x:true}"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<#if list_need_pca>
<template slot="pcaSlot" slot-scope="text">
<div>{{ getPcaText(text) }}</div>
</template>
</#if>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<#if bpm_flag>
<a-menu-item v-if="record.bpmStatus === '1'">
<a @click="startProcess(record)">发起流程</a>
</a-menu-item>
</#if>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"/>
</a-card>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ${entityName}Modal from './modules/${entityName}Modal'
<#if query_field_select>
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
</#if>
<#if query_field_date>
import JDate from '@/components/jeecg/JDate.vue'
</#if>
<#if list_need_category>
import { loadCategoryData } from '@/api/api'
</#if>
<#if list_need_dict>
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
</#if>
<#if query_field_pca>
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
</#if>
<#if list_need_pca>
import Area from '@/components/_util/Area'
</#if>
<#if query_inp>
import JInput from '@comp/jeecg/JInput'
</#if>
<#if query_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if query_sel_dep>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if query_sel_multi>
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
</#if>
<#if query_sel_cat>
import JCategorySelect from '@comp/jeecg/JCategorySelect'
</#if>
<#if query_sel_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
import '@/assets/less/TableExpand.less'
<#if bpm_flag>
import { postAction } from '@/api/manage'
</#if>
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
export default {
name: "${entityName}List",
mixins:[JeecgListMixin],
components: {
<#if query_field_select>
JDictSelectTag,
</#if>
<#if query_field_date>
JDate,
</#if>
<#if query_field_pca>
JAreaLinkage,
</#if>
<#if query_inp>
JInput,
</#if>
<#if query_sel_user>
JSelectUserByDep,
</#if>
<#if query_sel_dep>
JSelectDepart,
</#if>
<#if query_sel_multi>
JMultiSelectTag,
</#if>
<#if query_sel_cat>
JCategorySelect,
</#if>
<#if query_sel_search>
JSearchSelectTag,
</#if>
${entityName}Modal,
JSuperQuery
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
<#assign showColNum=0>
<#list columns as po>
<#if po.isShowList =='Y'>
<#assign showColNum=showColNum+1>
{
title:'${po.filedComment}',
align:"center",
<#if po.sort=='Y'>
sorter: true,
</#if>
<#if po.classType=='date'>
dataIndex: '${po.fieldName}',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
<#elseif po.fieldDbType=='Blob'>
dataIndex: '${po.fieldName}String'
<#elseif po.classType=='umeditor'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'htmlSlot'}
<#elseif po.classType=='file'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'fileSlot'}
<#elseif po.classType=='pca'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'pcaSlot'}
<#elseif po.classType=='image'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'imgSlot'}
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
<#if list_need_category>
dataIndex: '${po.fieldName}',
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
<#else>
dataIndex: '${po.fieldName}',
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
</#if>
<#elseif po.classType=='switch'>
dataIndex: '${po.fieldName}',
<#if po.dictField?default("")?trim?length gt 1>
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
<#else>
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
</#if>
<#else>
dataIndex: '${po.fieldName}'
</#if>
},
</#if>
</#list>
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' },
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
},
<#if bpm_flag>
flowCode: 'dev_${tableName}_001',
</#if>
dictOptions:{},
superFieldList:[],
}
},
created() {
<#if list_need_pca>
this.pcaData = new Area()
</#if>
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
}
},
methods: {
<#if list_need_pca>
getPcaText(code){
return this.pcaData.getText(code);
},
</#if>
initDictConfig(){
<#list columns as po>
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
<#if po.classType=='cat_tree' && list_need_category==true>
loadCategoryData({code:"${po.dictField?default('')}"}).then((res) => {
if (res.success) {
this.$set(this.dictOptions, '${po.fieldName}', res.result)
}
})
</#if>
</#if>
</#list>
},
<#if bpm_flag>
startProcess(record){
this.$confirm({
title:'提示',
content:'确认提交流程吗?',
onOk:()=>{
let params = {
flowCode: this.flowCode,
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrlMobile: ''
}
postAction(this.url.startProcess, params).then(res=>{
if(res.success){
this.$message.success(res.message);
this.loadData();
this.onClearSelected();
}else{
this.$message.warning(res.message);
}
}).catch((e)=>{
this.$message.warning('不识别的请求!');
})
}
})
},
</#if>
getSuperFieldList(){
<#include "/common/utils.ftl">
let fieldList=[];
<#list columns as po>
fieldList.push(${superQueryFieldList(po)})
</#list>
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

View File

@ -0,0 +1,598 @@
<#include "/common/utils.ftl">
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<!-- 主表单区域 -->
<a-form :form="form" slot="detail">
<a-row>
<#assign form_date = false>
<#assign form_select = false>
<#assign form_select_multi = false>
<#assign form_select_search = false>
<#assign form_popup = false>
<#assign form_sel_depart = false>
<#assign form_sel_user = false>
<#assign form_file = false>
<#assign form_image = false>
<#assign form_editor = false>
<#assign form_cat_tree = false>
<#assign form_cat_back = "">
<#assign form_pca = false>
<#assign form_md = false>
<#assign form_switch=false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum==2>
<#assign form_span = 12>
<#elseif tableVo.fieldRowNum==3>
<#assign form_span = 8>
<#elseif tableVo.fieldRowNum==4>
<#assign form_span = 6>
</#if>
<#list columns as po>
<#if po.isShow =='Y' && po.fieldName != 'id'>
<#assign form_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictField}">
</#if>
<#if po.classType =='textarea'>
<a-col :span="24">
<a-form-item label="${po.filedComment}" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<#else>
<a-col :span="${form_span}" >
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
</#if>
<#if po.classType =='date'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='datetime'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='popup'>
<#assign form_popup=true>
<j-popup
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
:trigger-change="true"
org-fields="${po.dictField}"
dest-fields="${Format.underlineToHump(po.dictText)}"
code="${po.dictTable}"
@callback="popupCallback"
<#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='switch'>
<#assign form_switch=true>
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
<#elseif po.classType =='pca'>
<#assign form_pca=true>
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='markdown'>
<#assign form_md=true>
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
<#elseif po.classType =='password'>
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='sel_user'>
<#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='sel_search'>
<#assign form_select_search = true>
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if> />
<#elseif po.classType=='cat_tree'>
<#assign form_cat_tree = true>
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if> <#if po.readonly=='Y'>disabled</#if>/>
<#if po.dictText?default("")?trim?length gt 1>
<#assign form_cat_back = "${po.dictText}">
</#if>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='file'>
<#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
<#elseif po.classType=='image'>
<#assign form_image = true>
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
<#elseif po.classType=='umeditor'>
<#assign form_editor = true>
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.fieldDbType=='Blob'>
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
<#else>
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
</#if>
</a-form-item>
<#if form_cat_tree && form_cat_back?length gt 1>
<a-form-item v-show="false">
<a-input v-decorator="['${form_cat_back}']"></a-input>
</a-form-item>
</#if>
</a-col>
</#if>
</#list>
</a-row>
</a-form>
</j-form-container>
<!-- 子表单区域 -->
<a-tabs v-model="activeKey" @change="handleChangeTabs">
<#list subTables as sub><#rt/>
<#if sub.foreignRelationType =='1'>
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
<${Format.humpToShortbar(sub.entityName)}-form ref="${sub.entityName?uncap_first}Form" @validateError="validateError" :disabled="formDisabled"></${Format.humpToShortbar(sub.entityName)}-form>
</a-tab-pane>
<#else>
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
<j-editable-table
:ref="refKeys[${sub_index}]"
:loading="${sub.entityName?uncap_first}Table.loading"
:columns="${sub.entityName?uncap_first}Table.columns"
:dataSource="${sub.entityName?uncap_first}Table.dataSource"
:maxHeight="300"
:disabled="formDisabled"
:rowNumber="true"
:rowSelection="true"
:actionButton="true"/>
</a-tab-pane>
</#if>
</#list>
</a-tabs>
</a-spin>
</template>
<script>
import pick from 'lodash.pick'
import { getAction } from '@/api/manage'
import { FormTypes,getRefPromise } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
<#list subTables as sub>
<#if sub.foreignRelationType =='1'>
import ${sub.entityName}Form from './${sub.entityName}Form.vue'
</#if>
</#list>
<#if form_date>
import JDate from '@/components/jeecg/JDate'
</#if>
<#if form_file>
import JUpload from '@/components/jeecg/JUpload'
</#if>
<#if form_image>
import JImageUpload from '@/components/jeecg/JImageUpload'
</#if>
<#if form_sel_depart>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if form_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if form_select>
import JDictSelectTag from "@/components/dict/JDictSelectTag"
</#if>
<#if form_select_multi>
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
</#if>
<#if form_select_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
<#if form_editor>
import JEditor from '@/components/jeecg/JEditor'
</#if>
<#if form_cat_tree>
import JCategorySelect from '@/components/jeecg/JCategorySelect'
</#if>
<#if form_pca>
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
</#if>
<#if form_md>
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
</#if>
<#if form_switch==true >
import JSwitch from '@/components/jeecg/JSwitch'
</#if>
export default {
name: '${entityName}Form',
mixins: [JEditableTableMixin],
components: {
JFormContainer,
<#list subTables as sub>
<#if sub.foreignRelationType =='1'>
${sub.entityName}Form,
</#if>
</#list>
<#if form_date>
JDate,
</#if>
<#if form_file>
JUpload,
</#if>
<#if form_image>
JImageUpload,
</#if>
<#if form_sel_depart>
JSelectDepart,
</#if>
<#if form_sel_user>
JSelectUserByDep,
</#if>
<#if form_select>
JDictSelectTag,
</#if>
<#if form_select_multi>
JMultiSelectTag,
</#if>
<#if form_select_search>
JSearchSelectTag,
</#if>
<#if form_editor>
JEditor,
</#if>
<#if form_pca>
JAreaLinkage,
</#if>
<#if form_cat_tree>
JCategorySelect,
</#if>
<#if form_md>
JMarkdownEditor,
</#if>
<#if form_switch==true >
JSwitch,
</#if>
},
data() {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
labelCol2: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol2: {
xs: { span: 24 },
sm: { span: 20 },
},
// 新增时子表默认添加几行空数据
addDefaultRowNum: 1,
<#include "/common/validatorRulesTemplate/main.ftl">
refKeys: [<#list subTables as sub>'${sub.entityName?uncap_first}', </#list>],
<#assign hasOne2Many = false>
tableKeys:[<#list subTables as sub><#if sub.foreignRelationType =='0'>'${sub.entityName?uncap_first}', <#assign hasOne2Many = true></#if></#list>],
activeKey: '${subTables[0].entityName?uncap_first}',
<#list subTables as sub><#rt/>
// ${sub.ftlDescription}
${sub.entityName?uncap_first}Table: {
loading: false,
dataSource: [],
columns: [
<#if sub.foreignRelationType =='0'>
<#assign popupBackFields = "">
<#-- 循环子表的列 开始 -->
<#list sub.colums as col><#rt/>
<#if col.isShow =='Y'>
<#if col.filedComment !='外键' >
{
title: '${col.filedComment}',
key: '${col.fieldName}',
<#if col.classType =='date'>
type: FormTypes.date,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='datetime'>
type: FormTypes.datetime,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif "int,decimal,double,"?contains(col.classType)>
type: FormTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='list' || col.classType =='radio'>
type: FormTypes.select,
<#if col.dictTable?default("")?trim?length gt 1>
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
<#else>
dictCode:"${col.dictField}",
</#if>
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='list_multi' || col.classType =='checkbox'>
type: FormTypes.list_multi,
<#if col.dictTable?default("")?trim?length gt 1>
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
<#else>
dictCode:"${col.dictField}",
</#if>
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='switch'>
type: FormTypes.checkbox,
<#if col.dictField?default("")?trim?length gt 1>
customValue:${col.dictField},
<#else>
customValue: ['Y', 'N'],
</#if>
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='sel_search'>
type: FormTypes.sel_search,
<#if col.dictTable?default("")?trim?length gt 1>
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
<#else>
dictCode:"${col.dictField}",
</#if>
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='image'>
type: FormTypes.image,
token:true,
responseName:"message",
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#if col.uploadnum??>
number: ${col.uploadnum},
</#if>
<#elseif col.classType =='file'>
type: FormTypes.file,
token:true,
responseName:"message",
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#if col.uploadnum??>
number: ${col.uploadnum},
</#if>
<#elseif col.classType =='popup'>
<#if popupBackFields?length gt 0>
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">
<#else>
<#assign popupBackFields = "${col.dictText}">
</#if>
type: FormTypes.popup,
popupCode:"${col.dictTable}",
destFields:"${Format.underlineToHump(col.dictText)}",
orgFields:"${col.dictField}",
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
type: FormTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#else>
type: FormTypes.input,
<#if col.readonly=='Y'>
disabled:true,
</#if>
</#if>
<#if col.classType =='list_multi' || col.classType =='checkbox'>
width:"250px",
<#else>
width:"200px",
</#if>
<#if col.classType =='file'>
placeholder: '请选择文件',
<#else>
placeholder: '请输入${'$'}{title}',
</#if>
<#if col.defaultVal??>
<#if col.fieldDbType=="BigDecimal" || col.fieldDbType=="double" || col.fieldDbType=="int">
defaultValue:${col.defaultVal},
<#else>
defaultValue:"${col.defaultVal}",
</#if>
<#else>
defaultValue:'',
</#if>
<#-- 子表的校验 -->
<#assign subFieldValidType = col.fieldValidType!''>
<#-- 非空校验 -->
<#if col.nullable == 'N' || subFieldValidType == '*'>
validateRules: [{ required: true, message: '${'$'}{title}不能为空' }],
<#-- 其他情况下,只要有值就被认为是正则校验 -->
<#elseif subFieldValidType?length gt 0>
<#assign subMessage = '格式不正确'>
<#if subFieldValidType == 'only' >
<#assign subMessage = '不能重复'>
</#if>
validateRules: [{ pattern: "${subFieldValidType}", message: "${'$'}{title}${subMessage}" }],
</#if>
},
</#if>
</#if>
</#list>
<#-- 循环子表的列 结束 -->
<#-- 处理popup的隐藏列 -->
<#if popupBackFields?length gt 0>
<#list popupBackFields?split(",") as item>
<#if item?length gt 0>
<#assign tempItemFlag = true>
<#list sub.colums as col>
<#if col.isShow =='Y' && col.fieldName == item>
<#assign tempItemFlag = false>
</#if>
</#list>
<#if tempItemFlag>
{
title: '${item}',
key: '${item}',
type:"hidden"
},
</#if>
</#if>
</#list>
</#if>
</#if>
]
},
</#list>
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById",
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}: {
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
},
</#list>
}
}
},
props: {
//流程表单data
formData: {
type: Object,
default: ()=>{},
required: false
},
//表单模式false流程表单 true普通表单
formBpm: {
type: Boolean,
default: false,
required: false
},
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
computed: {
formDisabled(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return false
}
return true
}
return this.disabled
},
showFlowSubmitButton(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return true
}
}
return false
}
},
created () {
//如果是流程中表单则需要加载流程表单data
this.showFlowData();
},
methods: {
addBefore(){
this.form.resetFields()
<#list subTables as sub><#rt/>
<#if sub.foreignRelationType =='1'>
this.$refs.${sub.entityName?uncap_first}Form.clearFormData()
<#else>
this.${sub.entityName?uncap_first}Table.dataSource=[]
</#if>
</#list>
},
getAllTable() {
<#if hasOne2Many==true>
let values = this.tableKeys.map(key => getRefPromise(this, key))
return Promise.all(values)
<#else>
return new Promise(resolve => {
resolve([]);
})
</#if>
},
/** 调用完edit()方法之后会自动调用此方法 */
editAfter() {
let fieldval = pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>)
this.$nextTick(() => {
this.form.setFieldsValue(fieldval)
<#list subTables as sub><#rt/>
<#if sub.foreignRelationType =='1'>
this.$refs.${sub.entityName?uncap_first}Form.initFormData(this.url.${sub.entityName?uncap_first}.list,this.model.id)
</#if>
</#list>
})
// 加载子表数据
if (this.model.id) {
let params = { id: this.model.id }
<#list subTables as sub><#rt/>
<#if sub.foreignRelationType =='0'>
this.requestSubTableData(this.url.${sub.entityName?uncap_first}.list, params, this.${sub.entityName?uncap_first}Table)
</#if>
</#list>
}
},
/** 整理成formData */
classifyIntoFormData(allValues) {
let main = Object.assign(this.model, allValues.formValue)
return {
...main, // 展开
<#assign subManyIndex = 0>
<#list subTables as sub><#rt/>
<#if sub.foreignRelationType =='0'>
${sub.entityName?uncap_first}List: allValues.tablesValue[${subManyIndex}].values,
<#assign subManyIndex = subManyIndex+1>
<#else>
${sub.entityName?uncap_first}List: this.$refs.${sub.entityName?uncap_first}Form.getFormData(),
</#if>
</#list>
}
},
//渲染流程表单数据
showFlowData(){
if(this.formBpm === true){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
}
})
}
},
validateError(msg){
this.$message.error(msg)
},
popupCallback(row){
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
},
<#if form_cat_tree>
handleCategoryChange(value,backObj){
this.form.setFieldsValue(backObj)
}
</#if>
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,65 @@
<#include "/common/utils.ftl">
<template>
<j-modal
:title="title"
:width="1200"
:visible="visible"
:maskClosable="false"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel">
<${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
</j-modal>
</template>
<script>
import ${entityName}Form from './${entityName}Form'
export default {
name: '${entityName}Modal',
components: {
${entityName}Form
},
data() {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods:{
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.handleOk();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,306 @@
<#include "/common/utils.ftl">
<#list subTables as sub>
<#if sub.foreignRelationType=='1'>
#segment#${sub.entityName}Form.vue
<template>
<j-form-container :disabled="disabled">
<a-form :form="form" slot="detail">
<a-row>
<#assign form_date = false>
<#assign form_select = false>
<#assign form_select_multi = false>
<#assign form_select_search = false>
<#assign form_popup = false>
<#assign form_sel_depart = false>
<#assign form_sel_user = false>
<#assign form_file = false>
<#assign form_image = false>
<#assign form_editor = false>
<#assign form_cat_tree = false>
<#assign form_cat_back = "">
<#assign form_pca = false>
<#assign form_md = false>
<#assign form_switch=false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum == 2>
<#assign form_span = 12>
<#elseif tableVo.fieldRowNum==3>
<#assign form_span = 8>
<#elseif tableVo.fieldRowNum==4>
<#assign form_span = 6>
</#if>
<#list sub.colums as po>
<#if po.isShow =='Y' && po.fieldName != 'id'>
<#assign form_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictField}">
</#if>
<#if po.classType =='textarea'>
<a-col :span="24">
<a-form-item label="${po.filedComment}" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<#else>
<a-col :span="${form_span}">
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
</#if>
<#if po.classType =='date'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
<#elseif po.classType =='datetime'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
<#elseif po.classType =='popup'>
<#assign form_popup=true>
<j-popup
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
:trigger-change="true"
org-fields="${po.dictField}"
dest-fields="${Format.underlineToHump(po.dictText)}"
code="${po.dictTable}"
@callback="popupCallback"/>
<#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
<#elseif po.classType =='switch'>
<#assign form_switch=true>
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
<#elseif po.classType =='pca'>
<#assign form_pca=true>
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
<#elseif po.classType =='markdown'>
<#assign form_md=true>
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
<#elseif po.classType =='password'>
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
<#elseif po.classType =='sel_user'>
<#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
<#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
<#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
<#elseif po.classType=='sel_search'>
<#assign form_select_search = true>
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
<#elseif po.classType=='cat_tree'>
<#assign form_cat_tree = true>
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
<#if po.dictText?default("")?trim?length gt 1>
<#assign form_cat_back = "${po.dictText}">
</#if>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
<#elseif po.classType=='file'>
<#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
<#elseif po.classType=='image'>
<#assign form_image = true>
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
<#elseif po.classType=='umeditor'>
<#assign form_editor = true>
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
<#elseif po.fieldDbType=='Blob'>
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
<#else>
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
</#if>
</a-form-item>
<#if form_cat_tree && form_cat_back?length gt 1>
<a-form-item v-show="false">
<a-input v-decorator="['${form_cat_back}']"></a-input>
</a-form-item>
</#if>
</a-col>
</#if>
</#list>
</a-row>
</a-form>
</j-form-container>
</template>
<script>
import pick from 'lodash.pick'
import { getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
<#if form_date>
import JDate from '@/components/jeecg/JDate'
</#if>
<#if form_file>
import JUpload from '@/components/jeecg/JUpload'
</#if>
<#if form_image>
import JImageUpload from '@/components/jeecg/JImageUpload'
</#if>
<#if form_sel_depart>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if form_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if form_select>
import JDictSelectTag from "@/components/dict/JDictSelectTag"
</#if>
<#if form_select_multi>
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
</#if>
<#if form_select_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
<#if form_editor>
import JEditor from '@/components/jeecg/JEditor'
</#if>
<#if form_cat_tree>
import JCategorySelect from '@/components/jeecg/JCategorySelect'
</#if>
<#if form_pca>
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
</#if>
<#if form_md>
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
</#if>
<#if form_switch==true >
import JSwitch from '@/components/jeecg/JSwitch'
</#if>
export default {
name: '${sub.entityName}Form',
components: {
JFormContainer,
<#if form_date>
JDate,
</#if>
<#if form_file>
JUpload,
</#if>
<#if form_image>
JImageUpload,
</#if>
<#if form_sel_depart>
JSelectDepart,
</#if>
<#if form_sel_user>
JSelectUserByDep,
</#if>
<#if form_select>
JDictSelectTag,
</#if>
<#if form_select_multi>
JMultiSelectTag,
</#if>
<#if form_select_search>
JSearchSelectTag,
</#if>
<#if form_editor>
JEditor,
</#if>
<#if form_pca>
JAreaLinkage,
</#if>
<#if form_cat_tree>
JCategorySelect,
</#if>
<#if form_md>
JMarkdownEditor,
</#if>
<#if form_switch==true >
JSwitch,
</#if>
},
props:{
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
labelCol2: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol2: {
xs: { span: 24 },
sm: { span: 20 },
},
<#include "/common/validatorRulesTemplate/sub.ftl">
confirmLoading: false,
}
},
methods:{
initFormData(url,id){
this.clearFormData()
if(!id){
this.edit({})
}else{
getAction(url,{id:id}).then(res=>{
if(res.success){
let records = res.result
if(records && records.length>0){
this.edit(records[0])
}
}
})
}
},
edit(record){
this.model = Object.assign({}, record)
console.log("${sub.entityName}Form-edit",this.model);
let fieldval = pick(this.model<#list sub.colums as po><#if po.fieldName !='id'>,'${po.fieldName}'</#if></#list>)
this.$nextTick(() => {
this.form.setFieldsValue(fieldval)
})
},
getFormData(){
let formdata_arr = []
this.form.validateFields((err, values) => {
if (!err) {
let formdata = Object.assign(this.model, values)
let isNullObj = true
Object.keys(formdata).forEach(key=>{
if(formdata[key]){
isNullObj = false
}
})
if(!isNullObj){
formdata_arr.push(formdata)
}
}else{
this.$emit("validateError","${sub.ftlDescription}表单校验未通过");
}
})
console.log("${sub.ftlDescription}表单数据集",formdata_arr);
return formdata_arr;
},
popupCallback(row){
this.form.setFieldsValue(pick(row<#list sub.colums as po><#if po.fieldName !='id'>,'${po.fieldName}'</#if></#list>))
},
clearFormData(){
this.form.resetFields()
this.model={}
},
<#if form_cat_tree>
handleCategoryChange(value,backObj){
this.form.setFieldsValue(backObj);
}
</#if>
}
}
</script>
</#if>
</#list>

View File

@ -0,0 +1,235 @@
package ${bussiPackage}.${entityPackage}.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
<#assign pidFieldName = "">
<#list originalColumns as po>
<#if po.fieldDbName == tableVo.extendParams.pidField>
<#assign pidFieldName = po.fieldName>
</#if>
</#list>
@Api(tags="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service>{
@Autowired
private I${entityName}Service ${entityName?uncap_first}Service;
/**
* 分页列表查询
*
* @param ${entityName?uncap_first}
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/rootList")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
String hasQuery = req.getParameter("hasQuery");
if(hasQuery != null && "true".equals(hasQuery)){
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
List<${entityName}> list = ${entityName?uncap_first}Service.queryTreeListNoPage(queryWrapper);
IPage<${entityName}> pageList = new Page<>(1, 10, list.size());
pageList.setRecords(list);
return Result.OK(pageList);
}else{
String parentId = ${entityName?uncap_first}.get${pidFieldName?cap_first}();
if (oConvertUtils.isEmpty(parentId)) {
parentId = "0";
}
${entityName?uncap_first}.set${pidFieldName?cap_first}(null);
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
// 使用 eq 防止模糊查询
queryWrapper.eq("${Format.humpToUnderline(pidFieldName)}", parentId);
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);
}
}
/**
* 获取子数据
* @param ${entityName?uncap_first}
* @param req
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-获取子数据")
@ApiOperation(value="${tableVo.ftlDescription}-获取子数据", notes="${tableVo.ftlDescription}-获取子数据")
@GetMapping(value = "/childList")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
List<${entityName}> list = ${entityName?uncap_first}Service.list(queryWrapper);
IPage<${entityName}> pageList = new Page<>(1, 10, list.size());
pageList.setRecords(list);
return Result.OK(pageList);
}
/**
* 批量查询子节点
* @param parentIds 父ID多个采用半角逗号分割
* @return 返回 IPage
* @param parentIds
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量获取子数据")
@ApiOperation(value="${tableVo.ftlDescription}-批量获取子数据", notes="${tableVo.ftlDescription}-批量获取子数据")
@GetMapping("/getChildListBatch")
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
try {
QueryWrapper<${entityName}> queryWrapper = new QueryWrapper<>();
List<String> parentIdList = Arrays.asList(parentIds.split(","));
queryWrapper.in("${Format.humpToUnderline(pidFieldName)}", parentIdList);
List<${entityName}> list = ${entityName?uncap_first}Service.list(queryWrapper);
IPage<${entityName}> pageList = new Page<>(1, 10, list.size());
pageList.setRecords(list);
return Result.OK(pageList);
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error("批量查询子节点失败:" + e.getMessage());
}
}
/**
* 添加
*
* @param ${entityName?uncap_first}
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.add${entityName}(${entityName?uncap_first});
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param ${entityName?uncap_first}
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.update${entityName}(${entityName?uncap_first});
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.delete${entityName}(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
if(${entityName?uncap_first}==null) {
return Result.error("未找到对应数据");
}
return Result.OK(${entityName?uncap_first});
}
/**
* 导出excel
*
* @param request
* @param ${entityName?uncap_first}
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ${entityName}.class);
}
}

View File

@ -0,0 +1,81 @@
package ${bussiPackage}.${entityPackage}.entity;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Data
@TableName("${tableName}")
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
<#if po.classType='sel_user'>
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
<#elseif po.classType='sel_depart'>
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
<#if po.dictTable?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
</#if>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@TableId(type = IdType.ASSIGN_ID)
<#else>
<#if po.fieldDbType =='Date'>
<#if po.classType=='date'>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
</#if>
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>
<#-- <#if po.classType!='popup'>
<#if po.dictTable?default("")?trim?length gt 1>
@Dict(dicCode="${po.dictField}",dicText="${po.dictText}",dictTable="${po.dictTable}")
<#elseif po.dictField?default("")?trim?length gt 1>
@Dict(dicCode="${po.dictField}")
</#if>
</#if>-->
<#if list_field_dictCode?length gt 1>
@Dict(${list_field_dictCode?substring(2)})
</#if>
</#if>
@ApiModelProperty(value = "${po.filedComment}")
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
</#list>
}

View File

@ -0,0 +1,22 @@
package ${bussiPackage}.${entityPackage}.mapper;
import org.apache.ibatis.annotations.Param;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
/**
* 编辑节点状态
* @param id
* @param status
*/
void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status);
}

View File

@ -0,0 +1,15 @@
<#assign hasChildrenField = "">
<#list originalColumns as po>
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
<#assign hasChildrenField = po.fieldName>
</#if>
</#list>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
<update id="updateTreeNodeStatus" parameterType="java.lang.String">
update ${tableName} set ${Format.humpToUnderline(hasChildrenField)} = ${r'#'}{status} where id = ${r'#'}{id}
</update>
</mapper>

View File

@ -0,0 +1,38 @@
package ${bussiPackage}.${entityPackage}.service;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.exception.JeecgBootException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
public interface I${entityName}Service extends IService<${entityName}> {
/**根节点父ID的值*/
public static final String ROOT_PID_VALUE = "0";
/**树节点有子节点状态值*/
public static final String HASCHILD = "1";
/**树节点无子节点状态值*/
public static final String NOCHILD = "0";
/**新增节点*/
void add${entityName}(${entityName} ${entityName?uncap_first});
/**修改节点*/
void update${entityName}(${entityName} ${entityName?uncap_first}) throws JeecgBootException;
/**删除节点*/
void delete${entityName}(String id) throws JeecgBootException;
/**查询所有数据,无分页*/
List<${entityName}> queryTreeListNoPage(QueryWrapper<${entityName}> queryWrapper);
}

View File

@ -0,0 +1,199 @@
package ${bussiPackage}.${entityPackage}.service.impl;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.oConvertUtils;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
<#assign pidFieldName = "">
<#assign hasChildrenField = "">
<#list originalColumns as po>
<#if po.fieldDbName == tableVo.extendParams.pidField>
<#assign pidFieldName = po.fieldName>
</#if>
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
<#assign hasChildrenField = po.fieldName>
</#if>
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Service
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
@Override
public void add${entityName}(${entityName} ${entityName?uncap_first}) {
if(oConvertUtils.isEmpty(${entityName?uncap_first}.get${pidFieldName?cap_first}())){
${entityName?uncap_first}.set${pidFieldName?cap_first}(I${entityName}Service.ROOT_PID_VALUE);
}else{
//如果当前节点父ID不为空 则设置父节点的hasChildren 为1
${entityName} parent = baseMapper.selectById(${entityName?uncap_first}.get${pidFieldName?cap_first}());
if(parent!=null && !"1".equals(parent.get${hasChildrenField?cap_first}())){
parent.set${hasChildrenField?cap_first}("1");
baseMapper.updateById(parent);
}
}
baseMapper.insert(${entityName?uncap_first});
}
@Override
public void update${entityName}(${entityName} ${entityName?uncap_first}) {
${entityName} entity = this.getById(${entityName?uncap_first}.getId());
if(entity==null) {
throw new JeecgBootException("未找到对应实体");
}
String old_pid = entity.get${pidFieldName?cap_first}();
String new_pid = ${entityName?uncap_first}.get${pidFieldName?cap_first}();
if(!old_pid.equals(new_pid)) {
updateOldParentNode(old_pid);
if(oConvertUtils.isEmpty(new_pid)){
${entityName?uncap_first}.set${pidFieldName?cap_first}(I${entityName}Service.ROOT_PID_VALUE);
}
if(!I${entityName}Service.ROOT_PID_VALUE.equals(${entityName?uncap_first}.get${pidFieldName?cap_first}())) {
baseMapper.updateTreeNodeStatus(${entityName?uncap_first}.get${pidFieldName?cap_first}(), I${entityName}Service.HASCHILD);
}
}
baseMapper.updateById(${entityName?uncap_first});
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete${entityName}(String id) throws JeecgBootException {
//查询选中节点下所有子节点一并删除
id = this.queryTreeChildIds(id);
if(id.indexOf(",")>0) {
StringBuffer sb = new StringBuffer();
String[] idArr = id.split(",");
for (String idVal : idArr) {
if(idVal != null){
${entityName} ${entityName?uncap_first} = this.getById(idVal);
String pidVal = ${entityName?uncap_first}.get${pidFieldName?cap_first}();
//查询此节点上一级是否还有其他子节点
List<${entityName}> dataList = baseMapper.selectList(new QueryWrapper<${entityName}>().eq("${tableVo.extendParams.pidField}", pidVal).notIn("id",Arrays.asList(idArr)));
if((dataList == null || dataList.size()==0) && !Arrays.asList(idArr).contains(pidVal)
&& !sb.toString().contains(pidVal)){
//如果当前节点原本有子节点 现在木有了,更新状态
sb.append(pidVal).append(",");
}
}
}
//批量删除节点
baseMapper.deleteBatchIds(Arrays.asList(idArr));
//修改已无子节点的标识
String[] pidArr = sb.toString().split(",");
for(String pid : pidArr){
this.updateOldParentNode(pid);
}
}else{
${entityName} ${entityName?uncap_first} = this.getById(id);
if(${entityName?uncap_first}==null) {
throw new JeecgBootException("未找到对应实体");
}
updateOldParentNode(${entityName?uncap_first}.get${pidFieldName?cap_first}());
baseMapper.deleteById(id);
}
}
@Override
public List<${entityName}> queryTreeListNoPage(QueryWrapper<${entityName}> queryWrapper) {
List<${entityName}> dataList = baseMapper.selectList(queryWrapper);
List<${entityName}> mapList = new ArrayList<>();
for(${entityName} data : dataList){
String pidVal = data.get${pidFieldName?cap_first}();
//递归查询子节点的根节点
if(pidVal != null && !"0".equals(pidVal)){
${entityName} rootVal = this.getTreeRoot(pidVal);
if(rootVal != null && !mapList.contains(rootVal)){
mapList.add(rootVal);
}
}else{
if(!mapList.contains(data)){
mapList.add(data);
}
}
}
return mapList;
}
/**
* 根据所传pid查询旧的父级节点的子节点并修改相应状态值
* @param pid
*/
private void updateOldParentNode(String pid) {
if(!I${entityName}Service.ROOT_PID_VALUE.equals(pid)) {
Integer count = baseMapper.selectCount(new QueryWrapper<${entityName}>().eq("${tableVo.extendParams.pidField}", pid));
if(count==null || count<=1) {
baseMapper.updateTreeNodeStatus(pid, I${entityName}Service.NOCHILD);
}
}
}
/**
* 递归查询节点的根节点
* @param pidVal
* @return
*/
private ${entityName} getTreeRoot(String pidVal){
${entityName} data = baseMapper.selectById(pidVal);
if(data != null && !"0".equals(data.get${pidFieldName?cap_first}())){
return this.getTreeRoot(data.get${pidFieldName?cap_first}());
}else{
return data;
}
}
/**
* 根据id查询所有子节点id
* @param ids
* @return
*/
private String queryTreeChildIds(String ids) {
//获取id数组
String[] idArr = ids.split(",");
StringBuffer sb = new StringBuffer();
for (String pidVal : idArr) {
if(pidVal != null){
if(!sb.toString().contains(pidVal)){
if(sb.toString().length() > 0){
sb.append(",");
}
sb.append(pidVal);
this.getTreeChildIds(pidVal,sb);
}
}
}
return sb.toString();
}
/**
* 递归查询所有子节点
* @param pidVal
* @param sb
* @return
*/
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
List<${entityName}> dataList = baseMapper.selectList(new QueryWrapper<${entityName}>().eq("${tableVo.extendParams.pidField}", pidVal));
if(dataList != null && dataList.size()>0){
for(${entityName} tree : dataList) {
if(!sb.toString().contains(tree.getId())){
sb.append(",").append(tree.getId());
}
this.getTreeChildIds(tree.getId(),sb);
}
}
return sb;
}
}

View File

@ -0,0 +1,599 @@
<#assign pidFieldName = "">
<#assign hasChildrenField = "">
<#list originalColumns as po>
<#if po.fieldDbName == tableVo.extendParams.pidField>
<#assign pidFieldName = po.fieldName>
</#if>
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
<#assign hasChildrenField = po.fieldName>
</#if>
</#list>
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<#assign query_field_no=0>
<#assign query_field_select=false>
<#assign query_field_date=false>
<#assign list_need_dict=false>
<#assign list_need_category=false>
<#assign query_field_pca=false>
<#assign list_need_pca=false>
<#assign query_flag=false>
<#assign query_inp=false>
<#assign query_popup=false>
<#assign query_sel_user=false>
<#assign query_sel_dep=false>
<#assign query_sel_multi=false>
<#assign query_sel_cat=false>
<#assign query_sel_search=false>
<#assign query_switch=false>
<#assign list_need_switch=false>
<#assign bpm_flag=false>
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
<#if po.isQuery=='Y'>
<#assign query_flag=true>
<#if query_field_no==2>
<template v-if="toggleSearchStatus">
</#if>
<#assign query_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign query_field_dictCode="${po.dictField}">
</#if>
<#if po.queryMode=='single'>
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
<#if po.classType=='sel_search'>
<#assign query_sel_search=true>
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
<#elseif po.classType=='sel_user'>
<#assign query_sel_user=true>
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='switch'>
<#assign query_switch=true>
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> query></j-switch>
<#elseif po.classType=='sel_depart'>
<#assign query_sel_dep=true>
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='list_multi'>
<#assign query_sel_multi=true>
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
<#elseif po.classType=='cat_tree'>
<#assign query_sel_cat=true>
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
<#elseif po.classType=='date'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
<#elseif po.classType=='datetime'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
<#elseif po.classType=='pca'>
<#assign query_field_pca=true>
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
<#elseif po.classType=='popup'>
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#assign query_field_select=true>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
<#if po.dictTable?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
<#elseif po.dictField?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
</#if>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
<#else>
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
<#if po.classType=='date'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
<#elseif po.classType=='datetime'>
<#assign query_field_date=true>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
</#if>
<#assign query_field_no=query_field_no+1>
</#if>
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
<#assign list_need_dict=true>
</#if>
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
<#assign list_need_category=true>
</#if>
<#if po.classType=='pca'>
<#assign list_need_pca=true>
</#if>
<#if po.classType=='switch'>
<#assign list_need_switch=true>
</#if>
</#list>
<#-- 结束循环 -->
<#t>
<#if query_field_no gt 2>
</template>
</#if>
<#if query_flag>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
</a-col>
</#if>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:expandedRowKeys="expandedRowKeys"
@change="handleTableChange"
@expand="handleExpand"
v-bind="tableProps">
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleAddChild(record)">添加下级</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteNode(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal>
</a-card>
</template>
<script>
import { getAction, deleteAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ${entityName}Modal from './modules/${entityName}Modal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import { filterObj } from '@/utils/util';
<#if query_field_select>
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
</#if>
<#if query_field_date>
import JDate from '@/components/jeecg/JDate.vue'
</#if>
<#if list_need_category>
import { loadCategoryData } from '@/api/api'
</#if>
<#if query_field_pca>
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
</#if>
<#if list_need_pca>
import Area from '@/components/_util/Area'
</#if>
<#if query_inp>
import JInput from '@comp/jeecg/JInput'
</#if>
<#if query_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if query_sel_dep>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if query_sel_multi>
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
</#if>
<#if query_sel_cat>
import JCategorySelect from '@comp/jeecg/JCategorySelect'
</#if>
<#if query_sel_search>
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
</#if>
<#if query_switch>
import JSwitch from '@/components/jeecg/JSwitch'
</#if>
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
export default {
name: "${entityName}List",
mixins:[JeecgListMixin],
components: {
<#if query_field_select>
JDictSelectTag,
</#if>
<#if query_field_date>
JDate,
</#if>
<#if query_field_pca>
JAreaLinkage,
</#if>
<#if query_inp>
JInput,
</#if>
<#if query_sel_user>
JSelectUserByDep,
</#if>
<#if query_sel_dep>
JSelectDepart,
</#if>
<#if query_sel_multi>
JMultiSelectTag,
</#if>
<#if query_sel_cat>
JCategorySelect,
</#if>
<#if query_sel_search>
JSearchSelectTag,
</#if>
<#if query_switch>
JSwitch,
</#if>
${entityName}Modal,
JSuperQuery
},
data () {
return {
description: '${tableVo.ftlDescription}管理页面',
// 表头
columns: [
<#list columns as po>
<#if po.fieldDbName==tableVo.extendParams.textField>
{
title:'${po.filedComment}',
align:"left",
dataIndex: '${po.fieldName}'
},
</#if>
</#list>
<#list columns as po>
<#if po.isShowList =='Y'>
<#if po.fieldDbName!=tableVo.extendParams.textField && po.fieldName!=pidFieldName>
{
title:'${po.filedComment}',
align:"left",
<#if po.sort=='Y'>
sorter: true,
</#if>
<#if po.classType=='date'>
dataIndex: '${po.fieldName}',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
<#elseif po.classType=='file'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'fileSlot'}
<#elseif po.classType=='image'>
dataIndex: '${po.fieldName}',
scopedSlots: {customRender: 'imgSlot'}
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='switch'>
dataIndex: '${po.fieldName}',
<#if po.dictField?default("")?trim?length gt 1>
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
<#else>
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
</#if>
<#else>
dataIndex: '${po.fieldName}'
</#if>
},
</#if>
</#if>
</#list>
{
title: '操作',
dataIndex: 'action',
align:"center",
width:147,
scopedSlots: { customRender: 'action' },
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/rootList",
childList: "/${entityPackage}/${entityName?uncap_first}/childList",
getChildListBatch: "/${entityPackage}/${entityName?uncap_first}/getChildListBatch",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
},
expandedRowKeys:[],
hasChildrenField:"${hasChildrenField}",
pidField:"${pidFieldName}",
dictOptions: {},
loadParent: false,
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl(){
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
},
tableProps() {
let _this = this
return {
// 列表项是否可选择
rowSelection: {
selectedRowKeys: _this.selectedRowKeys,
onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
}
}
}
},
methods: {
loadData(arg){
if(arg==1){
this.ipagination.current=1
}
this.loading = true
let params = this.getQueryParams()
params.hasQuery = 'true'
getAction(this.url.list,params).then(res=>{
if(res.success){
let result = res.result
if(Number(result.total)>0){
this.ipagination.total = Number(result.total)
this.dataSource = this.getDataByResult(res.result.records)
return this.loadDataByExpandedRows(this.dataSource)
}else{
this.ipagination.total=0
this.dataSource=[]
}
}else{
this.$message.warning(res.message)
}
}).finally(()=>{
this.loading = false
})
},
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
loadDataByExpandedRows(dataList) {
if (this.expandedRowKeys.length > 0) {
return getAction(this.url.getChildListBatch,{ parentIds: this.expandedRowKeys.join(',') }).then(res=>{
if (res.success && res.result.records.length>0) {
//已展开的数据批量子节点
let records = res.result.records
const listMap = new Map();
for (let item of records) {
let pid = item[this.pidField];
if (this.expandedRowKeys.join(',').includes(pid)) {
let mapList = listMap.get(pid);
if (mapList == null) {
mapList = [];
}
mapList.push(item);
listMap.set(pid, mapList);
}
}
let childrenMap = listMap;
let fn = (list) => {
if(list) {
list.forEach(data => {
if (this.expandedRowKeys.includes(data.id)) {
data.children = this.getDataByResult(childrenMap.get(data.id))
fn(data.children)
}
})
}
}
fn(dataList)
}
})
} else {
return Promise.resolve()
}
},
getQueryParams(arg) {
//获取查询条件
let sqp = {}
let param = {}
if(this.superQueryParams){
sqp['superQueryParams']=encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
if(arg){
param = Object.assign(sqp, this.isorter ,this.filters);
}else{
param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
}
if(JSON.stringify(this.queryParam) === "{}" || arg){
param.hasQuery = 'false'
}else{
param.hasQuery = 'true'
}
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
return filterObj(param);
},
searchReset() {
//重置
this.expandedRowKeys = []
this.queryParam = {}
this.loadData(1);
},
getDataByResult(result){
if(result){
return result.map(item=>{
//判断是否标记了带有子节点
if(item[this.hasChildrenField]=='1'){
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
item.children = [loadChild]
}
return item
})
}
},
handleExpand(expanded, record){
// 判断是否是展开状态
if (expanded) {
this.expandedRowKeys.push(record.id)
if (record.children.length>0 && record.children[0].isLoading === true) {
let params = this.getQueryParams(1);//查询条件
params[this.pidField] = record.id
params.hasQuery = 'false'
params.superQueryParams=""
getAction(this.url.childList,params).then((res)=>{
if(res.success){
if(res.result.records){
record.children = this.getDataByResult(res.result.records)
this.dataSource = [...this.dataSource]
}else{
record.children=''
record.hasChildrenField='0'
}
}else{
this.$message.warning(res.message)
}
})
}
}else{
let keyIndex = this.expandedRowKeys.indexOf(record.id)
if(keyIndex>=0){
this.expandedRowKeys.splice(keyIndex, 1);
}
}
},
handleAddChild(record){
this.loadParent = true
let obj = {}
obj[this.pidField] = record['id']
this.$refs.modalForm.add(obj);
},
handleDeleteNode(id) {
if(!this.url.delete){
this.$message.error("请设置url.delete属性!")
return
}
var that = this;
deleteAction(that.url.delete, {id: id}).then((res) => {
if (res.success) {
that.loadData(1)
} else {
that.$message.warning(res.message);
}
});
},
batchDel(){
if(this.selectedRowKeys.length<=0){
this.$message.warning('请选择一条记录!');
return false;
}else{
let ids = "";
let that = this;
that.selectedRowKeys.forEach(function(val) {
ids+=val+",";
});
that.$confirm({
title:"确认删除",
content:"是否删除选中数据?",
onOk: function(){
that.handleDeleteNode(ids)
that.onClearSelected();
}
});
}
},
getSuperFieldList(){
<#include "/common/utils.ftl">
let fieldList=[];
<#list columns as po>
fieldList.push(${superQueryFieldList(po)})
</#list>
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

View File

@ -0,0 +1,277 @@
<#include "/common/utils.ftl">
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
:destroyOnClose="true"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<#assign form_date = false>
<#assign form_select = false>
<#assign form_select_multi = false>
<#assign form_popup = false>
<#assign form_sel_depart = false>
<#assign form_sel_user = false>
<#assign form_file = false>
<#assign form_image = false>
<#assign form_tree_select = false>
<#assign form_switch=false>
<#assign pidFieldName = "">
<#list columns as po>
<#if po.isShow =='Y'>
<#assign form_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign form_field_dictCode="${po.dictField}">
</#if>
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
<#if po.fieldDbName == tableVo.extendParams.pidField>
<#assign form_tree_select = true>
<#assign pidFieldName = po.fieldName>
<j-tree-select
ref="treeSelect"
placeholder="请选择${po.filedComment}"
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
dict="${tableVo.tableName},${tableVo.extendParams.textField},id"
pidField="${tableVo.extendParams.pidField}"
pidValue="0"
hasChildField="${tableVo.extendParams.hasChildren}"
<#if po.readonly=='Y'>disabled</#if>>
</j-tree-select>
<#elseif po.classType =='date'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='datetime'>
<#assign form_date=true>
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='switch'>
<#assign form_switch=true>
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
<#elseif po.classType =='popup'>
<#assign form_popup=true>
<j-popup
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
:trigger-change="true"
org-fields="${po.dictField}"
dest-fields="${Format.underlineToHump(po.dictText)}"
code="${po.dictTable}"
@callback="popupCallback"
<#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='sel_depart'>
<#assign form_sel_depart=true>
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='sel_user'>
<#assign form_sel_user = true>
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType =='textarea'>
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='list' || po.classType=='radio'>
<#assign form_select = true>
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
<#assign form_select_multi = true>
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
<#elseif po.classType=='file'>
<#assign form_file = true>
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
<#elseif po.classType=='image'>
<#assign form_image = true>
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
<#else>
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
</#if>
</a-form-item>
</#if>
</#list>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
<#if form_date>
import JDate from '@/components/jeecg/JDate'
</#if>
<#if form_file>
import JUpload from '@/components/jeecg/JUpload'
</#if>
<#if form_image>
import JImageUpload from '@/components/jeecg/JImageUpload'
</#if>
<#if form_sel_depart>
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
</#if>
<#if form_sel_user>
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
</#if>
<#if form_select>
import JDictSelectTag from "@/components/dict/JDictSelectTag"
</#if>
<#if form_select_multi>
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
</#if>
<#if form_tree_select>
import JTreeSelect from '@/components/jeecg/JTreeSelect'
</#if>
<#if form_switch==true >
import JSwitch from '@/components/jeecg/JSwitch'
</#if>
export default {
name: "${entityName}Modal",
components: {
<#if form_date>
JDate,
</#if>
<#if form_file>
JUpload,
</#if>
<#if form_image>
JImageUpload,
</#if>
<#if form_sel_depart>
JSelectDepart,
</#if>
<#if form_sel_user>
JSelectUserByDep,
</#if>
<#if form_select>
JDictSelectTag,
</#if>
<#if form_select_multi>
JMultiSelectTag,
</#if>
<#if form_switch==true >
JSwitch,
</#if>
<#if form_tree_select>
JTreeSelect
</#if>
},
data () {
return {
form: this.$form.createForm(this),
title:"操作",
width:800,
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
<#include "/common/validatorRulesTemplate/main.ftl">
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
},
expandedRowKeys:[],
pidField:"${pidFieldName}"
}
},
created () {
},
methods: {
add (obj) {
this.edit(obj);
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id'>,'${po.fieldName}'</#if></#list>))
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let old_pid = this.model[this.pidField]
let formData = Object.assign(this.model, values);
let new_pid = this.model[this.pidField]
console.log("表单提交数据",formData)
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
this.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
popupCallback(row){
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'>,'${po.fieldName}'</#if></#list>))
},
submitSuccess(formData,flag){
if(!formData.id){
let treeData = this.$refs.treeSelect.getCurrTreeData()
this.expandedRowKeys=[]
this.getExpandKeysByPid(formData[this.pidField],treeData,treeData)
this.$emit('ok',formData,this.expandedRowKeys.reverse());
}else{
this.$emit('ok',formData,flag);
}
},
getExpandKeysByPid(pid,arr,all){
if(pid && arr && arr.length>0){
for(let i=0;i<arr.length;i++){
if(arr[i].key==pid){
this.expandedRowKeys.push(arr[i].key)
this.getExpandKeysByPid(arr[i]['parentId'],all,all)
}else{
this.getExpandKeysByPid(pid,arr[i].children,all)
}
}
}
}
}
}
</script>

View File

@ -0,0 +1,306 @@
package ${bussiPackage}.${entityPackage}.controller;
import org.jeecg.common.system.query.QueryGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import org.jeecg.common.util.oConvertUtils;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list>
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service;
</#list>
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
* @Date: ${.now?string["yyyy-MM-dd"]}
* @Version: V1.0
*/
@Api(tags="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> {
@Autowired
private I${entityName}Service ${entityName?uncap_first}Service;
<#list subTables as sub>
@Autowired
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
</#list>
/*---------------------------------主表处理-begin-------------------------------------*/
/**
* 分页列表查询
* @param ${entityName?uncap_first}
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
* @param ${entityName?uncap_first}
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.save(${entityName?uncap_first});
return Result.OK("添加成功!");
}
/**
* 编辑
* @param ${entityName?uncap_first}
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
return Result.OK("编辑成功!");
}
/**
* 通过id删除
* @param id
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.delMain(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 导出
* @return
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
}
/**
* 导入
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ${entityName}.class);
}
/*---------------------------------主表处理-end-------------------------------------*/
<#list subTables as sub>
/*--------------------------------子表处理-${sub.ftlDescription}-begin----------------------------------------------*/
/**
* 通过主表ID查询
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-通过主表ID查询")
@ApiOperation(value="${sub.ftlDescription}-通过主表ID查询", notes="${sub.ftlDescription}-通过主表ID查询")
@GetMapping(value = "/list${sub.entityName}ByMainId")
public Result<?> list${sub.entityName}ByMainId(${sub.entityName} ${sub.entityName?uncap_first},
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${sub.entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${sub.entityName?uncap_first}, req.getParameterMap());
Page<${sub.entityName}> page = new Page<${sub.entityName}>(pageNo, pageSize);
IPage<${sub.entityName}> pageList = ${sub.entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
* @param ${sub.entityName?uncap_first}
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-添加")
@ApiOperation(value="${sub.ftlDescription}-添加", notes="${sub.ftlDescription}-添加")
@PostMapping(value = "/add${sub.entityName}")
public Result<?> add${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
${sub.entityName?uncap_first}Service.save(${sub.entityName?uncap_first});
return Result.OK("添加成功!");
}
/**
* 编辑
* @param ${sub.entityName?uncap_first}
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-编辑")
@ApiOperation(value="${sub.ftlDescription}-编辑", notes="${sub.ftlDescription}-编辑")
@PutMapping(value = "/edit${sub.entityName}")
public Result<?> edit${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
${sub.entityName?uncap_first}Service.updateById(${sub.entityName?uncap_first});
return Result.OK("编辑成功!");
}
/**
* 通过id删除
* @param id
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-通过id删除")
@ApiOperation(value="${sub.ftlDescription}-通过id删除", notes="${sub.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete${sub.entityName}")
public Result<?> delete${sub.entityName}(@RequestParam(name="id",required=true) String id) {
${sub.entityName?uncap_first}Service.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-批量删除")
@ApiOperation(value="${sub.ftlDescription}-批量删除", notes="${sub.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch${sub.entityName}")
public Result<?> deleteBatch${sub.entityName}(@RequestParam(name="ids",required=true) String ids) {
this.${sub.entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 导出
* @return
*/
@RequestMapping(value = "/export${sub.entityName}")
public ModelAndView export${sub.entityName}(HttpServletRequest request, ${sub.entityName} ${sub.entityName?uncap_first}) {
// Step.1 组装查询条件
QueryWrapper<${sub.entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${sub.entityName?uncap_first}, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// Step.2 获取导出数据
List<${sub.entityName}> pageList = ${sub.entityName?uncap_first}Service.list(queryWrapper);
List<${sub.entityName}> exportList = null;
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
} else {
exportList = pageList;
}
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${sub.ftlDescription}"); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.CLASS, ${sub.entityName}.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${sub.ftlDescription}报表", "导出人:" + sysUser.getRealname(), "${sub.ftlDescription}"));
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
/**
* 导入
* @return
*/
@RequestMapping(value = "/import${sub.entityName}/{mainId}")
public Result<?> import${sub.entityName}(HttpServletRequest request, HttpServletResponse response, @PathVariable("mainId") String mainId) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<${sub.entityName}> list = ExcelImportUtil.importExcel(file.getInputStream(), ${sub.entityName}.class, params);
for (${sub.entityName} temp : list) {
<#list sub.foreignKeys as key>
temp.set${key?cap_first}(mainId);
</#list>
}
long start = System.currentTimeMillis();
${sub.entityName?uncap_first}Service.saveBatch(list);
log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error("文件导入失败:" + e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.error("文件导入失败!");
}
/*--------------------------------子表处理-${sub.ftlDescription}-end----------------------------------------------*/
</#list>
}

Some files were not shown because too many files have changed in this diff Show More