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"
......@@ -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")
......@@ -225,11 +259,10 @@ export default {
mixins: [table],
created() {
const appId = this.$route.query["query.appId"];
console.log("appId",appId)
this.appId=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,6 +365,24 @@ 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;
......@@ -340,8 +392,9 @@ export default {
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) {
......@@ -460,11 +501,13 @@ export default {
data() {
return {
breadcrumbList: [
{name: '工程构建',},
{name: '应用信息',path:'/app/list'},
{name: '生成列表',},
{ 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,6 +87,12 @@
<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>
......
......@@ -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 String test(){
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() {
return "aaa";
}
......@@ -44,6 +102,9 @@ public class GentableColumnEntityExt extends BaseEntityLong {
System.out.println(JSON.toJSONString(gentableColumnEntity));
// System.out.println(gentableColumnEntity.test());
System.out.println(DateUtils.getCurrDatetime().getTime());
}
}
\ No newline at end of file
......@@ -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);
/**
* 同步数据库
......
......@@ -9,7 +9,9 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.EntityUtil;
import com.mortals.framework.util.FileUtil;
import com.mortals.xhx.base.system.gentable.dao.GentableDao;
import com.mortals.xhx.base.system.gentable.model.*;
import com.mortals.xhx.base.system.gentable.service.GentableColumnService;
......@@ -32,6 +34,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.StringWriter;
import java.util.*;
import java.util.regex.Pattern;
......@@ -52,6 +55,20 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
@Autowired
private GentableColumnService gentableColumnService;
String headStr="版本 | 创建时间 | 作者 | 备注信息\n" +
"---|---|---|---\n" +
"v1.0|"+ DateUtils.getCurrStrDate()+"|zxfei| 接口文档\n\n" +
"## 数据类型\n" +
"类型名称|类型描述|参考样例\n" +
"---|---|---\n" +
"String |字符串|A、a、ab\n" +
"Integer|数字类型|1、12、-1\n" +
"Long|长整型数字|1、12、-1\n" +
"date|时间类型,单位纳秒数字|167988745573\n" +
"BigDecimal|小数类型|545.256\n" +
"object|对象类型|{\"name\":\"zhang3\"}\n" +
"arrays|数组类型|[{\"name\":\"zhang3\"},{\"name\":\"zhang2\"}]\n";
@Override
public List<GentableEntity> selectDbTableList(GentableQuery query) {
//query to dao
......@@ -145,6 +162,17 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
if (temp.equals("enum.java.ftl")) {
continue;
}
if (temp.equals("api.md.ftl")) {
continue;
}
if (temp.equals("api-two.md.ftl")) {
continue;
}
if (temp.equals("apidict.md.ftl")) {
continue;
}
try {
//初始化freeMarkers
FreeMarkerUtils.initFreeMarker(genFreePath(temp));
......@@ -173,12 +201,19 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
@SneakyThrows
@Override
public byte[] downloadCode(Long tableId) {
public byte[] downloadCode(Long tableId, String genTypes) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
FreeMarkerUtils.menuSql = new StringBuilder();
FreeMarkerUtils.paramsSql = new StringBuilder();
FreeMarkerUtils.dbSql = new StringBuilder();
generatorCode(tableId, zip);
FreeMarkerUtils.apimd = new StringBuilder();
FreeMarkerUtils.apitwomd = new StringBuilder();
FreeMarkerUtils.apidict = new StringBuilder();
FreeMarkerUtils.apidict.append("## 字典附录\n");
FreeMarkerUtils.apimd.append(headStr);
FreeMarkerUtils.apitwomd.append(headStr);
generatorCode(tableId, genTypes, zip);
if (StringUtils.isNotEmpty(FreeMarkerUtils.menuSql)) {
zip.putNextEntry(new ZipEntry("db/menu.sql"));
IOUtils.write(FreeMarkerUtils.menuSql.toString(), zip, Constant.UTF8);
......@@ -187,19 +222,45 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
zip.putNextEntry(new ZipEntry("db/db.sql"));
IOUtils.write(FreeMarkerUtils.dbSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.paramsSql)) {
zip.putNextEntry(new ZipEntry("db/params.sql"));
IOUtils.write(FreeMarkerUtils.paramsSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apimd)) {
zip.putNextEntry(new ZipEntry("doc/api.md"));
IOUtils.write(FreeMarkerUtils.apimd.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apitwomd)) {
zip.putNextEntry(new ZipEntry("doc/api-two.md"));
IOUtils.write(FreeMarkerUtils.apitwomd.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apidict)) {
zip.putNextEntry(new ZipEntry("doc/dict.md"));
IOUtils.write(FreeMarkerUtils.apidict.toString(), zip, Constant.UTF8);
}
IOUtils.closeQuietly(zip);
return outputStream.toByteArray();
}
@SneakyThrows
@Override
public byte[] downloadCode(Long[] tableIds) {
public byte[] downloadCode(Long[] tableIds, String genTypes) {
FreeMarkerUtils.menuSql = new StringBuilder();
FreeMarkerUtils.dbSql = new StringBuilder();
FreeMarkerUtils.paramsSql = new StringBuilder();
FreeMarkerUtils.apimd = new StringBuilder();
FreeMarkerUtils.apitwomd = new StringBuilder();
FreeMarkerUtils.apidict = new StringBuilder();
FreeMarkerUtils.apidict.append("## 字典附录\n");
FreeMarkerUtils.apimd.append(headStr);
FreeMarkerUtils.apitwomd.append(headStr);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
for (Long tableId : tableIds) {
generatorCode(tableId, zip);
generatorCode(tableId, genTypes, zip);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.menuSql)) {
zip.putNextEntry(new ZipEntry("db/menu.sql"));
......@@ -209,7 +270,30 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
zip.putNextEntry(new ZipEntry("db/db.sql"));
IOUtils.write(FreeMarkerUtils.dbSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.paramsSql)) {
zip.putNextEntry(new ZipEntry("db/params.sql"));
IOUtils.write(FreeMarkerUtils.paramsSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apimd)) {
FreeMarkerUtils.apimd.append(FreeMarkerUtils.apidict);
zip.putNextEntry(new ZipEntry("doc/api.md"));
IOUtils.write(FreeMarkerUtils.apimd.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apitwomd)) {
FreeMarkerUtils.apitwomd.append(FreeMarkerUtils.apidict);
zip.putNextEntry(new ZipEntry("doc/api-two.md"));
IOUtils.write(FreeMarkerUtils.apitwomd.toString(), zip, Constant.UTF8);
}
// if (StringUtils.isNotEmpty(FreeMarkerUtils.apidict)) {
// zip.putNextEntry(new ZipEntry("doc/dict.md"));
// IOUtils.write(FreeMarkerUtils.apidict.toString(), zip, Constant.UTF8);
// }
//
IOUtils.closeQuietly(zip);
return outputStream.toByteArray();
}
......@@ -243,6 +327,44 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
}
public void synchDb(Long tableId,List<GentableColumnEntity> dbTableColumns) {
GentableEntity table = this.get(tableId);
List<GentableColumnEntity> tableColumns = gentableColumnService.find(new GentableColumnQuery().tableId(table.getId()));
table.setColumns(tableColumns);
List<String> tableColumnNames = tableColumns.stream().map(GentableColumnEntity::getColumnName).collect(Collectors.toList());
List<String> dbTableColumnNames = dbTableColumns.stream().map(GentableColumnEntity::getColumnName).collect(Collectors.toList());
dbTableColumns.forEach(column -> {
//新增列
if (!tableColumnNames.contains(column.getColumnName())) {
GenUtils.initColumnField(column, table);
gentableColumnService.save(column);
}else{
//todo 更新列
GentableColumnEntity columnEntity = tableColumns.stream().filter(f -> f.getColumnName().equals(column.getColumnName())).findFirst().orElseGet(() -> null);
if(!ObjectUtils.isEmpty(columnEntity)){
columnEntity.setColumnComment(column.getColumnComment());
columnEntity.setDefaultValue(column.getDefaultValue());
columnEntity.setColumnType(column.getColumnType());
gentableColumnService.update(columnEntity);
}
}
});
//删除多于列
List<GentableColumnEntity> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
if (StringUtils.isNotEmpty(delColumns)) {
Long[] ids = delColumns.stream().map(GentableColumnEntity::getId).toArray(Long[]::new);
gentableColumnService.remove(ids, null);
}
}
@Override
public void importDoc(MultipartFile file, Long appId, Context context) {
......@@ -253,6 +375,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
GenUtils.initTable(table, operName);
table.setAppId(appId);
table.setGenType(0);
table.setIsGenExport(0);
table.setIsShowControl(0);
table.setGenPath("/");
table.setTplCategory("crud");
table.setCacheServiceType(CacheServiceTypeEnum.NORMAL_SERVICE.getValue());
......@@ -260,17 +384,16 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
//查询如果存在相同表名,先删除后再添加
GentableEntity gentableEntity = this.selectOne(new GentableQuery().tableName(table.getTableName()).appId(appId));
if (!ObjectUtils.isEmpty(gentableEntity)) {
//删除表
this.remove(gentableEntity.getId(), context);
//删除列
List<GentableColumnEntity> gentableColumnEntities = gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId()));
if (ObjectUtils.isEmpty(gentableColumnEntities)) {
gentableEntity.setColumns(gentableColumnEntities);
gentableColumnService.remove(gentableEntity.getColumns().stream().map(item -> item.getId()).toArray(Long[]::new), context);
}
}
synchDb(gentableEntity.getId(),table.getColumns());
// //删除表
// this.remove(gentableEntity.getId(), context);
// //删除列
// List<GentableColumnEntity> gentableColumnEntities = gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId()));
// if (ObjectUtils.isEmpty(gentableColumnEntities)) {
// gentableEntity.setColumns(gentableColumnEntities);
// gentableColumnService.remove(gentableEntity.getColumns().stream().map(item -> item.getId()).toArray(Long[]::new), context);
// }
} else {
//保存表
this.save(table);
......@@ -280,13 +403,17 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
//校验是否有主键列,如果没有,默认第一列为主键
GentableColumnEntity columnEntity = genTableColumns.stream().filter(f -> f.getIsPrimaryKey() != null).filter(f -> f.getIsPrimaryKey() == 1).findFirst().orElseGet(() -> null);
if (ObjectUtils.isEmpty(columnEntity)) {
if (genTableColumns.size() > 0) {
genTableColumns.get(0).setIsPrimaryKey(YesNo.YES.getValue());
}
}
for (GentableColumnEntity column : genTableColumns) {
GenUtils.initColumnField(column, table);
gentableColumnService.save(column);
}
}
}
} catch (Exception e) {
log.error("异常:" , e);
......@@ -326,8 +453,9 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
/**
* 查询表信息并生成代码
*/
private void generatorCode(Long tableId, ZipOutputStream zip) {
private void generatorCode(Long tableId, String genTypes, ZipOutputStream zip) {
GentableEntity gentableEntity = this.get(tableId);
Set<String> types = StrUtil.splitTrim(genTypes, ",".charAt(0), -1).stream().collect(Collectors.toSet());
if (!ObjectUtils.isEmpty(gentableEntity)) {
List<GentableColumnEntity> columnEntities = this.gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId())).stream().map(column -> {
String temp1 = StringUtils.substringBetween(column.getColumnComment(), "(" , ")");
......@@ -349,20 +477,35 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
List<String> templates = FreeMarkerUtils.getTemplateList(gentableEntity.getTplCategory());
for (String temp : templates) {
if (!types.contains("1") && types.contains("2")) {
//只生成model类型
Set<String> modelTemplateSet = FreeMarkerUtils.getModelTemplateSet();
if (!modelTemplateSet.contains(temp)) {
continue;
}
}
//通过模板生成不同的业务类
if (temp.equals("enum.java.ftl")) {
//单独生成枚举类
List<GentableColumnEntity> collect = gentableEntity.getColumns().stream()
.filter(f -> f.getDict() != null)
.map(item -> {
Map enumData = FreeMarkerUtils.prepareSetFreeMarkerDataByEnum(item.getDict(), item.getColumnComment(), item.getColumnName(), gentableEntity);
Map enumData = FreeMarkerUtils.prepareSetFreeMarkerDataByEnum(item.getDict(), item.getColumnComment(), item.getColumnName(), item.getJavaType());
try {
FreeMarkerUtils.initFreeMarker(genFreePath(temp));
StringWriter sw = new StringWriter();
Template template = FreeMarkerUtils.getTemplate(temp);
template.process(enumData, sw);
zip.putNextEntry(new ZipEntry(FreeMarkerUtils.getEnumFileName(item.getColumnName())));
String enumFileName = FreeMarkerUtils.getEnumFileName(item.getColumnName());
File file = new File(enumFileName);
if (file.exists()) {
return item;
}
zip.putNextEntry(new ZipEntry(enumFileName));
IOUtils.write(sw.toString(), zip, Constant.UTF8);
......@@ -389,6 +532,14 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
FreeMarkerUtils.menuSql.append(sw.toString());
} else if (template.getName().equals("db.sql.ftl")) {
FreeMarkerUtils.dbSql.append(sw.toString());
} else if (template.getName().equals("params.sql.ftl")) {
FreeMarkerUtils.paramsSql.append(sw.toString());
} else if (template.getName().equals("api.md.ftl")) {
FreeMarkerUtils.apimd.append(sw.toString());
} else if (template.getName().equals("api-two.md.ftl")) {
FreeMarkerUtils.apitwomd.append(sw.toString());
} else if (template.getName().equals("apidict.md.ftl")) {
FreeMarkerUtils.apidict.append(sw.toString()+"\n");
} else {
zip.putNextEntry(new ZipEntry(FreeMarkerUtils.getFileName(template.getName(), gentableEntity)));
IOUtils.write(sw.toString(), zip, Constant.UTF8);
......@@ -503,12 +654,16 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
path = "java";
} else if (temp.indexOf(".sql.") != -1) {
path = "sql";
} else if (temp.indexOf(".test.") != -1) {
path = "java";
} else if (temp.indexOf(".xml.") != -1) {
path = "xml";
} else if (temp.indexOf(".vue.") != -1) {
path = "vue";
} else if (temp.indexOf(".doc.") != -1) {
path = "doc";
} else if (temp.indexOf(".md.") != -1) {
path = "doc";
}
return path;
}
......
......@@ -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);
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")) {
if(!ObjectUtils.isEmpty(column.getDict())){
if(column.getDict().size()>2){
column.setHtmlType(HtmlTypeEnum.HTML_SELECT.getValue());
}else{
column.setHtmlType(HtmlTypeEnum.HTML_RADIO.getValue());
}
// 类型&性别字段设置下拉框
else if (StringUtils.endsWithIgnoreCase(columnName.toLowerCase(), "type")
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) {
column.setHtmlType(HtmlTypeEnum.HTML_SELECT.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
......
版本 | 创建时间 | 作者 | 备注信息
---|---|---|---
v1.0|2021-12-05|zxfei| 接口文档
## 数据类型
类型名称|类型描述|参考样例
---|---|---
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"}]
## 设备服务接口
### 查询设备列表
**URL:** http://localhost:8080/m/device/list
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 查询设备
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
pageInfo|object|分页对象|否|-
└─beginIndex|Integer|开始记录序号|否|-
└─prePageResult|Integer|每页条数|否|-
└─totalResult|Integer|总条数|否|-
└─totalPage|Integer|总页数|否|-
└─currPage|Integer|当前页|否|-
└─displayPageSize|Integer|显示页数量|否|-
└─hasNextPage|Boolean|是否有下一页|否|-
└─hasPrePage|Boolean|是否有前一页|否|-
└─lastRecordKey|String|最后一条|否|-
└─countPage|Boolean|是否计算总页数|否|-
query|object|查询对象|否|-
└─id|Long|主键ID,主键,自增长|否|-
└─deviceName|String|设备名称,支持英文字母、数字、短划线(-)、下划线(_)、at(@)、英文句号(.)和英文冒号(:),长度限制为4~20个字符。|否|-
└─deviceCode|String|设备编码|否|-
└─deviceType|Integer|设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|否|-
└─deviceMac|String|设备的MAC地址|否|-
└─deviceFirmId|Long|设备生产厂商ID关联mortals_xhx_stp_firm|否|-
└─deviceFirmname|String|设备生产厂商名称关联mortals_xhx_stp_firm|否|-
└─deviceToRoomId|Long|设备所属房间ID|否|-
└─deviceToRoomName|String|设备所属房间名称|否|-
└─deviceOnlineStatus|Integer|在线状态 (0.离线,1.在线)|否|-
└─deviceStatus|Integer|启用状态 (0.停止,1.启用,2.测试)|否|-
└─deviceRemark|String|备注|否|-
└─onlineTime|Date|最近上线时间|否|-
└─offlineTime|Date|最近离线时间|否|-
└─createUserId|Long|创建用户|否|-
└─createTime|Date|创建时间|否|-
└─updateUserId|Long|更新用户|否|-
└─updateTime|Date|更新时间|否|-
└─idStart|Long|大于 > 主键ID,主键,自增长|否|-
└─idEnd|Long|小于 < 主键ID,主键,自增长|否|-
└─idList|array|主键ID,主键,自增长列表|否|-
└─deviceNameList|array|设备名称,支持英文字母、数字、短划线(-)、下划线(_)、at(@)、英文句号(.)和英文冒号(:),长度限制为4~20个字符。列表|否|-
└─deviceCodeList|array|设备编码列表|否|-
└─deviceTypeStart|Integer|大于 > 设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|否|-
└─deviceTypeEnd|Integer|小于 < 设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|否|-
└─deviceTypeList|array|设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)列表|否|-
└─deviceMacList|array|设备的MAC地址列表|否|-
└─deviceFirmIdStart|Long|大于 > 设备生产厂商ID关联mortals_xhx_stp_firm|否|-
└─deviceFirmIdEnd|Long|小于 < 设备生产厂商ID关联mortals_xhx_stp_firm|否|-
└─deviceFirmIdList|array|设备生产厂商ID关联mortals_xhx_stp_firm列表|否|-
└─deviceFirmnameList|array|设备生产厂商名称关联mortals_xhx_stp_firm列表|否|-
└─deviceToRoomIdStart|Long|大于 > 设备所属房间ID|否|-
└─deviceToRoomIdEnd|Long|小于 < 设备所属房间ID|否|-
└─deviceToRoomIdList|array|设备所属房间ID列表|否|-
└─deviceToRoomNameList|array|设备所属房间名称列表|否|-
└─deviceOnlineStatusStart|Integer|大于 > 在线状态 (0.离线,1.在线)|否|-
└─deviceOnlineStatusEnd|Integer|小于 < 在线状态 (0.离线,1.在线)|否|-
└─deviceOnlineStatusList|array|在线状态 (0.离线,1.在线)列表|否|-
└─deviceStatusStart|Integer|大于 > 启用状态 (0.停止,1.启用,2.测试)|否|-
└─deviceStatusEnd|Integer|小于 < 启用状态 (0.停止,1.启用,2.测试)|否|-
└─deviceStatusList|array|启用状态 (0.停止,1.启用,2.测试)列表|否|-
└─deviceRemarkList|array|备注列表|否|-
└─onlineTimeStart|Date|大于 > 最近上线时间|否|-
└─onlineTimeEnd|Date|小于 < 最近上线时间|否|-
└─offlineTimeStart|Date|大于 > 最近离线时间|否|-
└─offlineTimeEnd|Date|小于 < 最近离线时间|否|-
└─createUserIdStart|Long|大于 > 创建用户|否|-
└─createUserIdEnd|Long|小于 < 创建用户|否|-
└─createUserIdList|array|创建用户列表|否|-
└─createTimeStart|Date|大于 > 创建时间|否|-
└─createTimeEnd|Date|小于 < 创建时间|否|-
└─updateUserIdStart|Long|大于 > 更新用户|否|-
└─updateUserIdEnd|Long|小于 < 更新用户|否|-
└─updateUserIdList|array|更新用户列表|否|-
└─updateTimeStart|Date|大于 > 更新时间|否|-
└─updateTimeEnd|Date|小于 < 更新时间|否|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─result|array|结果集列表|数组
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceName|String|设备名称,支持英文字母、数字、短划线(-)、下划线(_)、at(@)、英文句号(.)和英文冒号(:),长度限制为4~20个字符。|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceCode|String|设备编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|Integer|设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceMac|String|设备的MAC地址|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmId|Long|设备生产厂商ID关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmname|String|设备生产厂商名称关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomId|Long|设备所属房间ID|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomName|String|设备所属房间名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|Integer|在线状态 (0.离线,1.在线)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|Integer|启用状态 (0.停止,1.启用,2.测试)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─onlineTime|Date|最近上线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─offlineTime|Date|最近离线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─pageInfo|object|分页对象|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─beginIndex|Integer|开始记录序号|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─prePageResult|Integer|每页条数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─totalResult|Integer|总条数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─totalPage|Integer|总页数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─currPage|Integer|当前页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─displayPageSize|Integer|显示页数量|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─hasNextPage|Boolean|是否有下一页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─hasPrePage|Boolean|是否有前一页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─lastRecordKey|String|最后一条|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─countPage|Boolean|是否计算总页数|-
└─dict|object|字典对象|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|object|字典属性对象,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|object|字典属性对象,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|object|字典属性对象,详见附录|-
└─query|object|查询时候返回的查询列表参数对象|-
**响应消息样例:**
```
{
"code":1,
"data":{
"result":[
{
"appId":6,
"businessName":"device",
}
],
"pageInfo":{
"currPage":1,
"prePageResult":200,
"totalPage":1,
"totalResult":16
},
"dict":{
"dividedTableType":{
"0":"无",
"1":"日"
}
}
},
"query":{
"appId":6
}
}
```
### 编辑设备
**URL:** http://localhost:8080/m/device/edit
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 编辑设备,返回实例详细信息
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|array|实例主键ID,数组形式|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|对象实体|对象
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceName|String|设备名称,支持英文字母、数字、短划线(-)、下划线(_)、at(@)、英文句号(.)和英文冒号(:),长度限制为4~20个字符。|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceCode|String|设备编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|Integer|设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceMac|String|设备的MAC地址|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmId|Long|设备生产厂商ID关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmname|String|设备生产厂商名称关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomId|Long|设备所属房间ID|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomName|String|设备所属房间名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|Integer|在线状态 (0.离线,1.在线)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|Integer|启用状态 (0.停止,1.启用,2.测试)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─onlineTime|Date|最近上线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─offlineTime|Date|最近离线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─dict|object|字典对象|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|object|字典属性对象,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|object|字典属性对象,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|object|字典属性对象,详见附录|-
**响应消息样例:**
```
{
"code":1,
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 保存更新设备
**URL:** http://localhost:8080/m/device/save
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 保存或更新设备:id为空时为新增保存,否则为更新提交
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
entity|object|实体对象|是|-
└─deviceName|String|设备名称,支持英文字母、数字、短划线(-)、下划线(_)、at(@)、英文句号(.)和英文冒号(:),长度限制为4~20个字符。|是|-
└─deviceCode|String|设备编码|是|-
└─deviceType|Integer|设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|是|-
└─deviceMac|String|设备的MAC地址|是|-
└─deviceFirmId|Long|设备生产厂商ID关联mortals_xhx_stp_firm|是|-
└─deviceFirmname|String|设备生产厂商名称关联mortals_xhx_stp_firm|是|-
└─deviceToRoomId|Long|设备所属房间ID|是|-
└─deviceToRoomName|String|设备所属房间名称|是|-
└─deviceOnlineStatus|Integer|在线状态 (0.离线,1.在线)|是|-
└─deviceStatus|Integer|启用状态 (0.停止,1.启用,2.测试)|是|-
└─deviceRemark|String|备注|是|-
└─onlineTime|Date|最近上线时间|是|-
└─offlineTime|Date|最近离线时间|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|保存实体|对象
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceName|String|设备名称,支持英文字母、数字、短划线(-)、下划线(_)、at(@)、英文句号(.)和英文冒号(:),长度限制为4~20个字符。|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceCode|String|设备编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|Integer|设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceMac|String|设备的MAC地址|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmId|Long|设备生产厂商ID关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmname|String|设备生产厂商名称关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomId|Long|设备所属房间ID|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomName|String|设备所属房间名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|Integer|在线状态 (0.离线,1.在线)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|Integer|启用状态 (0.停止,1.启用,2.测试)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─onlineTime|Date|最近上线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─offlineTime|Date|最近离线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─dict|object|字典对象|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|object|字典属性对象想,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|object|字典属性对象想,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|object|字典属性对象想,详见附录|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功",
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 查看设备
**URL:** http://localhost:8080/m/device/view
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 查看设备,返回实例详细信息
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|array|实例主键ID,数组形式|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|对象实体|对象
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceName|String|设备名称,支持英文字母、数字、短划线(-)、下划线(_)、at(@)、英文句号(.)和英文冒号(:),长度限制为4~20个字符。|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceCode|String|设备编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|Integer|设备类型(1.引导查询机,2.电子门牌, 3.LED大屏,4.集中显示屏, 5.PAD,6.打印机, 7.电脑,8.服务器, 9.其他)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceMac|String|设备的MAC地址|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmId|Long|设备生产厂商ID关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceFirmname|String|设备生产厂商名称关联mortals_xhx_stp_firm|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomId|Long|设备所属房间ID|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceToRoomName|String|设备所属房间名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|Integer|在线状态 (0.离线,1.在线)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|Integer|启用状态 (0.停止,1.启用,2.测试)|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─onlineTime|Date|最近上线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─offlineTime|Date|最近离线时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─dict|object|字典对象|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceType|object|字典属性对象,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceOnlineStatus|object|字典属性对象,详见附录|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─deviceStatus|object|字典属性对象,详见附录|-
**响应消息样例:**
```
{
"code":1,
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 删除设备
**URL:** http://localhost:8080/m/device/delete
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 删除设备
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|array|实例主键ID,数组形式|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
### 设备导入模板下载
**URL:** http://localhost:8081/m/device/downloadTemplate
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 设备导入模板下载
**Request-example:**
```
curl -X POST -i http://localhost:8081/m/device/downloadTemplate
```
**Response-example:**
```
...
```
### 导入设备
**URL:** http://localhost:8081/m/device/importData
**Type:** POST
**Content-Type:** multipart/form-data
**Description:** 导入设备
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
file|file|文件流|是|-
updateSupport|boolean|相同数据项是否更新|false|-
**Request-example:**
```
curl -X POST -H 'Content-Type: multipart/form-data' -i http://localhost:8081/m/device/importData --data 'updateSupport=true'
```
**Response-example:**
```
...
```
## 设备生产厂商服务接口
### 查询设备生产厂商列表
**URL:** http://localhost:8080/m/firm/list
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 查询设备生产厂商
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
pageInfo|object|分页对象|否|-
└─beginIndex|Integer|开始记录序号|否|-
└─prePageResult|Integer|每页条数|否|-
└─totalResult|Integer|总条数|否|-
└─totalPage|Integer|总页数|否|-
└─currPage|Integer|当前页|否|-
└─displayPageSize|Integer|显示页数量|否|-
└─hasNextPage|Boolean|是否有下一页|否|-
└─hasPrePage|Boolean|是否有前一页|否|-
└─lastRecordKey|String|最后一条|否|-
└─countPage|Boolean|是否计算总页数|否|-
query|object|查询对象|否|-
└─id|Long|主键ID,主键,自增长|否|-
└─firmName|String|设备生产厂商名称|否|-
└─firmCode|String|设备生产商编码|否|-
└─firmRemark|String|备注|否|-
└─createUserId|Long|创建用户|否|-
└─createTime|Date|创建时间|否|-
└─updateUserId|Long|更新用户|否|-
└─updateTime|Date|更新时间|否|-
└─idStart|Long|大于 > 主键ID,主键,自增长|否|-
└─idEnd|Long|小于 < 主键ID,主键,自增长|否|-
└─idList|array|主键ID,主键,自增长列表|否|-
└─firmNameList|array|设备生产厂商名称列表|否|-
└─firmCodeList|array|设备生产商编码列表|否|-
└─firmRemarkList|array|备注列表|否|-
└─createUserIdStart|Long|大于 > 创建用户|否|-
└─createUserIdEnd|Long|小于 < 创建用户|否|-
└─createUserIdList|array|创建用户列表|否|-
└─createTimeStart|Date|大于 > 创建时间|否|-
└─createTimeEnd|Date|小于 < 创建时间|否|-
└─updateUserIdStart|Long|大于 > 更新用户|否|-
└─updateUserIdEnd|Long|小于 < 更新用户|否|-
└─updateUserIdList|array|更新用户列表|否|-
└─updateTimeStart|Date|大于 > 更新时间|否|-
└─updateTimeEnd|Date|小于 < 更新时间|否|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─result|array|结果集列表|数组
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmName|String|设备生产厂商名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmCode|String|设备生产商编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─pageInfo|object|分页对象|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─beginIndex|Integer|开始记录序号|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─prePageResult|Integer|每页条数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─totalResult|Integer|总条数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─totalPage|Integer|总页数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─currPage|Integer|当前页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─displayPageSize|Integer|显示页数量|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─hasNextPage|Boolean|是否有下一页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─hasPrePage|Boolean|是否有前一页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─lastRecordKey|String|最后一条|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─countPage|Boolean|是否计算总页数|-
└─dict|object|字典对象|-
└─query|object|查询时候返回的查询列表参数对象|-
**响应消息样例:**
```
{
"code":1,
"data":{
"result":[
{
"appId":6,
"businessName":"device",
}
],
"pageInfo":{
"currPage":1,
"prePageResult":200,
"totalPage":1,
"totalResult":16
},
"dict":{
"dividedTableType":{
"0":"无",
"1":"日"
}
}
},
"query":{
"appId":6
}
}
```
### 编辑设备生产厂商
**URL:** http://localhost:8080/m/firm/edit
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 编辑设备生产厂商,返回实例详细信息
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|array|实例主键ID,数组形式|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|对象实体|对象
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmName|String|设备生产厂商名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmCode|String|设备生产商编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─dict|object|字典对象|-
**响应消息样例:**
```
{
"code":1,
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 保存更新设备生产厂商
**URL:** http://localhost:8080/m/firm/save
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 保存或更新设备生产厂商:id为空时为新增保存,否则为更新提交
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
entity|object|实体对象|是|-
└─firmName|String|设备生产厂商名称|是|-
└─firmCode|String|设备生产商编码|是|-
└─firmRemark|String|备注|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|保存实体|对象
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmName|String|设备生产厂商名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmCode|String|设备生产商编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─dict|object|字典对象|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功",
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 查看设备生产厂商
**URL:** http://localhost:8080/m/firm/view
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 查看设备生产厂商,返回实例详细信息
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|array|实例主键ID,数组形式|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|对象实体|对象
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─id|Long|主键ID,主键,自增长|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmName|String|设备生产厂商名称|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmCode|String|设备生产商编码|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─firmRemark|String|备注|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createUserId|Long|创建用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─createTime|Date|创建时间|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateUserId|Long|更新用户|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─updateTime|Date|更新时间|-
└─dict|object|字典对象|-
**响应消息样例:**
```
{
"code":1,
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 删除设备生产厂商
**URL:** http://localhost:8080/m/firm/delete
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 删除设备生产厂商
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|array|实例主键ID,数组形式|是|-
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
### 设备生产厂商导入模板下载
**URL:** http://localhost:8081/m/firm/downloadTemplate
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 设备生产厂商导入模板下载
**Request-example:**
```
curl -X POST -i http://localhost:8081/m/firm/downloadTemplate
```
**Response-example:**
```
...
```
### 导入设备生产厂商
**URL:** http://localhost:8081/m/firm/importData
**Type:** POST
**Content-Type:** multipart/form-data
**Description:** 导入设备生产厂商
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
file|file|文件流|是|-
updateSupport|boolean|相同数据项是否更新|false|-
**Request-example:**
```
curl -X POST -H 'Content-Type: multipart/form-data' -i http://localhost:8081/m/firm/importData --data 'updateSupport=true'
```
**Response-example:**
```
...
```
###deviceType字典
字典参数key|字典参数值|其它
---|---|---
1|引导查询机
2|电子门牌
3|LED大屏
4|集中显示屏
5|PAD
6|打印机
7|电脑
8|服务器
9|其他
###deviceOnlineStatus字典
字典参数key|字典参数值|其它
---|---|---
0|离线
1|在线
###deviceStatus字典
字典参数key|字典参数值|其它
---|---|---
0|停止
1|启用
2|测试
## ${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:**
```
...
```
## ${functionName}服务接口
### 查询${functionName}列表
**URL:** http://localhost:8080/m/${RequestMapping}/list
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 查询${functionName}
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
pageInfo|object|分页对象|否|-
└─beginIndex|Integer|开始记录序号|否|-
└─prePageResult|Integer|每页条数|否|-
└─totalResult|Integer|总条数|否|-
└─totalPage|Integer|总页数|否|-
└─currPage|Integer|当前页|否|-
└─displayPageSize|Integer|显示页数量|否|-
└─hasNextPage|Boolean|是否有下一页|否|-
└─hasPrePage|Boolean|是否有前一页|否|-
└─lastRecordKey|String|最后一条|否|-
└─countPage|Boolean|是否计算总页数|否|-
query|object|查询对象|否|-
<#list columns as column>
└─${column.javaField}|${column.javaType}|${column.columnComment}|否|-
</#list>
<#list columns as column>
<#if column.javaType == "Long"||column.javaType == "Integer"||column.javaType == "BigDecimal">
└─${column.javaField}Start|${column.javaType}|大于 > ${column.columnComment}|否|-
└─${column.javaField}End|${column.javaType}|小于 < ${column.columnComment}|否|-
└─${column.javaField}List|array|${column.columnComment}列表|否|-
</#if>
<#if column.javaType == "String">
└─${column.javaField}List|array|${column.columnComment}列表|否|-
</#if>
<#if column.javaType == "Date">
└─${column.javaField}Start|${column.javaType}|大于 > ${column.columnComment}|否|-
└─${column.javaField}End|${column.javaType}|小于 < ${column.columnComment}|否|-
</#if>
</#list>
**请求样例:**
```
curl -X POST -i http://localhost:8080/m/${RequestMapping}/list --data 'query.id=1'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─result|array|结果集列表|数组
<#list columns as column>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${column.javaField}|${column.javaType}|${column.columnComment}|-
</#list>
└─pageInfo|object|分页对象|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─beginIndex|Integer|开始记录序号|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─prePageResult|Integer|每页条数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─totalResult|Integer|总条数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─totalPage|Integer|总页数|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─currPage|Integer|当前页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─displayPageSize|Integer|显示页数量|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─hasNextPage|Boolean|是否有下一页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─hasPrePage|Boolean|是否有前一页|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─lastRecordKey|String|最后一条|-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─countPage|Boolean|是否计算总页数|-
└─dict|object|字典对象|-
<#list columns as column>
<#if column.dict??&&(column.columnType?contains("tinyint") ||column.htmlType==3||column.htmlType==5)>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${column.javaField}|object|字典属性对象,详见附录|-
</#if>
</#list>
└─query|object|查询时候返回的查询列表参数对象|-
**响应消息样例:**
```
{
"code":1,
"data":{
"result":[
{
"appId":6,
"businessName":"device",
}
],
"pageInfo":{
"currPage":1,
"prePageResult":200,
"totalPage":1,
"totalResult":16
},
"dict":{
"dividedTableType":{
"0":"无",
"1":"日"
}
}
},
"query":{
"appId":6
}
}
```
### 编辑${functionName}
**URL:** http://localhost:8080/m/${RequestMapping}/edit
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 编辑${functionName},返回实例详细信息
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
${pkColumn.javaField}|array|实例主键ID,数组形式|是|-
**请求样例:**
```
curl -X POST -i http://localhost:8080/m/${RequestMapping}/edit --data 'id=[1]'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|对象实体|对象
<#list columns as column>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${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)>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${column.javaField}|object|字典属性对象,详见附录|-
</#if>
</#list>
**响应消息样例:**
```
{
"code":1,
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 保存更新${functionName}
**URL:** http://localhost:8080/m/${RequestMapping}/save
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 保存或更新${functionName}:id为空时为新增保存,否则为更新提交
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
entity|object|实体对象|是|-
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
└─${column.javaField}|${column.javaType}|${column.columnComment}|是|-
</#if>
</#list>
**请求样例:**
```
...
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|保存实体|对象
<#list columns as column>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${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)>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${column.javaField}|object|字典属性对象想,详见附录|-
</#if>
</#list>
**响应消息样例:**
```
{
"code":1,
"msg":"成功",
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 查看${functionName}
**URL:** http://localhost:8080/m/${RequestMapping}/view
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 查看${functionName},返回实例详细信息
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
${pkColumn.javaField}|array|实例主键ID,数组形式|是|-
**请求样例:**
```
curl -X POST -i http://localhost:8080/m/${RequestMapping}/view --data 'id=[1]'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
└─entity|object|对象实体|对象
<#list columns as column>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${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)>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└─${column.javaField}|object|字典属性对象,详见附录|-
</#if>
</#list>
**响应消息样例:**
```
{
"code":1,
"data":{
"dict":{
"interimExcuteStatus":{
"0":"未启用",
"1":"立即执行并保留"
}
},
"entity":{
"createTime":1628737643000,
"createUserId":1,
"createUserName":"系统管理员",
"excuteDate":0
}
}
}
```
### 删除${functionName}
**URL:** http://localhost:8080/m/${RequestMapping}/delete
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** 删除${functionName}
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
${pkColumn.javaField}|array|实例主键ID,数组形式|是|-
**请求样例:**
```
curl -X POST -i http://localhost:8080/m/${RequestMapping}/delete --data 'id=[1]'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(0.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
### ${functionName}导入模板下载
**URL:** http://localhost:8081/m/${RequestMapping}/downloadTemplate
**Type:** POST
**Content-Type:** application/x-www-form-urlencoded;charset=utf-8
**Description:** ${functionName}导入模板下载
**Request-example:**
```
curl -X POST -i http://localhost:8081/m/${RequestMapping}/downloadTemplate
```
**Response-example:**
```
...
```
### 导入${functionName}
**URL:** http://localhost:8081/m/${RequestMapping}/importData
**Type:** POST
**Content-Type:** multipart/form-data
**Description:** 导入${functionName}
**Query-parameters:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
file|file|文件流|是|-
updateSupport|boolean|相同数据项是否更新|false|-
**Request-example:**
```
curl -X POST -H 'Content-Type: multipart/form-data' -i http://localhost:8081/m/${RequestMapping}/importData --data 'updateSupport=true'
```
**Response-example:**
```
...
```
<#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,7 +111,7 @@ 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);
${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;
......
package ${packageName}.web;
<#if table.tplCategory=="crud" >
<#if table.isShowControl==1 >
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
<#assign Controller = "BaseCRUDJsonController">
<#elseif table.isShowControl==2 >
<#assign Controller = "BaseCRUDJsonPhpController">
<#else>
<#assign Controller = "BaseCRUDJsonMappingController">
</#if>
<#else>
<#assign Controller = "BaseCRUDJsonMappingController">
</#if>
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.${Controller};
import ${packageName}.model.${ClassName}Entity;
import ${packageName}.model.${ClassName}Query;
import ${packageName}.service.${ClassName}Service;
<#if table.tplCategory=="tree">
import ${packageName}.model.${ClassName}TreeSelect;
</#if>
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
* ${ClassName}Controller
*
* ${functionName} 控制器
* ${functionName}
*
* @author ${author}
* @date ${datetime}
......@@ -47,14 +59,90 @@ public class ${ClassName}Controller extends ${Controller}<${ClassName}Service,${
protected void init(HttpServletRequest request, HttpServletResponse response, ${ClassName}Form form, Map<String, Object> model, Context context) {
<#list columns as column>
<#if column.columnType?contains("tinyint") ||column.htmlType==3||column.htmlType==5>
this.addDict(model, "${column.javaField}", paramService.getParamByFirstOrganize("${column.javaField}"));
this.addDict(model, "${column.javaField}", paramService.getParamBySecondOrganize("${ClassName}","${column.javaField}"));
</#if>
</#list>
super.init(request, response, form, model, context);
}
<#if table.tplCategory=="tree">
@PostMapping("list/exclude")
public String excludeList(${ClassName}Form form) {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
Long id = form.getId()[0];
int code=VALUE_RESULT_SUCCESS;
try {
List<${ClassName}Entity> collect = this.service.find(new ${ClassName}Query()).stream().map(item -> {
if (item.getId().intValue() == id || ArrayUtils.contains(StringUtils.split(item.getAncestors(), ","), id + "")) {
return null;
}
return item;
}).filter(f -> f != null).collect(Collectors.toList());
model.put("result", collect);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 获取站点下拉树列表
*/
@PostMapping("treeselect")
public String treeselect(${ClassName}Form form) {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
try {
List<${ClassName}Entity> list = this.service.find(new ${ClassName}Query());
List<${ClassName}TreeSelect> treeSelects = this.service.build${ClassName}TreeSelect(list);
model.put("result", treeSelects);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 根据parentId查询子信息
*/
@GetMapping(value = "getListByParentId")
public String getListByParentId(String parentId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询" + this.getModuleDesc()+"子节点";
try {
List<${ClassName}TreeSelect> treeList = this.service.getListByParentId(parentId, getContext());
model.put(RESULT_KEY,treeList);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, model);
recordSysLog(request, busiDesc+"【成功】");
} catch (Exception e) {
log.error("根据parentId查询子信息错误", e);
this.doException(request, busiDesc, model, e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, e.getMessage());
}
return ret.toJSONString();
}
</#if>
<#if table.isShowControl==1 >
/**
* 查询{functionName}
* 查询${functionName}
*/
@PostMapping(value = "list")
public String list(${ClassName}Form form) {
......@@ -136,7 +224,7 @@ public class ${ClassName}Controller extends ${Controller}<${ClassName}Service,${
/**
* 逻辑删除${functionName}
*/
@PostMapping(value = "view")
@PostMapping(value = "logicDelete")
public String logicDelete(${ClassName}Form form) {
try {
return super.logicDelete(form);
......@@ -176,5 +264,157 @@ public class ${ClassName}Controller extends ${Controller}<${ClassName}Service,${
return ret.toJSONString();
}
}
<#elseif table.isShowControl==2 >
/**
* 查询${functionName}
*/
@PostMapping(value = "list")
public String list(@RequestBody ${ClassName}Query query) {
try {
${ClassName}Form form = new ${ClassName}Form();
form.setQuery(query);
return super.list(form);
} catch (Exception e) {
log.error("查询${functionName}列表错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
/**
* 新增${functionName}
*/
@PostMapping(value = "add")
public String add() {
try {
${ClassName}Form form = new ${ClassName}Form();
return super.add(form);
} catch (Exception e) {
log.error("新增${functionName}错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
/**
* 编辑${functionName}
*/
@GetMapping(value = "edit")
public String edit(Long id) {
try {
${ClassName}Form form = new ${ClassName}Form();
form.setId(new Long[]{id});
return super.edit(form);
} catch (Exception e) {
log.error("${functionName}模块错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
/**
* 保存${functionName}
*/
@PostMapping(value = "save")
public String save(@RequestBody ${ClassName}Entity entity) {
try {
${ClassName}Form form = new ${ClassName}Form();
form.set${ClassName}(entity);
return super.save(form);
} catch (Exception e) {
log.error("${functionName}模块错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
/**
* 删除${functionName}
*/
@GetMapping(value = "delete")
public String delete(String id) {
try {
${ClassName}Form form = new ${ClassName}Form();
String[] split = id.split(",");
Long[] ids = Arrays.asList(split).stream().map(Long::parseLong).toArray(Long[]::new);
form.setId(ids);
return super.delete(form);
} catch (Exception e) {
log.error("删除${functionName}错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
/**
* 查看${functionName}
*/
@GetMapping(value = "info")
public String info(Long id) {
try {
${ClassName}Form form = new ${ClassName}Form();
form.setId(new Long[]{id});
return super.view(form);
} catch (Exception e) {
log.error("查看${functionName}错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
/**
* ${functionName}导入模板下载
*/
@PostMapping(value = "downloadTemplate")
public void downloadTemplate() {
try {
super.downloadTemplate();
} catch (Exception e) {
log.error("${functionName}导入模板下载错误", e);
}
}
/**
* ${functionName}导出
*/
@PostMapping(value = "importData")
public String importData(MultipartFile file, boolean updateSupport) {
try {
return super.importData(file, updateSupport);
} catch (Exception e) {
log.error("${functionName}导入错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
/**
* ${functionName}导出
*/
@PostMapping("exportExcel")
public void exportExcel(@RequestBody ${ClassName}Query query) {
try {
${ClassName}Form form = new ${ClassName}Form();
form.setQuery(query);
super.exportExcel(form);
} catch (Exception e) {
log.error("${functionName}导出错误", e);
}
}
</#if>
}
\ No newline at end of file
-- ----------------------------
-- ${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="80px">
<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>
<#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")>
......@@ -20,23 +20,11 @@
<#elseif column.htmlType == 6>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${column.javaField}" type="date" />
<#elseif column.htmlType == 7>
<el-col span="12">
<el-form-item label="${comment}">
<imageUpload v-model="form.${column.javaField}" prePath="/uploadimage"/>
</el-form-item>
</el-col>
<Field label="${comment}"><imageUpload v-model="form.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<el-col span="12">
<el-form-item label="${comment}">
<fileUpload v-model="form.${column.javaField}" prePath="/uploadfile" />
</el-form-item>
</el-col>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/uploadfile"/></Field>
<#elseif column.htmlType == 9>
<el-col span="12">
<el-form-item label="${comment}">
<editor v-model="form.${column.javaField}" :min-height="192"/>
</el-form-item>
</el-col>
<Field label="${comment}"><editor v-model="form.${column.javaField}" :min-height="256"/></Field>
<#else >
<Field label="${comment}" prop="${column.javaField}" v-model="form.${column.javaField}" placeholder="请输入${comment}"/>
</#if>
......@@ -44,16 +32,79 @@
</#list>
</el-row>
<#if table.tplCategory=="sub">
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
<br/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">删除</el-button>
</el-col>
</el-row>
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<#list subTable.columns as column >
<#assign javaField=column.javaField />
<#assign comment=column.subComment(column.columnComment) />
<#if column.isPrimaryKey==1 || javaField == subTableFkclassName>
<#elseif "" != javaField>
<el-table-column label="${comment}" prop="${javaField}">
<template slot-scope="scope">
<el-input v-model="scope.row.${javaField}" placeholder="请输入${comment}" />
</template>
</el-table-column>
</#if>
</#list>
</el-table>
</#if>
<#if table.tplCategory=="subone">
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
<br/>
<el-row>
<#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.columnType?contains("tinyint")>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" placeholder="请输入${comment}"/>
<#elseif column.htmlType == 2>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="textarea" placeholder="请输入${comment}"/>
<#elseif column.htmlType == 3 ||column.columnType?contains("tinyint")>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="select" :enumData="dict.${column.javaField}" placeholder="请选择${comment}"/>
<#elseif column.htmlType == 4>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="checkbox" :enumData="dict.${column.javaField}" />
<#elseif column.htmlType == 5>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="radio" :enumData="dict.${column.javaField}" />
<#elseif column.htmlType == 6>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="date" />
<#elseif column.htmlType == 7>
<Field label="${comment}"><imageUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/uploadfile"/></Field>
<#elseif column.htmlType == 9>
<Field label="${comment}"><editor v-model="form.${subclassName}Entity.${column.javaField}" :min-height="256"/></Field>
<#else >
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" placeholder="请输入${comment}"/>
</#if>
</#if>
</#list>
</el-row>
</#if>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button type="primary" v-if="pageInfo.type !== 'view'" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import form from "@/assets/mixins/form";
import form from "@/assets/mixins/formdialog";
import dialogShow from "./dialogshow";
<#list columns as column>
<#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 7>
......@@ -98,6 +149,12 @@
},
data() {
return {
<#if table.tplCategory=="sub">
// 子表选中数据
checked${subClassName}: [],
// ${subTable.functionName}表格数据
${subclassName}List: [],
</#if>
// 遮罩层
loading: true,
// 弹出层标题
......@@ -114,24 +171,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>
......@@ -140,13 +200,55 @@
},
methods: {
<#if table.tplCategory=="sub">
/** ${subTable.functionName}序号 */
row${subClassName}Index({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** ${subTable.functionName}添加按钮操作 */
handleAdd${subClassName}() {
let obj = {};
<#list subTable.columns as column>
<#if column.isPrimaryKey==1 || column.javaField == subTableFkclassName>
<#elseif "" != javaField>
obj.${column.javaField} = "";
</#if>
</#list>
this.${subclassName}List.push(obj);
},
/** ${subTable.functionName}删除按钮操作 */
handleDelete${subClassName}() {
if (this.checked${subClassName}.length == 0) {
this.$alert("请先选择要删除的${subTable.functionName}数据", "提示", { confirmButtonText: "确定", });
} else {
this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1);
}
},
/** 单选框选中数据 */
handle${subClassName}SelectionChange(selection) {
if (selection.length > 1) {
this.$refs.${subclassName}.clearSelection();
this.$refs.${subclassName}.toggleRowSelection(selection.pop());
} else {
this.checked${subClassName} = selection;
}
},
// 渲染前置处理
beforeRender(data) {
if(data.entity.${subclassName}List) {
this.${subclassName}List = data.entity.${subclassName}List;
}
return data
},
<#elseif table.tplCategory=="subone" >
</#if>
/** 编辑 */
edit(row, ${className}Options) {
edit(row) {
this.reset()
this.query = { ${pkColumn.javaField}: row.${pkColumn.javaField} };
this.urls.currUrl =this.pageInfo.editUrl;;
this.getData();
this.open = true;
this.pageInfo.type="edit"
this.title = "修改${functionName}";
},
/** 新增 */
......@@ -155,7 +257,7 @@
this.query = { ${pkColumn.javaField}: row.${pkColumn.javaField} };
this.urls.currUrl = this.pageInfo.addUrl;
this.getData();
this.open = true;
this.pageInfo.type="add"
this.title = "新增${functionName}";
},
/** 查看*/
......@@ -164,13 +266,17 @@
this.query = { ${pkColumn.javaField}: row.${pkColumn.javaField} };
this.urls.currUrl =this.pageInfo.viewUrl;;
this.getData();
this.open = true;
this.pageInfo.type="view"
this.title = "${functionName}详细";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
......@@ -182,13 +288,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>
......
<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>
{
......
......@@ -3,7 +3,7 @@
<el-form :model="form" :loading="loading" :rules="rules" size='small' style="width:100%" label-width='120px' ref="form">
<el-row>
<#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")>
......@@ -19,23 +19,11 @@
<#elseif column.htmlType == 6>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${column.javaField}" type="date" />
<#elseif column.htmlType == 7>
<el-col span="12">
<el-form-item label="${comment}">
<imageUpload v-model="form.${column.javaField}" prePath="/uploadimage"/>
</el-form-item>
</el-col>
<Field label="${comment}"><imageUpload v-model="form.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<el-col span="12">
<el-form-item label="${comment}">
<fileUpload v-model="form.${column.javaField}" prePath="/uploadfile" />
</el-form-item>
</el-col>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/uploadfile"/></Field>
<#elseif column.htmlType == 9>
<el-col span="12">
<el-form-item label="${comment}">
<editor v-model="form.${column.javaField}" :min-height="192"/>
</el-form-item>
</el-col>
<Field label="${comment}"><editor v-model="form.${column.javaField}" :min-height="256"/></Field>
<#else >
<Field label="${comment}" prop="${column.javaField}" v-model="form.${column.javaField}" placeholder="请输入${comment}"/>
</#if>
......@@ -58,14 +46,11 @@
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<#list subTable.columns as column >
<#assign javaField=column.javaField />
<#assign comment=column.subComment(column.columnComment) />
<#if column.isPrimaryKey==1 || javaField == subTableFkclassName>
<#elseif "" != javaField>
<el-table-column label="${comment}" prop="${javaField}">
<#if column.isPrimaryKey != 1 &&column.javaField!= subTableFkclassName && !column.isSuperColumn(column.javaField)&& column.isEdit==1>
<el-table-column label="${comment}" prop="${column.javaField}">
<template slot-scope="scope">
<el-input v-model="scope.row.${javaField}" placeholder="请输入${comment}" />
<el-input v-model="scope.row.${column.javaField}" placeholder="请输入${comment}" />
</template>
</el-table-column>
</#if>
......@@ -78,79 +63,35 @@
<br/>
<el-row>
<#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.isPrimaryKey==1 || javaField == subTableFkclassName>
<#elseif "" != javaField>
<el-col :span="12">
<el-form-item label="${comment}" placeholder="请输入${comment}">
<el-input v-model="form.${subclassName}Entity.${javaField}"></el-input>
</el-form-item>
</el-col>
<#if column.htmlType == 1 && !column.columnType?contains("tinyint")>
<el-form-item label="${comment}" placeholder="请输入${comment}">
<el-input v-model="form.${subclassName}Entity.${javaField}"></el-input>
</el-form-item>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" placeholder="请输入${comment}"/>
<#elseif column.htmlType == 2>
<el-form-item label="${comment}" placeholder="请输入${comment}">
<el-input v-model="form.${subclassName}Entity.${javaField}" type="textarea" :rows="2"></el-input>
</el-form-item>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="textarea" placeholder="请输入${comment}"/>
<#elseif column.htmlType == 3 ||column.columnType?contains("tinyint")>
<el-form-item label="${comment}" prop="${column.javaField}" placeholder="请选择${comment}>
<el-select v-model="form.${subclassName}Entity.${javaField}" placeholder="请选择${comment}" clearable size="small">
<el-option
v-for="(label, value) in dict.${column.javaField}"
:key="value"
:label="label"
:value="value"
></el-option>
</el-select>
</el-form-item>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="select" :enumData="dict.${column.javaField}" placeholder="请选择${comment}"/>
<#elseif column.htmlType == 4>
<el-form-item label="${comment}" >
<el-checkbox-group v-model="form.${subclassName}Entity.${javaField}">
<el-checkbox
v-for='(label, value) in dict.${column.javaField}'
:key='value'
:label="value"
>{{label}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="checkbox" :enumData="dict.${column.javaField}" />
<#elseif column.htmlType == 5>
<el-form-item label="${comment}" >
<el-radio-group v-model="form.${subclassName}Entity.${javaField}">
<el-radio
v-for='(label, value) in dict.${column.javaField}'
:key='value'
:label="value"
>{{label}}</el-radio>
</el-radio-group>
</el-form-item>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="radio" :enumData="dict.${column.javaField}" />
<#elseif column.htmlType == 6>
<el-form-item label="${comment}" >
<el-date-picker type="date" value-format="yyyy-MM-dd HH:mm:ss" v-model="form.${subclassName}Entity.${javaField}" placeholder="选择日期" ></el-date-picker>
</el-form-item>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" type="date" />
<#elseif column.htmlType == 7>
<el-form-item label="${comment}">
<imageUpload v-model="form.${subclassName}Entity.${javaField}" prePath="/uploadimage"/>
</el-form-item>
<Field label="${comment}"><imageUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<el-form-item label="${comment}">
<fileUpload v-model="form.${subclassName}Entity.${javaField}" prePath="/uploadfile" />
</el-form-item>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/uploadfile"/></Field>
<#elseif column.htmlType == 9>
<el-form-item label="${comment}">
<editor v-model="form.${subclassName}Entity.${javaField}" :min-height="192"/>
</el-form-item>
<Field label="${comment}"><editor v-model="form.${subclassName}Entity.${column.javaField}" :min-height="256"/></Field>
<#else >
<Field label="${comment}" prop="${column.javaField}" v-model="form.${column.javaField}" placeholder="请输入${comment}"/>
<Field label="${comment}" prop="${column.javaField}" v-model="form.${subclassName}Entity.${column.javaField}" placeholder="请输入${comment}"/>
</#if>
</#if>
</#list>
</el-row>
</#if>
<form-buttons @submit='submitForm'/>
<form-buttons @submit='submitForm' :noSaveBtn="pageInfo.type === 'view'"/>
</el-form>
</layout-form>
</template>
......@@ -197,14 +138,8 @@
</#if>
</#list>
},
toString:[
<#list columns as column>
<#if column.columnType?contains("tinyint")>
"${column.javaField}",
</#if>
</#list>
],
methods: {
<#if table.tplCategory=="sub">
/** ${subTable.functionName}序号 */
row${subClassName}Index({ row, rowIndex }) {
......@@ -251,6 +186,13 @@
},
data() {
return {
toString:[
<#list columns as column>
<#if column.columnType?contains("tinyint")>
"${column.javaField}",
</#if>
</#list>
],
<#if table.tplCategory=="sub">
// 子表选中数据
checked${subClassName}: [],
......@@ -259,24 +201,27 @@
</#if>
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>
......
......@@ -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,7 +243,26 @@
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