parent
616922e041
commit
1719a94030
@ -1,33 +0,0 @@
|
|||||||
package com.example.module.admin.ent;
|
|
||||||
|
|
||||||
import xyz.wbsite.wsqlite.anonation.TableField;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MAPPING - 映射
|
|
||||||
*
|
|
||||||
* @author author
|
|
||||||
* @version 0.0.1
|
|
||||||
* @since 2019-09-28
|
|
||||||
*/
|
|
||||||
public class Port {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VALUE - 端口值
|
|
||||||
*/
|
|
||||||
@TableField
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Port(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.example.module.admin.ent;
|
||||||
|
|
||||||
|
import xyz.wbsite.wsqlite.anonation.TableField;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MAPPING - 映射
|
||||||
|
*
|
||||||
|
* @author author
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2019-09-28
|
||||||
|
*/
|
||||||
|
public class Service {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALUE - 端口ID
|
||||||
|
*/
|
||||||
|
@TableField
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALUE - 端口值
|
||||||
|
*/
|
||||||
|
@TableField
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALUE - 备注
|
||||||
|
*/
|
||||||
|
@TableField
|
||||||
|
private String bz;
|
||||||
|
|
||||||
|
private List<Mapping> mappingList;
|
||||||
|
|
||||||
|
public List<Mapping> getMappingList() {
|
||||||
|
return mappingList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMappingList(List<Mapping> mappingList) {
|
||||||
|
this.mappingList = mappingList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBz() {
|
||||||
|
return bz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBz(String bz) {
|
||||||
|
this.bz = bz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Service() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Service(Long id, String value, String bz) {
|
||||||
|
this.id = id;
|
||||||
|
this.value = value;
|
||||||
|
this.bz = bz;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.example.module.admin.mgr;
|
||||||
|
|
||||||
|
import freemarker.cache.ClassTemplateLoader;
|
||||||
|
import freemarker.cache.MultiTemplateLoader;
|
||||||
|
import freemarker.cache.TemplateLoader;
|
||||||
|
import freemarker.template.Configuration;
|
||||||
|
import freemarker.template.Template;
|
||||||
|
import freemarker.template.TemplateException;
|
||||||
|
import freemarker.template.TemplateExceptionHandler;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class FreeMarkerManager {
|
||||||
|
private FreeMarkerConfigurer freeMarkerConfigurer;
|
||||||
|
|
||||||
|
public FreeMarkerManager() {
|
||||||
|
freeMarkerConfigurer = new FreeMarkerConfigurer();
|
||||||
|
// 初始化一些配置
|
||||||
|
Configuration cfg = new Configuration(Configuration.VERSION_2_3_28);
|
||||||
|
cfg.setDefaultEncoding("UTF-8");
|
||||||
|
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
|
||||||
|
cfg.setNumberFormat("0.##");
|
||||||
|
|
||||||
|
MultiTemplateLoader multiTemplateLoader = new MultiTemplateLoader(new TemplateLoader[]{
|
||||||
|
new ClassTemplateLoader(ClassUtils.getDefaultClassLoader(), "/modules"),
|
||||||
|
});
|
||||||
|
|
||||||
|
cfg.setTemplateLoader(multiTemplateLoader);
|
||||||
|
freeMarkerConfigurer.setConfiguration(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outputTemp(File outfile, String template, Object model) {
|
||||||
|
try {
|
||||||
|
if (!outfile.exists()) {
|
||||||
|
outfile.createNewFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取连接
|
||||||
|
Configuration configuration = freeMarkerConfigurer.getConfiguration();
|
||||||
|
//设置编码
|
||||||
|
configuration.setDefaultEncoding("UTF-8");
|
||||||
|
//获取ftl,由于已经在配置文件中配置了路径所以在这里直接写模板名称就可以
|
||||||
|
Template temp = configuration.getTemplate(template);
|
||||||
|
//输出文件路径
|
||||||
|
Writer wr = new OutputStreamWriter(new FileOutputStream(outfile),"UTF-8");
|
||||||
|
//写入
|
||||||
|
temp.process(model, wr);
|
||||||
|
//关闭流
|
||||||
|
wr.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (TemplateException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.example.module.admin.rsp;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.frame.base.BaseFindResponse;
|
||||||
|
import com.example.module.admin.ent.Service;
|
||||||
|
|
||||||
|
public class PortLoadResponse extends BaseFindResponse<Service> {
|
||||||
|
}
|
Loading…
Reference in new issue