🐛 生成字段丢失
This commit is contained in:
parent
11b20ba6f5
commit
f95dc4d947
|
@ -52,17 +52,14 @@ public class VmsServiceImpl implements VmsService {
|
||||||
String sql = dto.getSql();
|
String sql = dto.getSql();
|
||||||
|
|
||||||
// 表格属性名 和 列信息
|
// 表格属性名 和 列信息
|
||||||
TableMetaData tableMetaData;
|
TableMetaData tableMetaData = StringUtils.hasText(dto.getSql())
|
||||||
List<ColumnMetaData> columnInfoList;
|
? sqlParserDatabaseInfo.getTableMetadata(dto.getSql())
|
||||||
|
: databaseInfoCore.getTableMetadata(dto.getTableName());
|
||||||
|
|
||||||
|
List<ColumnMetaData> columnInfoList = StringUtils.hasText(sql)
|
||||||
|
? sqlParserDatabaseInfo.tableColumnInfo(sql)
|
||||||
|
: databaseInfoCore.tableColumnInfo(tableName).stream().distinct().toList();
|
||||||
|
|
||||||
// 判断是否有 SQL 如果有SQL 优先解析并生成SQL相关内容
|
|
||||||
if (StringUtils.hasText(sql)) {
|
|
||||||
tableMetaData = sqlParserDatabaseInfo.getTableMetadata(sql);
|
|
||||||
columnInfoList = sqlParserDatabaseInfo.tableColumnInfo(sql);
|
|
||||||
} else {
|
|
||||||
tableMetaData = databaseInfoCore.getTableMetadata(tableName);
|
|
||||||
columnInfoList = databaseInfoCore.tableColumnInfo(tableName).stream().distinct().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return dto.getPath().stream().map(path -> {
|
return dto.getPath().stream().map(path -> {
|
||||||
// 生成模板
|
// 生成模板
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class ${classUppercaseName}Controller {
|
||||||
@Resource
|
@Resource
|
||||||
private ${classUppercaseName}Service ${classLowercaseName}Service;
|
private ${classUppercaseName}Service ${classLowercaseName}Service;
|
||||||
|
|
||||||
@Operation(summary = "分页查询${comment}", description = "分页${comment}", tags = "${classLowercaseName}::query")
|
@Operation(summary = "分页查询${comment}" , description = "分页${comment}" )
|
||||||
@GetMapping("{page}/{limit}" )
|
@GetMapping("{page}/{limit}" )
|
||||||
public Result<PageResult<${classUppercaseName}Vo>> get${classUppercaseName}Page(
|
public Result<PageResult<${classUppercaseName}Vo>> get${classUppercaseName}Page(
|
||||||
@Parameter(name = "page" , description = "当前页" , required = true)
|
@Parameter(name = "page" , description = "当前页" , required = true)
|
||||||
|
@ -42,21 +42,21 @@ public class ${classUppercaseName}Controller {
|
||||||
return Result.success(pageResult);
|
return Result.success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "添加${comment}", description = "添加${comment}", tags = "${classLowercaseName}::add")
|
@Operation(summary = "添加${comment}" , description = "添加${comment}" )
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public Result<String> add${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}AddDto dto) {
|
public Result<String> add${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}to dto) {
|
||||||
${classLowercaseName}Service.add${classUppercaseName}(dto);
|
${classLowercaseName}Service.add${classUppercaseName}(dto);
|
||||||
return Result.success(ResultCodeEnum.ADD_SUCCESS);
|
return Result.success(ResultCodeEnum.ADD_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "更新${comment}", description = "更新${comment}", tags = "${classLowercaseName}::update")
|
@Operation(summary = "更新${comment}" , description = "更新${comment}" )
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public Result<String> update${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}UpdateDto dto) {
|
public Result<String> update${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}Dto dto) {
|
||||||
${classLowercaseName}Service.update${classUppercaseName}(dto);
|
${classLowercaseName}Service.update${classUppercaseName}(dto);
|
||||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除${comment}", description = "删除${comment}", tags = "${classLowercaseName}::delete")
|
@Operation(summary = "删除${comment}" , description = "删除${comment}" )
|
||||||
@DeleteMapping()
|
@DeleteMapping()
|
||||||
public Result<String> delete${classUppercaseName}(@RequestBody List<Long> ids) {
|
public Result<String> delete${classUppercaseName}(@RequestBody List<Long> ids) {
|
||||||
${classLowercaseName}Service.delete${classUppercaseName}(ids);
|
${classLowercaseName}Service.delete${classUppercaseName}(ids);
|
||||||
|
|
|
@ -27,10 +27,4 @@ public interface ${classUppercaseName}Mapper extends BaseMapper<${classUppercase
|
||||||
*/
|
*/
|
||||||
IPage<${classUppercaseName}Vo> selectListByPage(@Param("page" ) Page<${classUppercaseName}> pageParams, @Param("dto" ) ${classUppercaseName}Dto dto);
|
IPage<${classUppercaseName}Vo> selectListByPage(@Param("page" ) Page<${classUppercaseName}> pageParams, @Param("dto" ) ${classUppercaseName}Dto dto);
|
||||||
|
|
||||||
/**
|
|
||||||
* 物理删除${comment}
|
|
||||||
*
|
|
||||||
* @param ids 删除 id 列表
|
|
||||||
*/
|
|
||||||
void deleteBatchIdsWithPhysics(List<Long> ids);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,4 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 物理删除${comment} -->
|
|
||||||
<delete id="deleteBatchIdsWithPhysics">
|
|
||||||
delete from ${tableName}
|
|
||||||
where id in
|
|
||||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function onAdd() {
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
#foreach($item in $columnInfoList)
|
#foreach($item in $columnInfoList)
|
||||||
$!{item.fieldName}: undefined,
|
$!{item.columnName}: undefined,
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -53,7 +53,7 @@ export function onUpdate(row: any) {
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
#foreach($item in $columnInfoList)
|
#foreach($item in $columnInfoList)
|
||||||
$!{item.fieldName}: row.$!{item.fieldName},
|
$!{item.columnName}: row.$!{item.fieldName},
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,7 +16,7 @@ export const use${classUppercaseName}Store = defineStore('${lowercaseName}Store'
|
||||||
form: {
|
form: {
|
||||||
#foreach($item in $columnInfoList)
|
#foreach($item in $columnInfoList)
|
||||||
// $!{item.comment}
|
// $!{item.comment}
|
||||||
$!{item.fieldName}: undefined,
|
$!{item.columnName}: undefined,
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
// 分页查询结果
|
// 分页查询结果
|
||||||
|
|
|
@ -3,9 +3,9 @@ export interface FormItemProps {
|
||||||
#foreach($field in $columnInfoList)
|
#foreach($field in $columnInfoList)
|
||||||
// $field.comment
|
// $field.comment
|
||||||
#if($field.javascriptType == "object")
|
#if($field.javascriptType == "object")
|
||||||
$field.fieldName: any
|
$field.columnName: any
|
||||||
#else
|
#else
|
||||||
$field.fieldName: $field.javascriptType
|
$field.columnName: $field.javascriptType
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue