Skip to content

Commit

Permalink
chore: 优化代码生成模板
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Nov 4, 2024
1 parent e0e157f commit 90e3bc0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ public class InnerGenConfigDO extends GenConfigDO {
*/
private boolean hasBigDecimalField;

/**
* 是否包含 List 字段
*/
private boolean hasListField;

/**
* 是否包含 Time 包字段
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,6 @@ private void pretreatment(InnerGenConfigDO genConfig) {
if (TIME_PACKAGE_CLASS.contains(fieldType)) {
genConfig.setHasTimeField(true);
}
QueryTypeEnum queryType = fieldConfig.getQueryType();
if (null != queryType && StrUtil.equalsAny(queryType.name(), QueryTypeEnum.IN.name(), QueryTypeEnum.NOT_IN
.name(), QueryTypeEnum.BETWEEN.name())) {
genConfig.setHasListField(true);
}
// 字典码
if (StrUtil.isNotBlank(fieldConfig.getDictCode())) {
genConfig.setHasDictField(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import java.time.*;
<#if hasBigDecimalField>
import java.math.BigDecimal;
</#if>
<#if hasListField>
import java.util.List;
</#if>

import lombok.Data;

Expand Down Expand Up @@ -41,7 +38,7 @@ public class ${className} implements Serializable {
@Schema(description = "${fieldConfig.comment}")
@Query(type = QueryType.${fieldConfig.queryType})
<#if fieldConfig.queryType = 'IN' || fieldConfig.queryType = 'NOT_IN' || fieldConfig.queryType = 'BETWEEN'>
private List<${fieldConfig.fieldType}> ${fieldConfig.fieldName};
private ${fieldConfig.fieldType}[] ${fieldConfig.fieldName};
<#else>
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
</#if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ const { <#list dictCodes as dictCode>${dictCode}<#if dictCode_has_next>,</#if></
const options: Options = {
form: {},
col: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },
btns: { hide: true }
}
const columns: Columns = reactive([
const { form, resetForm } = useForm({
// todo 待补充
})
const columns = computed<Columns<typeof form>>(() => [
<#list fieldConfigs as fieldConfig>
<#if fieldConfig.showInForm>
{
Expand Down Expand Up @@ -79,10 +82,6 @@ const columns: Columns = reactive([
</#list>
])
const { form, resetForm } = useForm({
// todo 待补充
})
// 重置
const reset = () => {
formRef.value?.formRef?.resetFields()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@
</#list>
<template #action="{ record }">
<a-space>
<a-link v-permission="['${apiModuleName}:${apiName}:list']" @click="onDetail(record)">查看</a-link>
<a-link v-permission="['${apiModuleName}:${apiName}:update']" @click="onUpdate(record)">修改</a-link>
<a-link v-permission="['${apiModuleName}:${apiName}:list']" title="查看" @click="onDetail(record)">查看</a-link>
<a-link v-permission="['${apiModuleName}:${apiName}:update']" title="修改" @click="onUpdate(record)">修改</a-link>
<a-link
v-permission="['${apiModuleName}:${apiName}:delete']"
status="danger"
:disabled="record.disabled"
title="删除"
@click="onDelete(record)"
>
删除
Expand Down

0 comments on commit 90e3bc0

Please sign in to comment.