处理生成mapper出现的问题
处理中文乱码问题
This commit is contained in:
parent
4bc34ef94c
commit
0b79f47cb2
@ -19,7 +19,6 @@ import javafx.scene.control.TableColumn;
|
|||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.stage.DirectoryChooser;
|
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@ -103,6 +102,7 @@ public class GenerateController implements Initializable {
|
|||||||
this.generateService = new GenerateService(fieldTableView);
|
this.generateService = new GenerateService(fieldTableView);
|
||||||
this.fieldService.setTableView(fieldTableView);
|
this.fieldService.setTableView(fieldTableView);
|
||||||
this.fieldService.setTableName(tableVO.getTableName());
|
this.fieldService.setTableName(tableVO.getTableName());
|
||||||
|
this.fieldService.setTableNamePrefix(this.tablePrefixTextField.getText());
|
||||||
this.fieldService.showField();
|
this.fieldService.showField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package ink.wgink.code.factory.factory;
|
package ink.wgink.code.factory.factory;
|
||||||
|
|
||||||
import com.sun.deploy.uitoolkit.impl.fx.ui.FXUIFactory;
|
import ink.wgink.code.factory.service.FieldService;
|
||||||
import ink.wgink.code.factory.vos.FieldVO;
|
import ink.wgink.code.factory.vos.FieldVO;
|
||||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||||
import javafx.beans.value.ChangeListener;
|
|
||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
@ -37,9 +34,32 @@ public class CheckBoxTableCellFactory implements Callback<TableColumn.CellDataFe
|
|||||||
public ObservableValue<CheckBox> call(TableColumn.CellDataFeatures<FieldVO, String> param) {
|
public ObservableValue<CheckBox> call(TableColumn.CellDataFeatures<FieldVO, String> param) {
|
||||||
FieldVO fieldVO = param.getValue();
|
FieldVO fieldVO = param.getValue();
|
||||||
CheckBox checkBox = new CheckBox();
|
CheckBox checkBox = new CheckBox();
|
||||||
|
String tableName = param.getValue().getTableName();
|
||||||
|
String tableNamePrefix = param.getValue().getTableNamePrefix();
|
||||||
if (StringUtils.equals(IS_FORM_SHOW, property)) {
|
if (StringUtils.equals(IS_FORM_SHOW, property)) {
|
||||||
Boolean isFormShow = param.getValue().getFormShow();
|
Boolean isFormShow = param.getValue().getFormShow();
|
||||||
checkBox.setSelected(isFormShow == null || !isFormShow ? false : true);
|
// 如果是主键
|
||||||
|
if (StringUtils.equals(String.format("%s_id", tableName.replace(tableNamePrefix, "")), param.getValue().getColumnName())) {
|
||||||
|
param.getValue().setFormShow(false);
|
||||||
|
checkBox.setSelected(false);
|
||||||
|
} else if(StringUtils.equals(FieldService.DEFAULT_COLUMN_CREATOR, param.getValue().getColumnName())) {
|
||||||
|
param.getValue().setFormShow(false);
|
||||||
|
checkBox.setSelected(false);
|
||||||
|
} else if(StringUtils.equals(FieldService.DEFAULT_COLUMN_GMT_CREATE, param.getValue().getColumnName())) {
|
||||||
|
param.getValue().setFormShow(false);
|
||||||
|
checkBox.setSelected(false);
|
||||||
|
} else if(StringUtils.equals(FieldService.DEFAULT_COLUMN_MODIFIER, param.getValue().getColumnName())) {
|
||||||
|
param.getValue().setFormShow(false);
|
||||||
|
checkBox.setSelected(false);
|
||||||
|
} else if(StringUtils.equals(FieldService.DEFAULT_COLUMN_GMT_MODIFIED, param.getValue().getColumnName())) {
|
||||||
|
param.getValue().setFormShow(false);
|
||||||
|
checkBox.setSelected(false);
|
||||||
|
} else if(StringUtils.equals(FieldService.DEFAULT_COLUMN_IS_DELETE, param.getValue().getColumnName())) {
|
||||||
|
param.getValue().setFormShow(false);
|
||||||
|
checkBox.setSelected(false);
|
||||||
|
} else {
|
||||||
|
checkBox.setSelected(isFormShow == null || !isFormShow ? false : true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.equals(IS_LIST_SHOW, property)) {
|
if (StringUtils.equals(IS_LIST_SHOW, property)) {
|
||||||
Boolean isListShow = param.getValue().getListShow();
|
Boolean isListShow = param.getValue().getListShow();
|
||||||
|
@ -47,6 +47,7 @@ public class FieldService {
|
|||||||
private ObservableList<FieldVO> fields = FXCollections.observableArrayList();
|
private ObservableList<FieldVO> fields = FXCollections.observableArrayList();
|
||||||
private TableView tableView;
|
private TableView tableView;
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
private String tableNamePrefix;
|
||||||
private Stage fieldStage;
|
private Stage fieldStage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,6 +115,8 @@ public class FieldService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FieldVO fieldVO = new FieldVO();
|
FieldVO fieldVO = new FieldVO();
|
||||||
|
fieldVO.setTableName(tableName);
|
||||||
|
fieldVO.setTableNamePrefix(tableNamePrefix);
|
||||||
fieldVO.setRowNumber(fieldIndex);
|
fieldVO.setRowNumber(fieldIndex);
|
||||||
fieldVO.setColumnName(columnName);
|
fieldVO.setColumnName(columnName);
|
||||||
fieldVO.setColumnType(field.get("COLUMN_TYPE").toString());
|
fieldVO.setColumnType(field.get("COLUMN_TYPE").toString());
|
||||||
@ -170,6 +173,14 @@ public class FieldService {
|
|||||||
this.tableName = tableName;
|
this.tableName = tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTableNamePrefix() {
|
||||||
|
return tableNamePrefix == null ? "" : tableNamePrefix.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTableNamePrefix(String tableNamePrefix) {
|
||||||
|
this.tableNamePrefix = tableNamePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
public void removeField(String columnName) {
|
public void removeField(String columnName) {
|
||||||
new Service<Integer>() {
|
new Service<Integer>() {
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ink.wgink.code.factory.service;
|
package ink.wgink.code.factory.service;
|
||||||
|
|
||||||
import freemarker.cache.ClassTemplateLoader;
|
|
||||||
import freemarker.template.Configuration;
|
import freemarker.template.Configuration;
|
||||||
import freemarker.template.Template;
|
import freemarker.template.Template;
|
||||||
import freemarker.template.TemplateException;
|
import freemarker.template.TemplateException;
|
||||||
@ -18,10 +17,7 @@ import javafx.stage.Stage;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -41,6 +37,7 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class GenerateService {
|
public class GenerateService {
|
||||||
|
|
||||||
|
public static final String UTF_8 = "UTF-8";
|
||||||
private Stage fieldStage;
|
private Stage fieldStage;
|
||||||
private TableView tableView;
|
private TableView tableView;
|
||||||
Configuration freemarkerConfiguration = new Configuration(Configuration.getVersion());
|
Configuration freemarkerConfiguration = new Configuration(Configuration.getVersion());
|
||||||
@ -53,7 +50,7 @@ public class GenerateService {
|
|||||||
// this.freemarkerConfiguration.setTemplateLoader(new ClassTemplateLoader(this.getClass(), "/template"));
|
// this.freemarkerConfiguration.setTemplateLoader(new ClassTemplateLoader(this.getClass(), "/template"));
|
||||||
// 3.加载 jar中的模板
|
// 3.加载 jar中的模板
|
||||||
this.freemarkerConfiguration.setClassForTemplateLoading(this.getClass(), "/template");
|
this.freemarkerConfiguration.setClassForTemplateLoading(this.getClass(), "/template");
|
||||||
this.freemarkerConfiguration.setDefaultEncoding("utf-8");
|
this.freemarkerConfiguration.setDefaultEncoding(UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateCode(TableVO tableVO, GenerateVO generateVO) throws IOException, TemplateException {
|
public void generateCode(TableVO tableVO, GenerateVO generateVO) throws IOException, TemplateException {
|
||||||
@ -68,6 +65,7 @@ public class GenerateService {
|
|||||||
String tableFullName = tableVO.getTableName();
|
String tableFullName = tableVO.getTableName();
|
||||||
String tableNameWithoutPrefix = tableFullName.replaceFirst(generateVO.getTablePrefix(), "");
|
String tableNameWithoutPrefix = tableFullName.replaceFirst(generateVO.getTablePrefix(), "");
|
||||||
String tableName = WStringUtil.underLine2LowerUpper(tableNameWithoutPrefix);
|
String tableName = WStringUtil.underLine2LowerUpper(tableNameWithoutPrefix);
|
||||||
|
String underlineTableName = WStringUtil.lowerUpper2UnderLine(tableName);
|
||||||
// 首字母大写驼峰表名
|
// 首字母大写驼峰表名
|
||||||
String firstUpperTableName = WStringUtil.firstToUpper(tableName);
|
String firstUpperTableName = WStringUtil.firstToUpper(tableName);
|
||||||
// 首字母小写驼峰表明
|
// 首字母小写驼峰表明
|
||||||
@ -82,6 +80,7 @@ public class GenerateService {
|
|||||||
dataModel.put("tableFullName", tableFullName);
|
dataModel.put("tableFullName", tableFullName);
|
||||||
dataModel.put("firstUpperTableName", firstUpperTableName);
|
dataModel.put("firstUpperTableName", firstUpperTableName);
|
||||||
dataModel.put("firstLowerTableName", firstLowerTableName);
|
dataModel.put("firstLowerTableName", firstLowerTableName);
|
||||||
|
dataModel.put("underlineTableName", underlineTableName);
|
||||||
dataModel.put("tableExplain", tableVO.getTableComment());
|
dataModel.put("tableExplain", tableVO.getTableComment());
|
||||||
dataModel.put("author", "CodeFactory");
|
dataModel.put("author", "CodeFactory");
|
||||||
dataModel.put("date", DateUtil.getTime());
|
dataModel.put("date", DateUtil.getTime());
|
||||||
@ -132,16 +131,22 @@ public class GenerateService {
|
|||||||
*/
|
*/
|
||||||
private void initFieldList(String tableNameWithoutPrefix, Map<String, Object> dataModel, ObservableList<FieldVO> fields) {
|
private void initFieldList(String tableNameWithoutPrefix, Map<String, Object> dataModel, ObservableList<FieldVO> fields) {
|
||||||
List<Map<String, Object>> fieldList = new ArrayList<>();
|
List<Map<String, Object>> fieldList = new ArrayList<>();
|
||||||
|
String idColumn = null;
|
||||||
boolean hasId = false;
|
boolean hasId = false;
|
||||||
|
boolean idFormShow = false;
|
||||||
boolean hasGmtCreate = false;
|
boolean hasGmtCreate = false;
|
||||||
boolean hasCreator = false;
|
boolean hasCreator = false;
|
||||||
boolean hasGmtModified = false;
|
boolean hasGmtModified = false;
|
||||||
|
boolean gmtModifiedFormShow = false;
|
||||||
boolean hasModifier = false;
|
boolean hasModifier = false;
|
||||||
|
boolean modifierFormShow = false;
|
||||||
boolean hasIsDelete = false;
|
boolean hasIsDelete = false;
|
||||||
for (int i = 0; i < fields.size(); i++) {
|
for (int i = 0; i < fields.size(); i++) {
|
||||||
FieldVO field = fields.get(i);
|
FieldVO field = fields.get(i);
|
||||||
if (!hasId && StringUtils.equals(String.format("%s_id", tableNameWithoutPrefix), field.getColumnName())) {
|
if (!hasId && StringUtils.equals(String.format("%s_id", tableNameWithoutPrefix), field.getColumnName())) {
|
||||||
hasId = true;
|
hasId = true;
|
||||||
|
idColumn = field.getColumnName();
|
||||||
|
idFormShow = field.getFormShow();
|
||||||
}
|
}
|
||||||
if (!hasGmtCreate && StringUtils.equals(FieldService.DEFAULT_FIELD_GMT_CREATE, field.getPropertyName())) {
|
if (!hasGmtCreate && StringUtils.equals(FieldService.DEFAULT_FIELD_GMT_CREATE, field.getPropertyName())) {
|
||||||
hasGmtCreate = true;
|
hasGmtCreate = true;
|
||||||
@ -151,9 +156,11 @@ public class GenerateService {
|
|||||||
}
|
}
|
||||||
if (!hasGmtModified && StringUtils.equals(FieldService.DEFAULT_FIELD_GMT_MODIFIED, field.getPropertyName())) {
|
if (!hasGmtModified && StringUtils.equals(FieldService.DEFAULT_FIELD_GMT_MODIFIED, field.getPropertyName())) {
|
||||||
hasGmtModified = true;
|
hasGmtModified = true;
|
||||||
|
gmtModifiedFormShow = field.getFormShow();
|
||||||
}
|
}
|
||||||
if (!hasModifier && StringUtils.equals(FieldService.DEFAULT_FIELD_MODIFIER, field.getPropertyName())) {
|
if (!hasModifier && StringUtils.equals(FieldService.DEFAULT_FIELD_MODIFIER, field.getPropertyName())) {
|
||||||
hasModifier = true;
|
hasModifier = true;
|
||||||
|
modifierFormShow = field.getFormShow();
|
||||||
}
|
}
|
||||||
if (!hasIsDelete && StringUtils.equals(FieldService.DEFAULT_FIELD_IS_DELETE, field.getPropertyName())) {
|
if (!hasIsDelete && StringUtils.equals(FieldService.DEFAULT_FIELD_IS_DELETE, field.getPropertyName())) {
|
||||||
hasIsDelete = true;
|
hasIsDelete = true;
|
||||||
@ -176,11 +183,15 @@ public class GenerateService {
|
|||||||
fieldMap.put("fieldSplit", fieldSplit);
|
fieldMap.put("fieldSplit", fieldSplit);
|
||||||
fieldList.add(fieldMap);
|
fieldList.add(fieldMap);
|
||||||
}
|
}
|
||||||
|
dataModel.put("idColumn", idColumn);
|
||||||
dataModel.put("hasId", hasId);
|
dataModel.put("hasId", hasId);
|
||||||
|
dataModel.put("idFormShow", idFormShow);
|
||||||
dataModel.put("hasGmtCreate", hasGmtCreate);
|
dataModel.put("hasGmtCreate", hasGmtCreate);
|
||||||
dataModel.put("hasCreator", hasCreator);
|
dataModel.put("hasCreator", hasCreator);
|
||||||
dataModel.put("hasGmtModified", hasGmtModified);
|
dataModel.put("hasGmtModified", hasGmtModified);
|
||||||
|
dataModel.put("gmtModifiedFormShow", gmtModifiedFormShow);
|
||||||
dataModel.put("hasModifier", hasModifier);
|
dataModel.put("hasModifier", hasModifier);
|
||||||
|
dataModel.put("modifierFormShow", modifierFormShow);
|
||||||
dataModel.put("hasIsDelete", hasIsDelete);
|
dataModel.put("hasIsDelete", hasIsDelete);
|
||||||
dataModel.put("fieldList", fieldList);
|
dataModel.put("fieldList", fieldList);
|
||||||
}
|
}
|
||||||
@ -308,7 +319,7 @@ public class GenerateService {
|
|||||||
if (!folder.exists()) {
|
if (!folder.exists()) {
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
}
|
}
|
||||||
code(templateFtl, String.format("%s/%s-mapper.xml", outFolder, tableName), dataModel);
|
code(templateFtl, String.format("%s/%s-mapper.xml", outFolder, WStringUtil.lowerUpper2UnderLine(tableName).replaceAll("\\_", "-")), dataModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -455,8 +466,8 @@ public class GenerateService {
|
|||||||
* @throws TemplateException
|
* @throws TemplateException
|
||||||
*/
|
*/
|
||||||
private void code(String templateFtl, String outFile, Map<String, Object> dataModel) throws IOException, TemplateException {
|
private void code(String templateFtl, String outFile, Map<String, Object> dataModel) throws IOException, TemplateException {
|
||||||
Template template = freemarkerConfiguration.getTemplate(templateFtl);
|
Template template = freemarkerConfiguration.getTemplate(templateFtl, UTF_8);
|
||||||
Writer out = new FileWriter(outFile);
|
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), UTF_8));
|
||||||
template.process(dataModel, out);
|
template.process(dataModel, out);
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ public class FieldVO {
|
|||||||
private Boolean isFormShow;
|
private Boolean isFormShow;
|
||||||
private Boolean isListShow;
|
private Boolean isListShow;
|
||||||
private Boolean isNotNull;
|
private Boolean isNotNull;
|
||||||
|
private String tableName;
|
||||||
|
private String tableNamePrefix;
|
||||||
|
|
||||||
public FieldVO() {
|
public FieldVO() {
|
||||||
this.rowNumber = new SimpleIntegerProperty(0);
|
this.rowNumber = new SimpleIntegerProperty(0);
|
||||||
@ -212,44 +214,20 @@ public class FieldVO {
|
|||||||
isNotNull = notNull;
|
isNotNull = notNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String getTableName() {
|
||||||
public String toString() {
|
return tableName == null ? "" : tableName.trim();
|
||||||
final StringBuilder sb = new StringBuilder("{");
|
|
||||||
sb.append("\"rowNumber\":")
|
|
||||||
.append(rowNumber);
|
|
||||||
sb.append(",\"columnName\":")
|
|
||||||
.append(columnName);
|
|
||||||
sb.append(",\"columnComment\":")
|
|
||||||
.append(columnComment);
|
|
||||||
sb.append(",\"columnDefault\":")
|
|
||||||
.append(columnDefault);
|
|
||||||
sb.append(",\"dataType\":\"")
|
|
||||||
.append(dataType).append('\"');
|
|
||||||
sb.append(",\"columnType\":")
|
|
||||||
.append(columnType);
|
|
||||||
sb.append(",\"characterMaximum\":")
|
|
||||||
.append(characterMaximum);
|
|
||||||
sb.append(",\"numericPrecision\":")
|
|
||||||
.append(numericPrecision);
|
|
||||||
sb.append(",\"numericScale\":")
|
|
||||||
.append(numericScale);
|
|
||||||
sb.append(",\"propertyName\":")
|
|
||||||
.append(propertyName);
|
|
||||||
sb.append(",\"propertyType\":")
|
|
||||||
.append(propertyType);
|
|
||||||
sb.append(",\"propertyLength\":")
|
|
||||||
.append(propertyLength);
|
|
||||||
sb.append(",\"formFieldType\":\"")
|
|
||||||
.append(formFieldType).append('\"');
|
|
||||||
sb.append(",\"formFieldValue\":\"")
|
|
||||||
.append(formFieldValue).append('\"');
|
|
||||||
sb.append(",\"isFormShow\":")
|
|
||||||
.append(isFormShow);
|
|
||||||
sb.append(",\"isListShow\":")
|
|
||||||
.append(isListShow);
|
|
||||||
sb.append(",\"isNotNull\":")
|
|
||||||
.append(isNotNull);
|
|
||||||
sb.append('}');
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTableName(String tableName) {
|
||||||
|
this.tableName = tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTableNamePrefix() {
|
||||||
|
return tableNamePrefix == null ? "" : tableNamePrefix.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTableNamePrefix(String tableNamePrefix) {
|
||||||
|
this.tableNamePrefix = tableNamePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
is_delete = 1
|
is_delete = 1
|
||||||
WHERE
|
WHERE
|
||||||
<#if hasId>
|
<#if hasId>
|
||||||
${tableName}_id IN
|
${underlineTableName}_id IN
|
||||||
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
||||||
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
||||||
</foreach>
|
</foreach>
|
||||||
@ -66,7 +66,7 @@
|
|||||||
${tableFullName}
|
${tableFullName}
|
||||||
WHERE
|
WHERE
|
||||||
<#if hasId>
|
<#if hasId>
|
||||||
${tableName}_id IN
|
${idColumn} IN
|
||||||
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
||||||
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
||||||
</foreach>
|
</foreach>
|
||||||
@ -81,36 +81,38 @@
|
|||||||
${tableFullName}
|
${tableFullName}
|
||||||
SET
|
SET
|
||||||
<#list fieldList! as field>
|
<#list fieldList! as field>
|
||||||
<#if field.listShow>
|
<#if field.formShow>
|
||||||
<#if field.formFieldValue == "number" || field.formFieldValue == "double">
|
<#if field.formFieldValue == "number" || field.formFieldValue == "double">
|
||||||
<if test="${field.propertyName} != null">
|
<if test="${field.propertyName} != null">
|
||||||
${field.columnName} = ${r"#{"}${field.propertyName}${r"}"},
|
${field.columnName} = ${r"#{"}${field.propertyName}${r"}"},
|
||||||
</if>
|
</if>
|
||||||
<#elseif field.formFieldValue == "radio" || field.formFieldValue == "checkbox" || field.formFieldValue == "select">
|
<#elseif field.formFieldValue == "radio" || field.formFieldValue == "checkbox" || field.formFieldValue == "select">
|
||||||
<if test="${field.propertyName} != null">
|
<if test="${field.propertyName} != null">
|
||||||
|
${field.columnName} = ${r"#{"}${field.propertyName}${r"}"},w
|
||||||
|
</if>
|
||||||
|
<#else>
|
||||||
|
<#if field.columnName != idColumn>
|
||||||
|
<if test="${field.propertyName} != null and ${field.propertyName} != ''">
|
||||||
${field.columnName} = ${r"#{"}${field.propertyName}${r"}"},
|
${field.columnName} = ${r"#{"}${field.propertyName}${r"}"},
|
||||||
</if>
|
</if>
|
||||||
<#else>
|
</#if>
|
||||||
<if test="${field.propertyName} != null and ${field.propertyName} != ''">
|
</#if>
|
||||||
${field.columnName} = ${r"#{"}${field.propertyName}${r"}"},
|
|
||||||
</if>
|
|
||||||
</#if>
|
|
||||||
<#if hasGmtModified>
|
|
||||||
gmt_modified = ${r"#{gmtModified}"},
|
|
||||||
</#if>
|
|
||||||
<#if hasModifier>
|
|
||||||
modifier = ${r"#{modifier}"},
|
|
||||||
</#if>
|
|
||||||
</#if>
|
|
||||||
<#if hasId>
|
|
||||||
${tableName}_id = ${tableName}_id
|
|
||||||
<#else>
|
|
||||||
<!-- 填充条件 -->
|
|
||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
|
<#if hasGmtModified && !gmtModifiedFormShow>
|
||||||
|
gmt_modified = ${r"#{gmtModified}"},
|
||||||
|
</#if>
|
||||||
|
<#if hasModifier && !modifierFormShow>
|
||||||
|
modifier = ${r"#{modifier}"},
|
||||||
|
</#if>
|
||||||
|
<#if hasId>
|
||||||
|
${idColumn} = ${idColumn}
|
||||||
|
<#else>
|
||||||
|
<!-- 填充条件 -->
|
||||||
|
</#if>
|
||||||
WHERE
|
WHERE
|
||||||
<#if hasId>
|
<#if hasId>
|
||||||
${tableName}_id = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
${idColumn} = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
||||||
<#else>
|
<#else>
|
||||||
<!-- 添加条件 -->
|
<!-- 添加条件 -->
|
||||||
</#if>
|
</#if>
|
||||||
@ -125,7 +127,7 @@
|
|||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
<#if hasId>
|
<#if hasId>
|
||||||
t1.${tableName}_id
|
t1.${idColumn}
|
||||||
<#else>
|
<#else>
|
||||||
1
|
1
|
||||||
</#if>
|
</#if>
|
||||||
@ -140,7 +142,7 @@
|
|||||||
<#if hasId>
|
<#if hasId>
|
||||||
<if test="${firstLowerTableName}Id != null and ${firstLowerTableName}Id != ''">
|
<if test="${firstLowerTableName}Id != null and ${firstLowerTableName}Id != ''">
|
||||||
AND
|
AND
|
||||||
t1.${tableName}_id = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
t1.${idColumn} = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
||||||
</if>
|
</if>
|
||||||
<#else>
|
<#else>
|
||||||
<!-- 添加条件 -->
|
<!-- 添加条件 -->
|
||||||
@ -164,7 +166,7 @@
|
|||||||
<#if hasId>
|
<#if hasId>
|
||||||
<if test="${firstLowerTableName}Id != null and ${firstLowerTableName}Id != ''">
|
<if test="${firstLowerTableName}Id != null and ${firstLowerTableName}Id != ''">
|
||||||
AND
|
AND
|
||||||
t1.${tableName}_id = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
t1.${idColumn} = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
||||||
</if>
|
</if>
|
||||||
<#else>
|
<#else>
|
||||||
<!-- 添加条件 -->
|
<!-- 添加条件 -->
|
||||||
@ -188,7 +190,7 @@
|
|||||||
<#if hasId>
|
<#if hasId>
|
||||||
<if test="${firstLowerTableName}Id != null and ${firstLowerTableName}Id != ''">
|
<if test="${firstLowerTableName}Id != null and ${firstLowerTableName}Id != ''">
|
||||||
AND
|
AND
|
||||||
t1.${tableName}_id = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
t1.${idColumn} = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
||||||
</if>
|
</if>
|
||||||
<#else>
|
<#else>
|
||||||
<!-- 添加条件 -->
|
<!-- 添加条件 -->
|
||||||
@ -231,7 +233,7 @@
|
|||||||
<#if hasId>
|
<#if hasId>
|
||||||
<if test="${firstLowerTableName}Ids != null and ${firstLowerTableName}Ids.size > 0">
|
<if test="${firstLowerTableName}Ids != null and ${firstLowerTableName}Ids.size > 0">
|
||||||
AND
|
AND
|
||||||
t1.${tableName}_id IN
|
t1.${idColumn} IN
|
||||||
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
||||||
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
||||||
</foreach>
|
</foreach>
|
||||||
@ -272,7 +274,7 @@
|
|||||||
<#if hasId>
|
<#if hasId>
|
||||||
<if test="${firstLowerTableName}Ids != null and ${firstLowerTableName}Ids.size > 0">
|
<if test="${firstLowerTableName}Ids != null and ${firstLowerTableName}Ids.size > 0">
|
||||||
AND
|
AND
|
||||||
t1.${tableName}_id IN
|
t1.${idColumn} IN
|
||||||
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
||||||
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
||||||
</foreach>
|
</foreach>
|
||||||
@ -313,7 +315,7 @@
|
|||||||
<#if hasId>
|
<#if hasId>
|
||||||
<if test="${firstLowerTableName}Ids != null and ${firstLowerTableName}Ids.size > 0">
|
<if test="${firstLowerTableName}Ids != null and ${firstLowerTableName}Ids.size > 0">
|
||||||
AND
|
AND
|
||||||
t1.${tableName}_id IN
|
t1.${idColumn} IN
|
||||||
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
||||||
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
Loading…
Reference in New Issue
Block a user