提交 5d9015fe 编写于 作者: zhouweidong's avatar zhouweidong

springboot init

上级
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<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>
<artifactId>${pub.getCodeName()?lower_case}-srv</artifactId>
<name>${pub.getCodeName()?lower_case}-srv</name>
<packaging>jar</packaging>
<parent>
<artifactId>${sys.codeName}</artifactId>
<groupId>${pub.getPKGCodeName()}</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${item.getPSSystemModule().codeName?lower_case}.domain;
import lombok.Data;
import java.sql.Timestamp;
/**
* 实体[${item.codeName}] 数据对象
*/
@Data
public class ${item.codeName}{
<#list item.getPSDEFields() as defield>
private ${srfjavatype(defield.stdDataType)} ${defield.codeName?lower_case};
</#list>
}
<#ibiztemplate>
TARGET=PSAPPDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${de.getPSSystemModule().codeName?lower_case}.rest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import ${pub.getPKGCodeName()}.${de.getPSSystemModule().codeName?lower_case}.domain.${de.codeName};
@RestController
public class ${de.codeName}Controller{
<#assign appReqUrl="/" +app.getPKGCodeName()?lower_case + "/"+de.getPSSystemModule().codeName?lower_case +"/"+de.codeName?lower_case ><#comment>拼接当前应用的请求路径</#comment>
@PostMapping(value="${appReqUrl}")
public ${de.codeName} index(){
${de.codeName} entity =new ${de.codeName}();
return entity;
}
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()};
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.SpringApplication;
@SpringBootApplication
public class ${pub.getCodeName()?lower_case}Main{
public static void main(String[] args) {
SpringApplication.run(${pub.getCodeName()?lower_case}Main.class, args);
}
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign dbinst = sysrun.getPSDBDevInst()>
server:
port: 8080
servlet:
contextPath: /
spring:
datasource:
username: ${dbinst.getUserName()}
password: '${dbinst.getPassword()}'
url: jdbc:h2:mem:${dbinst.getUserName()};
driver-class-name: org.h2.Driver
logging:
level:
${pub.getPKGCodeName()}: debug
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import ${pub.getPKGCodeName()}.jctaskMain;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = jctaskMain.class)
public class ApplicationTest {
private MockMvc mockMvc;
@Autowired
private WebApplicationContext webApplicationContext;
@Before
public void setUp() {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
@Test
public void contextLoads() {
try {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/tsweb2/quickstart/qjd")).andReturn();
System.out.println("返回结果为:"+mvcResult.getResponse().getContentAsString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<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>
<artifactId>${sys.codeName}</artifactId>
<groupId>${pub.getPKGCodeName()}</groupId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>${pub.getCodeName()?lower_case}-srv</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<properties>
<mybatis-plus.version>3.0.6</mybatis-plus.version>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${r'${junit.version}'}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
class Properties(object):
def __init__(self, fileName):
self.fileName = fileName
self.properties = {}
def __getDict(self, strName, dictName, value):
if (strName.find('.') > 0):
k = strName.split('.')[0]
dictName.setdefault(k, {})
return self.__getDict(strName[len(k) + 1:], dictName[k], value)
else:
dictName[strName] = value
return
def getProperties(self):
try:
pro_file = open(self.fileName, 'Ur')
for line in pro_file.readlines():
line = line.strip().replace('\n', '')
if line.find("#") != -1:
line = line[0:line.find('#')]
if line.find('=') > 0:
strs = line.split('=')
strs[1] = line[len(strs[0]) + 1:]
self.__getDict(strs[0].strip(), self.properties, strs[1].strip())
except Exception as e:
raise e
else:
pro_file.close()
return self.properties
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign ibizsys_base_file = '${pub.getPSApplication().getPFType()}'>
<#if pub.getPSApplication().getPSPFStyle().getVersionString()?? && (pub.getPSApplication().getPSPFStyle().getVersionString()!='')>
<#assign ibizsys_base_file += '-${pub.getPSApplication().getPSPFStyle().getVersionString()}'>
</#if>
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import git
import time
import sys
import os
import pycurl
import platform
from ReadProperties import Properties
if(sys.argv[1]=='begin' or sys.argv[1]=='rebuild'):
#初始化GIT目录
if(platform.system()=="Linux"):
pro = Properties('${codefolder}/${sys.getPSDevCenterDomain()}/${sys.getPubSystemId()}/${sys.getVCName()}/.TOOL/repo.properties').getProperties()
else:
pro = Properties('${codefolder}\\${sys.getPSDevCenterDomain()}\\${sys.getPubSystemId()}\\${sys.getVCName()}\\.TOOL\\repo.properties').getProperties()
git_user = pro["git_user"]
git_pass = pro["git_pass"].replace("@", "%40")
git_path = pro["git_path"]
#git_path = pro["git_path"].replace("//", "//" + git_user + ":" + git_pass + "@")
#git_api = git_path+"/api/v4/projects"
#git_repo = git_path+"/"+git_user+"/${sys.codeName}"
git_repo = git_path
if(platform.system()=="Linux"):
git_local = "${codefolder}/${sys.getPSDevCenterDomain()}/${sys.getPubSystemId()}/${sys.getVCName()}/${sys.codeName}"
else:
git_local = "${codefolder}\\${sys.getPSDevCenterDomain()}\\${sys.getPubSystemId()}\\${sys.getVCName()}\\${sys.codeName}"
if os.path.exists(git_local+os.sep+".git"):
repo = git.Repo(path=git_local)
repo.git.config("user.name",git_user)
repo.git.config("user.email",git_user)
repo.git.fetch("--all")
repo.git.reset('--hard','origin/master')
else:
#c = pycurl.Curl()
#c.setopt(c.URL, git_api) # (网址)
#c.setopt(c.HTTPHEADER, ["PRIVATE-TOKEN: axMxnfp_oyYpDGp-rP4J"]) # 网址头部
#c.setopt(c.POST, 1) # 1表示调用post方法而不是get
#c.setopt(c.POSTFIELDS, "name=${sys.codeName}") # 数据
#c.setopt(c.CONNECTTIMEOUT, 60) # 超时中断
#c.setopt(c.TIMEOUT, 600) # 下载超时
#c.perform() # 提交
if(platform.system()=="Linux"):
repo = git.Repo.clone_from(url=git_repo, to_path="${codefolder}/${sys.getPSDevCenterDomain()}/${sys.getPubSystemId()}/${sys.getVCName()}/${sys.codeName}")
else:
repo = git.Repo.clone_from(url=git_repo, to_path="${codefolder}\\${sys.getPSDevCenterDomain()}\\${sys.getPubSystemId()}\\${sys.getVCName()}\\${sys.codeName}")
repo.git.config("user.name",git_user)
repo.git.config("user.email",git_user)
if(sys.argv[1]=='rebuild'):
if os.path.exists(git_local+os.sep+".git"):
flag=False
rootdir = git_local
for root,dirs,files in os.walk(r,rootdir):
for i in files:
path = os.path.join(root,i)
if os.path.isfile(path) and path.find(".git")==-1:
edituser=repo.git.log(path).split("\n")[1].split(" ")[1]
if edituser=="" or edituser==git_user:
flag=True
repo.git.rm(path)
if flag:
repo.git.commit("-m 123")
repo.git.push("origin", "master")
#创建目录
if(platform.system()=="Linux"):
os.system(r"mkdir -p ${codefolder}/${sys.getPSDevCenterDomain()}/${sys.getPubSystemId()}/${sys.getVCName()}/${sys.codeName}/app_${pub.getPSApplication().getPKGCodeName()}")
else:
os.system(r"mkdir -p ${codefolder}\${sys.getPSDevCenterDomain()}\${sys.getPubSystemId()}\${sys.getVCName()}\${sys.codeName}\app_${pub.getPSApplication().getPKGCodeName()}")
#拷贝初始文件
if(platform.system()=="Linux"):
os.system(r"cp -p -rf ${toolfolder}/APP/${ibizsys_base_file}/APP/ ${codefolder}\${sys.getPSDevCenterDomain()}\${sys.getPubSystemId()}\${sys.getVCName()}\${sys.codeName}\app_${pub.getPSApplication().getPKGCodeName()}/")
else:
os.system(r"xcopy ${toolfolder}\APP\${ibizsys_base_file}\APP\*.* ${codefolder}\${sys.getPSDevCenterDomain()}\${sys.getPubSystemId()}\${sys.getVCName()}\${sys.codeName}\app_${pub.getPSApplication().getPKGCodeName()} /I/E/Y/D")
if(sys.argv[1]=='end'):
if(platform.system()=="Linux"):
pro = Properties('${codefolder}/${sys.getPSDevCenterDomain()}/${sys.getPubSystemId()}/${sys.getVCName()}/.TOOL/repo.properties').getProperties()
else:
pro = Properties('${codefolder}\\${sys.getPSDevCenterDomain()}\\${sys.getPubSystemId()}\\${sys.getVCName()}\\.TOOL\\repo.properties').getProperties()
git_user = pro["git_user"]
git_pass = pro["git_pass"].replace("@", "%40")
git_path = pro["git_path"]
#git_path = pro["git_path"].replace("//", "//" + git_user + ":" + git_pass + "@")
if(platform.system()=="Linux"):
repo = git.Repo(path="${codefolder}/${sys.getPSDevCenterDomain()}/${sys.getPubSystemId()}/${sys.getVCName()}/${sys.codeName}")
else:
repo = git.Repo(path="${codefolder}\\${sys.getPSDevCenterDomain()}\\${sys.getPubSystemId()}\\${sys.getVCName()}\\${sys.codeName}")
flag=False
for i in (repo.git.status("-s").split("\n")):
if i.startswith(" M"):
flag = True
editfile=i.split(" ")[2]
edituser=repo.git.log(editfile).split("\n")[1].split(" ")[1]
print("***"+edituser+"****")
if edituser=="" or edituser==git_user:
repo.git.add(editfile,"-f")
elif i.startswith("??"):
flag = True
editfile = i.split(" ")[1]
repo.git.add(editfile, "-f")
if flag:
repo.git.commit("-m 123")
repo.git.push("origin", "master")
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#if sys.getPSSVNInstRepo().getSVNType()=="GIT">
git_user=${sys.getPSSVNInstRepo().getGitUserName()}
git_pass=
git_path=${sys.getPSSVNInstRepo().getGitPath()}
</#if>
\ No newline at end of file
%DEDQ_FIELDCOND%=<#if code??><#assign oldcode=r"${srf"+cond.getPSVARTypeId()?lower_case+r"('"+cond.getCondValue()+"','"+cond.getVARTypeParam()+r"')}"><#assign newcode=r"#{srf."+cond.getPSVARTypeId()?lower_case+"."+cond.getCondValue()?lower_case+r"}"><#if cond.isIgnoreEmpty()?? && cond.isIgnoreEmpty()==true><#assign newcode=newcode+r" or #{srf."+cond.getPSVARTypeId()?lower_case+"."+cond.getCondValue()?lower_case+r"} is null "></#if>${code?replace(oldcode,newcode)}</#if>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册