mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-23 23:39:47 +08:00
feat: 测试代码生成
This commit is contained in:
@ -71,10 +71,10 @@ public class VelocityUtils {
|
||||
velocityContext.put("pkColumn", genTable.getPkColumn());
|
||||
velocityContext.put("importList", getImportList(genTable));
|
||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||
velocityContext.put("columns", getColumns(genTable));
|
||||
velocityContext.put("table", genTable);
|
||||
velocityContext.put("dicts", getDicts(genTable));
|
||||
velocityContext.put("dictList", getDictList(genTable));
|
||||
velocityContext.put("columns", getColumns(genTable));
|
||||
velocityContext.put("table", genTable);
|
||||
setMenuVelocityContext(velocityContext, genTable);
|
||||
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||
setTreeVelocityContext(velocityContext, genTable);
|
||||
@ -178,7 +178,7 @@ public class VelocityUtils {
|
||||
if (template.contains("soy.index.vue.vm")) {
|
||||
fileName = StringUtils.format("soybean/views/{}/{}/index.vue", moduleName, businessName);
|
||||
} else if (template.contains("soy.api.d.ts.vm")) {
|
||||
fileName = StringUtils.format("soybean/typings/api/{}.d.ts", moduleName);
|
||||
fileName = StringUtils.format("soybean/typings/api/{}.api.d.ts", moduleName);
|
||||
} else if (template.contains("soy.api.ts.vm")) {
|
||||
fileName = StringUtils.format("soybean/api/{}/{}.ts", moduleName, businessName);
|
||||
} else if (template.contains("soy.search.vue.vm")) {
|
||||
|
2
docs/template/api/soy.api.ts.vm
vendored
2
docs/template/api/soy.api.ts.vm
vendored
@ -28,7 +28,7 @@ export function fetchUpdate${BusinessName} (data: Api.${ModuleName}.${BusinessNa
|
||||
}
|
||||
|
||||
/** 批量删除${functionName} */
|
||||
export function fetchDelete${BusinessName} (${pkColumn.javaField}s: CommonType.IdType[]) {
|
||||
export function fetchBatchDelete${BusinessName} (${pkColumn.javaField}s: CommonType.IdType[]) {
|
||||
return request<boolean>({
|
||||
url: `/${moduleName}/${businessName}/${${pkColumn.javaField}s.join(',')}`,
|
||||
method: 'delete'
|
||||
|
@ -3,6 +3,7 @@ import { computed, reactive, watch } from 'vue';
|
||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||
import { $t } from '@/locales';
|
||||
import { fetchCreate${BusinessName}, fetchUpdate${BusinessName} } from '@/service/api/${moduleName}/${businessName}';
|
||||
#if($dictList && $dictList.size() > 0)import { useDict } from '@/hooks/business/dict';#end
|
||||
|
||||
defineOptions({
|
||||
name: '${BusinessName}OperateDrawer'
|
||||
|
5
docs/template/modules/soy.search.vue.vm
vendored
5
docs/template/modules/soy.search.vue.vm
vendored
@ -3,6 +3,7 @@
|
||||
import { ref } from 'vue';
|
||||
import { $t } from '@/locales';
|
||||
import { useNaiveForm } from '@/hooks/common/form';
|
||||
#if($dictList && $dictList.size() > 0)import { useDict } from '@/hooks/business/dict';#end
|
||||
|
||||
defineOptions({
|
||||
name: '${BusinessName}Search'
|
||||
@ -27,14 +28,14 @@ const model = defineModel<Api.$ModuleName.${BusinessName}SearchParams>('model',
|
||||
|
||||
#if($dictList && $dictList.size() > 0)
|
||||
#foreach($dict in $dictList)
|
||||
const { options: ${dict.name}Options } = useDict(${dict.type}#if($dict.immediate), false#end);
|
||||
const { options: ${dict.name}Options } = useDict('${dict.type}#if($dict.immediate)', false#end);
|
||||
#end#end
|
||||
|
||||
async function reset() {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
const dateRange${AttrName}.value = undefined;
|
||||
dateRange${AttrName}.value = undefined;
|
||||
#end
|
||||
#end
|
||||
await restoreValidation();
|
||||
|
6
docs/template/soy.index.vue.vm
vendored
6
docs/template/soy.index.vue.vm
vendored
@ -26,8 +26,8 @@ const {
|
||||
} = useTable({
|
||||
apiFn: fetchGet${BusinessName}List,
|
||||
apiParams: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null
|
||||
// the value can not be undefined, otherwise the property in Form will not be reactive
|
||||
#foreach ($column in $columns)
|
||||
@ -109,7 +109,7 @@ async function handleDelete(#foreach($column in $columns)#if($column.isPk == '1'
|
||||
onDeleted();
|
||||
}
|
||||
|
||||
async function edit(id: CommonType.IdType) {
|
||||
async function edit(#foreach($column in $columns)#if($column.isPk == '1')$column.javaField#end#end: CommonType.IdType) {
|
||||
handleEdit('#foreach($column in $columns)#if($column.isPk == '1')$column.javaField#end#end', #foreach($column in $columns)#if($column.isPk == '1')$column.javaField#end#end);
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user