Commit 5b6faec7 authored by 赵啸非's avatar 赵啸非

修改部分生成代码逻辑

parent 7a46454f
......@@ -65,6 +65,7 @@
<template slot-scope="scope">
<el-checkbox
true-label="1"
false-label="0"
v-model="scope.row.isInsert"
></el-checkbox>
</template>
......@@ -73,6 +74,7 @@
<template slot-scope="scope">
<el-checkbox
true-label="1"
false-label="0"
v-model="scope.row.isEdit"
></el-checkbox>
</template>
......@@ -81,6 +83,7 @@
<template slot-scope="scope">
<el-checkbox
true-label="1"
false-label="0"
v-model="scope.row.isList"
></el-checkbox>
</template>
......@@ -89,6 +92,7 @@
<template slot-scope="scope">
<el-checkbox
true-label="1"
false-label="0"
v-model="scope.row.isExport"
></el-checkbox>
</template>
......@@ -97,6 +101,7 @@
<template slot-scope="scope">
<el-checkbox
true-label="1"
false-label="0"
v-model="scope.row.isSerialize"
></el-checkbox>
</template>
......@@ -105,6 +110,7 @@
<template slot-scope="scope">
<el-checkbox
true-label="1"
false-label="0"
v-model="scope.row.isQuery"
></el-checkbox>
</template>
......@@ -113,6 +119,7 @@
<template slot-scope="scope">
<el-checkbox
true-label="1"
false-label="0"
v-model="scope.row.isRequired"
></el-checkbox>
</template>
......@@ -232,6 +239,14 @@ export default {
this.util_toString(entity, this.toString)
);
this.info = this.util_toString(res.data.info, this.toString);
if(res.data.info.options){
Object.assign(this.info, JSON.parse(res.data.info.options));
console.log("info",this.info)
}
this.tables = res.data.tables;
this.dict = Object.assign({}, this.dict, res.data.dict);
this.loading = false;
......@@ -245,22 +260,12 @@ export default {
this.data = this.rule2;
},
methods: {
submitAns(data, label, all_data, index) {
let ans = null;
if (data) {
ans = deepClone(data);
}
console.log(this.rule);
this.$emit("submitAns", data, label, all_data, this.moIndex);
},
/** 提交按钮 */
submitForm() {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
const genForm = this.$refs.genInfo.$refs.genInfoForm;
//构建树扩展
if(basicForm.model.tplCategory==='tree'){
let json={}
json.treeCode=basicForm.model.treeCode
......@@ -269,8 +274,7 @@ export default {
basicForm.model.options=JSON.stringify(json)
}
console.log("basicForm", basicForm);
console.log("genForm", genForm);
Promise.all([basicForm, genForm].map(this.getFormPromise)).then((res) => {
const validateResult = res.every((item) => !!item);
//console.log("validateResult", validateResult);
......
......@@ -108,6 +108,7 @@
</span>
<el-select v-model="info.isShowControl">
<el-option label="php" value="2" />
<el-option label="是" value="1" />
<el-option label="否" value="0" />
</el-select>
......
<template>
<div class="page">
<LayoutTable :data="tableData" :config="tableConfig" notSearch notAdd notDel>
<Breadcrumb slot='breadcrumb' :list='breadcrumbList'></Breadcrumb>
<LayoutTable
:data="tableData"
:config="tableConfig"
notSearch
notAdd
notDel
>
<Breadcrumb slot="breadcrumb" :list="breadcrumbList"></Breadcrumb>
<el-button
slot="table-head-left2"
type="primary"
......@@ -64,7 +69,7 @@
>执行建表语句</el-button
>
<!-- <el-button
<!-- <el-button
slot="table-head-left2"
type="primary"
plain
......@@ -201,6 +206,34 @@
</div>
</el-dialog>
<!-- 生成代码对话框 -->
<el-dialog
:title="genCodeDialog.title"
:visible.sync="genCodeDialog.open"
width="1000px"
append-to-body
>
<el-form label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="生成代码类型">
<el-checkbox true-label="1" false-label="0" v-model="all"
>All</el-checkbox
>
<el-checkbox true-label="2" false-label="0" v-model="model"
>model模型</el-checkbox
>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitGenCodeForm">确 定</el-button>
<el-button @click="genCodeDialog.open = false">取 消</el-button>
</div>
</el-dialog>
<import-table ref="import" @ok="handleQuery" />
</div>
</template>
......@@ -214,6 +247,7 @@ hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage("test", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage(
"javascript",
require("highlight.js/lib/languages/javascript")
......@@ -224,12 +258,11 @@ export default {
components: { importTable },
mixins: [table],
created() {
const appId = this.$route.query["query.appId"];
console.log("appId",appId)
this.appId=appId
//this.query={ appId: appId }
// this.config.addQuery = { appId: appId };
const appId = this.$route.query["query.appId"];
console.log("appId", appId);
this.appId = appId;
//this.query={ appId: appId }
// this.config.addQuery = { appId: appId };
},
methods: {
onCopy(e) {
......@@ -271,15 +304,15 @@ export default {
/** 生成sql建表 */
submitSqlForm() {
this.loading = true;
this.$post("/gentable/createTableSql", {
this.$post("/device/liset", {
tableSql: this.sqlDialog.textarea,
})
.then((res) => {
this.loading = false;
this.sqlDialog.open = false;
this.sqlDialog.textarea=""
this.sqlDialog.textarea = "";
this.$message.success("执行成功!");
})
.catch((error) => {
console.log("error", error);
......@@ -292,20 +325,20 @@ export default {
//this.queryParams.pageNum = 1;
//this.getList();
},
/** 生成代码操作 */
handleGenTable(row) {
console.log("gen", row);
const tableIds = row.id || this.ids;
if (tableIds == "") {
this.$message.error("请选择要生成的数据");
return;
}
submitGenCodeForm() {
let types=[]
types.push(this.all)
types.push(this.model)
let gentype=types.join(",")
this.loading = true;
if (row.tableName) {
if (this.genCodeDialog.tableName) {
this.$download(
"/gentable/genCode",
{
tableId: tableIds,
tableId: this.genCodeDialog.tableId,genTypes:gentype
},
{ type: "zip" }
)
......@@ -319,11 +352,12 @@ export default {
} else {
this.$download(
"/gentable/batchGenCode",
{ tables: tableIds.join(",") },
{ tables: this.ids.join(",") ,genTypes:gentype},
{ type: "zip" }
)
.then((res) => {
this.loading = false;
this.genCodeDialog.open = false;
})
.catch((error) => {
console.log("error", error);
......@@ -331,17 +365,36 @@ export default {
});
}
},
/** 生成代码操作 */
handleGenTable(row) {
console.log("gen", row);
const tableIds = row.id || this.ids;
if (tableIds == "") {
this.$message.error("请选择要生成的数据");
return;
}
if (row.tableName) {
this.genCodeDialog.tableId = tableIds;
this.genCodeDialog.tableName = true;
} else {
this.genCodeDialog.tableName = false;
}
this.genCodeDialog.open = true;
},
/** 同步数据库操作 */
handleSynchDb(row) {
let _this = this;
this.$confirm('确认要强制同步"' + row.tableName + '"表结构吗?', "警告", {
this.$confirm('确认要强制同步"' + row.tableName + '"表结构吗?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(function () {
_this.loading = true;
_this.$post("/gentable/synchDb", {
tableId: row.tableId,
_this
.$post("/gentable/synchDb", {
tableId: row.id,
})
.then((res) => {
if (res && res.code && res.code == 1) {
......@@ -399,21 +452,12 @@ export default {
const tableId = row.id;
this.$router.push({
path: "/gen/edit",
query: { tableId: tableId,appId:this.appId },
query: { tableId: tableId, appId: this.appId },
});
// this.$router.push("/gen/edit/" + tableId);
},
test() {
this.$router.push("/demo");
// this.$router.push({
// path: "demo",
// query: { tableId: tableId },
// });
// this.$router.push("/gen/edit/" + tableId);
},
/** 删除按钮操作 */
handleDelete(row) {
......@@ -433,11 +477,8 @@ export default {
},
handleImportExcel() {
this.upload.title = "导入";
this.upload.url+=this.appId;
this.upload.url += this.appId;
this.upload.open = true;
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
......@@ -459,12 +500,14 @@ export default {
},
data() {
return {
breadcrumbList: [
{name: '工程构建',},
{name: '应用信息',path:'/app/list'},
{name: '生成列表',},
breadcrumbList: [
{ name: "工程构建" },
{ name: "应用信息", path: "/app/list" },
{ name: "生成列表" },
],
appId:null,
appId: null,
all:"1",
model:"0",
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
......@@ -474,7 +517,7 @@ export default {
// 是否禁用上传
isUploading: false,
// 上传的地址
url: "/m/gentable/importDoc?appId="
url: "/m/gentable/importDoc?appId=",
},
// 文档导出参数
docExport: {
......@@ -493,6 +536,14 @@ export default {
// 是否禁用上传
textarea: "",
},
genCodeDialog: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "生成代码对话框",
tableName: false,
},
// 预览参数
preview: {
open: false,
......@@ -501,7 +552,7 @@ export default {
activeName: "entity.java",
},
docForm: {},
appId:null,
appId: null,
config: {
search: [],
......
......@@ -87,9 +87,15 @@
<artifactId>freemarker</artifactId>
<version>2.3.31</version>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencies>
<build>
......
......@@ -2,7 +2,7 @@
PORT="17211"
BASEDIR=`dirname $0`
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="appbuild-manager"
PROJECT_NAME="@project.artifactId@"
MAIN_CLASS="$PROJECT_NAME";
if [ ! -n "$PORT" ]; then
......
package com.mortals.xhx.base.system.gentable.model;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.github.javafaker.Faker;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.common.utils.StringUtils;
import lombok.Data;
import org.springframework.util.ObjectUtils;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
......@@ -18,22 +24,74 @@ public class GentableColumnEntityExt extends BaseEntityLong {
private List<Map<String, String>> dict;
public static String subComment(String comment) {
if (comment.indexOf("(")!=-1) {
return comment.substring(0,comment.indexOf("("));
if (comment.indexOf("(") != -1) {
return comment.substring(0, comment.indexOf("("));
}
if (comment.indexOf("(")!=-1) {
return comment.substring(0,comment.indexOf("("));
if (comment.indexOf("(") != -1) {
return comment.substring(0, comment.indexOf("("));
}
return comment;
}
public static String randomStr(GentableColumnEntity column) {
String returnStr = "";
if(!ObjectUtils.isEmpty(column.getDefaultValue())){
returnStr =column.getDefaultValue();
}else{
if ("String".equalsIgnoreCase(column.getJavaType())) {
returnStr = RandomUtil.randomString(6);
} else if ("Integer".equalsIgnoreCase(column.getJavaType()) || "Long".equalsIgnoreCase(column.getJavaType())) {
returnStr = RandomUtil.randomInt(0, 1000) + "";
} else if ("BigDecimal".equalsIgnoreCase(column.getJavaType())) {
returnStr = RandomUtil.randomBigDecimal().setScale(2, 1).doubleValue() + "";
} else if ("date".equalsIgnoreCase(column.getJavaType())) {
returnStr = DateUtils.getCurrDate().getTime()+"";
}
}
return returnStr;
}
public static String randomStr(String javaType) {
String returnStr = "";
if ("String".equalsIgnoreCase(javaType)) {
returnStr = RandomUtil.randomString(6);
} else if ("Integer".equalsIgnoreCase(javaType) || "Long".equalsIgnoreCase(javaType)) {
returnStr = RandomUtil.randomInt(0, 10000) + "";
} else if ("BigDecimal".equalsIgnoreCase(javaType)) {
returnStr = RandomUtil.randomBigDecimal().setScale(2, 1).doubleValue() + "";
} else if ("date".equalsIgnoreCase(javaType)) {
returnStr = DateUtils.getCurrStrDate();
}
return returnStr;
}
public static String randomNumber() {
Faker faker = new Faker(Locale.CHINESE);
return faker.number().numberBetween(0, 10000) + "";
}
public static String subBetween(String comment) {
comment = comment.replaceAll("(", "(");
comment = comment.replaceAll(")", ")");
String max = StrUtil.subBetween(comment, "(", ")");
return max == null ? "9999" : max;
}
public String test(){
public String test() {
return "aaa";
}
......@@ -42,7 +100,10 @@ public class GentableColumnEntityExt extends BaseEntityLong {
GentableColumnEntity gentableColumnEntity = new GentableColumnEntity();
gentableColumnEntity.setCreateUser("bbbbbb");
System.out.println(JSON.toJSONString(gentableColumnEntity));
// System.out.println(gentableColumnEntity.test());
// System.out.println(gentableColumnEntity.test());
System.out.println(DateUtils.getCurrDatetime().getTime());
}
......
......@@ -67,7 +67,7 @@ public interface GentableService extends ICRUDService<GentableEntity, Long> {
* @param tableId 表tableId
* @return 数据
*/
byte[] downloadCode(Long tableId);
byte[] downloadCode(Long tableId,String genTypes);
/**
* 批量生成代码(下载方式)
......@@ -75,7 +75,7 @@ public interface GentableService extends ICRUDService<GentableEntity, Long> {
* @param tableIds 表数组
* @return 数据
*/
byte[] downloadCode(Long[] tableIds);
byte[] downloadCode(Long[] tableIds,String genTypes);
/**
* 同步数据库
......
......@@ -2,6 +2,7 @@ package com.mortals.xhx.base.system.gentable.web;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.gentable.model.*;
......@@ -62,6 +63,14 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe
super.init(request, response, form, model, context);
}
@Override
protected void doListBefore(HttpServletRequest request, HttpServletResponse response, GentableForm form, Map<String, Object> model, Context context) throws AppException {
form.getQuery().setOrderField("tableName");
super.doListBefore(request, response, form, model, context);
}
/**
* 导入数据库列表
*
......@@ -131,13 +140,9 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe
//查询单表信息
GentableEntity gentableEntity = this.service.get(tableId);
//关联查询表与列信息
List<GentableEntity> allList = this.service.find(new GentableQuery().appId(appId)).stream().map(item->{
List<GentableColumnEntity> columnEntities = gentableColumnService.find(new GentableColumnQuery().tableId(item.getId()));
item.setColumns(columnEntities);
return item;
}).collect(Collectors.toList());
......@@ -167,12 +172,12 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe
* @return
*/
@PostMapping("/genCode")
public void genCode(@RequestParam(value = "tableId") Long tableId) {
public void genCode(@RequestParam(value = "tableId") Long tableId,@RequestParam(value = "genTypes") String genTypes) {
Map<String, Object> model = new HashMap<>();
String busiDesc = "生成单表代码";
try {
byte[] bytes = this.service.downloadCode(tableId);
byte[] bytes = this.service.downloadCode(tableId, genTypes);
genCode(response, bytes);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
......@@ -188,12 +193,12 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe
* @return
*/
@PostMapping("/batchGenCode")
public void batchGenCode(@RequestParam(value = "tables") String tables) {
public void batchGenCode(@RequestParam(value = "tables") String tables,@RequestParam(value = "genTypes") String genTypes) {
Map<String, Object> model = new HashMap<>();
String busiDesc = "批量生成单表代码";
try {
Long[] tableIds = Convert.toLongArray(tables);
byte[] bytes = this.service.downloadCode(tableIds);
byte[] bytes = this.service.downloadCode(tableIds, genTypes);
genCode(response, bytes);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
......
......@@ -12,8 +12,8 @@ public enum HtmlTypeEnum {
HTML_INPUT(1, "文本框"),
HTML_TEXTAREA(2, "文本域"),
HTML_SELECT(3, "下拉框"),
HTML_RADIO(4, "单选框"),
HTML_CHECKBOX(5, "复选框"),
HTML_CHECKBOX(4, "复选框"),
HTML_RADIO(5, "单选框"),
HTML_DATETIME(6, "日期控件"),
HTML_IMAGE_UPLOAD(7, "图片上传控件"),
HTML_FILE_UPLOAD(8, "文件上传控件"),
......@@ -22,7 +22,7 @@ public enum HtmlTypeEnum {
private int value;
private String desc;
private HtmlTypeEnum(int value, String desc) {
HtmlTypeEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
......
......@@ -66,19 +66,19 @@ public class GenConstants {
/**
* 页面不需要编辑字段
*/
public static final String[] COLUMNNAME_NOT_EDIT = {"id", "createUser", "createTime", "delFlag","updateUser",
public static final String[] COLUMNNAME_NOT_EDIT = {"id", "createUser","createUserId", "createTime", "delFlag","updateUser","updateUserId","updateTime",
"updateTime"};
/**
* 页面不需要显示的列表字段
*/
public static final String[] COLUMNNAME_NOT_LIST = {"id", "createUser", "createTime", "delFlag", "updateUser",
public static final String[] COLUMNNAME_NOT_LIST = {"id", "createUser","createUserId", "createTime", "delFlag", "updateUser","updateUserId",
"updateTime"};
/**
* 页面不需要查询字段
*/
public static final String[] COLUMNNAME_NOT_QUERY = {"id", "createUser", "createTime", "delFlag", "updateUser",
public static final String[] COLUMNNAME_NOT_QUERY = {"id", "createUser","createUserId", "createTime", "delFlag", "updateUser","updateUserId",
"updateTime", "remark"};
/**
......
......@@ -31,6 +31,7 @@ public class FreeMarkerUtils {
* 项目空间路径
*/
private static final String PROJECT_PATH = "main/java";
private static final String TEST_PATH = "test/java/com/mortals/httpclient";
/**
* mybatis空间路径
......@@ -46,6 +47,10 @@ public class FreeMarkerUtils {
public static StringBuilder dbSql = new StringBuilder();
public static StringBuilder menuSql = new StringBuilder();
public static StringBuilder paramsSql = new StringBuilder();
public static StringBuilder apimd = new StringBuilder();
public static StringBuilder apitwomd = new StringBuilder();
public static StringBuilder apidict = new StringBuilder();
/**
* 初始化freeMaker方法
......@@ -113,7 +118,11 @@ public class FreeMarkerUtils {
templates.add("sqlMap.xml.ftl");
templates.add("db.sql.ftl");
templates.add("menu.sql.ftl");
//templates.add("db.doc.ftl");
templates.add("params.sql.ftl");
templates.add("api.md.ftl");
templates.add("api-two.md.ftl");
templates.add("apidict.md.ftl");
templates.add("httpclient.test.ftl");
if (GenConstants.TPL_CRUD.equals(tplCategory)) {
templates.add("service.java.ftl");
templates.add("serviceImpl.java.ftl");
......@@ -133,6 +142,23 @@ public class FreeMarkerUtils {
templates.add("webVueShow.vue.ftl");
templates.add("VueDialogShow.vue.ftl");
}
templates.add("webVueView.vue.ftl");
return templates;
}
/**
* 获取model模板信息
*
* @return 模板列表
*/
public static Set<String> getModelTemplateSet() {
Set<String> templates = new HashSet<String>();
templates.add("vo.java.ftl");
templates.add("entity.java.ftl");
templates.add("entityQuery.java.ftl");
templates.add("sqlMap.xml.ftl");
templates.add("entity-tree.java.ftl");
return templates;
}
......@@ -213,10 +239,11 @@ public class FreeMarkerUtils {
*
* @return 模板列表
*/
public static Map prepareSetFreeMarkerDataByEnum(List<Map<String,String>> enums, String enumName, String enumClassName,GentableEntity genTable) {
public static Map prepareSetFreeMarkerDataByEnum(List<Map<String,String>> enums, String enumName, String enumClassName,String javaType) {
Map data = new HashMap();
data.put("enums", enums);
data.put("EnumName", enumName);
data.put("JavaType", javaType);
data.put("EnumClassName", StringUtils.capitalize(enumClassName));
return data;
}
......@@ -431,6 +458,10 @@ public class FreeMarkerUtils {
String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/show.vue", vuePath, businessNameExt);
} else if (template.contains("webVueView.vue.ftl")) {
String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/view.vue", vuePath, businessNameExt);
} else if (template.contains("webVueTreeList.vue.ftl")) {
String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
......@@ -444,7 +475,11 @@ public class FreeMarkerUtils {
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/dialogshow.vue", vuePath, businessNameExt);
} else if (template.contains("db.doc.ftl")) {
fileName = StringUtils.format("{}/views/{}/show.vue", vuePath, businessName);
fileName = StringUtils.format("doc/alldoc.docx");
} else if (template.contains("api.doc.ftl")) {
fileName = StringUtils.format("doc/api.md");
}else if (template.contains("httpclient.test.ftl")) {
fileName = StringUtils.format("{}/{}/{}Controller.http", TEST_PATH, businessName, className);
}
return fileName;
}
......
......@@ -49,7 +49,9 @@ public class GenUtils {
column.setCreateUser(table.getCreateUser());
column.setCreateTime(new Date());
column.setIsSerialize(0);
column.setIsExport(0);
if(column.getIsExport()==null){
column.setIsExport(0);
}
column.setQueryType("=");
// 设置java字段名
column.setJavaField(StrUtil.toCamelCase(columnName));
......@@ -57,9 +59,9 @@ public class GenUtils {
column.setJavaType(GenConstants.TYPE_STRING);
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) {
// 字符串长度超过500设置为文本域
// 字符串长度超过255设置为文本域
Integer columnLength = getColumnLength(column.getColumnType());
Integer htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? HtmlTypeEnum.HTML_TEXTAREA.getValue() : HtmlTypeEnum.HTML_INPUT.getValue();
Integer htmlType = columnLength >= 255 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? HtmlTypeEnum.HTML_TEXTAREA.getValue() : HtmlTypeEnum.HTML_INPUT.getValue();
column.setHtmlType(htmlType);
} else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) {
column.setJavaType(GenConstants.TYPE_DATE);
......@@ -109,7 +111,10 @@ public class GenUtils {
column.setIsQuery(GenConstants.NOREQUIRE);
}
}
//默认都是否
column.setIsList(GenConstants.NOREQUIRE);
column.setIsQuery(GenConstants.NOREQUIRE);
//拆解枚举类,格式必须为(1.啊啊啊,2.不不不)
String temp1 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
......@@ -117,17 +122,27 @@ public class GenUtils {
checkDict(column, temp1);
checkDict(column, temp2);
// if(column.)
// 状态字段设置单选框
if (StringUtils.endsWithIgnoreCase(columnName.toLowerCase(), "status")) {
column.setHtmlType(HtmlTypeEnum.HTML_RADIO.getValue());
}
// 类型&性别字段设置下拉框
else if (StringUtils.endsWithIgnoreCase(columnName.toLowerCase(), "type")
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) {
column.setHtmlType(HtmlTypeEnum.HTML_SELECT.getValue());
if(!ObjectUtils.isEmpty(column.getDict())){
if(column.getDict().size()>2){
column.setHtmlType(HtmlTypeEnum.HTML_SELECT.getValue());
}else{
column.setHtmlType(HtmlTypeEnum.HTML_RADIO.getValue());
}
//radio
}
// 状态字段设置单选框
// if (StringUtils.endsWithIgnoreCase(columnName.toLowerCase(), "status")) {
// column.setHtmlType(HtmlTypeEnum.HTML_RADIO.getValue());
// }
// // 类型&性别字段设置下拉框
// else if (StringUtils.endsWithIgnoreCase(columnName.toLowerCase(), "type")
// || StringUtils.endsWithIgnoreCase(columnName, "sex")) {
// column.setHtmlType(HtmlTypeEnum.HTML_SELECT.getValue());
// }
// 图片字段设置图片上传控件
else if (StringUtils.endsWithIgnoreCase(columnName.toLowerCase(), "imagepath")) {
column.setHtmlType(HtmlTypeEnum.HTML_IMAGE_UPLOAD.getValue());
......@@ -145,20 +160,21 @@ public class GenUtils {
public static void checkDict(GentableColumnEntity column, String temp) {
if (StringUtils.isNotEmpty(temp)) {
//同意替换分割符号
temp=temp.replaceAll(",",",");
temp=temp.replaceAll(";",",");
temp=temp.replaceAll("、",".");
temp=temp.replaceAll("。",".");
String[] split = checkSplitStr(temp, ",");
if (split.length <= 1) {
split = checkSplitStr(temp, ",");
}
if (split.length <= 1) {
split = checkSplitStr(temp, "、");
}
if (split.length > 0) {
Arrays.asList(split).stream().peek(item -> {
String[] vals = checkSplitStr(item, ".");
if (vals.length > 1) {
HashMap<String, String> map = new HashMap<>();
map.put("num", vals[0]);
map.put("value", vals[1]);
map.put("num", vals[0].trim());
map.put("value", vals[1].trim());
if (ObjectUtils.isEmpty(column.getDict())) {
column.setDict(new ArrayList<>());
......@@ -316,6 +332,10 @@ public class GenUtils {
public static Integer getColumnLength(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0) {
String length = StringUtils.substringBetween(columnType, "(", ")");
if(ObjectUtils.isEmpty(length)) {
return 0;
}
return Integer.valueOf(length);
} else {
return 0;
......
......@@ -9,6 +9,7 @@ import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileInputStream;
......@@ -86,44 +87,46 @@ public class ReadDoc {
GentableColumnEntity column = new GentableColumnEntity();
XWPFTableRow row = rows.get(i);
//判断是否第一个列数据为空 如果为空 跳过
if ("".equals(row.getCell(0).getText().trim())) {
continue;
}
// if ("".equals(row.getCell(0).getText().trim())) {
// continue;
// }
//读取每一列数据
List<XWPFTableCell> cells = row.getTableCells();
//列名
XWPFTableCell cell = cells.get(0);
XWPFTableCell cell = cells.get(1);
column.setColumnName(cell.getText().trim());
//备注说明
column.setColumnComment(cells.get(1).getText().trim() + "," + cells.get(4).getText().trim());
//物理类型
//数据类型
cell = cells.get(2);
column.setColumnType(cell.getText().trim());
//是否必填
cell = cells.get(3);
column.setIsRequired(cell.getText().trim() == "是" ? 1 : 0);
//是否列表
column.setIsRequired("是".equals(cell.getText().trim()) ? 1 : 0);
//是否主键
cell = cells.get(4);
column.setIsPrimaryKey("是".equals(cell.getText().trim()) ? 1 : 0);
//是否自增
cell = cells.get(5);
column.setIsList(cell.getText().trim() == "是" ? 1 : 0);
//是否编辑
column.setIsIncrement("是".equals(cell.getText().trim()) ? 1 : 0);
//是否列表
cell = cells.get(6);
column.setIsEdit(cell.getText().trim() == "是" ? 1 : 0);
//是否查询
column.setIsList("是".equals(cell.getText().trim()) ? 1 : 0);
//是否导入导出
cell = cells.get(7);
column.setIsQuery(cell.getText().trim() == "是" ? 1 : 0);
column.setIsPrimaryKey(0);
column.setIsIncrement(0);
if (column.getColumnComment().trim().indexOf("自增长") > -1) {
column.setIsIncrement(1);
column.setIsExport("是".equals(cell.getText().trim()) ? 1 : 0);
//是否查询
cell = cells.get(8);
column.setIsQuery("是".equals(cell.getText().trim()) ? 1 : 0);
//默认值
cell = cells.get(9);
if(!ObjectUtils.isEmpty(cell.getText().trim())){
column.setDefaultValue(cell.getText().trim());
}else{
column.setDefaultValue("");
}
//备注信息
cell = cells.get(10);
column.setColumnComment(cell.getText().trim());
if (column.getColumnComment().trim().indexOf("主键") > -1) {
column.setIsPrimaryKey(1);
}
columns.add(column);
}
......
......@@ -9,4 +9,4 @@ gen:
# 自动去除表前缀,默认是false
autoRemovePre: true
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_,mortals_xhx_,mortals_iot_
\ No newline at end of file
tablePrefix: sys_,mortals_xhx_,mortals_iot_,mortals_stp_,mortals_sys_
\ No newline at end of file
......@@ -2,7 +2,15 @@ Version | Update Time | Status | Author | Description
---|---|---|---|---
v2021-11-05 16:10:28|2021-11-05 16:10:28|auto|@finegirl|Created by smart-doc
类型名称|类型描述|参考样例
---|---|---
String |字符串|A、a、ab
Integer|数字类型|1、12、-1
Long|长整型数字|1、12、-1
date|时间类型,单位纳秒数字|167988745573
BigDecimal|小数类型|545.256
object|对象类型|{"name":"zhang3"}
arrays|数组类型|[{"name":"zhang3"},{"name":"zhang2"}]
## 错误码列表
Error code |Description
......
This diff is collapsed.
## ${functionName}
### 查询${functionName}列表
**请求URL:** ${RequestMapping}/list
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询${functionName}
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
page|Integer|当前页|否|-
size|Integer|每页条数|否|-
<#list columns as column>
<#if column.isQuery == 1>
${column.javaField}|${column.javaType}|${column.columnComment}|否|-
</#if>
</#list>
**请求样例:**
```
{
<#list columns as column>
<#if column.isQuery == 1>
<#if column.javaType=="String" ||column.javaType=="Date">
<#assign fakeValue>"${column.randomStr(column.javaType)}"</#assign>
<#else>
<#assign fakeValue>${column.randomStr(column.javaType)}</#assign>
</#if>
"${column.javaField}":${fakeValue}<#sep>,</#sep>
</#if>
</#list>
"page":1,
"size":10
}
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
&emsp;per_page|Integer|每页条数|-
&emsp;total|Integer|总条数|-
&emsp;last_page|Integer|总页数|-
&emsp;current_page|Integer|当前页|-
&emsp;data|array|结果集列表|数组
<#list columns as column>
&emsp;&emsp;${column.javaField}|${column.javaType}|${column.columnComment}|-
</#list>
dict|object|字典对象|-
<#list columns as column>
<#if column.dict??&&(column.columnType?contains("tinyint") ||column.htmlType==3||column.htmlType==5)>
&emsp;${column.javaField}|object|字典属性对象,详见附录|-
</#if>
</#list>
**响应消息样例:**
```
{
"code":1,
"data":{
"per_page":10,
"total":0,
"data":[],
"last_page":0,
"current_page":1
},
"query":{
"modelCode":"phxt1",
"modelName":"排号系统"
}
}
```
### 编辑${functionName}
**请求URL:** ${RequestMapping}/edit
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 编辑${functionName},返回实例详细信息
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
${pkColumn.javaField}|${pkColumn.javaType}|主键,唯一|是|-
**请求样例:**
```
http://localhost/${RequestMapping}/edit?id=549
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
<#list columns as column>
&emsp;${column.javaField}|${column.javaType}|${column.columnComment}|-
</#list>
dict|object|字典对象|-
<#list columns as column>
<#if column.dict??&&(column.columnType?contains("tinyint") ||column.htmlType==3||column.htmlType==5)>
&emsp;${column.javaField}|object|字典属性对象,详见附录|-
</#if>
</#list>
**响应消息样例:**
```
{
"code": 1,
"data": {
<#list columns as column>
<#if column.javaType=="String" ||column.javaType=="Date">
<#assign fakeValue>"${column.randomStr(column.javaType)}"</#assign>
<#else>
<#assign fakeValue>${column.randomStr(column.javaType)}</#assign>
</#if>
"${column.javaField}":${fakeValue}<#sep>,</#sep>
</#list>
}
}
```
### 查看${functionName}
**请求URL:** ${RequestMapping}/info
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 查看${functionName},返回实例详细信息
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
${pkColumn.javaField}|${pkColumn.javaType}|主键,唯一|是|-
**请求样例:**
```
http://localhost/${RequestMapping}/info?id=549
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
<#list columns as column>
&emsp;${column.javaField}|${column.javaType}|${column.columnComment}|-
</#list>
dict|object|字典对象|-
<#list columns as column>
<#if column.dict??&&(column.columnType?contains("tinyint") ||column.htmlType==3||column.htmlType==5)>
&emsp;${column.javaField}|object|字典属性对象,详见附录|-
</#if>
</#list>
**响应消息样例:**
```
{
"code": 1,
"data": {
<#list columns as column>
<#if column.javaType=="String" ||column.javaType=="Date">
<#assign fakeValue>"${column.randomStr(column.javaType)}"</#assign>
<#else>
<#assign fakeValue>${column.randomStr(column.javaType)}</#assign>
</#if>
"${column.javaField}":${fakeValue}<#sep>,</#sep>
</#list>
}
}
```
### 保存更新${functionName}
**请求URL:** ${RequestMapping}/save
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 保存或更新${functionName}:id为空时为新增保存,否则为更新提交
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
${column.javaField}|${column.javaType}|${column.columnComment}|是|-
</#if>
</#list>
**请求样例:**
```
{
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
<#if column.javaType=="String" ||column.javaType=="Date">
<#assign fakeValue>"${column.randomStr(column.javaType)}"</#assign>
<#else>
<#assign fakeValue>${column.randomStr(column.javaType)}</#assign>
</#if>
"${column.javaField}":${fakeValue}<#sep>,</#sep>
</#if>
</#list>
}
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
&emsp;id|Long|保存后主键id|-
&emsp;entity|object|保存更新实体|对象
<#list columns as column>
&emsp;&emsp;${column.javaField}|${column.javaType}|${column.columnComment}|-
</#list>
**响应消息样例:**
```
{
"msg":"新增模块成功",
"code":1,
"data":{
"__mortals_form_state__":"ADD",
"id":4,
"entity":{
"createTime":1642486776780,
"id":4,
"modelCode":"phxt1",
"modelName":"排号系统4",
"updateTime":1642486776780
}
}
}
```
### 删除${functionName}
**请求URL:** ${RequestMapping}/delete
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 删除${functionName}
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|String|字符串,多个逗号分隔|是|-
**请求样例:**
```
http://localhost:8080/${RequestMapping}/delete?id=1'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
<#if table.isGenExport==1 >
### 导入${functionName}模板下载
**请求URL:** ${RequestMapping}/downloadTemplate
**请求方式:** POST
**内容类型:** application/x-www-form-urlencoded;charset=utf-8
**简要描述:** ${functionName}导入模板下载
**请求样例:**
```
http://localhost/${RequestMapping}/downloadTemplate
```
**Response-example:**
```
...
```
### 导入${functionName}
**请求URL:** ${RequestMapping}/importData
**请求方式:** POST
**内容类型:** multipart/form-data
**简要描述:** 导入${functionName}
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
file|file|文件流|是|-
updateSupport|boolean|相同数据项是否更新|false|-
**请求样例:**
```
http://localhost/${RequestMapping}/importData --data 'updateSupport=true'
```
**Response-example:**
```
...
```
</#if>
### 导出${functionName}
**请求URL:** ${RequestMapping}/exportExcel
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 导出${functionName}
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
idList|Arrays|id数组|否|需要导出的多项
<#list columns as column>
<#if column.isQuery == 1>
${column.javaField}|${column.javaType}|${column.columnComment}|否|参数查询条件
</#if>
</#list>
**请求样例:**
```
{
idList:[1,2],
<#list columns as column>
<#if column.isQuery == 1>
<#if column.javaType=="String" ||column.javaType=="Date">
<#assign fakeValue>"${column.randomStr(column.javaType)}"</#assign>
<#else>
<#assign fakeValue>${column.randomStr(column.javaType)}</#assign>
</#if>
"${column.javaField}":${fakeValue}<#sep>,</#sep>
</#if>
</#list>
}
```
**Response-example:**
```
...
```
This diff is collapsed.
<#list columns as column>
<#if column.dict??>
<#assign comment=column.subComment(column.columnComment) />
### ${column.javaField}
字典参数key|字典参数值|其它
---|---|---
<#list column.dict as dict>
${dict.num}|${dict.value}|-
</#list>
</#if>
</#list>
......@@ -13,7 +13,7 @@ import java.util.stream.Collectors;
* @author ${author}
* @date ${datetime}
*/
@Data
public class ${ClassName}TreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
......
......@@ -36,6 +36,7 @@ import com.alibaba.fastjson.annotation.JSONField;
</#list>
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.${Entity};
import ${packageName}.model.vo.${ClassName}Vo;
......@@ -58,16 +59,11 @@ public class ${ClassName}Entity extends ${ClassName}Vo {
* ${column.columnComment}
*/
<#if column.isExport==1>
<#assign comment=column.subComment(column.columnComment) />
<#assign parentheseIndex =column.columnComment?index_of("(")>
<#if parentheseIndex != -1>
<#assign comment =column.columnComment[0..parentheseIndex-1]>
<#else>
<#assign comment =column.columnComment>
</#if>
<#if parentheseIndex != -1>
@Excel(name = "${comment}", readConverterExp = "${column.readConverterExp()}")
<#elseif column.javaType == "Date">
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
<#else>
@Excel(name = "${comment}")
......@@ -84,7 +80,7 @@ public class ${ClassName}Entity extends ${ClassName}Vo {
/**
* ${table.subTable.functionName}信息
*/
private List<${subClassName}Entity> ${subclassName}List=new ArrayList<>();
private List<${subClassName}Entity> ${subclassName}List=new ArrayList<>();;
</#if>
<#if table.subTable?? && table.tplCategory=="subone" >
......@@ -170,16 +166,17 @@ public class ${ClassName}Entity extends ${ClassName}Vo {
public void initAttrValue(){
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
<#if column.javaType=="Long" && column.defaultValue??>
<#if column.javaType=="Long" && column.defaultValue??&& column.defaultValue!="">
<#assign Default>${column.defaultValue}L</#assign>
<#elseif column.javaType=="Integer" && column.defaultValue??>
<#elseif column.javaType=="Integer" && column.defaultValue?? && column.defaultValue!="">
<#assign Default>${column.defaultValue}</#assign>
<#elseif column.javaType=="String" && column.defaultValue??>
<#assign Default>"${column.defaultValue}"</#assign>
<#elseif column.javaType=="BigDecimal" && column.defaultValue??>
<#elseif column.javaType=="BigDecimal" && column.defaultValue??&& column.defaultValue!="">
<#assign Default>BigDecimal.valueOf(${column.defaultValue})</#assign>
<#elseif column.javaType=="Date" >
<#assign Default>new Date()</#assign>
<#assign Default>null</#assign>
<#else>
<#assign Default>null</#assign>
</#if>
......
......@@ -10,18 +10,22 @@ import java.util.Map;
*/
public enum ${EnumClassName?cap_first}Enum {
<#list enums as enum>
<#if JavaType="Integer">
${enum.value}(${enum.num}, "${enum.value}")<#sep>,
<#elseif JavaType="String">
${enum.value}("${enum.num}", "${enum.value}")<#sep>,
</#if>
</#list>
;
private int value;
private ${JavaType} value;
private String desc;
${EnumClassName?cap_first}Enum(int value, String desc) {
${EnumClassName?cap_first}Enum(${JavaType} value, String desc) {
this.value = value;
this.desc = desc;
}
public int getValue() {
public ${JavaType} getValue() {
return this.value;
}
......@@ -29,7 +33,7 @@ public enum ${EnumClassName?cap_first}Enum {
return this.desc;
}
public static ${EnumClassName?cap_first}Enum getByValue(int value) {
public static ${EnumClassName?cap_first}Enum getByValue(${JavaType} value) {
for (${EnumClassName?cap_first}Enum ${EnumClassName?uncap_first}Enum : ${EnumClassName?cap_first}Enum.values()) {
if (${EnumClassName?uncap_first}Enum.getValue() == value) {
return ${EnumClassName?uncap_first}Enum;
......@@ -44,12 +48,12 @@ public enum ${EnumClassName?cap_first}Enum {
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(int... eItem) {
public static Map<String, String> getEnumMap(${JavaType}... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (${EnumClassName?cap_first}Enum item : ${EnumClassName?cap_first}Enum.values()) {
try {
boolean hasE = false;
for (int e : eItem) {
for (${JavaType} e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
......
###${functionName}列表
POST {{baseUrl}}/${RequestMapping}/list
Content-Type: application/json
{
<#list columns as column>
<#if column.isQuery == 1>
<#if column.javaType=="String" ||column.javaType=="Date">
<#assign fakeValue>"${column.randomStr(column)}"</#assign>
<#else>
<#assign fakeValue>${column.randomStr(column)}</#assign>
</#if>
"${column.javaField}":${fakeValue}<#sep>,</#sep>
</#if>
</#list>
"page":1,
"size":10
}
###${functionName}更新与保存
POST {{baseUrl}}/${RequestMapping}/save
Content-Type: application/json
{
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
<#if column.javaType=="String" ||column.javaType=="Date">
<#assign fakeValue>"${column.randomStr(column)}"</#assign>
<#else>
<#assign fakeValue>${column.randomStr(column)}</#assign>
</#if>
"${column.javaField}":${fakeValue}<#sep>,</#sep>
</#if>
</#list>
}
> {%
client.global.set("${ClassName}_id", JSON.parse(response.body).data.id);
%}
###${functionName}查看
GET {{baseUrl}}/${RequestMapping}/info?id={{${ClassName}_id}}
Accept: application/json
###${functionName}编辑
GET {{baseUrl}}/${RequestMapping}/edit?id={{${ClassName}_id}}
Accept: application/json
###${functionName}删除
GET {{baseUrl}}/${RequestMapping}/delete?id={{${ClassName}_id}}
Accept: application/json
......@@ -14,7 +14,6 @@ import ${packageName}.model.${ClassName}TreeSelect;
import java.util.List;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
/**
* ${ClassName}Service
*
......@@ -51,4 +50,11 @@ public interface ${ClassName}Service extends ${Service}<${ClassName}Entity,${pkC
*/
List<${ClassName}TreeSelect> build${ClassName}TreeSelect(List<${ClassName}Entity> ${ClassName?uncap_first}List);
/**
* 根据父id查询子节点
* @param parentId
* @param context
* @return
*/
List<${ClassName}TreeSelect> getListByParentId(String parentId,Context context);
}
\ No newline at end of file
......@@ -10,7 +10,6 @@ package ${packageName}.service;
</#if>
import com.mortals.framework.service.${Service};
import ${packageName}.model.${ClassName}Entity;
/**
* ${ClassName}Service
*
......
......@@ -24,7 +24,6 @@ import java.util.stream.Collectors;
<#if pkColumn??&&pkColumn.isIncrement==0 >
import cn.hutool.core.util.IdUtil;
</#if>
<#if pkColumn??&&pkColumn.isIncrement==0 >
<#assign Temp>
@Override
......@@ -43,8 +42,6 @@ import cn.hutool.core.util.IdUtil;
<#else>
<#assign Temp ></#assign>
</#if>
/**
* ${ClassName}Service
* ${functionName} service实现
......@@ -201,4 +198,19 @@ public class ${ClassName}ServiceImpl extends ${Service}<${ClassName}Dao, ${Class
}).filter(f->f!=null).collect(Collectors.toList());
}
@Override
public List<${ClassName}TreeSelect> getListByParentId(String parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) {
parentId = "0";
}
//只做一层
List<${ClassName}TreeSelect> collect = this.find(new ${ClassName}Query().${treeParentCode?cap_first}(parentId), context).stream().map(item -> new ${ClassName}TreeSelect(item)
).collect(Collectors.toList());
if ("0".equals(parentId)) {
return collect;
}
return collect;
}
}
\ No newline at end of file
......@@ -26,7 +26,6 @@ import java.util.Date;
<#if pkColumn??&&pkColumn.isIncrement==0 >
import cn.hutool.core.util.IdUtil;
</#if>
<#if pkColumn??&&pkColumn.isIncrement==0 >
<#assign Temp>
@Override
......@@ -45,8 +44,6 @@ import cn.hutool.core.util.IdUtil;
<#else>
<#assign Temp ></#assign>
</#if>
/**
* ${ClassName}Service
* ${functionName} service实现
......@@ -114,8 +111,8 @@ public class ${ClassName}ServiceImpl extends ${Service}<${ClassName}Dao, ${Class
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
for (int i = 0; i < ids.length; i++) {
${pkColumn.javaType}[] ${subclassName}Ids = ${subclassName}Service.find(new ${subClassName}Query().${subTableFkClassName}(ids[i]), context).stream().map(${subClassName}Entity::get${pkColumn.javaField?cap_first}).toArray(${pkColumn.javaType}[]::new);
${subclassName}Service.remove(${subclassName}Ids, context);
${pkColumn.javaType}[] ${subclassName}Ids = ${subclassName}Service.find(new ${subClassName}Query().${subTableFkClassName?cap_first}(ids[i]), context).stream().map(${subClassName}Entity::get${pkColumn.javaField?cap_first}).toArray(${pkColumn.javaType}[]::new);
${subclassName}Service.remove(${subclassName}Ids, context);
}
super.removeAfter(ids, context, result);
}
......@@ -126,19 +123,22 @@ public class ${ClassName}ServiceImpl extends ${Service}<${ClassName}Dao, ${Class
@Override
protected void saveAfter(${ClassName}Entity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.get${subClassName}Entity())){
${subClassName}Entity ${subclassName}Entity = new ${subClassName}Entity();
${subclassName}Entity.initAttrValue();
${subClassName}Entity subEntity=entity.get${subClassName}Entity();
BeanUtils.copyProperties(subEntity,${subclassName}Entity);
<#if subPkColumn??&&subPkColumn.isIncrement==0&&subPkColumn.javaType=="String" >
subEntity.set${subPkColumn.javaField?cap_first}(IdUtil.fastSimpleUUID());
${subclassName}Entity.set${subPkColumn.javaField?cap_first}(IdUtil.fastSimpleUUID());
<#elseif subPkColumn??&&subPkColumn.isIncrement==0&&subPkColumn.javaType=="Integer">
subEntity.set${subPkColumn.javaField?cap_first}(((Long)IdUtil.getSnowflake(1024,512).nextId()).intValue());
${subclassName}Entity.set${subPkColumn.javaField?cap_first}(((Long)IdUtil.getSnowflake(1024,512).nextId()).intValue());
<#elseif subPkColumn??&&subPkColumn.isIncrement==0&&subPkColumn.javaType=="Long">
subEntity.set${subPkColumn.javaField?cap_first}(IdUtil.getSnowflake(1024,512).nextId());
${subclassName}Entity.set${subPkColumn.javaField?cap_first}(IdUtil.getSnowflake(1024,512).nextId());
</#if>
subEntity.set${subTableFkClassName}(entity.get${pkColumn.javaField?cap_first}());
subEntity.setCreateUser(context.getUser().getLoginName());
subEntity.setCreateUserId(context.getUser().getId());
subEntity.setCreateTime(new Date());
${subclassName}Service.save(subEntity,context);
${subclassName}Entity.set${subTableFkClassName}(entity.get${pkColumn.javaField?cap_first}());
${subclassName}Entity.setCreateUser(context.getUser().getLoginName());
${subclassName}Entity.setCreateUserId(context.getUser().getId());
${subclassName}Entity.setCreateTime(new Date());
${subclassName}Service.save(${subclassName}Entity,context);
}
super.saveAfter(entity, context);
}
......
......@@ -25,7 +25,7 @@ package ${packageName}.model.vo;
<#assign Entity = "BaseEntityLong">
</#if>
import com.mortals.framework.model.${Entity};
import com.mortals.xhx.module.demotree.model.DemotreeEntity;
import ${packageName}.model.${ClassName}Entity;
import lombok.Data;
import java.util.ArrayList;
......
-- ----------------------------
-- ${functionName}菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '${tableComment}', '/${RequestMapping}/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 3, NULL, NULL, NULL);
INSERT INTO `mortals_xhx_menu` VALUES (null, '${tableComment}', '/${RequestMapping}/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- ${functionName}资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '${functionName}-菜单管理-查看', '/${RequestMapping}/list,/${RequestMapping}/view', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '${functionName}-菜单管理-维护', '/${RequestMapping}/add,/${RequestMapping}/edit,/${RequestMapping}/delete,/${RequestMapping}/save', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- ${functionName}参数 SQL
-- ----------------------------
<#list columns as column>
<#if column.dict??&&(column.columnType?contains("tinyint") ||column.htmlType==3||column.htmlType==5)>
<#list column.dict as dict>
INSERT INTO `mortals_xhx_param` VALUES (null, '${column.subComment(column.columnComment)}', '${column.javaField}', NULL, '${dict.num}', '${dict.value}', 1, 4, 0, NULL, NULL, NULL, NULL);
</#list>
</#if>
</#list>
\ No newline at end of file
INSERT INTO `mortals_xhx_resource` VALUES (null, '${functionName}-菜单管理-查看', '/${RequestMapping}/list,/${RequestMapping}/view,/${RequestMapping}/info,/${RequestMapping}/export,/${RequestMapping}/exportExcel,/${RequestMapping}/downloadTemplate,/${RequestMapping}/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '${functionName}-菜单管理-维护', '/${RequestMapping}/add,/${RequestMapping}/edit,/${RequestMapping}/delete,/${RequestMapping}/logicDelete,/${RequestMapping}/save,/${RequestMapping}/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- ${functionName}参数 SQL
-- ----------------------------
<#list columns as column>
<#if column.dict??>
<#list column.dict as dict>
INSERT INTO `mortals_xhx_param` VALUES (null, '${column.subComment(column.columnComment)}', '${ClassName}', '${column.javaField}', '${dict.num}', '${dict.value}', 1, 4, 0, '${column.javaField}', NULL, NULL, NULL);
</#list>
</#if>
</#list>
\ No newline at end of file
<template>
<!-- 弹出框表单 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24" v-if="form.${treeParentCode} !== 0">
<el-form-item label="上级点" prop="${treeParentCode}">
<el-form-item label="上级点" prop="${treeParentCode}">
<treeselect
v-model="form.${treeParentCode}"
:options="${className}Options"
......@@ -13,12 +13,10 @@
/>
</el-form-item>
</el-col>
<#list columns as column>
<#if column.isPrimaryKey != 1 && !column.isSuperColumn(column.javaField)>
<#if column.isPrimaryKey != 1 && !column.isSuperColumn(column.javaField)&& column.isEdit==1>
<#assign javaField=column.javaField />
<#assign comment=column.subComment(column.columnComment) />
<#if column.htmlType == 1 && !column.columnType?contains("tinyint")>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${column.javaField}" placeholder="请输入${comment}"/>
<#elseif column.htmlType == 2>
......@@ -65,7 +63,7 @@
</template>
<script>
import form from "@/assets/mixins/form";
import form from "@/assets/mixins/formdialog";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
<#list columns as column>
......@@ -128,24 +126,27 @@
// 表单校验
rules: {
<#list columns as column>
<#if column.javaType == "String" && column.isEdit==1>
<#assign comment=column.subComment(column.columnComment) />
<#if column.javaType == "String" && column.isRequired==1>
${column.javaField}: [
{<#if column.isRequired==1>required: true,</#if> trigger: "blur" },
{<#if column.isRequired==1>required: true,message: "请输入${comment}",</#if> trigger: "blur" },
<#assign max=column.subBetween(column.columnType) />
{max: ${max},message: "最多只能录入${max}个字符",trigger: "blur",},
],
</#if>
<#if column.javaType == "Integer" && column.isEdit==1>
<#if column.javaType == "Integer" && column.isRequired==1>
${column.javaField}: [
{<#if column.isRequired==1>required: true,</#if> type: 'integer',trigger: "blur" },
{<#if column.isRequired==1>required: true,message: "请输入${comment}",</#if> trigger: "blur" },
],
</#if>
<#if column.javaType == "BigDecimal" && column.isEdit==1>
<#if column.javaType == "BigDecimal" && column.isRequired==1>
${column.javaField}: [
{<#if column.isRequired==1>required: true,</#if> type: 'number',trigger: "blur" },
{<#if column.isRequired==1>required: true,message: "请输入${comment}",</#if>trigger: "blur" },
],
</#if>
<#if column.javaType == "Date" &&column.htmlType ==6 && column.isEdit==1>
<#if column.javaType == "Date" &&column.htmlType ==6 && column.isRequired==1>
${column.javaField}: [
{<#if column.isRequired==1>required: true,</#if> },
{<#if column.isRequired==1>required: true,message: "请选择${comment}"</#if> },
],
</#if>
</#list>
......@@ -161,7 +162,6 @@
this.urls.currUrl =this.pageInfo.editUrl;;
this.getData();
this.${className}Options = ${className}Options;
this.open = true;
this.title = "修改${functionName}";
},
/** 新增 */
......@@ -170,25 +170,28 @@
this.query = { ${pkColumn.javaField}: row.${pkColumn.javaField} };
this.urls.currUrl = this.pageInfo.addUrl;
this.getData();
if(row.id){
this.form.parentId=row.id
}
this.${className}Options = ${className}Options;
this.open = true;
this.title = "新增${functionName}";
},
/** 查看*/
view(row, ${className}Options) {
this.reset()
this.query = { ${pkColumn.javaField}: row.${pkColumn.javaField} };
this.urls.currUrl =this.pageInfo.viewUrl;;
this.getData();
this.${className}Options = ${className}Options;
this.open = true;
this.title = "${functionName}详细";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
......@@ -210,13 +213,13 @@
this.form = {
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
<#if column.javaType=="Long" && column.defaultValue??>
<#assign Default>${column.defaultValue}L</#assign>
<#elseif column.javaType=="Integer" && column.defaultValue??>
<#if column.javaType=="Long" && column.defaultValue??&& column.defaultValue!="">
<#assign Default>${column.defaultValue}</#assign>
<#elseif column.javaType=="Integer" && column.defaultValue??&& column.defaultValue!="">
<#assign Default>${column.defaultValue}</#assign>
<#elseif column.javaType=="String" && column.defaultValue??>
<#assign Default>"${column.defaultValue}"</#assign>
<#elseif column.javaType=="BigDecimal" && column.defaultValue??>
<#elseif column.javaType=="BigDecimal" && column.defaultValue??&& column.defaultValue!="">
<#assign Default>BigDecimal.valueOf(${column.defaultValue})</#assign>
<#else>
<#assign Default>null</#assign>
......
......@@ -143,30 +143,11 @@
</el-table-column>
);
},
<#elseif table.tplCategory=="subone">
renderTable(obj) {
let tableData = [];
tableData.push(obj);
return (
<el-table stripe data={tableData} class="total-table">
{this.columnSet.map((item) => this.renderTableColumn(item))}
</el-table>
);
},
renderTableColumn(options) {
return (
<el-table-column
prop={options.prop}
label={options.label}
width={options.width}
></el-table-column>
);
},
</#if>
/** 重写新增方法 */
toAdd(row) {
this.$refs.dialogform.add(row, this.${className}Options);
this.$refs.dialogform.add(row);
},
/** 重写编辑方法 */
toEdit(row) {
......@@ -174,9 +155,9 @@
},
/** 重写查看方法 */
toView(row) {
this.$refs.dialogform.view(row);
},
// toView(row) {
// this.$refs.dialogform.view(row);
// },
},
data() {
......@@ -197,7 +178,7 @@
},
isExport: false,
</#if>
<#if table.tplCategory=="sub" ||table.tplCategory=="subone">
<#if table.tplCategory=="sub">
/** 子表列元素 */
columnSet:[
<#list subColumns as column>
......@@ -229,7 +210,7 @@
},
<#elseif column.isQuery == 1 &&column.htmlType==4>
{
name: "${column.javaField}",
name: "${column.javaField}List",
type: "checkbox",
label: "${comment}",
fuzzy: true
......@@ -248,13 +229,17 @@
{type: "selection", width: 60},
<#list columns as column>
<#assign comment=column.subComment(column.columnComment) />
<#if column.columnName != pkColumn.columnName && !column.isSuperColumn(column.javaField)>
<#if column.columnName != pkColumn.columnName && !column.isSuperColumn(column.javaField)&& column.isList==1>
<#if column.javaType == "Long">
{label: "${comment}", prop: "${column.javaField}", formatter: this.formatterString},
</#if>
<#if column.javaType == "String"||column.javaType == "Integer">
<#if column.javaType == "String">
{label: "${comment}", prop: "${column.javaField}"},
</#if>
<#if column.javaType == "Integer">
{label: "${comment}", prop: "${column.javaField}",formatter: this.formatter},
</#if>
<#if column.javaType == "Date">
{label: "${comment}", prop: "${column.javaField}", formatter: this.formatterDate},
</#if>
......@@ -280,20 +265,18 @@
},
},
<#elseif table.tplCategory=="subone">
{label: "${subFunctionName}",
width: 120,
prop: "subColumns",
formatter: (row) => {
let widthsize = this.columnSet.reduce((pre, cur) => {
return pre + Number(cur.width);
}, 50);
return (
<el-popover placement="right" width={widthsize} trigger="click">
{this.renderTable(row.${subclassName}Entity)}
<el-button type="text" slot="reference">详细</el-button>
</el-popover>
);
},
{
prop: "${subclassName}Entity",
label: "${subFunctionName}",
align: "center",
subColumns: [
<#list subColumns as column>
<#if column.columnName != subPkColumn.columnName && !column.isSuperColumn(column.javaField)>
<#assign comment=column.subComment(column.columnComment) />
{prop:"${column.javaField}",label:"${comment}",width:100}<#sep>,
</#if>
</#list>
],
},
</#if>
{
......
......@@ -19,7 +19,6 @@
:disabled="isExport"
>导出</el-button>
</#if>
</LayoutTable>
<#if table.isGenExport==1 >
<!-- ${functionName}导入对话框 -->
......@@ -68,11 +67,11 @@
</template>
<script>
import dialogShow from "./dialogshow";
import { handleTree } from "@/assets/utils/table";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import table from "@/assets/mixins/table";
import dialogShow from "./dialogshow";
export default {
name: "${ClassName}",
mixins: [table],
......@@ -133,6 +132,14 @@
this.$refs.layoutTable.showType="treetable"
},
handleAdd(row) {
if (row.fileType == 2) {
this.$message.info("文件节点不允许添加子节点!");
return;
}
this.$refs.dialogform.add(row, this.${className}fileOptions);
},
/** 重写新增方法 */
toAdd(row) {
this.$refs.dialogform.add(row, this.${className}Options);
......@@ -159,8 +166,6 @@
},
data() {
return {
/** 树表是否默认展开 */
expand:true,
<#if table.isGenExport==1 >
// 用户导入参数
upload: {
......@@ -177,8 +182,10 @@
},
isExport: false,
</#if>
config: {
/** 树表是否默认展开 */
expand:true,
showType: "treetable",
search: [
<#list columns as column>
<#if column.isQuery == 1 &&column.htmlType==1>
......@@ -214,18 +221,19 @@
],
columns: [
<#list columns as column>
<#if column.columnName != pkColumn.columnName && !column.isSuperColumn(column.javaField)>
<#if column.columnName != pkColumn.columnName && !column.isSuperColumn(column.javaField)&& column.isList==1>
<#assign comment=column.subComment(column.columnComment) />
<#if column.javaType == "Long">
{label: "${column.columnComment}", prop: "${column.javaField}", formatter: this.formatterString},
{label: "${comment}", prop: "${column.javaField}", formatter: this.formatterString},
</#if>
<#if column.javaType == "String"||column.javaType == "Integer">
{label: "${column.columnComment}", prop: "${column.javaField}"},
{label: "${comment}", prop: "${column.javaField}"},
</#if>
<#if column.javaType == "Date">
{label: "${column.columnComment}", prop: "${column.javaField}", formatter: this.formatterDate},
{label: "${comment}", prop: "${column.javaField}", formatter: this.formatterDate},
</#if>
<#if column.javaType == "BigDecimal">
{label: "${column.columnComment}", prop: "${column.javaField}", formatter: this.formatterMoney},
{label: "${comment}", prop: "${column.javaField}", formatter: this.formatterMoney},
</#if>
</#if>
</#list>
......@@ -235,8 +243,27 @@
width: 280,
formatter: row => {
return (
<table-buttons row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
);
<div>
<el-button
size="mini"
type="text"
icon="el-icon-edit-outline"
onClick={() => {
this.handleAdd(row);
}}
>
新增
</el-button>
<table-buttons
noAdd
noView
row={row}
onEdit={this.toEdit}
onView={this.toView}
onDel={this.toDel}
/>
</div>
);
}
}
]
......
<template>
<layout-view>
<el-descriptions :title="title" :column="column" :size="size" :colon="false" border>
<template slot="title">
<i class="el-icon-tickets"></i>
基本详细信息
</template>
<template slot="extra">
<el-button type="primary" @click="$router.go(-1)" size="small">返回</el-button>
</template>
<#list columns as column>
<#if column.isPrimaryKey != 1 && !column.isSuperColumn(column.javaField)&& column.isEdit==1>
<#assign javaField=column.javaField />
<#assign comment=column.subComment(column.columnComment) />
<#if column.htmlType == 1 ||column.htmlType == 2&& !column.columnType?contains("tinyint")>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{form.${column.javaField}}}
</el-descriptions-item>
<#elseif column.htmlType == 3||column.htmlType == 4||column.htmlType == 5>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("${column.javaField}", form.${column.javaField}) }}
</el-descriptions-item>
<#elseif column.htmlType == 6>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatterDate(form.${column.javaField})}}
</el-descriptions-item>
<#elseif column.htmlType == 7>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
<imageUpload v-model="form.${column.javaField}" prePath="/file/preview"/>
</el-descriptions-item>
<#elseif column.htmlType == 8>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
<fileUpload v-model="form.${column.javaField}" prePath="/file/uploadfile"/>
</el-descriptions-item>
<#elseif column.htmlType == 9>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
<editor v-model="form.${column.javaField}" :min-height="256"/>
</el-descriptions-item>
<#else >
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{form.${column.javaField}}}
</el-descriptions-item>
</#if>
</#if>
</#list>
</el-descriptions>
<#if table.tplCategory=="subone">
<el-descriptions :title="title" :column="column" :size="size" :colon="false" border>
<template slot="title">
<i class="el-icon-tickets"></i>
扩展信息
</template>
<#list subTable.columns as column >
<#if column.isPrimaryKey != 1 && !column.isSuperColumn(column.javaField)&& column.isEdit==1>
<#assign javaField=column.javaField />
<#assign comment=column.subComment(column.columnComment) />
<#if column.htmlType == 1 ||column.htmlType == 2&& !column.columnType?contains("tinyint")>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{form.${column.javaField}}}
</el-descriptions-item>
<#elseif column.htmlType == 3||column.htmlType == 4||column.htmlType == 5>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("${column.javaField}", form.${subclassName}Entity.${column.javaField}) }}
</el-descriptions-item>
<#elseif column.htmlType == 6>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatterDate(form.${subclassName}Entity.${column.javaField})}}
</el-descriptions-item>
<#elseif column.htmlType == 7>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
<imageUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/preview"/>
</el-descriptions-item>
<#elseif column.htmlType == 8>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
<fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/uploadfile"/>
</el-descriptions-item>
<#elseif column.htmlType == 9>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
<editor v-model="form.${subclassName}Entity.${column.javaField}" :min-height="256"/>
</el-descriptions-item>
<#else >
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
{{form.${subclassName}Entity.${column.javaField}}}
</el-descriptions-item>
</#if>
</#if>
</#list>
</el-descriptions>
</#if>
</layout-view>
</template>
<script>
import view from "@/assets/mixins/view";
<#list columns as column>
<#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 7>
import ImageUpload from '@/components/ImageUpload';
<#break>
</#if>
</#list>
<#list columns as column>
<#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 8>
import FileUpload from '@/components/FileUpload';
<#break>
</#if>
</#list>
<#list columns as column>
<#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 9>
import Editor from '@/components/Editor';
<#break>
</#if>
</#list>
export default {
mixins: [view],
components: {
<#list columns as column>
<#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 7>
ImageUpload,
<#break>
</#if>
</#list>
<#list columns as column>
<#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 8>
FileUpload,
<#break>
</#if>
</#list>
<#list columns as column>
<#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 9>
Editor,
<#break>
</#if>
</#list>
},
methods: {
},
data() {
return {
size:"small",
column:2,
toString:[
<#list columns as column>
<#if column.columnType?contains("tinyint")>
"${column.javaField}",
</#if>
</#list>
],
toArrays: [
],
toDate: [
]
}
}
}
</script>
<style lang="less">
.labelClass{
width: 200px;
}
.el-descriptions__body{
margin-left: 5px;
margin-right: 5px;
color: #606266;
background-color: #FFF;
}
.contentClass{
width: 600px;
}
</style>
\ No newline at end of file
......@@ -237,12 +237,8 @@
<#if table.tplCategory=="tree" >
<!-- 获取子节点 -->
<select id="selectChildrenSiteById" parameterType="String" resultMap="${ClassName}Entity-Map">
select <include refid="_columns"/>
from ${TempTable} as a
<trim suffixOverrides="where" suffix="">
where find_in_set(<#noparse>#</#noparse>${ClassName?uncap_first}Id, ancestors)
</trim>
<select id="selectChildren${ClassName}ById" parameterType="String" resultMap="${ClassName}Entity-Map">
select * from ${TempTable} as a where find_in_set(<#noparse>#</#noparse>{${ClassName?uncap_first}Id}, ancestors)
</select>
</#if>
......
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