chore: 合并 develop 代码生成分支

This commit is contained in:
ray
2024-07-28 23:43:44 +08:00
50 changed files with 1659 additions and 220 deletions

View File

@@ -1,9 +1,50 @@
### 代码生成器配置
# 代码生成器配置
generator:
defaultConfig:
author: youlaitech
backendAppName: youlai-boot
frontendAppName: vue3-element-admin
## 模板配置
templateConfigs:
Controller:
## 模板路径
templatePath: templates/generator/controller.java.vm
## 包名
packageName: controller
templatePath: generator/controller.java.vm
packageName: controller
Service:
templatePath: generator/service.java.vm
packageName: service
ServiceImpl:
templatePath: generator/serviceImpl.java.vm
packageName: service.impl
Mapper:
templatePath: generator/mapper.java.vm
packageName: mapper
MapperXml:
templatePath: generator/mapper.xml.vm
packageName: mapper
extension: .xml
Converter:
templatePath: generator/converter.java.vm
packageName: converter
Query:
templatePath: generator/query.java.vm
packageName: model.query
Form:
templatePath: generator/form.java.vm
packageName: model.form
VO:
templatePath: generator/vo.java.vm
packageName: model.vo
Entity:
templatePath: generator/entity.java.vm
packageName: model.entity
API:
templatePath: generator/api.ts.vm
packageName: api
extension: .ts
VIEW:
templatePath: generator/index.vue.vm
packageName: views
extension: .vue

View File

@@ -24,7 +24,21 @@
CREATE_TIME DESC
</select>
<select id="getTableColumns" resultType="com.youlai.system.model.vo.TableColumnVO">
<select id="getTableMetadata" resultType="com.youlai.system.model.bo.TableMetaData">
SELECT
TABLE_NAME ,
TABLE_COMMENT ,
TABLE_COLLATION,
ENGINE,
CREATE_TIME
FROM
information_schema.tables
WHERE
TABLE_SCHEMA = (SELECT DATABASE())
AND TABLE_NAME = #{tableName}
</select>
<select id="getTableColumns" resultType="com.youlai.system.model.bo.ColumnMetaData">
SELECT
COLUMN_NAME,
DATA_TYPE,
@@ -40,4 +54,6 @@
TABLE_SCHEMA = (SELECT DATABASE())
AND TABLE_NAME = #{tableName}
</select>
</mapper>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.youlai.system.mapper.GenFieldConfigMapper">
</mapper>

View File

@@ -0,0 +1,93 @@
import request from "@/utils/request";
const ${entityName.toUpperCase()}_BASE_URL = "/api/v1/${entityName.toLowerCase()}s";
class ${entityName}API {
/** 获取${businessName}分页数据 */
static getPage(queryParams?: ${entityName}PageQuery) {
return request<any, PageResult<${entityName}PageVO[]>>({
url: `${${entityName.toUpperCase()}_BASE_URL}/page`,
method: "get",
params: queryParams,
});
}
/**
* 获取${businessName}表单数据
*
* @param id ${entityName}ID
* @returns ${entityName}表单数据
*/
static getFormData(id: number) {
return request<any, ${entityName}Form>({
url: `${${entityName.toUpperCase()}_BASE_URL}/${id}/form`,
method: "get",
});
}
/** 添加${businessName}*/
static add(data: ${entityName}Form) {
return request({
url: `${${entityName.toUpperCase()}_BASE_URL}`,
method: "post",
data: data,
});
}
/**
* 更新${businessName}
*
* @param id ${entityName}ID
* @param data ${entityName}表单数据
*/
static update(id: number, data: ${entityName}Form) {
return request({
url: `${${entityName.toUpperCase()}_BASE_URL}/${id}`,
method: "put",
data: data,
});
}
/**
* 批量删除${businessName},多个以英文逗号(,)分割
*
* @param ids ${businessName}ID字符串多个以英文逗号(,)分割
*/
static deleteByIds(ids: string) {
return request({
url: `${${entityName.toUpperCase()}_BASE_URL}/${ids}`,
method: "delete",
});
}
}
export default ${entityName}API;
/** $${businessName}分页查询参数 */
export interface ${entityName}PageQuery extends PageQuery {
/** 搜索关键字 */
keywords?: string;
}
/** ${businessName}表单对象 */
export interface ${entityName}Form {
#foreach($fieldConfig in $fieldConfigs)
#if($fieldConfig.isShowInForm)
#if("$!fieldConfig.fieldComment" != "")
/** ${fieldConfig.fieldComment} */
#end
${fieldConfig.fieldName}?: ${fieldConfig.tsType};
#end
#end
}
/** ${businessName}分页对象 */
export interface ${entityName}PageVO {
#foreach($fieldConfig in $fieldConfigs)
#if($fieldConfig.isShowInList)
#if("$!fieldConfig.fieldComment" != "")
/** ${fieldConfig.fieldComment} */
#end
${fieldConfig.fieldName}?: ${fieldConfig.tsType};
#end
#end
}

