新增创建模块的代码生成功能,模块代码生成模板。

This commit is contained in:
thinkgem
2020-09-24 10:06:59 +08:00
parent 3dd8ec03b9
commit 63fa05b440
11 changed files with 3741 additions and 5 deletions

View File

@@ -878,8 +878,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
if (f.exists()){
break;
}
if (file.getParentFile() != null){
file = file.getParentFile();
File p = file.getParentFile();
if (p != null){
file = p;
}else{
break;
}
@@ -916,8 +917,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
if (f.exists()){
return f.getPath();
}
if (file.getParentFile() != null){
file = file.getParentFile();
File p = file.getParentFile();
if (p != null){
file = p;
}else{
break;
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>controller</name>
<name>client</name>
<filePath>${moduleName}-client/src/main/java/${packageName}/${moduleName}/client/${subModuleName}</filePath>
<fileName>${ClassName}ServiceClient.java</fileName>
<content><![CDATA[

View File

@@ -129,4 +129,17 @@
<dict value="4/4/8" label="4/4/8 三列"/>
<dict value="3/4/8" label="3/4/8 四列"/>
</gridRowCol>
<!-- 模块生成模板分类 -->
<moduleTplCategory>
<category value="module" label="生成模块代码">
<template>module/pom.xml</template>
<template>module/db/erm.xml</template>
<template>module/bin/deploy.bat.xml</template>
<template>module/bin/package.bat.xml</template>
<template>module/src/main/java/package.xml</template>
<template>module/src/main/resources/db/versions.xml</template>
<template>module/src/main/resources/config/jeesite.xml</template>
<template>module/src/main/resources/static/static.xml</template>
</category>
</moduleTplCategory>
</config>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>deploy</name>
<filePath>${module.moduleCode}/bin</filePath>
<fileName>deploy.bat</fileName>
<charset>GBK</charset>
<content><![CDATA[@echo off
rem /**
rem * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
rem *
rem * Author: ThinkGem@163.com
rem */
echo.
echo [信息] 部署工程版本到Nexus服务器。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean deploy -Dmaven.test.skip=true -Pdeploy
cd bin
cmd /c msg %username% /time:0 /w "部署完成..."
pause]]>
</content>
</template>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>package</name>
<filePath>${module.moduleCode}/bin</filePath>
<fileName>package.bat</fileName>
<charset>GBK</charset>
<content><![CDATA[@echo off
rem /**
rem * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
rem *
rem * Author: ThinkGem@163.com
rem */
echo.
echo [信息] 打包安装工程生成jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean install -Dmaven.test.skip=true -Ppackage
cd bin
cmd /c msg %username% /time:0 /w "打包完成..."
pause]]>
</content>
</template>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>pom</name>
<filePath>${module.moduleCode}</filePath>
<fileName>pom.xml</fileName>
<charset></charset>
<content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-parent</artifactId>
<version>${jeesiteVersion}-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
<artifactId>jeesite-module-${module.moduleCode}</artifactId>
<packaging>jar</packaging>
<name>JeeSite Module ${module.moduleName}</name>
<url>http://jeesite.com</url>
<inceptionYear>2013-Now</inceptionYear>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-module-core</artifactId>
<version>\${project.parent.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
</plugins>
<pluginManagement>
<plugins>
</plugins>
</pluginManagement>
</build>
<developers>
<developer>
<id>thinkgem</id>
<name>WangZhen</name>
<email>thinkgem at 163.com</email>
<roles><role>Project lead</role></roles>
<timezone>+8</timezone>
</developer>
</developers>
<organization>
<name>JeeSite</name>
<url>http://jeesite.com</url>
</organization>
</project>
]]>
</content>
</template>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>package</name>
<filePath>${module.moduleCode}/src/main/java/com/jeesite/modules/${module.moduleCode}</filePath>
<fileName></fileName>
<content><![CDATA[
]]>
</content>
</template>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>jeesite</name>
<filePath>${module.moduleCode}/src/main/resources/config</filePath>
<fileName>jeesite-${module.moduleCode}.yml</fileName>
<content><![CDATA[
# 温馨提示不建议直接修改此文件为了平台升级方便建议将需要修改的参数值复制到application.yml里进行覆盖该参数值。
#${module.moduleCode}:
# enabled: true
]]>
</content>
</template>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>versions</name>
<filePath>${module.moduleCode}/src/main/resources/db/upgrade/${module.moduleCode}</filePath>
<fileName>versions</fileName>
<content><![CDATA[${module.currentVersion}]]>
</content>
</template>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved. -->
<template>
<name>static</name>
<filePath>${module.moduleCode}/src/main/resources/static/modules/${module.moduleCode}</filePath>
<fileName></fileName>
<content><![CDATA[
]]>
</content>
</template>