提交 | 用户 | 时间
|
1ac2bc
|
1 |
package cn.stylefeng.guns.gen.core.generator.restful.feign; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.gen.core.generator.base.AbstractCustomGenerator; |
|
4 |
import org.beetl.core.Template; |
|
5 |
|
|
6 |
import java.io.File; |
|
7 |
import java.util.Map; |
|
8 |
|
|
9 |
/** |
|
10 |
* feign的api生成器 |
|
11 |
* |
|
12 |
* @author fengshuonan |
|
13 |
* @date 2018-12-13-2:20 PM |
|
14 |
*/ |
|
15 |
public class FeignApiGenerator extends AbstractCustomGenerator { |
|
16 |
|
|
17 |
public FeignApiGenerator(Map<String, Object> tableContext) { |
|
18 |
super(tableContext); |
|
19 |
} |
|
20 |
|
|
21 |
@Override |
|
22 |
public void bindingOthers(Template template) { |
|
23 |
template.binding("apiPackage", contextParam.getProPackage() + ".api"); |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public String getTemplateResourcePath() { |
|
28 |
return "/feignTemplates/FeignApi.btl"; |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
public String getGenerateFileTempPath() { |
|
33 |
String proPackage = this.contextParam.getProPackage(); |
|
34 |
String proPath = proPackage.replaceAll("\\.", "/"); |
|
35 |
File file = new File(contextParam.getOutputPath() + "/" + proPath + "/api/" + tableContext.get("entity") + "Api.java"); |
|
36 |
return file.getAbsolutePath(); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public String getGenerateFileDirectPath() { |
|
41 |
return this.getGenerateFileTempPath(); |
|
42 |
} |
|
43 |
} |