View File

@@ -17,12 +17,12 @@ import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
/**
* $!{tableComment} 前端控制
* $!{businessName}前端控制
*
* @author ${author}
* @since ${date}
*/
@Tag(name = "${tableComment}接口")
@Tag(name = "${businessName}接口")
@RestController
@RequestMapping("/api/v1/${lowerFirstEntityName}s")
@RequiredArgsConstructor
@@ -30,41 +30,41 @@ public class ${entityName}Controller {
private final ${entityName}Serivie ${lowerFirstEntityName}Service;
@Operation(summary = "$!{tableComment}分页列表")
@Operation(summary = "$!{businessName}分页列表")
@GetMapping("/page")
public PageResult<${entityName}PageVO> get${entityName}Page(${entityName}PageQuery queryParams ) {
IPage<${entityName}PageVO> result = ${lowerFirstEntityName}Service.get${entityName}Page(queryParams);
return PageResult.success(result);
}
@Operation(summary = "新增$!{tableComment}")
@Operation(summary = "新增${businessName}")
@PostMapping
public Result save${entityName}(@RequestBody @Valid ${entityName}Form formData ) {
boolean result = ${lowerFirstEntityName}Service.save${entityName}(formData);
return Result.judge(result);
}
@Operation(summary = "$!{tableComment}表单数据")
@Operation(summary = "获取${businessName}表单数据")
@GetMapping("/{id}/form")
public Result<${entityName}Form> get${entityName}Form(
@Parameter(description = "$!{tableComment}ID") @PathVariable Long id
@Parameter(description = "$!{businessName}ID") @PathVariable Long id
) {
${entityName}Form formData = ${lowerFirstEntityName}Service.get${entityName}FormData(id);
return Result.success(formData);
}
@Operation(summary = "修改$!{tableComment}")
@Operation(summary = "修改${businessName}")
@PutMapping(value = "/{id}")
public Result update${entityName}(@Parameter(description = "$!{tableComment}ID") @PathVariable Long id,
public Result update${entityName}(@Parameter(description = "$!{businessName}ID") @PathVariable Long id,
@RequestBody @Validated ${entityName}Form formData) {
boolean result = ${lowerFirstEntityName}Service.update${entityName}(id, formData);
return Result.judge(result);
}
@Operation(summary = "删除$!{tableComment}")
@Operation(summary = "删除${businessName}")
@DeleteMapping("/{ids}")
public Result delete${entityName}s(
@Parameter(description = "$!{tableComment}ID多个以英文逗号(,)分割") @PathVariable String ids
@Parameter(description = "$!{businessName}ID多个以英文逗号(,)分割") @PathVariable String ids
) {
boolean result = ${lowerFirstEntityName}Service.delete${entityName}s(ids);
return Result.judge(result);

View File

@@ -6,7 +6,7 @@ import ${package}.model.entity.${entityName};
import ${package}.model.form.${entityName}Form;
/**
* $!{tableComment}转换器
* $!{businessName}对象转换器
*
* @author ${author}
* @since ${date}

View File

@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.system.common.base.BaseEntity;
/**
* $!{tableComment}实体对象
* $!{businessName}实体对象
*
* @author ${author}
* @since ${date}

View File

@@ -1,4 +1,4 @@
package ${package}.model.form;
package ${package}.${subPackage};
import java.io.Serial;
import java.io.Serializable;
@@ -11,27 +11,41 @@ import java.time.LocalDateTime;
#if(${hasBigDecimal})
import java.math.BigDecimal;
#end
#if(${hasRequiredField})
import jakarta.validation.constraints.*;
#end
/**
* $!{tableComment} 表单对象
* $!{businessName}表单对象
*
* @author ${author}
* @since ${date}
*/
@Getter
@Setter
@Schema(description = "$!{tableComment}表单对象")
@Schema(description = "$!{businessName}表单对象")
public class ${entityName}Form implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
## ---------- BEGIN 字段循环遍历 ----------
#foreach($field in ${fields})
#if("$!field.comment" != "")
@Schema(description = "${field.comment}")
#if($fieldConfigs)
#foreach($fieldConfig in ${fieldConfigs})
#if($fieldConfig.isShowInForm)
#if($fieldConfig.isRequired)
#if($fieldConfig.fieldType == 'String')
@NotBlank(message = "$fieldConfig.fieldComment不能为空")
#else
@NotNull(message = "$fieldConfig.fieldComment不能为空")
#end
#end
#if("$!fieldConfig.fieldComment" != "")
@Schema(description = "${fieldConfig.fieldComment}")
#end
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
#end
#end
private ${field.propertyType} ${field.propertyName};
#end
}

View File

@@ -0,0 +1,278 @@
<template>
<div class="app-container">
<div class="search-container">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
#foreach($fieldConfig in $fieldConfigs)
#if($fieldConfig.isShowInQuery == 1)
<el-form-item :label="$fieldConfig.fieldComment" :key="$fieldConfig.fieldName">
#if($fieldConfig.formType == "INPUT")
<el-input v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable @keyup.enter="handleQuery" />
#elseif($fieldConfig.formType == "SELECT")
<el-select v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable>
<!-- 这里可以根据具体需求生成select options -->
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
</el-select>
#elseif($fieldConfig.formType == "RADIO")
<el-radio-group v-model="queryParams.$fieldConfig.fieldName">
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
</el-radio-group>
#elseif($fieldConfig.formType == "CHECK_BOX")
<el-checkbox-group v-model="queryParams.$fieldConfig.fieldName">
<el-checkbox v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-checkbox>
</el-checkbox-group>
#elseif($fieldConfig.formType == "INPUT_NUMBER")
<el-input-number v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" />
#elseif($fieldConfig.formType == "SWITCH")
<el-switch v-model="queryParams.$fieldConfig.fieldName" />
#elseif($fieldConfig.formType == "TEXT_AREA")
<el-input type="textarea" v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" />
#elseif($fieldConfig.formType == "DATE_TIME")
<el-date-picker v-model="queryParams.$fieldConfig.fieldName" type="datetime" :placeholder="$fieldConfig.fieldComment" />
#elseif($fieldConfig.formType == "DATE")
<el-date-picker v-model="queryParams.$fieldConfig.fieldName" type="date" :placeholder="$fieldConfig.fieldComment" />
#end
</el-form-item>
#end
#end
<el-form-item>
<el-button type="primary" @click="handleQuery"><i-ep-search />搜索</el-button>
<el-button @click="handleResetQuery"><i-ep-refresh />重置</el-button>
</el-form-item>
</el-form>
</div>
<el-card shadow="never" class="table-container">
<template #header>
<el-button type="success" @click="handleOpenDialog"><i-ep-plus />新增</el-button>
<el-button type="danger" :disabled="ids.length === 0" @click="handleDelete"><i-ep-delete />删除</el-button>
</template>
<el-table
ref="dataTableRef"
v-loading="loading"
:data="pageData"
highlight-current-row
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
#foreach($fieldConfig in $fieldConfigs)
#if($fieldConfig.isShowInList == 1)
<el-table-column
:key="$fieldConfig.fieldName"
:label="$fieldConfig.fieldComment"
:prop="$fieldConfig.fieldName"
min-width="100"
/>
#end
#end
<el-table-column fixed="right" label="操作" width="220">
<template #default="scope">
<el-button type="primary" size="small" link @click="handleOpenDialog(scope.row.id)"><i-ep-edit />编辑</el-button>
<el-button type="danger" size="small" link @click="handleDelete(scope.row.id)"><i-ep-delete />删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-if="total > 0"
v-model:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="handleQuery"
/>
</el-card>
<!-- $!{businessName}表单弹窗 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" @close="handleCloseDialog">
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="100px">
#foreach($fieldConfig in $fieldConfigs)
#if($fieldConfig.isShowInForm == 1)
<el-form-item :label="$fieldConfig.fieldComment" :key="$fieldConfig.fieldName">
#if($fieldConfig.formType == "INPUT")
<el-input v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
#elseif($fieldConfig.formType == "SELECT")
<el-select v-model="formData.$fieldConfig.fieldName" :placeholder="'请选择$fieldConfig.fieldComment">
<!-- 这里可以根据具体需求生成select options -->
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
</el-select>
#elseif($fieldConfig.formType == "RADIO")
<el-radio-group v-model="formData.$fieldConfig.fieldName">
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
</el-radio-group>
#elseif($fieldConfig.formType == "CHECK_BOX")
<el-checkbox-group v-model="formData.$fieldConfig.fieldName">
<el-checkbox v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-checkbox>
</el-checkbox-group>
#elseif($fieldConfig.formType == "INPUT_NUMBER")
<el-input-number v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
#elseif($fieldConfig.formType == "SWITCH")
<el-switch v-model="formData.$fieldConfig.fieldName" />
#elseif($fieldConfig.formType == "TEXT_AREA")
<el-input type="textarea" v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
#elseif($fieldConfig.formType == "DATE_TIME")
<el-date-picker v-model="formData.$fieldConfig.fieldName" type="datetime" :placeholder="'请选择$fieldConfig.fieldComment" />
#elseif($fieldConfig.formType == "DATE")
<el-date-picker v-model="formData.$fieldConfig.fieldName" type="date" :placeholder="'请选择$fieldConfig.fieldComment" />
#end
</el-form-item>
#end
#end
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleSubmit">确定</el-button>
<el-button @click="handleCloseDialog">取消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
defineOptions({
name: "${entityName}",
inheritAttrs: false,
});
import ${entityName}API, { ${entityName}PageVO, ${entityName}Form, ${entityName}PageQuery } from "@/api/${lowerFirstEntityName}";
const queryFormRef = ref(null);
const dataFormRef = ref(null);
const loading = ref(false);
const ids = ref<number[]>([]);
const total = ref(0);
const queryParams = reactive<RolePageQuery>({
pageNum: 1,
pageSize: 10,
keywords: '',
name: '',
code: '',
});
// $!{businessName}表格数据
const pageData = ref<RolePageVO[]>([]);
// 弹窗
const dialog = reactive({
title: "",
visible: false,
});
// $!{businessName}表单
const formData = reactive<RoleForm>({
keywords: '',
name: '',
code: '',
});
const rules = reactive({
name: [{ required: true, message: "请输入$!{businessName}名称", trigger: "blur" }],
code: [{ required: true, message: "请输入$!{businessName}编码", trigger: "blur" }],
});
/** 查询$!{businessName} */
function handleQuery() {
loading.value = true;
${entityName}API.getPage(queryParams)
.then((data) => {
pageData.value = data.list;
total.value = data.total;
})
.finally(() => {
loading.value = false;
});
}
/** 重置$!{businessName}查询 */
function handleResetQuery() {
queryFormRef.value.resetFields();
queryParams.pageNum = 1;
handleQuery();
}
/** 行复选框选中记录选中ID集合 */
function handleSelectionChange(selection: any) {
ids.value = selection.map((item: any) => item.id);
}
/** 打开$!{businessName}弹窗 */
function handleOpenDialog(id?: number) {
dialog.visible = true;
if (id) {
dialog.title = "修改$!{businessName}";
${entityName}API.getFormData(id).then((data) => {
Object.assign(formData, data);
});
} else {
dialog.title = "新增$!{businessName}";
}
}
/** 提交$!{businessName}表单 */
function handleSubmit() {
dataFormRef.value.validate((valid: any) => {
if (valid) {
loading.value = true;
const id = formData.id;
if (id) {
${entityName}API.update(id, formData)
.then(() => {
ElMessage.success("修改成功");
handleCloseDialog();
handleResetQuery();
})
.finally(() => (loading.value = false));
} else {
${entityName}API.add(formData)
.then(() => {
ElMessage.success("新增成功");
handleCloseDialog();
handleResetQuery();
})
.finally(() => (loading.value = false));
}
}
});
}
/** 关闭$!{businessName}弹窗 */
function handleCloseDialog() {
dialog.visible = false;
dataFormRef.value.resetFields();
dataFormRef.value.clearValidate();
formData.id = undefined;
}
/** 删除$!{businessName} */
function handleDelete(id?: number) {
const ids = [id || ids.value].join(",");
if (!ids) {
ElMessage.warning("请勾选删除项");
return;
}
ElMessageBox.confirm("确认删除已选中的数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(
() => {
loading.value = true;
${entityName}API.deleteByIds(ids)
.then(() => {
ElMessage.success("删除成功");
handleResetQuery();
})
.finally(() => (loading.value = false));
},
() => {
ElMessage.info("已取消删除");
}
);
}
onMounted(() => {
handleQuery();
});
</script>

View File

@@ -7,7 +7,7 @@ import ${package}.model.query.${entityName}Query;
import org.apache.ibatis.annotations.Mapper;
/**
* $!{tableComment} 数据库访问层
* $!{businessName}Mapper接口
*
* @author ${author}
* @since ${date}
@@ -16,7 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
/**
* 获取$!{tableComment}分页数据
* 获取${businessName}分页数据
*
* @param page 分页对象
* @param queryParams 查询参数

View File

@@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${package}.mapper.${entityName}Mapper">
<!-- 获取${tableComment}分页列表 -->
<select id="listPaged${entityName}s" resultType="${package}.model.entity.${entityName}">
<!-- 获取${businessName}分页列表 -->
<select id="get${entityName}Page" resultType="${package}.model.vo.${entityName}VO">
SELECT
*
FROM

View File

@@ -11,24 +11,26 @@ import java.time.LocalDateTime;
import java.math.BigDecimal;
#end
/**
* $!{tableComment}分页查询对象
* $!{businessName}分页查询对象
*
* @author ${author}
* @since ${date}
*/
@Schema(description ="$!{tableComment}分页查询对象")
@Schema(description ="$!{businessName}查询对象")
@Getter
@Setter
public class ${entityName}Query extends BasePageQuery {
private static final long serialVersionUID = 1L;
#foreach($field in ${fields})
#if("$!field.comment" != "")
@Schema(description = "${field.comment}")
#if($fieldConfigs)
#foreach($fieldConfig in ${fieldConfigs})
#if($fieldConfig.isShowInQuery)
#if("$!fieldConfig.fieldComment" != "")
@Schema(description = "${fieldConfig.fieldComment}")
#end
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
#end
#end
private ${field.propertyType} ${field.propertyName};
#end
}

View File

@@ -6,54 +6,51 @@ import ${package}.model.query.${entityName}PageQuery;
import ${package}.model.vo.${entityName}PageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* $!{tableComment} 服务类
* $!{businessName}服务类
*
* @author ${author}
* @since ${date}
*/
public interface ${entityName}Service extends IService<${entityName}> {
/**
*$!{tableComment}分页列表
*$!{businessName}分页列表
*
* @return
*/
IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams);
/**
* 获取$!{tableComment}表单数据
* 获取${businessName}表单数据
*
* @param id $!{tableComment}ID
* @param id $!{businessName}ID
* @return
*/
${entityName}Form get${entityName}FormData(Long id);
/**
* 新增$!{tableComment}
* 新增${businessName}
*
* @param formData $!{tableComment}表单对象
* @param formData $!{businessName}表单对象
* @return
*/
boolean save${entityName}(${entityName}Form formData);
/**
* 修改$!{tableComment}
* 修改${businessName}
*
* @param id $!{tableComment}ID
* @param formData $!{tableComment}表单对象
* @param id $!{businessName}ID
* @param formData $!{businessName}表单对象
* @return
*/
boolean update${entityName}(Long id, ${entityName}Form formData);
/**
* 删除$!{tableComment}
* 删除${businessName}
*
* @param ids $!{tableComment}ID多个以英文逗号(,)分割
* @param ids $!{businessName}ID多个以英文逗号(,)分割
* @return
*/
boolean delete${entityName}s(String ids);

View File

@@ -21,22 +21,22 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
/**
* $!{tableComment}服务实现类
* $!{businessName}服务实现类
*
* @author ${author}
* @since ${date}
*/
@Service
@RequiredArgsConstructor
public class ${table.serviceImplName} extends ServiceImpl<${entityName}Mapper, ${entityName}> implements ${entityName}Service {
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements ${entityName}Service {
private final ${entityName}Converter ${lowerFirstEntityName}Converter;
/**
* 获取$!{tableComment}分页列表
* 获取${businessName}分页列表
*
* @param queryParams 查询参数
* @return {@link IPage<${entityName}PageVO>} $!{tableComment}分页列表
* @return {@link IPage<${entityName}PageVO>} $!{businessName}分页列表
*/
@Override
public IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams) {
@@ -48,9 +48,9 @@ public class ${table.serviceImplName} extends ServiceImpl<${entityName}Mapper, $
}
/**
* 获取$!{tableComment}表单数据
* 获取${businessName}表单数据
*
* @param id $!{tableComment}ID
* @param id $!{businessName}ID
* @return
*/
@Override
@@ -60,9 +60,9 @@ public class ${table.serviceImplName} extends ServiceImpl<${entityName}Mapper, $
}
/**
* 新增$!{tableComment}
* 新增${businessName}
*
* @param formData $!{tableComment}表单对象
* @param formData $!{businessName}表单对象
* @return
*/
@Override
@@ -72,10 +72,10 @@ public class ${table.serviceImplName} extends ServiceImpl<${entityName}Mapper, $
}
/**
* 更新$!{tableComment}
* 更新${businessName}
*
* @param id $!{tableComment}ID
* @param formData $!{tableComment}表单对象
* @param id $!{businessName}ID
* @param formData $!{businessName}表单对象
* @return
*/
@Override
@@ -85,14 +85,14 @@ public class ${table.serviceImplName} extends ServiceImpl<${entityName}Mapper, $
}
/**
* 删除$!{tableComment}
* 删除${businessName}
*
* @param ids $!{tableComment}ID多个以英文逗号(,)分割
* @return true|false
* @param ids $!{businessName}ID多个以英文逗号(,)分割
* @return
*/
@Override
public boolean delete${entityName}s(String ids) {
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的$!{tableComment}数据为空");
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的${businessName}数据为空");
// 逻辑删除
List<Long> idList = Arrays.stream(ids.split(","))
.map(Long::parseLong)

View File

@@ -14,24 +14,27 @@ import java.math.BigDecimal;
#end
/**
* $!{tableComment} 图对象
* $!{businessName}视图对象
*
* @author ${author}
* @since ${date}
*/
@Getter
@Setter
@Schema( description = "$!{tableComment}视图对象")
@Schema( description = "$!{businessName}视图对象")
public class ${entityName}VO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
#foreach($field in ${fields})
#if("$!field.comment" != "")
@Schema(description = "${field.comment}")
#if($fieldConfigs)
#foreach($fieldConfig in ${fieldConfigs})
#if($fieldConfig.isShowInList)
#if("$!fieldConfig.fieldComment" != "")
@Schema(description = "${fieldConfig.fieldComment}")
#end
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
#end
#end
private ${field.propertyType} ${field.propertyName};
#end
}