提交 3c6c353f 编写于 作者: zhouweidong's avatar zhouweidong

git模板示例测试

上级 ae79d45b
<#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>${pub.getCodeName()?lower_case}-srv</artifactId>
<name>${pub.getCodeName()?lower_case}-srv</name>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<properties>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
</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};
import org.springframework.beans.factory.annotation.Autowired;
import ${pub.getPKGCodeName()}.${de.getPSSystemModule().codeName?lower_case}.service.${de.codeName}Service;
@RestController
public class ${de.codeName}Controller{
<#assign appReqUrl="/" +app.getPKGCodeName()?lower_case + "/"+de.getPSSystemModule().codeName?lower_case +"/"+de.codeName?lower_case ><#comment>当前实体请求路径</#comment>
<#comment>注入当前实体的服务对象</#comment>
@Autowired
private ${de.codeName}Service ${de.codeName?lower_case}Service;
<#list item.getPSControls() as ctrl><#comment>输出实体所使用到的部件(实体用到的部件可能有:表格、表单、树视图等)</#comment>
<#if ctrl.getControlType() == 'FORM'><#comment>本示例中只展示表单</#comment>
<#list ctrl.getPSAjaxControlHandler().getPSAjaxHandlerActions() as action><#comment>输出表单行为:(新建、编辑、删除等)</#comment>
<#if action.getPSDEAction?? && action.getPSDEAction()??>
<#assign ctrltype=ctrl.getControlType()>
@PostMapping(value="${appReqUrl}/${ctrl.getCodeName()?lower_case}${srfclassname(ctrltype)?lower_case}/${action.getPSDEAction().getCodeName()?lower_case}")
public ${de.codeName} ${srfmethodname(ctrl.getCodeName())}${srfclassname(ctrltype)}${action.getPSDEAction().getCodeName()}(${de.codeName} entity){
this.${de.codeName?lower_case}Service.${srfmethodname(action.getPSDEAction().getCodeName())}(entity);
return entity;
}
</#if>
</#list>
</#if>
</#list>
}
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${item.getPSSystemModule().codeName?lower_case}.service;
import ${pub.getPKGCodeName()}.${item.getPSSystemModule().codeName?lower_case}.domain.${item.codeName};
/**
* 实体[${item.codeName}] 服务对象接口
*/
public interface ${item.codeName}Service{
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if (deaction.getActionMode() == "READ") ><#comment>Get与自定义行为返回DoMain不发带major</#comment>
${item.codeName} ${srfmethodname(deaction.getCodeName())}(${item.codeName} et);
<#else>
boolean ${srfmethodname(deaction.getCodeName())}(${item.codeName} et);
</#if>
</#list>
</#if>
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${item.getPSSystemModule().codeName?lower_case}.service.impl;
import org.springframework.stereotype.Service;
import ${pub.getPKGCodeName()}.${item.getPSSystemModule().codeName?lower_case}.domain.${item.codeName};
import ${pub.getPKGCodeName()}.${item.getPSSystemModule().codeName?lower_case}.service.${item.codeName}Service;
/**
* 实体[${item.codeName}] 服务对象接口实现
*/
@Service
public class ${item.codeName}ServiceImpl implements ${item.codeName}Service{
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if (deaction.getActionMode() == "READ") ><#comment>Get与自定义行为返回DoMain不发带major</#comment>
@Override
public ${item.codeName} ${srfmethodname(deaction.getCodeName())}(${item.codeName} et){
System.out.println(String.format("您当前正在调用[%s]的[%s]方法","${item.codeName}ServiceImpl","${srfmethodname(deaction.getCodeName())}"));
return et;
}
<#else>
@Override
public boolean ${srfmethodname(deaction.getCodeName())}(${item.codeName} et){
System.out.println(String.format("您当前正在调用[%s]的[%s]方法","${item.codeName}ServiceImpl","${srfmethodname(deaction.getCodeName())}"));
return true;
}
</#if>
</#list>
</#if>
}
\ No newline at end of file
<#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>
import cn.ibizlab.demo.demoMain;
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 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 = demoMain.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("/demo/springboot/dbet/maineditform/get")).andReturn();
System.out.println("返回结果为:"+mvcResult.getResponse().getContentAsString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册