Commit da20f6ea authored by 赵啸非's avatar 赵啸非

完善文档转换功能

parent 8e8480a4
...@@ -51,6 +51,16 @@ ...@@ -51,6 +51,16 @@
@click="handleGenDoc" @click="handleGenDoc"
>生成文档</el-button >生成文档</el-button
> >
<el-button
slot="table-head-left2"
type="primary"
plain
icon="el-icon-download"
size="mini"
@click="handleCreateTable"
>执行建表语句</el-button
>
</LayoutTable> </LayoutTable>
<!-- 列表导入对话框 --> <!-- 列表导入对话框 -->
<el-dialog <el-dialog
...@@ -102,7 +112,9 @@ ...@@ -102,7 +112,9 @@
:name="key.substring(key.lastIndexOf('/') + 1, key.indexOf('.ftl'))" :name="key.substring(key.lastIndexOf('/') + 1, key.indexOf('.ftl'))"
:key="key" :key="key"
> >
<el-link :underline="false" type="primary" <el-link
:underline="false"
type="primary"
class="copy-btn" class="copy-btn"
v-clipboard:copy="value" v-clipboard:copy="value"
v-clipboard:success="onCopy" v-clipboard:success="onCopy"
...@@ -148,6 +160,35 @@ ...@@ -148,6 +160,35 @@
<el-button @click="docExport.open = false">取 消</el-button> <el-button @click="docExport.open = false">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 建表对话框 -->
<el-dialog
:title="sqlDialog.title"
:visible.sync="sqlDialog.open"
width="1000px"
append-to-body
>
<el-form label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="sql语句">
<el-input
type="textarea"
:rows="15"
placeholder="请输入建表DDL语句"
v-model="sqlDialog.textarea"
>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSqlForm">确 定</el-button>
<el-button @click="sqlDialog.open = false">取 消</el-button>
</div>
</el-dialog>
<import-table ref="import" @ok="handleQuery" /> <import-table ref="import" @ok="handleQuery" />
</div> </div>
</template> </template>
...@@ -167,8 +208,6 @@ hljs.registerLanguage( ...@@ -167,8 +208,6 @@ hljs.registerLanguage(
); );
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql")); hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"));
import { resolveBlob } from "@/assets/utils";
export default { export default {
components: { importTable }, components: { importTable },
mixins: [table], mixins: [table],
...@@ -189,6 +228,9 @@ export default { ...@@ -189,6 +228,9 @@ export default {
this.docExport.title = "导出文档"; this.docExport.title = "导出文档";
this.docExport.open = true; this.docExport.open = true;
}, },
handleCreateTable() {
this.sqlDialog.open = true;
},
/** 生成选中的文档 */ /** 生成选中的文档 */
submitDocExportForm() { submitDocExportForm() {
const tableNames = this.tableNames; const tableNames = this.tableNames;
...@@ -206,6 +248,25 @@ export default { ...@@ -206,6 +248,25 @@ export default {
this.$message.error(error.message); this.$message.error(error.message);
}); });
}, },
/** 生成sql建表 */
submitSqlForm() {
this.loading = true;
this.$post("/gentable/createTableSql", {
tableSql: this.sqlDialog.textarea,
})
.then((res) => {
this.loading = false;
this.sqlDialog.open = false;
this.sqlDialog.textarea=""
this.$message.success("执行成功!");
})
.catch((error) => {
console.log("error", error);
this.$message.error(error.message);
});
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.getData(); this.getData();
...@@ -386,6 +447,14 @@ export default { ...@@ -386,6 +447,14 @@ export default {
// 是否禁用上传 // 是否禁用上传
isUploading: false, isUploading: false,
}, },
sqlDialog: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "建表对话框",
// 是否禁用上传
textarea: "",
},
// 预览参数 // 预览参数
preview: { preview: {
open: false, open: false,
......
...@@ -35,4 +35,7 @@ public interface GentableDao extends ICRUDDao<GentableEntity,Long> { ...@@ -35,4 +35,7 @@ public interface GentableDao extends ICRUDDao<GentableEntity,Long> {
* @return * @return
*/ */
List<GentableEntity> selectDbTableListByNames(String[] tableNames); List<GentableEntity> selectDbTableListByNames(String[] tableNames);
void createTable(String tableSql);
} }
...@@ -31,4 +31,9 @@ public class GentableDaoImpl extends BaseCRUDDaoMybatis<GentableEntity,Long> imp ...@@ -31,4 +31,9 @@ public class GentableDaoImpl extends BaseCRUDDaoMybatis<GentableEntity,Long> imp
public List<GentableEntity> selectDbTableListByNames(String[] tableNames) { public List<GentableEntity> selectDbTableListByNames(String[] tableNames) {
return getSqlSession().selectList(getSqlId("selectDbTableListByNames"), tableNames); return getSqlSession().selectList(getSqlId("selectDbTableListByNames"), tableNames);
} }
@Override
public void createTable(String tableSql) {
getSqlSession().update("createTable",tableSql);
}
} }
...@@ -99,4 +99,11 @@ public interface GentableService extends ICRUDService<GentableEntity, Long> { ...@@ -99,4 +99,11 @@ public interface GentableService extends ICRUDService<GentableEntity, Long> {
* @return 数据 * @return 数据
*/ */
byte[] exportDoc(ProjectInfoEntity projectInfoEntity); byte[] exportDoc(ProjectInfoEntity projectInfoEntity);
/**
* 自动建表
*
* @param tableSql
*/
void crateTableBySql(String tableSql, Context context);
} }
\ No newline at end of file
...@@ -98,7 +98,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -98,7 +98,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
} }
@Override @Override
public void validData(GentableEntity genTable,Context context) throws AppException { public void validData(GentableEntity genTable, Context context) throws AppException {
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
String options = JSON.toJSONString(genTable.getOptions()); String options = JSON.toJSONString(genTable.getOptions());
JSONObject paramsObj = JSONObject.parseObject(options); JSONObject paramsObj = JSONObject.parseObject(options);
...@@ -121,14 +121,15 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -121,14 +121,15 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
@Override @Override
public Map<String, String> previewCode(Long id) { public Map<String, String> previewCode(Long id) {
Map<String, String> dataMap = new LinkedHashMap<>(); Map<String, String> dataMap = new LinkedHashMap<>();
// 查询表信息 // 查询表信息
GentableEntity gentableEntity = this.get(id); GentableEntity gentableEntity = this.get(id);
List<GentableColumnEntity> columnEntities = this.gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId())).stream().map(column -> { List<GentableColumnEntity> columnEntities = this.gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId())).stream().map(column -> {
//拆解枚举类,格式必须为(1.啊啊啊,2.不不不) //拆解枚举类,格式必须为(1.啊啊啊,2.不不不)
String temp1 = StringUtils.substringBetween(column.getColumnComment(), "(" , ")"); String temp1 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
String temp2 = StringUtils.substringBetween(column.getColumnComment(), "(" , ")"); String temp2 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
GenUtils.checkDict(column, temp1); GenUtils.checkDict(column, temp1);
GenUtils.checkDict(column, temp2); GenUtils.checkDict(column, temp2);
return column; return column;
...@@ -155,7 +156,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -155,7 +156,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
template.process(data, sw); template.process(data, sw);
dataMap.put(temp, sw.toString()); dataMap.put(temp, sw.toString());
} catch (Exception e) { } catch (Exception e) {
log.error("异常" , e); log.error("异常", e);
} }
} }
return dataMap; return dataMap;
...@@ -293,7 +294,17 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -293,7 +294,17 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
return generatorDoc(projectInfoEntity); return generatorDoc(projectInfoEntity);
} }
@Override
public void crateTableBySql(String tableSql, Context context) {
//校验部分命令 禁止使用 比如清库的
// if(tableSql.indexOf("")!=-1){
// throw new AppException("禁止使用");
// }
this.getDao().createTable(tableSql);
}
/** /**
* 查询表信息并生成代码 * 查询表信息并生成代码
*/ */
...@@ -301,8 +312,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -301,8 +312,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
GentableEntity gentableEntity = this.selectOne(new GentableQuery().tableName(tableName)); GentableEntity gentableEntity = this.selectOne(new GentableQuery().tableName(tableName));
if (!ObjectUtils.isEmpty(gentableEntity)) { if (!ObjectUtils.isEmpty(gentableEntity)) {
List<GentableColumnEntity> columnEntities = this.gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId())).stream().map(column -> { List<GentableColumnEntity> columnEntities = this.gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId())).stream().map(column -> {
String temp1 = StringUtils.substringBetween(column.getColumnComment(), "(" , ")"); String temp1 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
String temp2 = StringUtils.substringBetween(column.getColumnComment(), "(" , ")"); String temp2 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
GenUtils.checkDict(column, temp1); GenUtils.checkDict(column, temp1);
GenUtils.checkDict(column, temp2); GenUtils.checkDict(column, temp2);
return column; return column;
...@@ -377,7 +388,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -377,7 +388,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
template.process(data, sw); template.process(data, sw);
return sw.toString().getBytes(Constant.UTF8); return sw.toString().getBytes(Constant.UTF8);
} catch (Exception e) { } catch (Exception e) {
log.error("渲染模板失败:" , e); log.error("渲染模板失败:", e);
return null; return null;
} }
...@@ -399,7 +410,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -399,7 +410,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
if (StringUtils.isNull(table.getPkColumn())) { if (StringUtils.isNull(table.getPkColumn())) {
table.setPkColumn(table.getColumns().get(0)); table.setPkColumn(table.getColumns().get(0));
} }
if (GenConstants.TPL_SUB.equals(table.getTplCategory())&&!ObjectUtils.isEmpty(table.getSubTable())) { if (GenConstants.TPL_SUB.equals(table.getTplCategory()) && !ObjectUtils.isEmpty(table.getSubTable())) {
for (GentableColumnEntity column : table.getSubTable().getColumns()) { for (GentableColumnEntity column : table.getSubTable().getColumns()) {
if (column.getIsPrimaryKey() == YesNoEnum.YES.getValue()) { if (column.getIsPrimaryKey() == YesNoEnum.YES.getValue()) {
table.getSubTable().setPkColumn(column); table.getSubTable().setPkColumn(column);
......
...@@ -274,6 +274,33 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe ...@@ -274,6 +274,33 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe
} }
/**
* 前端动态建表
*
* @param tableSql
* @return
*/
@PostMapping("/createTableSql")
public String createTableSql(@RequestParam(value = "tableSql") String tableSql) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
Context context = getContext();
String busiDesc = "建表" + getModuleDesc();
int code = VALUE_RESULT_SUCCESS;
try {
this.service.crateTableBySql(tableSql, context);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_CODE, code);
ret.put(KEY_RESULT_MSG, model.remove(MESSAGE_INFO));
return ret.toJSONString();
}
/** /**
* 生成zip文件 * 生成zip文件
*/ */
......
...@@ -9,6 +9,10 @@ public abstract class Component extends FieldsItem { ...@@ -9,6 +9,10 @@ public abstract class Component extends FieldsItem {
private String type; private String type;
public Component(String type) {
this.type = type;
}
public abstract FieldsItem buildDefaultComponent(ComponentCons cons); public abstract FieldsItem buildDefaultComponent(ComponentCons cons);
...@@ -16,37 +20,28 @@ public abstract class Component extends FieldsItem { ...@@ -16,37 +20,28 @@ public abstract class Component extends FieldsItem {
public static Component createType(String type) { public static Component createType(String type) {
if (type.equals(ComponentEnum.INPUT.getValue())) { if (type.equals(ComponentEnum.INPUT.getValue())) {
return new InputComponent(); return new InputComponent(type);
} else if (type.equals(ComponentEnum.TEXTAREA.getValue())) { } else if (type.equals(ComponentEnum.TEXTAREA.getValue())) {
return new TextAreaComponent(); return new TextAreaComponent(type);
} else if (type.equals(ComponentEnum.SELECT.getValue())) { } else if (type.equals(ComponentEnum.SELECT.getValue())) {
return new SelectComponent(); return new SelectComponent(type);
} else if (type.equals(ComponentEnum.BUTTON.getValue())) { } else if (type.equals(ComponentEnum.BUTTON.getValue())) {
return new ButtonComponent(); return new ButtonComponent(type);
} else if (type.equals(ComponentEnum.DATE.getValue())) { } else if (type.equals(ComponentEnum.DATE.getValue())) {
return new DateComponent(); return new DateComponent(type);
} else if (type.equals(ComponentEnum.CHECKBOX.getValue())) { } else if (type.equals(ComponentEnum.CHECKBOX.getValue())) {
return new CheckboxComponent(); return new CheckboxComponent(type);
} else if (type.equals(ComponentEnum.IMAGE.getValue())) { } else if (type.equals(ComponentEnum.IMAGE.getValue())) {
return new ImageComponent(); return new ImageComponent(type);
} else if (type.equals(ComponentEnum.AREA.getValue())) { } else if (type.equals(ComponentEnum.AREA.getValue())) {
return new AreaComponent(); return new AreaComponent(type);
} else { } else {
throw new AppException(String.format("不支持当前组件类型,Type:%s", type)); throw new AppException(String.format("不支持当前组件类型,Type:%s", type));
} }
//return null;
} }
// public Component(int sizeType) { public abstract String getType();
// this.sizeType = sizeType;
// }
// public abstract void createInchPhoto(PhotoInchCons photoInchCons);
//abstract int getSizeType();
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -64,263 +64,4 @@ public class GenRoot { ...@@ -64,263 +64,4 @@ public class GenRoot {
} }
public FieldsItem createDefaultInput() {
FieldsItem fieldsItem = new FieldsItem();
Config config = new Config();
config.setLabel("");
config.setLabelWidth("");
config.setShowLabel(true);
config.setChangeTag(true);
config.setTag("el-input");
config.setTagIcon("inuput");
config.setRequired(true);
config.setLayout("colFormItem");
config.setDocument("https://element.eleme.cn/#/zh-CN/component/input");
config.setRegList(new ArrayList<>());
config.setSpan(12);
fieldsItem.setConfig(config);
Slot slot = new Slot();
slot.setPrepend("");
slot.setAppend("");
fieldsItem.setSlot(slot);
Style style = new Style();
style.setWidth("100%");
fieldsItem.setStyle(style);
fieldsItem.setClearable(true);
fieldsItem.setPrefixIcon("");
fieldsItem.setSuffixIcon("");
fieldsItem.setMaxlength(null);
fieldsItem.setShowWordLimit(false);
fieldsItem.setReadonly(false);
fieldsItem.setDisabled(false);
fieldsItem.setVModel("reson");
return fieldsItem;
}
public FieldsItem createDefaultTextArea() {
FieldsItem fieldsItem = new FieldsItem();
Config config = new Config();
config.setLabel("多行文本");
config.setLabelWidth("");
config.setShowLabel(true);
config.setChangeTag(true);
config.setTag("el-input");
config.setTagIcon("textarea");
config.setRequired(true);
config.setLayout("colFormItem");
config.setDocument("https://element.eleme.cn/#/zh-CN/component/input");
config.setRegList(new ArrayList<>());
config.setSpan(24);
fieldsItem.setConfig(config);
fieldsItem.setType("textarea");
Autosize autosize = new Autosize();
autosize.setMinRows(2);
autosize.setMaxRows(4);
fieldsItem.setAutosize(autosize);
Style style = new Style();
style.setWidth("100%");
fieldsItem.setStyle(style);
fieldsItem.setClearable(true);
fieldsItem.setMaxlength(null);
fieldsItem.setReadonly(false);
fieldsItem.setDisabled(false);
fieldsItem.setVModel("textarea");
return fieldsItem;
}
public FieldsItem createDefaultSelect() {
FieldsItem fieldsItem = new FieldsItem();
Config config = new Config();
config.setLabel("下拉选项框");
config.setLabelWidth("");
config.setShowLabel(true);
config.setChangeTag(true);
config.setTag("el-select");
config.setTagIcon("select");
config.setLayout("colFormItem");
config.setRequired(true);
config.setDocument("https://element.eleme.cn/#/zh-CN/component/select");
config.setRegList(new ArrayList<>());
config.setFormId(1);
config.setRenderKey("");
config.setSpan(12);
fieldsItem.setConfig(config);
Slot slot = new Slot();
List<OptionsItem> list = new ArrayList<>();
OptionsItem optionsItem = new OptionsItem();
optionsItem.setLabel("选项一");
optionsItem.setValue("1");
list.add(optionsItem);
slot.setOptions(list);
fieldsItem.setSlot(slot);
Style style = new Style();
style.setWidth("100%");
fieldsItem.setStyle(style);
fieldsItem.setClearable(true);
fieldsItem.setMultiple(false);
fieldsItem.setVModel("field");
return fieldsItem;
}
public FieldsItem createDefaultDatePicker() {
//时间选择
FieldsItem fieldsItem = new FieldsItem();
Config config = new Config();
config.setLabel("日期选择");
config.setTag("el-date-picker");
config.setTagIcon("date");
config.setLabelWidth("");
config.setShowLabel(true);
config.setChangeTag(true);
config.setRequired(true);
config.setLayout("colFormItem");
config.setDocument("https://element.eleme.cn/#/zh-CN/component/input");
config.setRegList(new ArrayList<>());
config.setSpan(12);
fieldsItem.setConfig(config);
fieldsItem.setType("date");
Style style = new Style();
style.setWidth("100%");
fieldsItem.setStyle(style);
fieldsItem.setClearable(true);
fieldsItem.setPlaceholder("请选择日期");
fieldsItem.setFormat("yyyy 年 MM 月 dd 日");
fieldsItem.setValueFormat("yyyy 年 MM 月 dd 日");
fieldsItem.setReadonly(false);
fieldsItem.setDisabled(false);
fieldsItem.setVModel("datepick");
return fieldsItem;
}
public FieldsItem createDefaultImage() {
//图片选择
FieldsItem fieldsItem = new FieldsItem();
Config config = new Config();
config.setLabel("日期选择");
config.setTag("el-upload");
config.setTagIcon("upload");
config.setButtonText("点击上传");
config.setFileSize(2);
config.setSizeUnit("MB");
config.setLabelWidth("");
config.setShowLabel(true);
config.setChangeTag(true);
config.setTag("el-upload");
config.setRequired(false);
config.setLayout("colFormItem");
config.setDocument("https://element.eleme.cn/#/zh-CN/component/upload");
config.setRegList(new ArrayList<>());
config.setSpan(12);
fieldsItem.setConfig(config);
Slot slot = new Slot();
slot.setListType(true);
fieldsItem.setSlot(slot);
fieldsItem.setAction("/m/file/commonupload?prePath=preview");
fieldsItem.setAccept("image/*");
fieldsItem.setName("file");
fieldsItem.setAutoUpload(true);
fieldsItem.setListType("picture-card");
fieldsItem.setMultiple(false);
fieldsItem.setClearable(true);
fieldsItem.setReadonly(false);
fieldsItem.setDisabled(false);
fieldsItem.setVModel("imageupload");
return fieldsItem;
}
public FieldsItem createDefaultCheckBox() {
//复选框
FieldsItem fieldsItem = new FieldsItem();
Config config = new Config();
config.setLabel("多选框组");
config.setTag("el-checkbox-group");
config.setTagIcon("checkbox");
config.setDefaultValue(new ArrayList<>());
config.setLabelWidth("");
config.setShowLabel(true);
config.setChangeTag(true);
config.setRequired(true);
config.setLayout("colFormItem");
config.setDocument("https://element.eleme.cn/#/zh-CN/component/checkbox");
config.setRegList(new ArrayList<>());
config.setSpan(12);
config.setBorder(false);
fieldsItem.setConfig(config);
Slot slot = new Slot();
List<OptionsItem> list = new ArrayList<>();
OptionsItem optionsItem = new OptionsItem();
optionsItem.setLabel("选项一");
optionsItem.setValue("1");
list.add(optionsItem);
slot.setOptions(list);
fieldsItem.setSlot(slot);
Style style = new Style();
fieldsItem.setStyle(style);
fieldsItem.setDisabled(false);
fieldsItem.setVModel("checkbox");
return fieldsItem;
}
public FieldsItem createDefaultButton() {
//创建按钮事件
FieldsItem fieldsItem = new FieldsItem();
Config config = new Config();
config.setLabel("按钮");
config.setTag("el-button");
config.setTagIcon("button");
config.setLabelWidth("");
config.setShowLabel(true);
config.setChangeTag(true);
config.setTag("el-button");
config.setRequired(false);
config.setLayout("colFormItem");
config.setDocument("https://element.eleme.cn/#/zh-CN/component/button");
config.setSpan(12);
fieldsItem.setConfig(config);
Slot slot = new Slot();
slot.setJsonMemberDefault("主要按钮");
fieldsItem.setSlot(slot);
fieldsItem.setSize("small");
fieldsItem.setType("primary");
fieldsItem.setIcon("el-icon-search");
fieldsItem.setRound(false);
fieldsItem.setPlain(false);
fieldsItem.setCircle(false);
fieldsItem.setDisabled(false);
fieldsItem.setVModel("button");
On on = new On();
on.setClick("clickTestButton1");
fieldsItem.setOn(on);
return fieldsItem;
}
} }
\ No newline at end of file
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.Component; import com.mortals.xhx.common.pdu.gen.Component;
import com.mortals.xhx.common.pdu.gen.Config; import com.mortals.xhx.common.pdu.gen.Config;
import com.mortals.xhx.common.pdu.gen.FieldsItem; import com.mortals.xhx.common.pdu.gen.FieldsItem;
...@@ -16,6 +17,11 @@ import java.util.ArrayList; ...@@ -16,6 +17,11 @@ import java.util.ArrayList;
**/ **/
public class AreaComponent extends Component { public class AreaComponent extends Component {
public AreaComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
//todo //todo
...@@ -48,4 +54,9 @@ public class AreaComponent extends Component { ...@@ -48,4 +54,9 @@ public class AreaComponent extends Component {
return fieldsItem; return fieldsItem;
} }
@Override
public String getType() {
return ComponentEnum.AREA.getValue();
}
} }
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*; import com.mortals.xhx.common.pdu.gen.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -13,6 +14,9 @@ import java.util.ArrayList; ...@@ -13,6 +14,9 @@ import java.util.ArrayList;
**/ **/
public class ButtonComponent extends Component { public class ButtonComponent extends Component {
public ButtonComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
...@@ -52,4 +56,9 @@ public class ButtonComponent extends Component { ...@@ -52,4 +56,9 @@ public class ButtonComponent extends Component {
fieldsItem.setOn(on); fieldsItem.setOn(on);
return fieldsItem; return fieldsItem;
} }
@Override
public String getType() {
return ComponentEnum.BUTTON.getValue();
}
} }
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*; import com.mortals.xhx.common.pdu.gen.*;
import com.mortals.xhx.common.utils.ExportDocUtil; import com.mortals.xhx.common.utils.ExportDocUtil;
import com.mortals.xhx.common.utils.StringUtils; import com.mortals.xhx.common.utils.StringUtils;
...@@ -18,6 +19,9 @@ import java.util.stream.Collectors; ...@@ -18,6 +19,9 @@ import java.util.stream.Collectors;
**/ **/
public class CheckboxComponent extends Component { public class CheckboxComponent extends Component {
public CheckboxComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
...@@ -81,4 +85,9 @@ public class CheckboxComponent extends Component { ...@@ -81,4 +85,9 @@ public class CheckboxComponent extends Component {
} }
} }
@Override
public String getType() {
return ComponentEnum.CHECKBOX.getValue();
}
} }
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*; import com.mortals.xhx.common.pdu.gen.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -13,6 +14,10 @@ import java.util.ArrayList; ...@@ -13,6 +14,10 @@ import java.util.ArrayList;
**/ **/
public class DateComponent extends Component { public class DateComponent extends Component {
public DateComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
//时间选择 //时间选择
...@@ -45,4 +50,9 @@ public class DateComponent extends Component { ...@@ -45,4 +50,9 @@ public class DateComponent extends Component {
return fieldsItem; return fieldsItem;
} }
@Override
public String getType() {
return ComponentEnum.DATE.getValue();
}
} }
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*; import com.mortals.xhx.common.pdu.gen.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -13,6 +14,10 @@ import java.util.ArrayList; ...@@ -13,6 +14,10 @@ import java.util.ArrayList;
**/ **/
public class ImageComponent extends Component { public class ImageComponent extends Component {
public ImageComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
//图片选择 //图片选择
...@@ -53,4 +58,9 @@ public class ImageComponent extends Component { ...@@ -53,4 +58,9 @@ public class ImageComponent extends Component {
return fieldsItem; return fieldsItem;
} }
@Override
public String getType() {
return ComponentEnum.IMAGE.getValue();
}
} }
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*; import com.mortals.xhx.common.pdu.gen.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -13,6 +14,9 @@ import java.util.ArrayList; ...@@ -13,6 +14,9 @@ import java.util.ArrayList;
**/ **/
public class InputComponent extends Component { public class InputComponent extends Component {
public InputComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
...@@ -51,4 +55,9 @@ public class InputComponent extends Component { ...@@ -51,4 +55,9 @@ public class InputComponent extends Component {
return fieldsItem; return fieldsItem;
} }
@Override
public String getType() {
return ComponentEnum.INPUT.getValue();
}
} }
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*; import com.mortals.xhx.common.pdu.gen.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -14,6 +15,9 @@ import java.util.List; ...@@ -14,6 +15,9 @@ import java.util.List;
**/ **/
public class SelectComponent extends Component { public class SelectComponent extends Component {
public SelectComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
...@@ -107,4 +111,9 @@ public class SelectComponent extends Component { ...@@ -107,4 +111,9 @@ public class SelectComponent extends Component {
} }
return list; return list;
} }
@Override
public String getType() {
return ComponentEnum.SELECT.getValue();
}
} }
package com.mortals.xhx.common.pdu.gen.component; package com.mortals.xhx.common.pdu.gen.component;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*; import com.mortals.xhx.common.pdu.gen.*;
import com.mortals.xhx.common.pdu.gen.component.ComponentCons; import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
...@@ -14,6 +15,9 @@ import java.util.ArrayList; ...@@ -14,6 +15,9 @@ import java.util.ArrayList;
**/ **/
public class TextAreaComponent extends Component { public class TextAreaComponent extends Component {
public TextAreaComponent(String type) {
super(type);
}
@Override @Override
public FieldsItem buildDefaultComponent(ComponentCons cons) { public FieldsItem buildDefaultComponent(ComponentCons cons) {
...@@ -49,4 +53,9 @@ public class TextAreaComponent extends Component { ...@@ -49,4 +53,9 @@ public class TextAreaComponent extends Component {
return fieldsItem; return fieldsItem;
} }
@Override
public String getType() {
return ComponentEnum.TEXTAREA.getValue();
}
} }
...@@ -117,7 +117,7 @@ public class FreeMarkerUtils { ...@@ -117,7 +117,7 @@ public class FreeMarkerUtils {
templates.add("webVueShow.vue.ftl"); templates.add("webVueShow.vue.ftl");
templates.add("db.sql.ftl"); templates.add("db.sql.ftl");
templates.add("menu.sql.ftl"); templates.add("menu.sql.ftl");
templates.add("db.doc.ftl"); //templates.add("db.doc.ftl");
if (GenConstants.TPL_CRUD.equals(tplCategory)) { if (GenConstants.TPL_CRUD.equals(tplCategory)) {
// templates.add("vm/vue/index.vue.vm"); // templates.add("vm/vue/index.vue.vm");
} else if (GenConstants.TPL_TREE.equals(tplCategory)) { } else if (GenConstants.TPL_TREE.equals(tplCategory)) {
......
...@@ -78,4 +78,9 @@ ...@@ -78,4 +78,9 @@
c.sort c.sort
</select> </select>
<update id="createTable" parameterType="String">
${createTableSql}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
formatter: (row) => { formatter: (row) => {
let widthsize = this.columnSet.reduce((pre, cur) => { let widthsize = this.columnSet.reduce((pre, cur) => {
return pre + Number(cur.width); return pre + Number(cur.width);
}, this.columnSet.length * 150); }, 50);
return ( return (
<el-popover placement="right" width={widthsize} trigger="click"> <el-popover placement="right" width={widthsize} trigger="click">
{this.renderTable(row.${subclassName}Entity)} {this.renderTable(row.${subclassName}Entity)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment