Introduces GEMINI.md to provide a comprehensive overview of the ActionModelsGenerator project, including its purpose, core technologies, build instructions, and development conventions. This document serves as essential context for future interactions and development.
103 lines
3.1 KiB
Plaintext
103 lines
3.1 KiB
Plaintext
package ${basePackage}.bean.base;
|
|
|
|
/**
|
|
* Generated by IntelliJ ActionBean Generator
|
|
* For Table: ${tableName}
|
|
*/
|
|
|
|
import sdk.dbutils.*;
|
|
import sdk.utils.*;
|
|
import ${basePackage}.dto.*;
|
|
|
|
public class ${className} extends ActionBean {
|
|
|
|
public static final String tableName = "${tableName}";
|
|
public static final String schemaName = "${dbSchema}";
|
|
public static final String fullTableName = "${tableName}";
|
|
private DTO_${tableName} myDTO;
|
|
|
|
public ${className}(DBConnector dbConnector) { //class construction
|
|
super(dbConnector, fullTableName);
|
|
myDTO = new DTO_${tableName}();
|
|
initFieldDefs();
|
|
fieldList = "${fieldList}";
|
|
keyList = "${keyList}";
|
|
}
|
|
|
|
public ${className}() { //class construction
|
|
super();
|
|
myDTO = new DTO_${tableName}();
|
|
initFieldDefs();
|
|
fieldList = "${fieldList}";
|
|
keyList = "${keyList}";
|
|
}
|
|
|
|
@Override
|
|
protected void initFieldDefs() {
|
|
fieldDefs.clear();
|
|
<#list columns as col>
|
|
fieldDefs.put("${col.name}", "${col.customType}<#if col.isPk>:KEY</#if>");
|
|
</#list>
|
|
}
|
|
|
|
public DTO_${tableName} getInstanceDTO() {
|
|
myDTO.setDTO(this.getDTO());
|
|
return myDTO;
|
|
}
|
|
|
|
@Override
|
|
protected void initSqlSelect() {
|
|
StringBuilder Sql = new StringBuilder();
|
|
Sql.append("SELECT ");
|
|
<#list columns as col>
|
|
<#if col?is_first>
|
|
Sql.append(" <#if col.customType == 'DATE'>JDTOET(${col.name}) ${col.name}, ${col.name} AS DT_${col.name}<#else> ${col.name}</#if>\n");
|
|
<#else>
|
|
Sql.append(" ,<#if col.customType == 'DATE'>JDTOET(${col.name}) ${col.name}, ${col.name} AS DT_${col.name}<#else>${col.name}</#if>\n");
|
|
</#if>
|
|
</#list>
|
|
Sql.append(" FROM ${tableName}\n");
|
|
Sql.append(" WHERE 0=0 \n");
|
|
|
|
sqlSelect = new StringBuilder(Sql);
|
|
}
|
|
|
|
<#-- Generate Setters -->
|
|
<#list columns as col>
|
|
public void set${col.name}(String value) {
|
|
<#if col.isPk>
|
|
if (JUtils.isMacro(value)) {
|
|
setKeyField(${col.name}, value);
|
|
fieldByName(${col.name}).setAsString(value);
|
|
} else {
|
|
setKeyField(${col.name}, JUtils.cleanUpNumber(value));
|
|
fieldByName(${col.name}).setAsString(JUtils.cleanUpNumber(value));
|
|
}
|
|
<#elseif col.customType == "DATE">
|
|
if (JUtils.isMacro(value)) {
|
|
setField(${col.name}, value);
|
|
fieldByName(${col.name}).setAsString(value);
|
|
} else {
|
|
setField(${col.name}, DateUtils.strToSqlDate(value));
|
|
fieldByName(${col.name}).setAsString(value);
|
|
}
|
|
<#else>
|
|
setField(${col.name}, value);
|
|
fieldByName(${col.name}).setAsString(value);
|
|
</#if>
|
|
}
|
|
|
|
</#list>
|
|
|
|
<#-- Generate Getters and Constants -->
|
|
<#list columns as col>
|
|
public static final String ${col.name} = "${col.name}";
|
|
public String get${col.name}() {
|
|
return getValue(${col.name});
|
|
}
|
|
public String get${col.name}(String defValue) {
|
|
return getValue(${col.name}, defValue);
|
|
}
|
|
|
|
</#list>
|
|
} |