feat: add archetype

This commit is contained in:
15858193327
2020-10-09 00:56:56 +08:00
parent 596f674863
commit 40dcf3e4e5
46 changed files with 340 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.api;
import org.shoulder.core.dto.response.RestResult;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
* demo restful api
*
* @author ${author}
*/
@Path("/rest/demo/v1")
@Produces(MediaType.APPLICATION_JSON)
public interface DemoRestfulApi {
/**
* test
*
* @return BaseResult
*/
@GET
@Path("/hi/{key}")
RestResult configItem(@PathParam("key") String key);
}

View File

@@ -0,0 +1,4 @@
/**
* 这里定义接口入参对象
*/
package ${package}.dto.param;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义接口返回值对象
*/
package ${package}.dto.result;

View File

@@ -0,0 +1,27 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.notify;
import lombok.Data;
/**
* xxx变更通知
*
* @author ${author}
*/
@Data
public class XxxChangeEvent {
private String type;
private String key;
private Object value;
/**
* 配置项版本号,每次变更加一
*/
private Integer version;
}

View File

@@ -0,0 +1,4 @@
/**
* 这里定义常量类
*/
package ${package}.common.constant;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义传输对象
*/
package ${package}.common.dto;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义接口入参对象
*/
package ${package}.common.dto.param;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义接口返回值对象
*/
package ${package}.common.dto.result;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义异常类
*/
package ${package}.common.exception;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放存储层实现
*/
package ${package}.common.repository.impl;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放存储层接口
*/
package ${package}.common.repository;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放业务层实现
*/
package ${package}.common.service.impl;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放业务层接口
*/
package ${package}.common.service;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义配置类
*/
package ${package}.core.config;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义常量类
*/
package ${package}.core.constant;

View File

@@ -0,0 +1,40 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.core.controller;
import lombok.extern.shoulder.SLog;
import org.shoulder.core.log.Logger;
import org.shoulder.core.log.LoggerFactory;
import org.shoulder.web.annotation.SkipResponseWrap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author ${author}
*/
//@SLog // 与 @Slf4j 类似,在希望打日志的类上添加 @SLog 注解,编译时将生成类似下面定义 logger 的代码
@SkipResponseWrap // 该类所有方法的返回值将不被包装
@RestController
@RequestMapping("demo")
public class DemoController {
/**
* 定义 shoulder 的 logger 使用注解 {@link SLog} 时则可不写这行代码
*/
private static final Logger log = LoggerFactory.getLogger(DemoController.class);
/**
* 访问 http://localhost:8080/demo/test 测试
*/
@GetMapping("test")
public String test() {
return "this is a demo controller";
}
}

View File

@@ -0,0 +1,4 @@
/**
* 这里定义传输对象
*/
package ${package}.core.dto;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义接口入参对象
*/
package ${package}.core.dto.param;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义接口返回值对象
*/
package ${package}.core.dto.result;

View File

@@ -0,0 +1,4 @@
/**
* 这里定义异常类
*/
package ${package}.core.exception;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放存储层实现
*/
package ${package}.core.repository.impl;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放存储层接口
*/
package ${package}.core.repository;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放业务层实现
*/
package ${package}.core.service.impl;

View File

@@ -0,0 +1,4 @@
/**
* 这里存放业务层接口
*/
package ${package}.core.service;

View File

@@ -0,0 +1,40 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.xxx.controller;
import lombok.extern.shoulder.SLog;
import org.shoulder.core.log.Logger;
import org.shoulder.core.log.LoggerFactory;
import org.shoulder.web.annotation.SkipResponseWrap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author ${author}
*/
//@SLog // 与 @Slf4j 类似,在希望打日志的类上添加 @SLog 注解,编译时将生成类似下面定义 logger 的代码
@SkipResponseWrap // 该类所有方法的返回值将不被包装
@RestController
@RequestMapping("demo")
public class DemoController {
/**
* 定义 shoulder 的 logger 使用注解 {@link SLog} 时则可不写这行代码
*/
private static final Logger log = LoggerFactory.getLogger(DemoController.class);
/**
* 访问 http://localhost:8080/demo/test 测试
*/
@GetMapping("test")
public String test() {
return "this is a demo controller";
}
}

View File

@@ -0,0 +1,21 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.start;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* ${appId} 启动类
*
* @author ${author}
*/
@SpringBootApplication(scanBasePackages = "${package}")
public class ${StartClassName} {
public static void main(String[] args) {
SpringApplication.run(${StartClassName}.class, args);
}
}

View File

@@ -0,0 +1,20 @@
package ${package}.start.config;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import ${package}.start.${StartClassName};
/**
* 打成 war 包部署到外部tomcat需要这个否则删除即可
*
* @author ${author}
*/
//@Configuration
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(${StartClassName}.class);
}
}

View File

@@ -0,0 +1,4 @@
/**
* 可以在这里配置拦截器、过滤器、静态文件路径等全局配置
*/
package ${package}.start.config;