diff --git a/src/main/resources/templates/codegen/api.ts.vm b/src/main/resources/templates/codegen/api.ts.vm index 1e2e6c97..daaf4a99 100644 --- a/src/main/resources/templates/codegen/api.ts.vm +++ b/src/main/resources/templates/codegen/api.ts.vm @@ -3,7 +3,7 @@ import request from "@/utils/request"; const ${entityName.toUpperCase()}_BASE_URL = "/api/v1/${lowerFirstEntityName}s"; const ${entityName}API = { - /** 获取${businessName}分页数据 */ + /** 获取${businessName.trim()}分页数据 */ getPage(queryParams?: ${entityName}PageQuery) { return request>({ url: `${${entityName.toUpperCase()}_BASE_URL}/page`, @@ -12,7 +12,7 @@ const ${entityName}API = { }); }, /** - * 获取${businessName}表单数据 + * 获取${businessName.trim()}表单数据 * * @param id ${entityName}ID * @returns ${entityName}表单数据 @@ -24,7 +24,7 @@ const ${entityName}API = { }); }, - /** 添加${businessName}*/ + /** 添加${businessName.trim()}*/ add(data: ${entityName}Form) { return request({ url: `${${entityName.toUpperCase()}_BASE_URL}`, @@ -34,7 +34,7 @@ const ${entityName}API = { }, /** - * 更新${businessName} + * 更新${businessName.trim()} * * @param id ${entityName}ID * @param data ${entityName}表单数据 @@ -48,9 +48,9 @@ const ${entityName}API = { }, /** - * 批量删除${businessName},多个以英文逗号(,)分割 + * 批量删除${businessName.trim()},多个以英文逗号(,)分割 * - * @param ids ${businessName}ID字符串,多个以英文逗号(,)分割 + * @param ids ${businessName.trim()}ID字符串,多个以英文逗号(,)分割 */ deleteByIds(ids: string) { return request({ @@ -62,7 +62,7 @@ const ${entityName}API = { export default ${entityName}API; -/** ${businessName}分页查询参数 */ +/** ${businessName.trim()}分页查询参数 */ export interface ${entityName}PageQuery extends PageQuery { #foreach($fieldConfig in $fieldConfigs) #if($fieldConfig.isShowInQuery) @@ -82,7 +82,7 @@ export interface ${entityName}PageQuery extends PageQuery { #end } -/** ${businessName}表单对象 */ +/** ${businessName.trim()}表单对象 */ export interface ${entityName}Form { #foreach($fieldConfig in $fieldConfigs) #if($fieldConfig.isShowInForm) @@ -94,7 +94,7 @@ export interface ${entityName}Form { #end } -/** ${businessName}分页对象 */ +/** ${businessName.trim()}分页对象 */ export interface ${entityName}PageVO { #foreach($fieldConfig in $fieldConfigs) #if($fieldConfig.isShowInList) diff --git a/src/main/resources/templates/codegen/controller.java.vm b/src/main/resources/templates/codegen/controller.java.vm index 792db37a..c19b6bed 100644 --- a/src/main/resources/templates/codegen/controller.java.vm +++ b/src/main/resources/templates/codegen/controller.java.vm @@ -19,12 +19,12 @@ import org.springframework.web.bind.annotation.*; import jakarta.validation.Valid; /** - * $!{businessName}前端控制层 + * $!{businessName.trim()}前端控制层 * * @author ${author} * @since ${date} */ -@Tag(name = "${businessName}接口") +@Tag(name = "${businessName.trim()}接口") @RestController @RequestMapping("/api/v1/${lowerFirstEntityName}s") @RequiredArgsConstructor @@ -32,7 +32,7 @@ public class ${entityName}Controller { private final ${entityName}Service ${lowerFirstEntityName}Service; - @Operation(summary = "$!{businessName}分页列表") + @Operation(summary = "$!{businessName.trim()}分页列表") @GetMapping("/page") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:query')") public PageResult<${entityName}VO> get${entityName}Page(${entityName}Query queryParams ) { @@ -40,7 +40,7 @@ public class ${entityName}Controller { return PageResult.success(result); } - @Operation(summary = "新增${businessName}") + @Operation(summary = "新增${businessName.trim()}") @PostMapping @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:add')") public Result save${entityName}(@RequestBody @Valid ${entityName}Form formData ) { @@ -48,32 +48,32 @@ public class ${entityName}Controller { return Result.judge(result); } - @Operation(summary = "获取${businessName}表单数据") + @Operation(summary = "获取${businessName.trim()}表单数据") @GetMapping("/{id}/form") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:edit')") public Result<${entityName}Form> get${entityName}Form( - @Parameter(description = "$!{businessName}ID") @PathVariable Long id + @Parameter(description = "$!{businessName.trim()}ID") @PathVariable Long id ) { ${entityName}Form formData = ${lowerFirstEntityName}Service.get${entityName}FormData(id); return Result.success(formData); } - @Operation(summary = "修改${businessName}") + @Operation(summary = "修改${businessName.trim()}") @PutMapping(value = "/{id}") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:edit')") public Result update${entityName}( - @Parameter(description = "$!{businessName}ID") @PathVariable Long id, + @Parameter(description = "$!{businessName.trim()}ID") @PathVariable Long id, @RequestBody @Validated ${entityName}Form formData ) { boolean result = ${lowerFirstEntityName}Service.update${entityName}(id, formData); return Result.judge(result); } - @Operation(summary = "删除${businessName}") + @Operation(summary = "删除${businessName.trim()}") @DeleteMapping("/{ids}") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:delete')") public Result delete${entityName}s( - @Parameter(description = "$!{businessName}ID,多个以英文逗号(,)分割") @PathVariable String ids + @Parameter(description = "$!{businessName.trim()}ID,多个以英文逗号(,)分割") @PathVariable String ids ) { boolean result = ${lowerFirstEntityName}Service.delete${entityName}s(ids); return Result.judge(result); diff --git a/src/main/resources/templates/codegen/converter.java.vm b/src/main/resources/templates/codegen/converter.java.vm index b56f6234..92430c0d 100644 --- a/src/main/resources/templates/codegen/converter.java.vm +++ b/src/main/resources/templates/codegen/converter.java.vm @@ -6,7 +6,7 @@ import ${packageName}.${moduleName}.model.entity.${entityName}; import ${packageName}.${moduleName}.model.form.${entityName}Form; /** - * $!{businessName}对象转换器 + * $!{businessName.trim()}对象转换器 * * @author ${author} * @since ${date} diff --git a/src/main/resources/templates/codegen/entity.java.vm b/src/main/resources/templates/codegen/entity.java.vm index 2f6b2cbf..c5faa81f 100644 --- a/src/main/resources/templates/codegen/entity.java.vm +++ b/src/main/resources/templates/codegen/entity.java.vm @@ -12,14 +12,14 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.youlai.boot.common.base.BaseEntity; /** - * $!{businessName}实体对象 + * $!{businessName.trim()}实体对象 * * @author ${author} * @since ${date} */ @Getter @Setter -@TableName("${tableName}") +@TableName("${tableName.trim()}") public class ${entityName} extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/src/main/resources/templates/codegen/form.java.vm b/src/main/resources/templates/codegen/form.java.vm index e2c07377..54a6cdb8 100644 --- a/src/main/resources/templates/codegen/form.java.vm +++ b/src/main/resources/templates/codegen/form.java.vm @@ -16,14 +16,14 @@ import jakarta.validation.constraints.*; #end /** - * $!{businessName}表单对象 + * $!{businessName.trim()}表单对象 * * @author ${author} * @since ${date} */ @Getter @Setter -@Schema(description = "$!{businessName}表单对象") +@Schema(description = "$!{businessName.trim()}表单对象") public class ${entityName}Form implements Serializable { @Serial diff --git a/src/main/resources/templates/codegen/index.vue.vm b/src/main/resources/templates/codegen/index.vue.vm index 8a486510..7bdb64b8 100644 --- a/src/main/resources/templates/codegen/index.vue.vm +++ b/src/main/resources/templates/codegen/index.vue.vm @@ -169,7 +169,7 @@ /> - + ([]); // 弹窗 @@ -279,10 +279,10 @@ visible: false, }); - // $!{businessName}表单数据 + // $!{businessName.trim()}表单数据 const formData = reactive<${entityName}Form>({}); - // $!{businessName}表单校验规则 + // $!{businessName.trim()}表单校验规则 const rules = reactive({ #if($fieldConfigs) #foreach($fieldConfig in ${fieldConfigs}) @@ -293,7 +293,7 @@ #end }); - /** 查询$!{businessName} */ + /** 查询$!{businessName.trim()} */ function handleQuery() { loading.value = true; ${entityName}API.getPage(queryParams) @@ -306,7 +306,7 @@ }); } - /** 重置$!{businessName}查询 */ + /** 重置$!{businessName.trim()}查询 */ function handleResetQuery() { queryFormRef.value!.resetFields(); queryParams.pageNum = 1; @@ -318,20 +318,20 @@ removeIds.value = selection.map((item: any) => item.id); } - /** 打开$!{businessName}弹窗 */ + /** 打开$!{businessName.trim()}弹窗 */ function handleOpenDialog(id?: number) { dialog.visible = true; if (id) { - dialog.title = "修改$!{businessName}"; + dialog.title = "修改$!{businessName.trim()}"; ${entityName}API.getFormData(id).then((data) => { Object.assign(formData, data); }); } else { - dialog.title = "新增$!{businessName}"; + dialog.title = "新增$!{businessName.trim()}"; } } - /** 提交$!{businessName}表单 */ + /** 提交$!{businessName.trim()}表单 */ function handleSubmit() { dataFormRef.value.validate((valid: any) => { if (valid) { @@ -358,7 +358,7 @@ }); } - /** 关闭$!{businessName}弹窗 */ + /** 关闭$!{businessName.trim()}弹窗 */ function handleCloseDialog() { dialog.visible = false; dataFormRef.value.resetFields(); @@ -366,7 +366,7 @@ formData.id = undefined; } - /** 删除$!{businessName} */ + /** 删除$!{businessName.trim()} */ function handleDelete(id?: number) { const ids = [id || removeIds.value].join(","); if (!ids) { diff --git a/src/main/resources/templates/codegen/mapper.java.vm b/src/main/resources/templates/codegen/mapper.java.vm index ca4eedd8..ef330027 100644 --- a/src/main/resources/templates/codegen/mapper.java.vm +++ b/src/main/resources/templates/codegen/mapper.java.vm @@ -8,7 +8,7 @@ import ${packageName}.${moduleName}.model.vo.${entityName}VO; import org.apache.ibatis.annotations.Mapper; /** - * $!{businessName}Mapper接口 + * $!{businessName.trim()}Mapper接口 * * @author ${author} * @since ${date} @@ -17,7 +17,7 @@ import org.apache.ibatis.annotations.Mapper; public interface ${entityName}Mapper extends BaseMapper<${entityName}> { /** - * 获取${businessName}分页数据 + * 获取${businessName.trim()}分页数据 * * @param page 分页对象 * @param queryParams 查询参数 diff --git a/src/main/resources/templates/codegen/mapper.xml.vm b/src/main/resources/templates/codegen/mapper.xml.vm index f690e0ee..63e3254a 100644 --- a/src/main/resources/templates/codegen/mapper.xml.vm +++ b/src/main/resources/templates/codegen/mapper.xml.vm @@ -2,7 +2,7 @@ - +