first commit

This commit is contained in:
2023-07-04 22:31:18 +08:00
parent 45da8ae298
commit b17f1efed3
6 changed files with 18 additions and 128 deletions

View File

@ -34,5 +34,9 @@
<groupId>com.qiaoba</groupId>
<artifactId>qiaoba-auth</artifactId>
</dependency>
<dependency>
<groupId>com.qiaoba</groupId>
<artifactId>qiaoba-common-doc</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -33,7 +33,7 @@ public class VelocityUtil {
private static final String VM_SERVICE_IMPL = "serviceImpl.java.vm";
private static final String VM_SQL = "sql.vm";
private static final String VM_API_JS = "api.js.vm";
private static final String VM_INDEX_VUE = "index.vue.vm";
private static final String VM_INDEX_VUE = "index";
private static final String VM_INDEX_TREE_VUE = "index-tree.vue.vm";
/**
@ -65,7 +65,7 @@ public class VelocityUtil {
templates.add("vm/java/controller.java.vm");
// 前端
templates.add("vm/js/api.js.vm");
templates.add("vm/vue/index.vue.vm");
templates.add("vm/vue/index");
// SQL
templates.add("vm/sql/sql.vm");
}
@ -84,7 +84,7 @@ public class VelocityUtil {
else if (GenConstants.TEMPLATE_TYPE_VUE.equals(templateType)) {
// 前端
templates.add("vm/js/api.js.vm");
templates.add("vm/vue/index.vue.vm");
templates.add("vm/vue/index");
} else {
// SQL
templates.add("vm/sql/sql.vm");

View File

@ -1 +0,0 @@
如果不慎使用了IDEA代码格式化, 导致代码生成出来的数据异常, 删除vm目录下的所有文件, 解压vm.zip下的文件即可

View File

@ -46,4 +46,5 @@ public class ${ClassName}Param implements Serializable {
private $column.javaType $column.javaField;
#end
#end
}

View File

@ -118,21 +118,21 @@
#else
#set($comment=$column.columnComment)
#end
#if($column.pk)
#if($column.isPk == "1")
<el-table-column label="${comment}" align="center" prop="${javaField}" />
#elseif($column.list && $column.htmlType == "datetime")
#elseif($column.isList == "1" && $column.htmlType == "datetime")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
#elseif($column.list && $column.htmlType == "imageUpload")
#elseif($column.isList == "1" && $column.htmlType == "imageUpload")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
<template #default="scope">
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
</template>
</el-table-column>
#elseif($column.list && "" != $column.dictType)
#elseif($column.isList == "1" && "" != $column.dictType)
<el-table-column label="${comment}" align="center" prop="${javaField}">
<template #default="scope">
#if($column.htmlType == "checkbox")
@ -142,7 +142,7 @@
#end
</template>
</el-table-column>
#elseif($column.list && "" != $javaField)
#elseif($column.isList == "1" && "" != $javaField)
<el-table-column label="${comment}" align="center" prop="${javaField}" />
#end
#end
@ -167,7 +167,7 @@
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
#foreach($column in $columns)
#set($field=$column.javaField)
#if($column.insert && !$column.pk)
#if($column.isInsert == "1" && "1" != $column.isPk)
#if(($column.usableColumn) || (!$column.superColumn))
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
@ -266,70 +266,6 @@
#end
#end
#end
#end
#if($table.sub)
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAdd${subClassName}">添加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="Delete" @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"/>
#foreach($column in $subTable.columns)
#set($javaField=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#end
#if($column.pk || $javaField == ${subTableFkclassName})
#elseif($column.list && $column.htmlType == "input")
<el-table-column label="$comment" prop="${javaField}" width="150">
<template #default="scope">
<el-input v-model="scope.row.$javaField" placeholder="请输入$comment" />
</template>
</el-table-column>
#elseif($column.list && $column.htmlType == "datetime")
<el-table-column label="$comment" prop="${javaField}" width="240">
<template #default="scope">
<el-date-picker clearable
v-model="scope.row.$javaField"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择$comment">
</el-date-picker>
</template>
</el-table-column>
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
<el-table-column label="$comment" prop="${javaField}" width="150">
<template #default="scope">
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
<el-option
v-for="dict in $column.dictType"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</template>
</el-table-column>
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType)
<el-table-column label="$comment" prop="${javaField}" width="150">
<template #default="scope">
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
<el-option label="请选择字典生成" value="" />
</el-select>
</template>
</el-table-column>
#end
#end
</el-table>
#end
</el-form>
<template #footer>
@ -352,16 +288,10 @@ const { ${dictsNoSymbol} } = proxy.useDict(${dicts});
#end
const ${businessName}List = ref([]);
#if($table.sub)
const ${subclassName}List = ref([]);
#end
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
#if($table.sub)
const checked${subClassName} = ref([]);
#end
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
@ -386,7 +316,7 @@ const data = reactive({
},
rules: {
#foreach ($column in $columns)
#if($column.required)
#if($column.isRequired)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
@ -438,16 +368,15 @@ function cancel() {
function reset() {
form.value = {
#foreach ($column in $columns)
#if(!$generator.isBaseColumn($column.javaField))
#if($column.htmlType == "checkbox")
$column.javaField: []#if($foreach.count != $columns.size()),#end
#else
$column.javaField: null#if($foreach.count != $columns.size()),#end
#end
#end
};
#if($table.sub)
${subclassName}List.value = [];
#end
};
proxy.resetForm("${businessName}Ref");
}
@ -461,7 +390,7 @@ function handleQuery() {
function resetQuery() {
#foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.string(1)})
daterange${AttrName}.value = [];
#end
#end
@ -493,9 +422,6 @@ function handleUpdate(row) {
#if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.split(",");
#end
#end
#if($table.sub)
${subclassName}List.value = response.data.${subclassName}List;
#end
open.value = true;
title.value = "修改${functionName}";
@ -510,9 +436,6 @@ function submitForm() {
#if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.join(",");
#end
#end
#if($table.sub)
form.value.${subclassName}List = ${subclassName}List.value;
#end
if (form.value.${pkColumn.javaField} != null) {
update${BusinessName}(form.value).then(response => {
@ -542,43 +465,6 @@ function handleDelete(row) {
}).catch(() => {});
}
#if($table.sub)
/** ${subTable.functionName}序号 */
function row${subClassName}Index({ row, rowIndex }) {
row.index = rowIndex + 1;
}
/** ${subTable.functionName}添加按钮操作 */
function handleAdd${subClassName}() {
let obj = {};
#foreach($column in $subTable.columns)
#if($column.pk || $column.javaField == ${subTableFkclassName})
#elseif($column.list && "" != $javaField)
obj.$column.javaField = "";
#end
#end
${subclassName}List.value.push(obj);
}
/** ${subTable.functionName}删除按钮操作 */
function handleDelete${subClassName}() {
if (checked${subClassName}.value.length == 0) {
proxy.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
} else {
const ${subclassName}s = ${subclassName}List.value;
const checked${subClassName}s = checked${subClassName}.value;
${subclassName}List.value = ${subclassName}s.filter(function(item) {
return checked${subClassName}s.indexOf(item.index) == -1
});
}
}
/** 复选框选中数据 */
function handle${subClassName}SelectionChange(selection) {
checked${subClassName}.value = selection.map(item => item.index)
}
#end
/** 导出按钮操作 */
function handleExport() {
proxy.download('${moduleName}/${businessName}/export', {