├── src └── main │ ├── resources │ ├── templates │ │ ├── jsonModel.ftl │ │ ├── dbToJson.ftl │ │ ├── serviceInterface.ftl │ │ ├── mapperClass.ftl │ │ ├── beanClass.ftl │ │ ├── serviceImpl.ftl │ │ ├── mapperXml.ftl │ │ ├── deviceController.ftl │ │ └── view.ftl │ ├── modelBuilders │ │ ├── jsonModel.json │ │ ├── mysql.json │ │ └── dbtojson.json │ └── config.json │ └── java │ └── org │ └── bigmamonkey │ ├── core │ ├── IModelBuilder.java │ ├── ModelHolder.java │ └── GeneratorManager.java │ ├── modelBuilder │ ├── JsonModelBuilder.java │ ├── MySqlConfig.java │ ├── DbColumnType.java │ ├── TableInfo.java │ ├── TableField.java │ └── MySqlModelBuilder.java │ ├── App.java │ ├── config │ ├── Config.java │ ├── ModelBuilderConfig.java │ └── TemplateConfig.java │ └── util │ ├── ClassBuilder.java │ ├── ConfigReader.java │ └── StringUtil.java ├── .idea ├── vcs.xml ├── encodings.xml ├── modules.xml ├── libraries │ ├── Maven__junit_junit_3_8_1.xml │ ├── Maven__org_freemarker_freemarker_2_3_23.xml │ ├── Maven__org_apache_commons_commons_lang3_3_5.xml │ ├── Maven__mysql_mysql_connector_java_5_1_41.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_8_8.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_8_8.xml │ └── Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml ├── dataSources.xml └── uiDesigner.xml ├── .gitignore ├── easygen.iml ├── pom.xml ├── README.md └── LICENSE /src/main/resources/templates/jsonModel.ftl: -------------------------------------------------------------------------------- 1 | this is data from json file: ${model.org.name} -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/modelBuilders/jsonModel.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "name": "BigMaMonkey", 3 | "org": { 4 | "name": "medlinker" 5 | } 6 | }, 7 | { 8 | "name": "zhangshuo", 9 | "org": { 10 | "name": "medlinker" 11 | } 12 | }] -------------------------------------------------------------------------------- /src/main/resources/modelBuilders/mysql.json: -------------------------------------------------------------------------------- 1 | { 2 | "dbUrl": "jdbc:mysql://localhost:3306/device_manage?useSSL=false", 3 | "driverClassName": "com.mysql.jdbc.Driver", 4 | "username": "root", 5 | "password": "root", 6 | "tables": "" 7 | } -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/core/IModelBuilder.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.core; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 模型构建器接口 7 | * @param 构建器配置类类型 8 | */ 9 | public interface IModelBuilder { 10 | 11 | /** 12 | * 构建数据模型 13 | * @param config 构建器配置类实例 14 | * @return 数据模型列表,返回List接口以支持批量生成 15 | * @throws Exception 16 | */ 17 | List buildDataModels(T config) throws Exception; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/modelBuilder/JsonModelBuilder.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.modelBuilder; 2 | 3 | import org.bigmamonkey.core.IModelBuilder; 4 | 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | /** 9 | * Created by bigmamonkey on 6/2/17. 10 | */ 11 | public class JsonModelBuilder implements IModelBuilder { 12 | @Override 13 | public List buildDataModels(Object config) throws Exception { 14 | return (List) config; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/templates/dbToJson.ftl: -------------------------------------------------------------------------------- 1 | [<#list model as table>{ 2 | "name": "${table.name}", 3 | "upperCaseName": "${table.upperCaseName}", 4 | "simpleName": "${table.simpleName}", 5 | "upperCaseSimpleName": "${table.upperCaseSimpleName}", 6 | "fields": [ 7 | <#list table.fields as field>{ 8 | "name": "${field.name}", 9 | "type": "${field.typeName}", 10 | "dictType": 0, 11 | "remarks": "${field.remarks}" 12 | }<#sep>, 13 | ] 14 | }<#sep>, 15 | ] -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/App.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey; 2 | 3 | import org.bigmamonkey.core.GeneratorManager; 4 | 5 | /** 6 | * Hello world! 7 | */ 8 | public class App { 9 | public static void main(String[] args) { 10 | GeneratorManager generatorManager = new GeneratorManager(); 11 | try { 12 | generatorManager.Start(); 13 | } catch (Exception e) { 14 | System.out.println(e.getMessage()); 15 | e.printStackTrace(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_3_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_freemarker_freemarker_2_3_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__mysql_mysql_connector_java_5_1_41.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/config/Config.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.config; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by bigmamonkey on 5/22/17. 7 | */ 8 | public class Config { 9 | 10 | private List modelBuilders; 11 | private List templates; 12 | 13 | public List getModelBuilders() { 14 | return modelBuilders; 15 | } 16 | 17 | public void setModelBuilders(List modelBuilders) { this.modelBuilders = modelBuilders; } 18 | 19 | public List getTemplates() { 20 | return templates; 21 | } 22 | 23 | public void setTemplates(List templates) { 24 | this.templates = templates; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/util/ClassBuilder.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.util; 2 | 3 | import java.lang.reflect.ParameterizedType; 4 | 5 | /** 6 | * Created by bigmamonkey on 6/3/17. 7 | */ 8 | public class ClassBuilder { 9 | public static TClass newInstance(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { 10 | Class builderClass = Class.forName(className); 11 | return (TClass) builderClass.newInstance(); 12 | } 13 | 14 | public static Class getGenericTypeArgumengt(String className) throws ClassNotFoundException { 15 | Class builderClass = Class.forName(className); 16 | return (Class) (((ParameterizedType) builderClass.getGenericInterfaces()[0]).getActualTypeArguments()[0]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/core/ModelHolder.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.core; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * 模型根对象,用于保存数据模型和模板自己定义参数, 7 | * 注意这里的model保存的是ModelBuilder返回的List中的元素。 8 | * Created by bigmamonkey on 5/31/17. 9 | */ 10 | public class ModelHolder { 11 | private Object model; 12 | private HashMap options; 13 | 14 | public ModelHolder(Object model, HashMap options) { 15 | this.model = model; 16 | this.options = options; 17 | } 18 | 19 | public Object getModel() { 20 | return model; 21 | } 22 | 23 | public void setModel(Object model) { 24 | this.model = model; 25 | } 26 | 27 | public HashMap getOptions() { 28 | return options; 29 | } 30 | 31 | public void setOptions(HashMap options) { 32 | this.options = options; 33 | } 34 | } -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mysql 6 | true 7 | com.mysql.jdbc.Driver 8 | jdbc:mysql://localhost:3306/device_manage 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/util/ConfigReader.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.util; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import java.io.File; 5 | import java.io.IOException; 6 | 7 | /** 8 | * Created by bigmamonkey on 5/23/17. 9 | */ 10 | public class ConfigReader { 11 | 12 | public static TConfig getConfigByFilePath(Class type, String path) throws Exception { 13 | 14 | File file = new File(path); 15 | if (!file.exists()) { 16 | String errMsg = String.format("config file at {%s} not exist..", path); 17 | throw new Exception(errMsg); 18 | } 19 | 20 | ObjectMapper objectMapper = new ObjectMapper(); 21 | TConfig config; 22 | try { 23 | config = objectMapper.readValue(file, type); 24 | return config; 25 | } catch (IOException e) { 26 | String errMsg = String.format("read config file {%s} exception..", path); 27 | throw new Exception(errMsg, e); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/config/ModelBuilderConfig.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.config; 2 | 3 | /** 4 | * Created by bigmamonkey on 5/22/17. 5 | */ 6 | public class ModelBuilderConfig { 7 | 8 | private String name; 9 | private String type; 10 | private String configPath; 11 | private String modelBuilderClassName; 12 | 13 | public String getName() { 14 | return name; 15 | } 16 | 17 | public void setName(String name) { 18 | this.name = name; 19 | } 20 | 21 | public String getType() { 22 | return type; 23 | } 24 | 25 | public void setType(String type) { 26 | this.type = type; 27 | } 28 | 29 | public String getConfigPath() { 30 | return configPath; 31 | } 32 | 33 | public void setConfigPath(String configPath) { 34 | this.configPath = configPath; 35 | } 36 | 37 | public String getModelBuilderClassName() { 38 | return modelBuilderClassName; 39 | } 40 | 41 | public void setModelBuilderClassName(String modelBuilderClassName) { 42 | this.modelBuilderClassName = modelBuilderClassName; 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/resources/templates/serviceInterface.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. bigmamonkey zhangshuocool@163.com 3 | * Unless required by applicable law or agreed to in writing, software distributed under 4 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 5 | * ANY KIND, either express or implied. See the License for the specific language governing 6 | * permissions and limitations under the License. 7 | */ 8 | 9 | package ${options.itns}; 10 | 11 | import ${options.pons}.${model.upperCaseName}; 12 | import java.util.List; 13 | 14 | public interface I${model.upperCaseSimpleName}Service { 15 | 16 | int deleteByPrimaryKey(${model.primaryKey.columnType.javaType} ${model.primaryKey.name}); 17 | 18 | int insert(${model.upperCaseName} record); 19 | 20 | int insertSelective(${model.upperCaseName} record); 21 | 22 | List<${model.upperCaseName}> selectAll(); 23 | 24 | ${model.upperCaseName} selectByPrimaryKey(${model.primaryKey.columnType.javaType} ${model.primaryKey.name}); 25 | 26 | int updateByPrimaryKeySelective(${model.upperCaseName} record); 27 | 28 | int updateByPrimaryKey(${model.upperCaseName} record); 29 | } -------------------------------------------------------------------------------- /src/main/resources/templates/mapperClass.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. bigmamonkey zhangshuocool@163.com 3 | * Unless required by applicable law or agreed to in writing, software distributed under 4 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 5 | * ANY KIND, either express or implied. See the License for the specific language governing 6 | * permissions and limitations under the License. 7 | */ 8 | 9 | package ${options.mpns}; 10 | 11 | import ${options.pons}.${model.upperCaseName}; 12 | import org.springframework.stereotype.Repository; 13 | import java.util.List; 14 | 15 | @Repository 16 | public interface ${model.upperCaseName}Mapper { 17 | 18 | int deleteByPrimaryKey(${model.primaryKey.columnType.javaType} ${model.primaryKey.name}); 19 | 20 | int insert(${model.upperCaseName} record); 21 | 22 | int insertSelective(${model.upperCaseName} record); 23 | 24 | List<${model.upperCaseName}> selectAll(); 25 | 26 | ${model.upperCaseName} selectByPrimaryKey(${model.primaryKey.columnType.javaType} ${model.primaryKey.name}); 27 | 28 | int updateByPrimaryKeySelective(${model.upperCaseName} record); 29 | 30 | int updateByPrimaryKey(${model.upperCaseName} record); 31 | } -------------------------------------------------------------------------------- /src/main/resources/templates/beanClass.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. bigmamonkey zhangshuocool@163.com 3 | * Unless required by applicable law or agreed to in writing, software distributed under 4 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 5 | * ANY KIND, either express or implied. See the License for the specific language governing 6 | * permissions and limitations under the License. 7 | */ 8 | 9 | package ${options.pons}; 10 | 11 | <#list model.pkgs as pkg> 12 | import ${pkg}; 13 | 14 | 15 | /** 16 | * ${model.remarks}表 17 | */ 18 | public class ${model.upperCaseName} { 19 | 20 | <#list model.fields as field> 21 | private ${field.columnType.javaType} ${field.name}; // ${field.remarks} 22 | 23 | 24 | <#list model.fields as field> 25 | /** 26 | * 获取${field.remarks}字段 27 | */ 28 | public ${field.columnType.javaType} get${field.upperCaseName}() { 29 | return ${field.name}; 30 | } 31 | 32 | /** 33 | * 设置${field.remarks}字段 34 | */ 35 | public void set${field.upperCaseName}(${field.columnType.javaType} ${field.name}) { 36 | this.${field.name} = ${field.name}<#if field.columnType.javaType == "String"> == null ? null : ${field.name}.trim(); 37 | } 38 | <#sep> 39 | 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/modelBuilder/MySqlConfig.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.modelBuilder; 2 | 3 | /** 4 | * Created by bigmamonkey on 5/22/17. 5 | */ 6 | public class MySqlConfig { 7 | 8 | private String dbUrl; // 数据库访问链接 9 | private String driverClassName; //驱动类名称 10 | private String username; 11 | private String password; 12 | private String tables; // 可指定要生成的表名,用,分割 13 | 14 | public String getDbUrl() { 15 | return dbUrl; 16 | } 17 | 18 | public void setDbUrl(String dbUrl) { 19 | this.dbUrl = dbUrl; 20 | } 21 | 22 | public String getDriverClassName() { 23 | return driverClassName; 24 | } 25 | 26 | public void setDriverClassName(String driverClassName) { 27 | this.driverClassName = driverClassName; 28 | } 29 | 30 | public String getUsername() { 31 | return username; 32 | } 33 | 34 | public void setUsername(String username) { 35 | this.username = username; 36 | } 37 | 38 | public String getPassword() { 39 | return password; 40 | } 41 | 42 | public void setPassword(String password) { 43 | this.password = password; 44 | } 45 | 46 | public String getTables() { 47 | return tables; 48 | } 49 | 50 | public void setTables(String tables) { 51 | this.tables = tables; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/modelBuilder/DbColumnType.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.modelBuilder; 2 | 3 | /** 4 | * Created by bigmamonkey on 5/23/17. 5 | */ 6 | public enum DbColumnType { 7 | 8 | STRING("String", null), 9 | LONG("Long", null), 10 | INTEGER("Integer", null), 11 | FLOAT("Float", null), 12 | DOUBLE("Double", null), 13 | BOOLEAN("Boolean", null), 14 | BYTE_ARRAY("byte[]", null), 15 | CHARACTER("Character", null), 16 | OBJECT("Object", null), 17 | DATE("Date", "java.util.Date"), 18 | TIME("Time", "java.sql.Time"), 19 | BLOB("Blob", "java.sql.Blob"), 20 | CLOB("Clob", "java.sql.Clob"), 21 | TIMESTAMP("Timestamp", "java.sql.Timestamp"), 22 | BIG_INTEGER("BigInteger", "java.math.BigInteger"), 23 | BIG_DECIMAL("BigDecimal", "java.math.BigDecimal"), 24 | LOCAL_DATE("LocalDate", "java.time.LocalDate"), 25 | LOCAL_TIME("LocalTime", "java.time.LocalTime"), 26 | LOCAL_DATE_TIME("LocalDateTime", "java.time.LocalDateTime"); 27 | 28 | private final String javaType; // 字段对应的java类型 29 | private final String pkg; // java类型需要导入的包路径,基本类型不需要,为null 30 | 31 | DbColumnType(final String javaType, final String pkg) { 32 | this.javaType = javaType; 33 | this.pkg = pkg; 34 | } 35 | 36 | public String getJavaType() { 37 | return this.javaType; 38 | } 39 | 40 | public String getPkg() { 41 | return this.pkg; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /easygen.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/util/StringUtil.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.util; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import java.util.ArrayList; 6 | import java.util.Arrays; 7 | import java.util.List; 8 | import java.util.stream.Collectors; 9 | 10 | /** 11 | * Created by bigmamonkey on 6/1/17. 12 | */ 13 | public class StringUtil { 14 | 15 | public static String ToUpperName(String str) throws Exception { 16 | String[] strsOld = str.split("_"); 17 | if ((str.length() <= 0)) { 18 | throw new Exception("table or field name rule wrong, please use xx_xx or xx or _xx.."); 19 | } 20 | 21 | List strList = new ArrayList(Arrays.asList(strsOld)); 22 | strList.remove(""); 23 | 24 | String[] strs = {}; 25 | strs = strList.toArray(strs); 26 | StringBuilder stringBuilder = new StringBuilder(); 27 | if (strs.length > 1) { 28 | stringBuilder.append(strs[0].toUpperCase()); 29 | for (int i = 1; i < strs.length; i++) { 30 | stringBuilder.append("_"); 31 | stringBuilder.append(strs[1].toUpperCase().charAt(0)); 32 | stringBuilder.append(strs[1].substring(1)); 33 | } 34 | } else { 35 | stringBuilder.append(strs[0].toUpperCase().charAt(0)); 36 | stringBuilder.append(strs[0].substring(1)); 37 | } 38 | 39 | return stringBuilder.toString(); 40 | } 41 | 42 | public static String ToSimpleName(String str) { 43 | String[] strs = str.split("_"); 44 | String simpleName = strs[0]; 45 | if (strs.length > 1) 46 | { 47 | simpleName = str.replaceFirst(strs[0] + "_", ""); 48 | } 49 | return simpleName; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/config/TemplateConfig.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.config; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * Created by bigmamonkey on 5/22/17. 7 | */ 8 | public class TemplateConfig { 9 | 10 | private String name; 11 | private String modelBuilderName; 12 | private String templateFilename; 13 | private String outputPath; 14 | private String outputFilenameRule; 15 | private boolean oneFile = false; 16 | private HashMap options; 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | public String getTemplateFilename() { 27 | return templateFilename; 28 | } 29 | 30 | public void setTemplateFilename(String templateFilename) { 31 | this.templateFilename = templateFilename; 32 | } 33 | 34 | public String getOutputPath() { 35 | return outputPath; 36 | } 37 | 38 | public void setOutputPath(String outputPath) { 39 | this.outputPath = outputPath; 40 | } 41 | 42 | public String getModelBuilderName() { 43 | return modelBuilderName; 44 | } 45 | 46 | public void setModelBuilderName(String modelBuilderName) { 47 | this.modelBuilderName = modelBuilderName; 48 | } 49 | 50 | public String getOutputFilenameRule() { 51 | return outputFilenameRule; 52 | } 53 | 54 | public void setOutputFilenameRule(String outputFilenameRule) { 55 | this.outputFilenameRule = outputFilenameRule; 56 | } 57 | 58 | public HashMap getOptions() { 59 | return options; 60 | } 61 | 62 | public void setOptions(HashMap options) { 63 | this.options = options; 64 | } 65 | 66 | public boolean isOneFile() { 67 | return oneFile; 68 | } 69 | 70 | public void setOneFile(boolean oneFile) { 71 | this.oneFile = oneFile; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/resources/templates/serviceImpl.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. bigmamonkey zhangshuocool@163.com 3 | * Unless required by applicable law or agreed to in writing, software distributed under 4 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 5 | * ANY KIND, either express or implied. See the License for the specific language governing 6 | * permissions and limitations under the License. 7 | */ 8 | 9 | package ${options.imns}; 10 | 11 | import ${options.pons}.${model.upperCaseName}; 12 | import ${options.mpns}.${model.upperCaseName}Mapper; 13 | import ${options.itns}.I${model.upperCaseSimpleName}Service; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Service; 16 | import java.util.List; 17 | 18 | @Service 19 | public class ${model.upperCaseSimpleName}ServiceImpl implements I${model.upperCaseSimpleName}Service { 20 | 21 | @Autowired 22 | ${model.upperCaseName}Mapper ${model.name}Mapper; 23 | 24 | @Override 25 | public int deleteByPrimaryKey(${model.primaryKey.columnType.javaType} ${model.primaryKey.name}) { 26 | return ${model.name}Mapper.deleteByPrimaryKey(${model.primaryKey.name}); 27 | } 28 | 29 | @Override 30 | public int insert(${model.upperCaseName} record) { 31 | return ${model.name}Mapper.insert(record); 32 | } 33 | 34 | @Override 35 | public int insertSelective(${model.upperCaseName} record) { 36 | return ${model.name}Mapper.insertSelective(record); 37 | } 38 | 39 | @Override 40 | public List<${model.upperCaseName}> selectAll() { 41 | return ${model.name}Mapper.selectAll(); 42 | } 43 | 44 | @Override 45 | public ${model.upperCaseName} selectByPrimaryKey(${model.primaryKey.columnType.javaType} ${model.primaryKey.name}) { 46 | return ${model.name}Mapper.selectByPrimaryKey(${model.primaryKey.name}); 47 | } 48 | 49 | @Override 50 | public int updateByPrimaryKeySelective(${model.upperCaseName} record) { 51 | return ${model.name}Mapper.updateByPrimaryKeySelective(record); 52 | } 53 | 54 | @Override 55 | public int updateByPrimaryKey(${model.upperCaseName} record) { 56 | return ${model.name}Mapper.updateByPrimaryKey(record); 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/modelBuilder/TableInfo.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.modelBuilder; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | import org.bigmamonkey.util.StringUtil; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by bigmamonkey on 5/22/17. 11 | */ 12 | public class TableInfo { 13 | private String name; // 原始表名 14 | private String upperCaseName; //前缀大写+首字符大写表名,用于创建PO、Mapper等 15 | private String simpleName;// 去掉前缀的表名,目前只支持_分割的表名,如sys_user 16 | private String upperCaseSimpleName; //simpleName的首字母大写形式 17 | private List fields = new ArrayList<>(); 18 | private List pkgs = new ArrayList<>(); // 所有字段类型对应的Java包,import到java文件 19 | private TableField primaryKey; // 主键字段 20 | private String remarks; // 表注释 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) throws Exception { 27 | 28 | this.name = name; 29 | this.upperCaseName = StringUtil.ToUpperName(name); 30 | this.simpleName = StringUtil.ToSimpleName(name); 31 | this.upperCaseSimpleName = StringUtil.ToSimpleName(this.upperCaseName); 32 | } 33 | 34 | public String getUpperCaseName() { 35 | return upperCaseName; 36 | } 37 | 38 | public void setUpperCaseName(String upperCaseName) { 39 | this.upperCaseName = upperCaseName; 40 | } 41 | 42 | public String getSimpleName() { 43 | return simpleName; 44 | } 45 | 46 | public void setSimpleName(String simpleName) { 47 | this.simpleName = simpleName; 48 | } 49 | 50 | public String getUpperCaseSimpleName() { 51 | return upperCaseSimpleName; 52 | } 53 | 54 | public void setUpperCaseSimpleName(String upperCaseSimpleName) { 55 | this.upperCaseSimpleName = upperCaseSimpleName; 56 | } 57 | 58 | public List getFields() { 59 | return fields; 60 | } 61 | 62 | public void setFields(List fields) { 63 | this.fields = fields; 64 | fields.forEach(field -> { 65 | 66 | String pkg = field.getColumnType().getPkg(); 67 | if (StringUtils.isEmpty(pkg) || pkgs.contains(pkg)) { 68 | return; 69 | } 70 | pkgs.add(pkg); 71 | }); 72 | } 73 | 74 | public List getPkgs() { 75 | return pkgs; 76 | } 77 | 78 | public void setPkgs(List pkgs) { 79 | this.pkgs = pkgs; 80 | } 81 | 82 | public TableField getPrimaryKey() { 83 | return primaryKey; 84 | } 85 | 86 | public void setPrimaryKey(TableField primaryKey) { 87 | this.primaryKey = primaryKey; 88 | } 89 | 90 | public String getRemarks() { 91 | return remarks; 92 | } 93 | 94 | public void setRemarks(String remarks) { 95 | this.remarks = remarks; 96 | } 97 | } -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/modelBuilder/TableField.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.modelBuilder; 2 | 3 | import org.bigmamonkey.util.StringUtil; 4 | 5 | import java.sql.Types; 6 | 7 | /** 8 | * Created by bigmamonkey on 5/22/17. 9 | */ 10 | public class TableField { 11 | private String name; // 原始字段名 12 | private String upperCaseName; // 首字母大写字段名 13 | private int dataType; // 字段类型值,对应 java.sql.Types中的枚举值 14 | private DbColumnType columnType; 15 | private String typeName; // 字段数据库类型,其他类型参见源码:TableField.java 16 | private int columnSize; // 字段大小 17 | private String remarks; // 字段注释 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) throws Exception { 24 | this.name = name; 25 | this.upperCaseName = StringUtil.ToUpperName(name); 26 | } 27 | 28 | public String getUpperCaseName() { 29 | return upperCaseName; 30 | } 31 | 32 | public void setUpperCaseName(String upperCaseName) { 33 | this.upperCaseName = upperCaseName; 34 | } 35 | 36 | public int getDataType() { 37 | return dataType; 38 | } 39 | 40 | public void setDataType(int dataType) { 41 | this.dataType = dataType; 42 | 43 | switch (dataType) { 44 | case Types.INTEGER: 45 | columnType = DbColumnType.INTEGER; 46 | typeName = "INTEGER"; 47 | break; 48 | case Types.BIGINT: 49 | columnType = DbColumnType.LONG; 50 | typeName = "BIGINT"; 51 | break; 52 | case Types.BIT: 53 | columnType = DbColumnType.BOOLEAN; 54 | typeName = "BIT"; 55 | break; 56 | case Types.VARCHAR: 57 | columnType = DbColumnType.STRING; 58 | typeName = "VARCHAR"; 59 | break; 60 | case Types.TIMESTAMP: 61 | columnType = DbColumnType.DATE; 62 | typeName = "TIMESTAMP"; 63 | break; 64 | case Types.FLOAT: 65 | columnType = DbColumnType.FLOAT; 66 | typeName = "FLOAT"; 67 | break; 68 | case Types.REAL: 69 | columnType = DbColumnType.FLOAT; 70 | typeName = "FLOAT"; 71 | break; 72 | case Types.DOUBLE: 73 | columnType = DbColumnType.DOUBLE; 74 | typeName = "DOUBLE"; 75 | break; 76 | default: 77 | columnType = DbColumnType.STRING; 78 | typeName = "VARCHAR"; 79 | break; 80 | } 81 | } 82 | 83 | public String getTypeName() { 84 | return typeName; 85 | } 86 | 87 | public void setTypeName(String typeName) { 88 | this.typeName = typeName; 89 | } 90 | 91 | public int getColumnSize() { 92 | return columnSize; 93 | } 94 | 95 | public void setColumnSize(int columnSize) { 96 | this.columnSize = columnSize; 97 | } 98 | 99 | public DbColumnType getColumnType() { 100 | return columnType; 101 | } 102 | 103 | public void setColumnType(DbColumnType columnType) { 104 | this.columnType = columnType; 105 | } 106 | 107 | public String getRemarks() { 108 | return remarks; 109 | } 110 | 111 | public void setRemarks(String remarks) { 112 | this.remarks = remarks; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/main/resources/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "modelBuilders": [ 3 | { 4 | "name": "mysql", 5 | "type": "db:mysql", 6 | "configPath": "modelBuilders/mysql.json" 7 | }, 8 | { 9 | "name": "json", 10 | "type": "json", 11 | "configPath": "modelBuilders/jsonModel.json" 12 | }, 13 | { 14 | "name": "viewJson", 15 | "type": "json", 16 | "configPath": "modelBuilders/dbtojson.json" 17 | } 18 | ], 19 | "templates": [ 20 | { 21 | "name": "beanClass", 22 | "modelBuilderName": "mysql", 23 | "templateFilename": "beanClass.ftl", 24 | "outputPath": "output/bean", 25 | "outputFilenameRule": "{upperCaseName}.java", 26 | "options": { 27 | "pons": "org.bigmonkey.robot.entity.po" 28 | } 29 | }, 30 | { 31 | "name": "mapperClass", 32 | "modelBuilderName": "mysql", 33 | "templateFilename": "mapperClass.ftl", 34 | "outputPath": "output/mapper", 35 | "outputFilenameRule": "{upperCaseName}Mapper.java", 36 | "options": { 37 | "pons": "org.bigmonkey.robot.entity.po", 38 | "mpns": "org.bigmonkey.robot.mapper" 39 | } 40 | }, 41 | { 42 | "name": "mapperXml", 43 | "modelBuilderName": "mysql", 44 | "templateFilename": "mapperXml.ftl", 45 | "outputPath": "output/mapperXml", 46 | "outputFilenameRule": "{upperCaseName}Mapper.xml", 47 | "options": { 48 | "mapperns": "org.bigmonkey.robot.mapper", 49 | "pons": "org.bigmonkey.robot.entity.po" 50 | } 51 | }, 52 | { 53 | "name": "serviceInterface", 54 | "modelBuilderName": "mysql", 55 | "templateFilename": "serviceInterface.ftl", 56 | "outputPath": "output/service", 57 | "outputFilenameRule": "I{upperCaseSimpleName}Service.java", 58 | "options": { 59 | "pons": "org.bigmonkey.robot.entity.po", 60 | "itns": "org.bigmonkey.robot.service" 61 | } 62 | }, 63 | { 64 | "name": "serviceImpl", 65 | "modelBuilderName": "mysql", 66 | "templateFilename": "serviceImpl.ftl", 67 | "outputPath": "output/serviceImpl", 68 | "outputFilenameRule": "{upperCaseSimpleName}ServiceImpl.java", 69 | "options": { 70 | "pons": "org.bigmonkey.robot.entity.po", 71 | "itns": "org.bigmonkey.robot.service", 72 | "mpns": "org.bigmonkey.robot.mapper", 73 | "imns": "org.bigmonkey.robot.service.impl" 74 | } 75 | }, 76 | { 77 | "name": "deviceController", 78 | "modelBuilderName": "mysql", 79 | "templateFilename": "deviceController.ftl", 80 | "outputPath": "output/devCtrl", 81 | "outputFilenameRule": "{upperCaseSimpleName}Controller.java", 82 | "options": {} 83 | }, 84 | { 85 | "name": "jsonToView", 86 | "modelBuilderName": "viewJson", 87 | "templateFilename": "view.ftl", 88 | "outputPath": "output/view", 89 | "outputFilenameRule": "{upperCaseSimpleName}.vue", 90 | "options": {} 91 | }, 92 | { 93 | "name": "jsonModel", 94 | "modelBuilderName": "json", 95 | "templateFilename": "jsonModel.ftl", 96 | "outputPath": "output/jsonModel", 97 | "outputFilenameRule": "data_{name}.xml", 98 | "options": {} 99 | }, 100 | { 101 | "name": "dbToJson", 102 | "modelBuilderName": "mysql", 103 | "templateFilename": "dbToJson.ftl", 104 | "outputPath": "output/dbToJson", 105 | "outputFilenameRule": "dbToJson.json", 106 | "oneFile": true, 107 | "options": {} 108 | } 109 | ] 110 | } -------------------------------------------------------------------------------- /src/main/resources/templates/mapperXml.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <#list model.fields as field> 7 | 8 | 9 | 10 | 11 | <#list model.fields as field>${field.name}<#sep>, 12 | 13 | 18 | 24 | 25 | delete from ${model.name} 26 | where id = ${r"#{"}${model.primaryKey.name},jdbcType=${model.primaryKey.typeName}${r"}"} 27 | 28 | 29 | insert into ${model.name} (<#list model.fields as field>${field.name}<#sep>, ) 30 | values (<#list model.fields as field>${r"#{"}${field.name},jdbcType=${field.typeName}${r"}"}<#sep>, ) 31 | 32 | 33 | insert into ${model.name} 34 | 35 | <#list model.fields as field> 36 | 37 | ${field.name}, 38 | 39 | 40 | 41 | 42 | <#list model.fields as field> 43 | 44 | ${r"#{"}${field.name},jdbcType=${field.typeName}${r"}"}, 45 | 46 | 47 | 48 | 49 | 50 | update ${model.name} 51 | 52 | <#list model.fields as field> 53 | <#if field.name != model.primaryKey.name> 54 | 55 | ${field.name} = ${r"#{"}${field.name},jdbcType=${field.typeName}${r"}"}, 56 | 57 | 58 | 59 | 60 | where id = ${r"#{"}${model.primaryKey.name},jdbcType=${model.primaryKey.typeName}${r"}"} 61 | 62 | 63 | update ${model.name} 64 | set 65 | <#list model.fields as field> 66 | <#if field.name != model.primaryKey.name> 67 | ${field.name} = ${r"#{"}${field.name},jdbcType=${field.typeName}${r"}"}<#sep>, 68 | 69 | 70 | 71 | where id = ${r"#{"}${model.primaryKey.name},jdbcType=${model.primaryKey.typeName}${r"}"} 72 | 73 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.bigmamonkey 6 | easygen 7 | 0.0.3-SNAPSHOT 8 | jar 9 | 10 | easygen 11 | http://maven.apache.org 12 | 13 | 14 | UTF-8 15 | 16 | 17 | 18 | 19 | junit 20 | junit 21 | 3.8.1 22 | test 23 | 24 | 25 | com.fasterxml.jackson.core 26 | jackson-core 27 | 2.8.8 28 | 29 | 30 | com.fasterxml.jackson.core 31 | jackson-databind 32 | 2.8.8 33 | 34 | 35 | mysql 36 | mysql-connector-java 37 | 5.1.41 38 | 39 | 40 | org.freemarker 41 | freemarker 42 | 2.3.23 43 | 44 | 45 | org.apache.commons 46 | commons-lang3 47 | 3.5 48 | 49 | 50 | 51 | 52 | 53 | 54 | src/main/resources 55 | ${project.build.directory} 56 | 57 | 58 | 59 | 60 | org.apache.maven.plugins 61 | maven-compiler-plugin 62 | 63 | 1.8 64 | 1.8 65 | UTF-8 66 | 67 | 68 | 69 | 70 | org.apache.maven.plugins 71 | maven-resources-plugin 72 | 73 | UTF-8 74 | 75 | 76 | 77 | org.apache.maven.plugins 78 | maven-jar-plugin 79 | 80 | 81 | 82 | true 83 | lib/ 84 | org.bigmamonkey.App 85 | 86 | 87 | 88 | 89 | 90 | org.apache.maven.plugins 91 | maven-dependency-plugin 92 | 93 | 94 | copy 95 | package 96 | 97 | copy-dependencies 98 | 99 | 100 | 101 | ${project.build.directory}/lib 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/main/resources/templates/deviceController.ftl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017. bigmamonkey zhangshuocool@163.com 3 | * Unless required by applicable law or agreed to in writing, software distributed under 4 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 5 | * ANY KIND, either express or implied. See the License for the specific language governing 6 | * permissions and limitations under the License. 7 | */ 8 | 9 | package org.bigmonkey.robot.controller.manage; 10 | 11 | import org.bigmonkey.robot.controller.BaseController; 12 | import org.bigmonkey.robot.entity.po.${model.upperCaseName}Search; 13 | import org.bigmonkey.robot.entity.po.SYS_User; 14 | import org.bigmonkey.robot.entity.vo.ServerResult; 15 | import org.bigmonkey.robot.entity.vo.VO_${model.upperCaseSimpleName}; 16 | import org.bigmonkey.robot.entity.vo.VO_DeviceSearch; 17 | import org.bigmonkey.robot.entity.vo.VO_PageResult; 18 | import org.bigmonkey.robot.service.IBaseInfoService; 19 | import org.bigmonkey.robot.service.I${model.upperCaseSimpleName}Service; 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | import org.springframework.stereotype.Controller; 22 | import org.springframework.web.bind.annotation.PostMapping; 23 | import org.springframework.web.bind.annotation.RequestBody; 24 | import org.springframework.web.bind.annotation.RequestMapping; 25 | import org.springframework.web.bind.annotation.ResponseBody; 26 | 27 | import java.util.Date; 28 | import java.util.List; 29 | 30 | /** 31 | * Created by bigmamonkey on 6/13/17. 32 | */ 33 | @RequestMapping("/manage/${model.simpleName}") 34 | @Controller 35 | public class ${model.upperCaseSimpleName}Controller extends BaseController { 36 | 37 | @Autowired 38 | private IBaseInfoService baseInfoService; 39 | 40 | @Autowired 41 | private I${model.upperCaseSimpleName}Service ${model.simpleName}Service; 42 | 43 | @PostMapping("/list") 44 | @ResponseBody 45 | public ServerResult listAll${model.upperCaseSimpleName}(@RequestBody VO_DeviceSearch search) throws IllegalAccessException { 46 | List<${model.upperCaseName}Search> ${model.name}s = ${model.simpleName}Service.selectBySearch(search.getRoadId(), search.getStartTime(), search.getEndTime(), search.getName(), search.getCode(), search.getPageNo(), 15); 47 | int total = ${model.simpleName}Service.selectFoundRows(); 48 | return success(new VO_PageResult(${model.name}s, total)); 49 | } 50 | 51 | @PostMapping("/add") 52 | @ResponseBody 53 | public ServerResult add${model.upperCaseSimpleName}(@RequestBody VO_${model.upperCaseSimpleName} vo) { 54 | if(baseInfoService.selectCountByCode(vo.getCode()) > 0) { 55 | return error("存在设备编码相同的设备"); 56 | } 57 | SYS_User sys_user = getUserInfoFromSession(); 58 | vo.setDeviceType("${model.simpleName}"); 59 | vo.setOrgId(sys_user.getOrgId()); 60 | vo.setCreator(sys_user.getId()); 61 | vo.setCreateTime(new Date()); 62 | vo.setModifier(sys_user.getId()); 63 | vo.setModifyTime(new Date()); 64 | baseInfoService.insertSelective(vo); 65 | ${model.simpleName}Service.insertSelective(vo); 66 | return success(vo); 67 | } 68 | 69 | @PostMapping("/edit") 70 | @ResponseBody 71 | public ServerResult edit${model.upperCaseSimpleName}(@RequestBody VO_${model.upperCaseSimpleName} vo) throws IllegalAccessException { 72 | if(baseInfoService.selectCountByCodeAndId(vo.getCode(), vo.getId()) > 0) { 73 | return error("存在设备编码相同的设备"); 74 | } 75 | vo.setModifier(getUserInfoFromSession().getId()); 76 | vo.setModifyTime(new Date()); 77 | baseInfoService.updateByPrimaryKeySelective(vo); 78 | if(checkNull(vo)) { 79 | ${model.simpleName}Service.updateByPrimaryKeySelective(vo); 80 | } 81 | return success(); 82 | } 83 | 84 | @PostMapping("/remove") 85 | @ResponseBody 86 | public ServerResult remove${model.upperCaseSimpleName}(int id) { 87 | baseInfoService.deleteByPrimaryKey(id); 88 | ${model.simpleName}Service.deleteByPrimaryKey(id); 89 | return success(); 90 | } 91 | } -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/modelBuilder/MySqlModelBuilder.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.modelBuilder; 2 | 3 | import jdk.nashorn.internal.runtime.Debug; 4 | import org.apache.commons.lang3.StringUtils; 5 | import org.bigmamonkey.core.IModelBuilder; 6 | 7 | import java.sql.*; 8 | import java.util.ArrayList; 9 | import java.util.Arrays; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by bigmamonkey on 5/22/17. 14 | */ 15 | public class MySqlModelBuilder implements IModelBuilder { 16 | 17 | public List buildDataModels(MySqlConfig config) throws Exception { 18 | 19 | try { 20 | Class.forName(config.getDriverClassName()); 21 | } catch (ClassNotFoundException e) { 22 | throw new Exception("load driver exception..", e); 23 | } 24 | 25 | List tableInfos = new ArrayList<>(); 26 | Connection connection; 27 | try { 28 | connection = DriverManager.getConnection(config.getDbUrl(), config.getUsername(), config.getPassword()); 29 | DatabaseMetaData dbMetaData = connection.getMetaData(); 30 | 31 | List allTableList = getAllTableList(dbMetaData); 32 | String[] tableNames = config.getTables().split(","); 33 | if (!(tableNames.length == 1 && StringUtils.isBlank(tableNames[0]))) { 34 | List tableNameList = Arrays.asList(tableNames); 35 | allTableList.removeIf(table -> !tableNameList.contains(table.getName())); 36 | } 37 | tableInfos.addAll(allTableList); 38 | 39 | } catch (SQLException e) { 40 | throw new Exception("load database metadata exception..", e); 41 | } 42 | 43 | try { 44 | connection.close(); 45 | } catch (SQLException e) { 46 | e.printStackTrace(); 47 | } 48 | return tableInfos; 49 | } 50 | 51 | /** 52 | * 获得该用户下面的所有表 53 | */ 54 | public static List getAllTableList(DatabaseMetaData dbMetaData) throws Exception { 55 | List tableInfos = new ArrayList(); 56 | try { 57 | // table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM". 58 | String[] types = {"TABLE"}; 59 | ResultSet rs = dbMetaData.getTables(null, null, "%", types); 60 | 61 | while (rs.next()) { 62 | String tableName = rs.getString("TABLE_NAME"); //表名 63 | // String tableType = rs.getString("TABLE_TYPE"); //表类型 64 | String remarks = rs.getString("REMARKS"); //表备注 65 | 66 | List tableFields = getTableFields(dbMetaData, tableName); 67 | String primaryKeyName = getAllPrimaryKeys(dbMetaData, tableName); 68 | TableField primaryKey = tableFields.stream() 69 | .filter(field -> field.getName().equals(primaryKeyName)) 70 | .findFirst().get(); 71 | TableInfo tableInfo = new TableInfo(); 72 | tableInfo.setName(tableName); 73 | tableInfo.setFields(tableFields); 74 | tableInfo.setPrimaryKey(primaryKey); 75 | tableInfo.setRemarks(remarks); 76 | tableInfos.add(tableInfo); 77 | } 78 | } catch (SQLException e) { 79 | e.printStackTrace(); 80 | } 81 | return tableInfos; 82 | } 83 | 84 | /** 85 | * 获得表或视图中的所有列信息 86 | */ 87 | public static List getTableFields(DatabaseMetaData dbMetaData, String tableName) throws Exception { 88 | 89 | ArrayList tableFields = new ArrayList<>(); 90 | 91 | ResultSet rs = dbMetaData.getColumns(null, null, tableName, "%"); 92 | while (rs.next()) { 93 | String columnName = rs.getString("COLUMN_NAME");//列名 94 | int dataType = rs.getInt("DATA_TYPE"); //对应的 类型 95 | String dataTypeName = rs.getString("TYPE_NAME");//java.sql.Types类型 名称 96 | int columnSize = rs.getInt("COLUMN_SIZE");//列大小 97 | String remarks = rs.getString("REMARKS");//列描述 98 | TableField tableField = new TableField(); 99 | tableField.setName(columnName); 100 | tableField.setDataType(dataType); 101 | // tableField.setTypeName(dataTypeName); 102 | tableField.setColumnSize(columnSize); 103 | tableField.setRemarks(remarks); 104 | tableFields.add(tableField); 105 | } 106 | return tableFields; 107 | } 108 | 109 | /** 110 | * 获得一个表的主键信息 111 | */ 112 | public static String getAllPrimaryKeys(DatabaseMetaData dbMetaData, String tableName) throws Exception { 113 | 114 | ResultSet rs = dbMetaData.getPrimaryKeys(null, null, tableName); 115 | if (!rs.next()) { 116 | throw new Exception(String.format("table:%s don't have primary key", tableName)); 117 | } 118 | return rs.getString("COLUMN_NAME");//列名 119 | } 120 | } -------------------------------------------------------------------------------- /src/main/java/org/bigmamonkey/core/GeneratorManager.java: -------------------------------------------------------------------------------- 1 | package org.bigmamonkey.core; 2 | 3 | import freemarker.template.Configuration; 4 | import freemarker.template.Template; 5 | import freemarker.template.TemplateExceptionHandler; 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.apache.commons.lang3.reflect.FieldUtils; 8 | import org.bigmamonkey.config.Config; 9 | import org.bigmamonkey.config.ModelBuilderConfig; 10 | import org.bigmamonkey.config.TemplateConfig; 11 | import org.bigmamonkey.modelBuilder.JsonModelBuilder; 12 | import org.bigmamonkey.modelBuilder.MySqlConfig; 13 | import org.bigmamonkey.modelBuilder.MySqlModelBuilder; 14 | import org.bigmamonkey.util.ClassBuilder; 15 | import org.bigmamonkey.util.ConfigReader; 16 | 17 | import java.io.File; 18 | import java.io.FileWriter; 19 | import java.util.ArrayList; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | 23 | /** 24 | * Created by bigmamonkey on 5/22/17. 25 | */ 26 | public class GeneratorManager { 27 | 28 | private String configPath; 29 | private String templatePath; 30 | private HashMap> dataModels = new HashMap<>(); 31 | private HashMap modelBuilderConfigs = new HashMap<>(); 32 | private Configuration cfg; 33 | 34 | public GeneratorManager() { 35 | this("config.json", "templates"); 36 | } 37 | 38 | public GeneratorManager(String configPath) { 39 | this(configPath, "templates"); 40 | } 41 | 42 | public GeneratorManager(String configPath, String templatePath) { 43 | this.configPath = StringUtils.isEmpty(configPath) ? "config.json" : configPath; 44 | this.templatePath = StringUtils.isEmpty(templatePath) ? "templates" : templatePath; 45 | } 46 | 47 | public void Start() throws Exception { 48 | 49 | Config config = ConfigReader.getConfigByFilePath(Config.class, configPath); 50 | 51 | for (ModelBuilderConfig modelBuilderConfig : config.getModelBuilders()) { 52 | modelBuilderConfigs.put(modelBuilderConfig.getName(), modelBuilderConfig); 53 | } 54 | 55 | List templates = config.getTemplates(); 56 | for (TemplateConfig template : templates) { 57 | String moderBuilderName = template.getModelBuilderName(); 58 | if (!modelBuilderConfigs.containsKey(moderBuilderName)) { 59 | throw new Exception("template's datasourceclassname not be defined"); 60 | } 61 | 62 | List models; 63 | if (dataModels.containsKey(moderBuilderName)) { 64 | models = dataModels.get(moderBuilderName); 65 | } else { 66 | ModelBuilderConfig modelBuilderConfig = modelBuilderConfigs.get(moderBuilderName); 67 | String builderType = modelBuilderConfig.getType(); 68 | IModelBuilder ds; 69 | Class type; 70 | switch (builderType) { 71 | case "db:mysql": 72 | type = MySqlConfig.class; 73 | ds = new MySqlModelBuilder(); 74 | break; 75 | case "json": 76 | type = ArrayList.class; 77 | ds = new JsonModelBuilder(); 78 | break; 79 | case "custom": 80 | String modelBuilderClassName = modelBuilderConfig.getModelBuilderClassName(); 81 | ds = ClassBuilder.newInstance(modelBuilderClassName); 82 | type = ClassBuilder.getGenericTypeArgumengt(modelBuilderClassName); 83 | break; 84 | default: 85 | throw new Exception("modelBuilderConfig miss type..."); 86 | } 87 | 88 | models = ds.buildDataModels(ConfigReader.getConfigByFilePath(type, modelBuilderConfig.getConfigPath())); 89 | 90 | dataModels.put(moderBuilderName, models); 91 | } 92 | cfg = new Configuration(Configuration.VERSION_2_3_22); 93 | cfg.setDirectoryForTemplateLoading(new File(templatePath)); 94 | cfg.setDefaultEncoding("UTF-8"); 95 | cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); 96 | 97 | if (template.isOneFile()) { 98 | ProcessTemplate(models, template); 99 | } else { 100 | for (Object eachModel : models) { 101 | ProcessTemplate(eachModel, template); 102 | } 103 | } 104 | } 105 | } 106 | 107 | private void ProcessTemplate(Object dataModel, TemplateConfig template) throws Exception { 108 | 109 | ModelHolder modelHolder = new ModelHolder(dataModel, template.getOptions()); 110 | String tempFilename = template.getTemplateFilename(); 111 | String outputPath = template.getOutputPath(); 112 | String outputFilenameRule = template.getOutputFilenameRule(); 113 | 114 | String filename; 115 | 116 | if (template.isOneFile()) { 117 | filename = outputFilenameRule; 118 | } 119 | else { 120 | int startIndex = outputFilenameRule.indexOf("{") + 1; 121 | int endIndex = outputFilenameRule.indexOf("}"); 122 | 123 | if (startIndex >= endIndex) { 124 | throw new StringIndexOutOfBoundsException(endIndex - startIndex); 125 | } 126 | 127 | String propName = outputFilenameRule.substring(startIndex, endIndex); 128 | String filenameValue; 129 | if (dataModel instanceof HashMap) { 130 | filenameValue = (String) ((HashMap) dataModel).get(propName); 131 | } else { 132 | filenameValue = (String) FieldUtils.readField(dataModel, propName, true); 133 | } 134 | 135 | filename = outputFilenameRule.replace("{" + propName + "}", filenameValue); 136 | } 137 | 138 | outputPath = outputPath.endsWith("/") ? outputPath : outputPath + "/"; 139 | 140 | filename = outputPath + filename; 141 | 142 | File outPath = new File(outputPath); 143 | outPath.mkdirs(); 144 | 145 | Template temp = cfg.getTemplate(tempFilename); 146 | FileWriter writer = new FileWriter(new File(filename)); 147 | temp.process(modelHolder, writer); 148 | writer.close(); 149 | } 150 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### easygen v0.0.3 2 | 3 | 一个灵活的通用代码生成框架,适用于多种代码生成场景,可以作为mybatis generator的替代。 4 | 5 | 主要设计思路为: 6 | 分离模型与模板,以达到模型重用的目的,模型的加载由模型构建器完成,模型构建器支持自定义,以满足多样的代码生成需求。 7 | 8 | 框架的执行流程主要是: 9 | - 1.easygen框架加载主配置文件config.json 10 | - 2.根据config.json中modelBuilders模型构建器配置创建模型构建器。 11 | - 3.根据config.json中的templates模板配置,顺序执行生成任务。 12 | - 3.1 根据模板的modelBuilderName属性,找到模板关联的模型构建器,并加载模型数据。 13 | - 3.2 freemarker利用模型数据和ftl模板文件(templateFilename属性指定)生成代码。 14 | - 3.3 freemarker根据指定的文件名(outputFilenameRule)和输出路径(outputPath)写入文件。 15 | 16 | 主要特色如下: 17 | 18 | - 基于freemarker的模板语法,上手简单 19 | - 内置mysql、json模型构建器,并支持自定义 20 | - 支持生成指定表、去掉表前缀、转换大小写等 21 | - 支持模型与模板的一对多关系(模型与模板的分离) 22 | - 支持List类型的模型,支持批量生成,也支持List生成单个文件。 23 | - 支持自定义文件名生成规则 24 | - 支持自定义输出路径 25 | - 支持模板自定义参数 26 | - 支持根据数据库remarks生成注释 27 | 28 | ###以下示例演示了应用于mybatis的代码生成使用。 29 | 30 | 1.首先下载easygen发布包 [下载](https://github.com/BigMaMonkey/easygen/releases) 31 | 32 | 解压后,包含以下几部分: 33 | - easygen-1.0-SNAPSHOT.jar:这是easygen主程序,负责读取配置文件并生成代码 34 | - config.json:这是easy主配置文件 35 | - modelBuildrs:这里存放的是模型构建器的配置文件 36 | - templates:这是里存放的是模板文件 37 | - lib:这里存放的是easygen引用的第三方jar包 38 | 39 | 2.编写主配置文件 40 | 41 | 目录下的config.json为主配置文件, 发布包已经给出了一个比较完整的配置,包括型构建器配置和模板配置,包括生成bean、mapperclass、mapperxml、serviceInterface、serviceImpl、view、dbtojson(生成数据库元数据)很简单自己看配置和代码就行了。。。 42 | 43 | ```json 44 | { 45 | "modelBuilders": [ 46 | { 47 | "name": "mysql", // 构建器名称要唯一 48 | "type": "db:mysql", // 构建器类型目前只支持mysql和json两种 49 | "configPath": "modelBuilders/mysql.json" // 数据库配置和生成表指定 50 | }, 51 | { 52 | "name": "json", 53 | "type": "json", 54 | "configPath": "modelBuilders/jsonModel.json" // 与mysql构建器不同的是,这里直接是模型数据,注意Json模型必须是数组,参考data.json 55 | }, 56 | { 57 | "name": "http", 58 | "type": "custom", // 自定义的构建器 59 | "configPath": "modelBuilders/xxx.json", // 这个json反序列化类型需要在IModelBuilder的泛型参数中指出。 60 | "modelBuilderClassName": "org.BigMaMonkey.XXX.XXX" // 自定义的构建器需要实现类,实现org.bigmamonkey.core.IModelBuilder接口 61 | } 62 | ], 63 | "templates": [ 64 | { 65 | "name": "jsonModel", 66 | "modelBuilderName": "json", // 关联的构建器名称,不是类型 67 | "templateFilename": "jsonModel.ftl", // ftl模板文件 68 | "outputPath": "output/jsonModel", // 输出目录,会自动递归创建目录。 69 | "outputFilenameRule": "jsonModel_{name}.xml", // 输出文件名规则,{}内变量为模型的字段field 70 | "options": {} // 自定义模板参数,可以在模板中使用,请自由发挥。 71 | }, 72 | { 73 | "name": "dbToJson", //输出数据库元数据到Json 74 | "modelBuilderName": "mysql", 75 | "templateFilename": "dbToJson.ftl", 76 | "outputPath": "output/dbToJson", 77 | "outputFilenameRule": "dbToJson.json", 78 | "oneFile": true, //通过设置这个属性,可以将所有表的元数据输出到一个Template 79 | "options": {} 80 | }, 81 | { 82 | "name": "mapperXml", 83 | "modelBuilderName": "mysql", 84 | "templateFilename": "mapperXml.ftl", 85 | "outputPath": "output/mapperXml", 86 | "outputFilenameRule": "{upperCaseName}Mapper.xml", 87 | "options": { 88 | "mapperns": "org.bigmonkey.robot.mapper", 89 | "pons": "org.bigmonkey.robot.entity.po" 90 | } 91 | }, 92 | { 93 | "name": "beanClass", 94 | "modelBuilderName": "mysql", 95 | "templateFilename": "beanClass.ftl", 96 | "outputPath": "output/bean", 97 | "outputFilenameRule": "{upperCaseName}.java", 98 | "options": { 99 | "pons": "org.bigmonkey.robot.entity.po" 100 | } 101 | }, 102 | { 103 | "name": "mapperClass", 104 | "modelBuilderName": "mysql", 105 | "templateFilename": "mapperClass.ftl", 106 | "outputPath": "output/mapper", 107 | "outputFilenameRule": "{upperCaseName}Mapper.java", 108 | "options": { 109 | "pons": "org.bigmonkey.robot.entity.po", 110 | "mpns": "org.bigmonkey.robot.mapper" 111 | } 112 | }, 113 | { 114 | "name": "serviceInterface", 115 | "modelBuilderName": "mysql", 116 | "templateFilename": "serviceInterface.ftl", 117 | "outputPath": "output/service", 118 | "outputFilenameRule": "I{upperCaseSimpleName}Service.java", 119 | "options": { 120 | "pons": "org.bigmonkey.robot.entity.po", 121 | "itns": "org.bigmonkey.robot.service" 122 | } 123 | }, 124 | { 125 | "name": "serviceImpl", 126 | "modelBuilderName": "mysql", 127 | "templateFilename": "serviceImpl.ftl", 128 | "outputPath": "output/service", 129 | "outputFilenameRule": "{upperCaseSimpleName}ServiceImpl.java", 130 | "options": { 131 | "pons": "org.bigmonkey.robot.entity.po", 132 | "imns": "org.bigmonkey.robot.service.impl" 133 | } 134 | }, 135 | { 136 | "name": "view", 137 | "modelBuilderName": "mysql", 138 | "templateFilename": "view.ftl", 139 | "outputPath": "output/view", 140 | "outputFilenameRule": "{name}view.vue", 141 | "options": {} 142 | }, 143 | { 144 | "name": "db-to-json", 145 | "modelBuilderName": "mysql", 146 | "templateFilename": "dbToJson.ftl", 147 | "outputPath": "output/json", 148 | "outputFilenameRule": "{name}.json", 149 | "options": {} 150 | } 151 | ] 152 | } 153 | ``` 154 | 3.编写模板 155 | 其实模板的编写很简单,你只需要掌握freemarker的ftl语法,以及基本的json知识就可以了。 156 | 这里只讲解mybatis内置构建器的使用 157 | 158 | 3.1.首先是构建器配置 159 | ```json 160 | { 161 | "name": "mysql", // 构建器名称要唯一 162 | "type": "db:mysql", // 构建器类型目前只支持mysql和json两种 163 | "configPath": "modelBuilders/mysql.json" // 数据库配置和生成表指定 164 | } 165 | ``` 166 | type中db:mysql指定使用内置的mysql构建器,configPath指定构建器的配置文件,配置如下: 167 | ```json 168 | { 169 | "dbUrl": "jdbc:mysql://localhost:3306/device_manage", 170 | "driverClassName": "com.mysql.jdbc.Driver", 171 | "username": "root", 172 | "password": "root", 173 | "tables": "sys_user,pub_dict" // 用,分割指定生成的表名,也可以留空表示生成所有表 174 | } 175 | ``` 176 | 3.2.需要给出的是内置mysql构建器的模型结构,你才能在ftl中使用 177 | 注意:构建器支持的表名和字段命名格式为xx_xx or xx or _xx.. 178 | ```json 179 | { 180 | "name": "sys_user", // 原始表名 181 | "upperCaseName": "SYS_User", // 前缀大写+首字符大写表名,用于创建PO、Mapper等 182 | "simpleName": "user", // 去掉前缀的表名,目前只支持_分割的表名,如sys_user 183 | "upperCaseSimpleName": "User", // simpleName的首字母大写形式 184 | "remarks": "系统用户", // 表注释 185 | "pkgs": [ 186 | "java.util.Date" // 字段类型对应的Java包,import到java文件 187 | ], 188 | "fields": [ 189 | { 190 | "name": "name", // 原始字段名 191 | "upperCaseName": "Name", // 首字母大写字段名 192 | "dataType": "12", // 字段类型值,对应 java.sql.Types中的枚举值 193 | "typeName": "VARCHAR", // 字段数据库类型,其他类型参见源码:TableField.java 194 | "columnSize": "32", // 字段大小 195 | "remarks": "名称", // 字段注释 196 | "columnType": { 197 | "javaType": "String", // 对应的java类型 198 | "pkg": null // 基础类型为null,不需要import 199 | } 200 | } 201 | ], 202 | "primaryKey": { 203 | // 同field中的元素属性 204 | } 205 | } 206 | ``` 207 | 在ftl中模型的跟是model,例如你要在ftl中输出一个表名${model.name}, 又或者是主键的名称${model.primaryKey.name} 208 | 209 | 如果你在模板配置中设置了自定义模板参数options,请这样使用它${options.xxx} 210 | 211 | 通过在outputFilenameRule中使用{XXX}可以引用model中根属性,来自定义输出文件名,如{upperCaseName}Mapper.java 212 | 213 | 4.最后使用方式相当简单: 214 | 215 | ```cmd 216 | java -jar easygen-0.0.2-SNAPSHOT.jar 217 | ``` 218 | 当然你也可以把代码的执行集成到你自己的项目或工具: 219 | 220 | ```java 221 | public class App { 222 | public static void main(String[] args) { 223 | GeneratorManager generatorManager = new GeneratorManager(); 224 | try { 225 | generatorManager.Start(); 226 | } catch (Exception e) { 227 | System.out.println(e.getMessage()); 228 | e.printStackTrace(); 229 | } 230 | } 231 | } 232 | ``` 233 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/main/resources/modelBuilders/dbtojson.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "name": "dev_baseInfo", 3 | "upperCaseName": "DEV_BaseInfo", 4 | "simpleName": "baseInfo", 5 | "upperCaseSimpleName": "BaseInfo", 6 | "fields": [ 7 | { 8 | "name": "id", 9 | "type": "INTEGER", 10 | "dictType": 0, 11 | "remarks": "" 12 | }, 13 | { 14 | "name": "name", 15 | "type": "VARCHAR", 16 | "dictType": 0, 17 | "remarks": "" 18 | }, 19 | { 20 | "name": "code", 21 | "type": "VARCHAR", 22 | "dictType": 0, 23 | "remarks": "设备编码" 24 | }, 25 | { 26 | "name": "orgId", 27 | "type": "INTEGER", 28 | "dictType": 0, 29 | "remarks": "" 30 | }, 31 | { 32 | "name": "projectId", 33 | "type": "INTEGER", 34 | "dictType": 0, 35 | "remarks": "" 36 | }, 37 | { 38 | "name": "roadId", 39 | "type": "INTEGER", 40 | "dictType": 0, 41 | "remarks": "" 42 | }, 43 | { 44 | "name": "posNo", 45 | "type": "VARCHAR", 46 | "dictType": 0, 47 | "remarks": "桩号" 48 | }, 49 | { 50 | "name": "installPos", 51 | "type": "VARCHAR", 52 | "dictType": 0, 53 | "remarks": "安装位置" 54 | }, 55 | { 56 | "name": "deviceType", 57 | "type": "VARCHAR", 58 | "dictType": 0, 59 | "remarks": "设备类型" 60 | }, 61 | { 62 | "name": "productId", 63 | "type": "INTEGER", 64 | "dictType": 0, 65 | "remarks": "产品Id" 66 | }, 67 | { 68 | "name": "productDate", 69 | "type": "TIMESTAMP", 70 | "dictType": 0, 71 | "remarks": "生产日期" 72 | }, 73 | { 74 | "name": "installDate", 75 | "type": "TIMESTAMP", 76 | "dictType": 0, 77 | "remarks": "安装日期" 78 | }, 79 | { 80 | "name": "acceptDate", 81 | "type": "TIMESTAMP", 82 | "dictType": 0, 83 | "remarks": "验收日期" 84 | }, 85 | { 86 | "name": "serviceDate", 87 | "type": "TIMESTAMP", 88 | "dictType": 0, 89 | "remarks": "质保日期" 90 | }, 91 | { 92 | "name": "providerId", 93 | "type": "VARCHAR", 94 | "dictType": 0, 95 | "remarks": "供应商Id" 96 | }, 97 | { 98 | "name": "builderId", 99 | "type": "VARCHAR", 100 | "dictType": 0, 101 | "remarks": "承建商Id" 102 | }, 103 | { 104 | "name": "image", 105 | "type": "VARCHAR", 106 | "dictType": 0, 107 | "remarks": "" 108 | }, 109 | { 110 | "name": "status", 111 | "type": "INTEGER", 112 | "dictType": 0, 113 | "remarks": "" 114 | }, 115 | { 116 | "name": "faultInfo", 117 | "type": "VARCHAR", 118 | "dictType": 0, 119 | "remarks": "故障信息" 120 | }, 121 | { 122 | "name": "preDevice", 123 | "type": "INTEGER", 124 | "dictType": 0, 125 | "remarks": "前置设备" 126 | }, 127 | { 128 | "name": "nextDevice", 129 | "type": "INTEGER", 130 | "dictType": 0, 131 | "remarks": "后置设备" 132 | }, 133 | { 134 | "name": "lanType", 135 | "type": "VARCHAR", 136 | "dictType": 0, 137 | "remarks": "通讯方式" 138 | }, 139 | { 140 | "name": "commAddress", 141 | "type": "VARCHAR", 142 | "dictType": 0, 143 | "remarks": "通讯地址" 144 | }, 145 | { 146 | "name": "lanProvider", 147 | "type": "VARCHAR", 148 | "dictType": 0, 149 | "remarks": "通讯供应商" 150 | }, 151 | { 152 | "name": "lanPhoneNo", 153 | "type": "VARCHAR", 154 | "dictType": 0, 155 | "remarks": "通讯号码" 156 | }, 157 | { 158 | "name": "longitude", 159 | "type": "DOUBLE", 160 | "dictType": 0, 161 | "remarks": "" 162 | }, 163 | { 164 | "name": "latitude", 165 | "type": "DOUBLE", 166 | "dictType": 0, 167 | "remarks": "" 168 | }, 169 | { 170 | "name": "createTime", 171 | "type": "TIMESTAMP", 172 | "dictType": 0, 173 | "remarks": "" 174 | }, 175 | { 176 | "name": "creator", 177 | "type": "INTEGER", 178 | "dictType": 0, 179 | "remarks": "" 180 | }, 181 | { 182 | "name": "modifyTime", 183 | "type": "TIMESTAMP", 184 | "dictType": 0, 185 | "remarks": "" 186 | }, 187 | { 188 | "name": "modifier", 189 | "type": "INTEGER", 190 | "dictType": 0, 191 | "remarks": "" 192 | }] 193 | }, 194 | { 195 | "name": "dev_camera", 196 | "upperCaseName": "DEV_Camera", 197 | "simpleName": "camera", 198 | "upperCaseSimpleName": "Camera", 199 | "fields": [ 200 | { 201 | "name": "id", 202 | "type": "INTEGER", 203 | "dictType": 0, 204 | "remarks": "" 205 | }, 206 | { 207 | "name": "sensorType", 208 | "type": "VARCHAR", 209 | "dictType": 0, 210 | "remarks": "传感器类型" 211 | }, 212 | { 213 | "name": "sensorSize", 214 | "type": "VARCHAR", 215 | "dictType": 0, 216 | "remarks": "传感器大小" 217 | }, 218 | { 219 | "name": "zoom", 220 | "type": "INTEGER", 221 | "dictType": 0, 222 | "remarks": "变焦倍数" 223 | }, 224 | { 225 | "name": "encodeType", 226 | "type": "VARCHAR", 227 | "dictType": 0, 228 | "remarks": "编码类型" 229 | }, 230 | { 231 | "name": "colorIllumination", 232 | "type": "FLOAT", 233 | "dictType": 0, 234 | "remarks": "彩色最小照度" 235 | }, 236 | { 237 | "name": "blackIllumination", 238 | "type": "FLOAT", 239 | "dictType": 0, 240 | "remarks": "黑白最小照度" 241 | }, 242 | { 243 | "name": "controlHorAngle", 244 | "type": "INTEGER", 245 | "dictType": 0, 246 | "remarks": "云台水平角度" 247 | }, 248 | { 249 | "name": "controlVerAngle", 250 | "type": "INTEGER", 251 | "dictType": 0, 252 | "remarks": "云台垂直角度" 253 | }, 254 | { 255 | "name": "controlHorSpeed", 256 | "type": "FLOAT", 257 | "dictType": 0, 258 | "remarks": "云台水平速度" 259 | }, 260 | { 261 | "name": "controlVerSpeed", 262 | "type": "FLOAT", 263 | "dictType": 0, 264 | "remarks": "云台垂直速度" 265 | }, 266 | { 267 | "name": "guardLevel", 268 | "type": "VARCHAR", 269 | "dictType": 0, 270 | "remarks": "防护等级" 271 | }, 272 | { 273 | "name": "rom", 274 | "type": "INTEGER", 275 | "dictType": 0, 276 | "remarks": "存储空间" 277 | }] 278 | }, 279 | { 280 | "name": "dev_infoboard", 281 | "upperCaseName": "DEV_Infoboard", 282 | "simpleName": "infoboard", 283 | "upperCaseSimpleName": "Infoboard", 284 | "fields": [ 285 | { 286 | "name": "id", 287 | "type": "INTEGER", 288 | "dictType": 0, 289 | "remarks": "" 290 | }, 291 | { 292 | "name": "boardType", 293 | "type": "VARCHAR", 294 | "dictType": 24, 295 | "remarks": "情报板类型" 296 | }, 297 | { 298 | "name": "renderArea", 299 | "type": "VARCHAR", 300 | "dictType": 0, 301 | "remarks": "显示面积" 302 | }, 303 | { 304 | "name": "pixelDistance", 305 | "type": "INTEGER", 306 | "dictType": 0, 307 | "remarks": "像素中心距离" 308 | }, 309 | { 310 | "name": "yellowBright", 311 | "type": "INTEGER", 312 | "dictType": 0, 313 | "remarks": "全黄亮度" 314 | }, 315 | { 316 | "name": "halfPowerAngle", 317 | "type": "INTEGER", 318 | "dictType": 0, 319 | "remarks": "半功角" 320 | }, 321 | { 322 | "name": "attenuationRate", 323 | "type": "INTEGER", 324 | "dictType": 0, 325 | "remarks": "衰减率" 326 | }, 327 | { 328 | "name": "dynamicViewDistance", 329 | "type": "INTEGER", 330 | "dictType": 0, 331 | "remarks": "动态视认距离" 332 | }, 333 | { 334 | "name": "maxPower", 335 | "type": "INTEGER", 336 | "dictType": 0, 337 | "remarks": "峰值功耗" 338 | }, 339 | { 340 | "name": "averRage", 341 | "type": "INTEGER", 342 | "dictType": 0, 343 | "remarks": "平均功耗" 344 | }, 345 | { 346 | "name": "guardWind", 347 | "type": "INTEGER", 348 | "dictType": 0, 349 | "remarks": "抗风等级" 350 | }, 351 | { 352 | "name": "guardLevel", 353 | "type": "VARCHAR", 354 | "dictType": 0, 355 | "remarks": "防护等级" 356 | }] 357 | }, 358 | { 359 | "name": "dev_operation", 360 | "upperCaseName": "DEV_Operation", 361 | "simpleName": "operation", 362 | "upperCaseSimpleName": "Operation", 363 | "fields": [ 364 | { 365 | "name": "id", 366 | "type": "INTEGER", 367 | "dictType": 0, 368 | "remarks": "" 369 | }, 370 | { 371 | "name": "opNo", 372 | "type": "VARCHAR", 373 | "dictType": 0, 374 | "remarks": "维修记录编号" 375 | }, 376 | { 377 | "name": "deviceCode", 378 | "type": "VARCHAR", 379 | "dictType": 0, 380 | "remarks": "" 381 | }, 382 | { 383 | "name": "occurTime", 384 | "type": "TIMESTAMP", 385 | "dictType": 0, 386 | "remarks": "发生时间" 387 | }, 388 | { 389 | "name": "fixedTime", 390 | "type": "TIMESTAMP", 391 | "dictType": 0, 392 | "remarks": "修理时间" 393 | }, 394 | { 395 | "name": "faultType", 396 | "type": "VARCHAR", 397 | "dictType": 0, 398 | "remarks": "故障类型" 399 | }, 400 | { 401 | "name": "operator", 402 | "type": "VARCHAR", 403 | "dictType": 0, 404 | "remarks": "填写人" 405 | }, 406 | { 407 | "name": "faultLevel", 408 | "type": "VARCHAR", 409 | "dictType": 0, 410 | "remarks": "故障级别" 411 | }, 412 | { 413 | "name": "reason", 414 | "type": "VARCHAR", 415 | "dictType": 0, 416 | "remarks": "故障原因" 417 | }, 418 | { 419 | "name": "reasonAnalysis", 420 | "type": "VARCHAR", 421 | "dictType": 0, 422 | "remarks": "原因分析" 423 | }, 424 | { 425 | "name": "solution", 426 | "type": "VARCHAR", 427 | "dictType": 0, 428 | "remarks": "" 429 | }, 430 | { 431 | "name": "effectLevel", 432 | "type": "VARCHAR", 433 | "dictType": 0, 434 | "remarks": "影响程度" 435 | }, 436 | { 437 | "name": "useList", 438 | "type": "VARCHAR", 439 | "dictType": 0, 440 | "remarks": "备件使用清单" 441 | }, 442 | { 443 | "name": "chargeList", 444 | "type": "VARCHAR", 445 | "dictType": 0, 446 | "remarks": "维修费用清单" 447 | }, 448 | { 449 | "name": "preImage", 450 | "type": "VARCHAR", 451 | "dictType": 0, 452 | "remarks": "异常图片" 453 | }, 454 | { 455 | "name": "nextImage", 456 | "type": "VARCHAR", 457 | "dictType": 0, 458 | "remarks": "正常图片" 459 | }, 460 | { 461 | "name": "creator", 462 | "type": "INTEGER", 463 | "dictType": 0, 464 | "remarks": "" 465 | }, 466 | { 467 | "name": "createTime", 468 | "type": "TIMESTAMP", 469 | "dictType": 0, 470 | "remarks": "" 471 | }, 472 | { 473 | "name": "modifier", 474 | "type": "INTEGER", 475 | "dictType": 0, 476 | "remarks": "" 477 | }, 478 | { 479 | "name": "modifyTime", 480 | "type": "TIMESTAMP", 481 | "dictType": 0, 482 | "remarks": "" 483 | }] 484 | }, 485 | { 486 | "name": "dev_product", 487 | "upperCaseName": "DEV_Product", 488 | "simpleName": "product", 489 | "upperCaseSimpleName": "Product", 490 | "fields": [ 491 | { 492 | "name": "id", 493 | "type": "INTEGER", 494 | "dictType": 0, 495 | "remarks": "" 496 | }, 497 | { 498 | "name": "deviceType", 499 | "type": "VARCHAR", 500 | "dictType": 0, 501 | "remarks": "" 502 | }, 503 | { 504 | "name": "name", 505 | "type": "VARCHAR", 506 | "dictType": 0, 507 | "remarks": "" 508 | }, 509 | { 510 | "name": "code", 511 | "type": "VARCHAR", 512 | "dictType": 0, 513 | "remarks": "" 514 | }, 515 | { 516 | "name": "productor", 517 | "type": "INTEGER", 518 | "dictType": 0, 519 | "remarks": "" 520 | }] 521 | }, 522 | { 523 | "name": "dev_slopeStation", 524 | "upperCaseName": "DEV_SlopeStation", 525 | "simpleName": "slopeStation", 526 | "upperCaseSimpleName": "SlopeStation", 527 | "fields": [ 528 | { 529 | "name": "id", 530 | "type": "INTEGER", 531 | "dictType": 0, 532 | "remarks": "" 533 | }, 534 | { 535 | "name": "chanelNum", 536 | "type": "INTEGER", 537 | "dictType": 0, 538 | "remarks": "通道数量" 539 | }, 540 | { 541 | "name": "maxCheckPoint", 542 | "type": "INTEGER", 543 | "dictType": 0, 544 | "remarks": "最大检测数量" 545 | }, 546 | { 547 | "name": "samplingFrequency", 548 | "type": "INTEGER", 549 | "dictType": 0, 550 | "remarks": "采样频率" 551 | }, 552 | { 553 | "name": "wavelengthRange", 554 | "type": "INTEGER", 555 | "dictType": 0, 556 | "remarks": "波长测量范围" 557 | }, 558 | { 559 | "name": "dynamicRange", 560 | "type": "INTEGER", 561 | "dictType": 0, 562 | "remarks": "动态范围" 563 | }, 564 | { 565 | "name": "wavelengthResolution", 566 | "type": "FLOAT", 567 | "dictType": 0, 568 | "remarks": "波长分辨率" 569 | }, 570 | { 571 | "name": "wavelengthRepeat", 572 | "type": "INTEGER", 573 | "dictType": 0, 574 | "remarks": "波长重复性" 575 | }, 576 | { 577 | "name": "wavelengthAccuracy", 578 | "type": "INTEGER", 579 | "dictType": 0, 580 | "remarks": "波长精度" 581 | }] 582 | }, 583 | { 584 | "name": "dev_trafficStation", 585 | "upperCaseName": "DEV_TrafficStation", 586 | "simpleName": "trafficStation", 587 | "upperCaseSimpleName": "TrafficStation", 588 | "fields": [ 589 | { 590 | "name": "id", 591 | "type": "INTEGER", 592 | "dictType": 0, 593 | "remarks": "" 594 | }, 595 | { 596 | "name": "techType", 597 | "type": "VARCHAR", 598 | "dictType": 23, 599 | "remarks": "技术类型" 600 | }, 601 | { 602 | "name": "laneNum", 603 | "type": "INTEGER", 604 | "dictType": 0, 605 | "remarks": "车道数量" 606 | }, 607 | { 608 | "name": "totalFlowAccuracy", 609 | "type": "FLOAT", 610 | "dictType": 0, 611 | "remarks": "总流量检测精度" 612 | }, 613 | { 614 | "name": "laneFlowAccuracy", 615 | "type": "INTEGER", 616 | "dictType": 0, 617 | "remarks": "车道流量检测精度" 618 | }, 619 | { 620 | "name": "measureRange", 621 | "type": "INTEGER", 622 | "dictType": 0, 623 | "remarks": "测量范围" 624 | }, 625 | { 626 | "name": "rom", 627 | "type": "INTEGER", 628 | "dictType": 0, 629 | "remarks": "存储空间" 630 | }, 631 | { 632 | "name": "guardLevel", 633 | "type": "VARCHAR", 634 | "dictType": 0, 635 | "remarks": "防护等级" 636 | }] 637 | }, 638 | { 639 | "name": "dev_weatherStation", 640 | "upperCaseName": "DEV_WeatherStation", 641 | "simpleName": "weatherStation", 642 | "upperCaseSimpleName": "WeatherStation", 643 | "fields": [ 644 | { 645 | "name": "id", 646 | "type": "INTEGER", 647 | "dictType": 0, 648 | "remarks": "" 649 | }, 650 | { 651 | "name": "humidityRange", 652 | "type": "VARCHAR", 653 | "dictType": 0, 654 | "remarks": "湿度范围" 655 | }, 656 | { 657 | "name": "humidityAccuracy", 658 | "type": "VARCHAR", 659 | "dictType": 0, 660 | "remarks": "湿度精度" 661 | }, 662 | { 663 | "name": "temperatureRange", 664 | "type": "VARCHAR", 665 | "dictType": 0, 666 | "remarks": "温度范围" 667 | }, 668 | { 669 | "name": "temperatureAccuracy", 670 | "type": "VARCHAR", 671 | "dictType": 0, 672 | "remarks": "温度精度" 673 | }, 674 | { 675 | "name": "startWindSpeed", 676 | "type": "FLOAT", 677 | "dictType": 0, 678 | "remarks": "启动风速" 679 | }, 680 | { 681 | "name": "startWindDirection", 682 | "type": "FLOAT", 683 | "dictType": 0, 684 | "remarks": "启动风向" 685 | }, 686 | { 687 | "name": "windSpeedRange", 688 | "type": "VARCHAR", 689 | "dictType": 0, 690 | "remarks": "风速范围" 691 | }, 692 | { 693 | "name": "windSpeedAccuracy", 694 | "type": "VARCHAR", 695 | "dictType": 0, 696 | "remarks": "风速精度" 697 | }, 698 | { 699 | "name": "guardWind", 700 | "type": "INTEGER", 701 | "dictType": 0, 702 | "remarks": "防风等级" 703 | }, 704 | { 705 | "name": "visibilityRange", 706 | "type": "VARCHAR", 707 | "dictType": 0, 708 | "remarks": "能见度范围" 709 | }, 710 | { 711 | "name": "visibilityAccuracy", 712 | "type": "VARCHAR", 713 | "dictType": 0, 714 | "remarks": "能见度精度" 715 | }] 716 | }, 717 | { 718 | "name": "pub_dictData", 719 | "upperCaseName": "PUB_DictData", 720 | "simpleName": "dictData", 721 | "upperCaseSimpleName": "DictData", 722 | "fields": [ 723 | { 724 | "name": "id", 725 | "type": "INTEGER", 726 | "dictType": 0, 727 | "remarks": "" 728 | }, 729 | { 730 | "name": "dictTypeId", 731 | "type": "INTEGER", 732 | "dictType": 0, 733 | "remarks": "" 734 | }, 735 | { 736 | "name": "name", 737 | "type": "VARCHAR", 738 | "dictType": 0, 739 | "remarks": "" 740 | }, 741 | { 742 | "name": "value", 743 | "type": "VARCHAR", 744 | "dictType": 0, 745 | "remarks": "" 746 | }, 747 | { 748 | "name": "remark", 749 | "type": "VARCHAR", 750 | "dictType": 0, 751 | "remarks": "" 752 | }, 753 | { 754 | "name": "creator", 755 | "type": "INTEGER", 756 | "dictType": 0, 757 | "remarks": "" 758 | }, 759 | { 760 | "name": "flag", 761 | "type": "INTEGER", 762 | "dictType": 0, 763 | "remarks": "" 764 | }, 765 | { 766 | "name": "orderNo", 767 | "type": "INTEGER", 768 | "dictType": 0, 769 | "remarks": "" 770 | }, 771 | { 772 | "name": "modifyTime", 773 | "type": "TIMESTAMP", 774 | "dictType": 0, 775 | "remarks": "" 776 | }, 777 | { 778 | "name": "modifier", 779 | "type": "INTEGER", 780 | "dictType": 0, 781 | "remarks": "" 782 | }, 783 | { 784 | "name": "createTime", 785 | "type": "TIMESTAMP", 786 | "dictType": 0, 787 | "remarks": "" 788 | }] 789 | }, 790 | { 791 | "name": "pub_dictType", 792 | "upperCaseName": "PUB_DictType", 793 | "simpleName": "dictType", 794 | "upperCaseSimpleName": "DictType", 795 | "fields": [ 796 | { 797 | "name": "id", 798 | "type": "INTEGER", 799 | "dictType": 0, 800 | "remarks": "" 801 | }, 802 | { 803 | "name": "name", 804 | "type": "VARCHAR", 805 | "dictType": 0, 806 | "remarks": "" 807 | }, 808 | { 809 | "name": "remark", 810 | "type": "VARCHAR", 811 | "dictType": 0, 812 | "remarks": "" 813 | }, 814 | { 815 | "name": "orderNo", 816 | "type": "INTEGER", 817 | "dictType": 0, 818 | "remarks": "" 819 | }] 820 | }, 821 | { 822 | "name": "pub_project", 823 | "upperCaseName": "PUB_Project", 824 | "simpleName": "project", 825 | "upperCaseSimpleName": "Project", 826 | "fields": [ 827 | { 828 | "name": "id", 829 | "type": "INTEGER", 830 | "dictType": 0, 831 | "remarks": "" 832 | }, 833 | { 834 | "name": "name", 835 | "type": "VARCHAR", 836 | "dictType": 0, 837 | "remarks": "" 838 | }, 839 | { 840 | "name": "description", 841 | "type": "VARCHAR", 842 | "dictType": 0, 843 | "remarks": "" 844 | }] 845 | }, 846 | { 847 | "name": "pub_road", 848 | "upperCaseName": "PUB_Road", 849 | "simpleName": "road", 850 | "upperCaseSimpleName": "Road", 851 | "fields": [ 852 | { 853 | "name": "id", 854 | "type": "INTEGER", 855 | "dictType": 0, 856 | "remarks": "" 857 | }, 858 | { 859 | "name": "pid", 860 | "type": "INTEGER", 861 | "dictType": 0, 862 | "remarks": "" 863 | }, 864 | { 865 | "name": "pids", 866 | "type": "VARCHAR", 867 | "dictType": 0, 868 | "remarks": "" 869 | }, 870 | { 871 | "name": "level", 872 | "type": "INTEGER", 873 | "dictType": 0, 874 | "remarks": "" 875 | }, 876 | { 877 | "name": "name", 878 | "type": "VARCHAR", 879 | "dictType": 0, 880 | "remarks": "" 881 | }, 882 | { 883 | "name": "code", 884 | "type": "VARCHAR", 885 | "dictType": 0, 886 | "remarks": "" 887 | }] 888 | }, 889 | { 890 | "name": "sys_organization", 891 | "upperCaseName": "SYS_Organization", 892 | "simpleName": "organization", 893 | "upperCaseSimpleName": "Organization", 894 | "fields": [ 895 | { 896 | "name": "id", 897 | "type": "INTEGER", 898 | "dictType": 0, 899 | "remarks": "" 900 | }, 901 | { 902 | "name": "name", 903 | "type": "VARCHAR", 904 | "dictType": 0, 905 | "remarks": "" 906 | }, 907 | { 908 | "name": "pid", 909 | "type": "INTEGER", 910 | "dictType": 0, 911 | "remarks": "" 912 | }, 913 | { 914 | "name": "pids", 915 | "type": "VARCHAR", 916 | "dictType": 0, 917 | "remarks": "" 918 | }, 919 | { 920 | "name": "level", 921 | "type": "INTEGER", 922 | "dictType": 0, 923 | "remarks": "" 924 | }, 925 | { 926 | "name": "keepper", 927 | "type": "VARCHAR", 928 | "dictType": 0, 929 | "remarks": "" 930 | }, 931 | { 932 | "name": "mobile", 933 | "type": "VARCHAR", 934 | "dictType": 0, 935 | "remarks": "" 936 | }, 937 | { 938 | "name": "modifyTime", 939 | "type": "TIMESTAMP", 940 | "dictType": 0, 941 | "remarks": "" 942 | }, 943 | { 944 | "name": "modifier", 945 | "type": "INTEGER", 946 | "dictType": 0, 947 | "remarks": "" 948 | }, 949 | { 950 | "name": "creator", 951 | "type": "INTEGER", 952 | "dictType": 0, 953 | "remarks": "" 954 | }, 955 | { 956 | "name": "createTime", 957 | "type": "TIMESTAMP", 958 | "dictType": 0, 959 | "remarks": "" 960 | }] 961 | }, 962 | { 963 | "name": "sys_permission", 964 | "upperCaseName": "SYS_Permission", 965 | "simpleName": "permission", 966 | "upperCaseSimpleName": "Permission", 967 | "fields": [ 968 | { 969 | "name": "id", 970 | "type": "INTEGER", 971 | "dictType": 0, 972 | "remarks": "" 973 | }, 974 | { 975 | "name": "parent", 976 | "type": "INTEGER", 977 | "dictType": 0, 978 | "remarks": "" 979 | }, 980 | { 981 | "name": "name", 982 | "type": "VARCHAR", 983 | "dictType": 0, 984 | "remarks": "" 985 | }, 986 | { 987 | "name": "permission", 988 | "type": "VARCHAR", 989 | "dictType": 0, 990 | "remarks": "" 991 | }, 992 | { 993 | "name": "level", 994 | "type": "INTEGER", 995 | "dictType": 0, 996 | "remarks": "" 997 | }] 998 | }, 999 | { 1000 | "name": "sys_role", 1001 | "upperCaseName": "SYS_Role", 1002 | "simpleName": "role", 1003 | "upperCaseSimpleName": "Role", 1004 | "fields": [ 1005 | { 1006 | "name": "id", 1007 | "type": "INTEGER", 1008 | "dictType": 0, 1009 | "remarks": "" 1010 | }, 1011 | { 1012 | "name": "name", 1013 | "type": "VARCHAR", 1014 | "dictType": 0, 1015 | "remarks": "" 1016 | }, 1017 | { 1018 | "name": "permissions", 1019 | "type": "VARCHAR", 1020 | "dictType": 0, 1021 | "remarks": "" 1022 | }, 1023 | { 1024 | "name": "creator", 1025 | "type": "INTEGER", 1026 | "dictType": 0, 1027 | "remarks": "" 1028 | }, 1029 | { 1030 | "name": "createTime", 1031 | "type": "TIMESTAMP", 1032 | "dictType": 0, 1033 | "remarks": "" 1034 | }, 1035 | { 1036 | "name": "modifier", 1037 | "type": "INTEGER", 1038 | "dictType": 0, 1039 | "remarks": "" 1040 | }, 1041 | { 1042 | "name": "modifyTime", 1043 | "type": "TIMESTAMP", 1044 | "dictType": 0, 1045 | "remarks": "" 1046 | }] 1047 | }, 1048 | { 1049 | "name": "sys_user", 1050 | "upperCaseName": "SYS_User", 1051 | "simpleName": "user", 1052 | "upperCaseSimpleName": "User", 1053 | "fields": [ 1054 | { 1055 | "name": "id", 1056 | "type": "INTEGER", 1057 | "dictType": 0, 1058 | "remarks": "" 1059 | }, 1060 | { 1061 | "name": "orgId", 1062 | "type": "INTEGER", 1063 | "dictType": 0, 1064 | "remarks": "" 1065 | }, 1066 | { 1067 | "name": "username", 1068 | "type": "VARCHAR", 1069 | "dictType": 0, 1070 | "remarks": "" 1071 | }, 1072 | { 1073 | "name": "password", 1074 | "type": "VARCHAR", 1075 | "dictType": 0, 1076 | "remarks": "" 1077 | }, 1078 | { 1079 | "name": "name", 1080 | "type": "VARCHAR", 1081 | "dictType": 0, 1082 | "remarks": "" 1083 | }, 1084 | { 1085 | "name": "mobile", 1086 | "type": "VARCHAR", 1087 | "dictType": 0, 1088 | "remarks": "" 1089 | }, 1090 | { 1091 | "name": "deleted", 1092 | "type": "INTEGER", 1093 | "dictType": 0, 1094 | "remarks": "" 1095 | }, 1096 | { 1097 | "name": "creator", 1098 | "type": "INTEGER", 1099 | "dictType": 0, 1100 | "remarks": "" 1101 | }, 1102 | { 1103 | "name": "userRoles", 1104 | "type": "VARCHAR", 1105 | "dictType": 0, 1106 | "remarks": "" 1107 | }, 1108 | { 1109 | "name": "email", 1110 | "type": "VARCHAR", 1111 | "dictType": 0, 1112 | "remarks": "" 1113 | }, 1114 | { 1115 | "name": "modifier", 1116 | "type": "INTEGER", 1117 | "dictType": 0, 1118 | "remarks": "" 1119 | }, 1120 | { 1121 | "name": "modifyTime", 1122 | "type": "TIMESTAMP", 1123 | "dictType": 0, 1124 | "remarks": "" 1125 | }, 1126 | { 1127 | "name": "createTime", 1128 | "type": "TIMESTAMP", 1129 | "dictType": 0, 1130 | "remarks": "" 1131 | }] 1132 | }] -------------------------------------------------------------------------------- /src/main/resources/templates/view.ftl: -------------------------------------------------------------------------------- 1 | 419 | 420 | 801 | 802 | 856 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate model communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------