feat: 完成生成文本修改
This commit is contained in:
parent
51515d2d5f
commit
06f458bec2
|
@ -23,6 +23,9 @@ public class ColumnMetaData {
|
||||||
/* Java类型 */
|
/* Java类型 */
|
||||||
private String javaType;
|
private String javaType;
|
||||||
|
|
||||||
|
/* Javascript类型 */
|
||||||
|
private String javascriptType;
|
||||||
|
|
||||||
/* 是否为主键 */
|
/* 是否为主键 */
|
||||||
private Boolean isPrimaryKey;
|
private Boolean isPrimaryKey;
|
||||||
|
|
||||||
|
|
|
@ -30,30 +30,41 @@ public class VmsServiceImpl implements VmsService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GeneratorVo> generator(VmsArgumentDto dto) {
|
public List<GeneratorVo> generator(VmsArgumentDto dto) {
|
||||||
|
String tableName = dto.getTableName();
|
||||||
|
|
||||||
return dto.getPath().stream().map(path -> {
|
return dto.getPath().stream().map(path -> {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
|
|
||||||
String vmsPath = "vms/" + path + ".vm";
|
// 表格属性名 和 列信息
|
||||||
String tableName = dto.getTableName();
|
|
||||||
|
|
||||||
TableInfoVo tableMetaData = tableService.getTableMetaData(tableName);
|
TableInfoVo tableMetaData = tableService.getTableMetaData(tableName);
|
||||||
List<ColumnMetaData> columnInfo = tableService.getColumnInfo(tableName);
|
List<ColumnMetaData> columnInfoList = tableService.getColumnInfo(tableName);
|
||||||
|
List<String> list = columnInfoList.stream().map(ColumnMetaData::getColumnName).toList();
|
||||||
|
|
||||||
|
// 添加要生成的属性
|
||||||
VelocityContext context = new VelocityContext();
|
VelocityContext context = new VelocityContext();
|
||||||
context.put("tableName", tableMetaData.getComment());
|
|
||||||
context.put("package", dto.getPackageName());
|
|
||||||
context.put("columnInfo", columnInfo);
|
|
||||||
|
|
||||||
// VmsUtil.commonVms(writer, context, "vms/server/controller.vm", dto);
|
// 当前的表名
|
||||||
VmsUtil.commonVms(writer, context, vmsPath, dto);
|
context.put("tableName", tableMetaData.getTableName());
|
||||||
String code = writer.toString();
|
|
||||||
|
// 表字段的注释内容
|
||||||
|
context.put("comment", tableMetaData.getComment());
|
||||||
|
|
||||||
|
// 设置包名称
|
||||||
|
context.put("package", dto.getPackageName());
|
||||||
|
|
||||||
|
// 当前表的列信息
|
||||||
|
context.put("columnInfoList", columnInfoList);
|
||||||
|
|
||||||
|
// 数据库sql列
|
||||||
|
context.put("baseColumnList", String.join(",", list));
|
||||||
|
|
||||||
|
VmsUtil.commonVms(writer, context, "vms/" + path + ".vm", dto);
|
||||||
|
|
||||||
return GeneratorVo.builder()
|
return GeneratorVo.builder()
|
||||||
.code(code)
|
.code(writer.toString())
|
||||||
.comment(tableMetaData.getComment())
|
.comment(tableMetaData.getComment())
|
||||||
.tableName(tableMetaData.getTableName())
|
.tableName(tableMetaData.getTableName())
|
||||||
.path(vmsPath)
|
.path(path)
|
||||||
.build();
|
.build();
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.utils;
|
||||||
|
|
||||||
import cn.bunny.dao.entity.ColumnMetaData;
|
import cn.bunny.dao.entity.ColumnMetaData;
|
||||||
import cn.bunny.dao.entity.TableMetaData;
|
import cn.bunny.dao.entity.TableMetaData;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -124,10 +125,13 @@ public class DbInfoUtil {
|
||||||
ColumnMetaData column = new ColumnMetaData();
|
ColumnMetaData column = new ColumnMetaData();
|
||||||
String columnName = columnsRs.getString("COLUMN_NAME" );
|
String columnName = columnsRs.getString("COLUMN_NAME" );
|
||||||
|
|
||||||
|
String javaType = ConvertUtil.convertToJavaType(column.getJdbcType());
|
||||||
|
|
||||||
column.setColumnName(columnName);
|
column.setColumnName(columnName);
|
||||||
column.setFieldName(ConvertUtil.convertToFieldName(column.getColumnName()));
|
column.setFieldName(ConvertUtil.convertToFieldName(column.getColumnName()));
|
||||||
column.setJdbcType(columnsRs.getString("TYPE_NAME" ));
|
column.setJdbcType(columnsRs.getString("TYPE_NAME" ));
|
||||||
column.setJavaType(ConvertUtil.convertToJavaType(column.getJdbcType()));
|
column.setJavaType(javaType);
|
||||||
|
column.setJavascriptType(StringUtils.uncapitalize(javaType));
|
||||||
column.setComment(columnsRs.getString("REMARKS" ));
|
column.setComment(columnsRs.getString("REMARKS" ));
|
||||||
|
|
||||||
// 确保 primaryKeyColumns 不为空
|
// 确保 primaryKeyColumns 不为空
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class VmsUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
String date = new SimpleDateFormat(dto.getSimpleDateFormat()).format(new Date());
|
String date = new SimpleDateFormat(dto.getSimpleDateFormat()).format(new Date());
|
||||||
|
context.put("leftBrace", "{" );
|
||||||
context.put("date", date);
|
context.put("date", date);
|
||||||
context.put("author", author);
|
context.put("author", author);
|
||||||
context.put("requestMapping", requestMapping);
|
context.put("requestMapping", requestMapping);
|
||||||
|
|
|
@ -15,13 +15,13 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* ${tableName}表 前端控制器
|
* ${comment}表 前端控制器
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Tag(name = "${tableName}" , description = "${tableName}相关接口" )
|
@Tag(name = "${comment}", description = "${comment}相关接口" )
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("${requestMapping}/${classLowercaseName}" )
|
@RequestMapping("${requestMapping}/${classLowercaseName}" )
|
||||||
public class ${classUppercaseName}Controller {
|
public class ${classUppercaseName}Controller {
|
||||||
|
@ -29,7 +29,7 @@ public class ${classUppercaseName}Controller {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ${classUppercaseName}Service ${classLowercaseName}Service;
|
private ${classUppercaseName}Service ${classLowercaseName}Service;
|
||||||
|
|
||||||
@Operation(summary = "分页查询${tableName}" , description = "分页查询${tableName}" )
|
@Operation(summary = "分页查询${comment}", description = "分页查询${comment}" )
|
||||||
@GetMapping("get${classUppercaseName}List/{page}/{limit}" )
|
@GetMapping("get${classUppercaseName}List/{page}/{limit}" )
|
||||||
public Result<PageResult<${classUppercaseName}Vo>> get${classUppercaseName}List(
|
public Result<PageResult<${classUppercaseName}Vo>> get${classUppercaseName}List(
|
||||||
@Parameter(name = "page", description = "当前页", required = true)
|
@Parameter(name = "page", description = "当前页", required = true)
|
||||||
|
@ -39,27 +39,27 @@ public class ${classUppercaseName}Controller {
|
||||||
${classUppercaseName}Dto dto) {
|
${classUppercaseName}Dto dto) {
|
||||||
Page<${classUppercaseName}> pageParams = new Page<>(page, limit);
|
Page<${classUppercaseName}> pageParams = new Page<>(page, limit);
|
||||||
PageResult<${classUppercaseName}Vo> pageResult = ${classLowercaseName}Service.get${classUppercaseName}List(pageParams, dto);
|
PageResult<${classUppercaseName}Vo> pageResult = ${classLowercaseName}Service.get${classUppercaseName}List(pageParams, dto);
|
||||||
return Mono.just(Result.success(pageResult));
|
return Result.success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "添加${tableName}" , description = "添加${tableName}" )
|
@Operation(summary = "添加${comment}", description = "添加${comment}" )
|
||||||
@PostMapping("add${classUppercaseName}" )
|
@PostMapping("add${classUppercaseName}" )
|
||||||
public Result<String> add${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}AddDto dto) {
|
public Result<String> add${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}AddDto dto) {
|
||||||
${classLowercaseName}Service.add${classUppercaseName}(dto);
|
${classLowercaseName}Service.add${classUppercaseName}(dto);
|
||||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
return Result.success(ResultCodeEnum.ADD_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "更新${tableName}" , description = "更新${tableName}" )
|
@Operation(summary = "更新${comment}", description = "更新${comment}" )
|
||||||
@PutMapping("update${classUppercaseName}" )
|
@PutMapping("update${classUppercaseName}" )
|
||||||
public Result<String> update${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}UpdateDto dto) {
|
public Result<String> update${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}UpdateDto dto) {
|
||||||
${classLowercaseName}Service.update${classUppercaseName}(dto);
|
${classLowercaseName}Service.update${classUppercaseName}(dto);
|
||||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除${tableName}" , description = "删除${tableName}" )
|
@Operation(summary = "删除${comment}", description = "删除${comment}" )
|
||||||
@DeleteMapping("delete${classUppercaseName}" )
|
@DeleteMapping("delete${classUppercaseName}" )
|
||||||
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);
|
||||||
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
return Result.success(ResultCodeEnum.DELETE_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* ${tableName} Mapper 接口
|
* ${comment} Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
|
@ -19,16 +19,16 @@ import java.util.List;
|
||||||
public interface ${classUppercaseName}Mapper extends BaseMapper<${classUppercaseName}> {
|
public interface ${classUppercaseName}Mapper extends BaseMapper<${classUppercaseName}> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 分页查询${tableName}内容
|
* * 分页查询${comment}内容
|
||||||
*
|
*
|
||||||
* @param pageParams ${tableName}分页参数
|
* @param pageParams ${comment}分页参数
|
||||||
* @param dto ${tableName}查询表单
|
* @param dto ${comment}查询表单
|
||||||
* @return ${tableName}分页结果
|
* @return ${comment}分页结果
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物理删除${tableName}
|
* 物理删除${comment}
|
||||||
*
|
*
|
||||||
* @param ids 删除 id 列表
|
* @param ids 删除 id 列表
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.bunny.services.mapper.${originalName}Mapper">
|
<mapper namespace="${package}.mapper.${classUppercaseName}Mapper">
|
||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="$type">
|
<resultMap id="BaseResultMap" type="${classUppercaseName}">
|
||||||
#foreach($field in $baseResultMaps)
|
#foreach($field in ${columnInfoList})
|
||||||
<id column="$field.column" property="$field.property"/>
|
<id column="${field.column}" property="${field.fieldName}"/>
|
||||||
#end
|
#end
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
$baseColumnList
|
${baseColumnList}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 分页查询${classTitle}内容 -->
|
<!-- 分页查询${comment}内容 -->
|
||||||
<select id="selectListByPage" resultType="${voClassType}">
|
<select id="selectListByPage" resultType="${voClassType}">
|
||||||
select
|
select
|
||||||
base.*,
|
base.*,
|
||||||
|
@ -25,18 +25,17 @@
|
||||||
left join sys_user update_user on update_user.id = base.update_user
|
left join sys_user update_user on update_user.id = base.update_user
|
||||||
<where>
|
<where>
|
||||||
base.is_deleted = 0
|
base.is_deleted = 0
|
||||||
#foreach($field in $pageQueryMap)
|
#foreach($field in $columnInfoList)
|
||||||
<if test="dto.${field.property} != null and dto.${field.property} != ''">
|
<if test="dto.${field.fieldName} != null and dto.${field.fieldName} != ''">
|
||||||
and base.$field.column like CONCAT('%',#{dto.${field.property}},'%')
|
and base.${field.columnName} like CONCAT('%',#{dto.${field.fieldName}},'%')
|
||||||
</if>
|
</if>
|
||||||
#end
|
#end
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 物理删除${classTitle} -->
|
<!-- 物理删除${comment} -->
|
||||||
<delete id="deleteBatchIdsWithPhysics">
|
<delete id="deleteBatchIdsWithPhysics">
|
||||||
delete
|
delete from ${tableName}
|
||||||
from $tableName
|
|
||||||
where id in
|
where id in
|
||||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||||
#{id}
|
#{id}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.services.service;
|
package ${package}.service;
|
||||||
|
|
||||||
import cn.bunny.dao.entity.system.MenuIcon;
|
import cn.bunny.dao.entity.system.MenuIcon;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
@ -11,39 +11,39 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* ${classTitle} 服务类
|
* ${comment} 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
public interface ${originalName}Service extends IService<${originalName}> {
|
public interface ${classUppercaseName}Service extends IService<${classUppercaseName}> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 获取${classTitle}列表
|
* * 获取${comment}列表
|
||||||
*
|
*
|
||||||
* @return ${classTitle}返回列表
|
* @return ${comment}返回列表
|
||||||
*/
|
*/
|
||||||
PageResult<${originalName}Vo> get${originalName}List(Page<${originalName}> pageParams, ${originalName}Dto dto);
|
PageResult<${classUppercaseName}Vo> get${classUppercaseName}List(Page<${classUppercaseName}> pageParams, ${classUppercaseName}Dto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 添加${classTitle}
|
* * 添加${comment}
|
||||||
*
|
*
|
||||||
* @param dto 添加表单
|
* @param dto 添加表单
|
||||||
*/
|
*/
|
||||||
void add${originalName}(@Valid ${originalName}AddDto dto);
|
void add${classUppercaseName}(@Valid ${classUppercaseName}AddDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 更新${classTitle}
|
* * 更新${comment}
|
||||||
*
|
*
|
||||||
* @param dto 更新表单
|
* @param dto 更新表单
|
||||||
*/
|
*/
|
||||||
void update${originalName}(@Valid ${originalName}UpdateDto dto);
|
void update${classUppercaseName}(@Valid ${classUppercaseName}UpdateDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 删除|批量删除${classTitle}类型
|
* * 删除|批量删除${comment}类型
|
||||||
*
|
*
|
||||||
* @param ids 删除id列表
|
* @param ids 删除id列表
|
||||||
*/
|
*/
|
||||||
void delete${originalName}(List<Long> ids);
|
void delete${classUppercaseName}(List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.bunny.services.service.impl;
|
package ${package}.service.impl;
|
||||||
|
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.services.mapper.${originalName}Mapper;
|
import ${package}.mapper.${classUppercaseName}Mapper;
|
||||||
import cn.bunny.services.service.${originalName}Service;
|
import ${package}.service.${classUppercaseName}Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
@ -13,66 +13,67 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* ${classTitle} 服务实现类
|
* ${comment} 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ${originalName}ServiceImpl extends ServiceImpl<${originalName}Mapper, ${originalName}> implements ${originalName}Service {
|
public class ${classUppercaseName}ServiceImpl extends ServiceImpl<${classUppercaseName}Mapper, ${classUppercaseName}> implements ${classUppercaseName}Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * ${classTitle} 服务实现类
|
* * ${comment} 服务实现类
|
||||||
*
|
*
|
||||||
* @param pageParams ${classTitle}分页查询page对象
|
* @param pageParams ${comment}分页查询page对象
|
||||||
* @param dto ${classTitle}分页查询对象
|
* @param dto ${comment}分页查询对象
|
||||||
* @return 查询分页${classTitle}返回对象
|
* @return 查询分页${comment}返回对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<${originalName}Vo> get${originalName}List(Page<${originalName}> pageParams, ${originalName}Dto dto) {
|
public PageResult<${classUppercaseName}Vo> get${classUppercaseName}List(Page<${classUppercaseName}> pageParams, ${classUppercaseName}Dto dto) {
|
||||||
IPage<${originalName}Vo> page = baseMapper.selectListByPage(pageParams, dto);
|
IPage<${classUppercaseName}Vo> page = baseMapper.selectListByPage(pageParams, dto);
|
||||||
|
|
||||||
return PageResult.<${originalName}Vo>builder()
|
return PageResult.<${classUppercaseName}Vo>builder()
|
||||||
.list(page.getRecords())
|
.list(page.getRecords())
|
||||||
.pageNo(page.getCurrent())
|
.pageNo(page.getCurrent())
|
||||||
.pageSize(page.getSize())
|
.pageSize(page.getSize())
|
||||||
.total(page.getTotal())
|
.total(page.getTotal())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加${classTitle}
|
* 添加${comment}
|
||||||
*
|
*
|
||||||
* @param dto ${classTitle}添加
|
* @param dto ${comment}添加
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void add${originalName}(@Valid ${originalName}AddDto dto) {
|
public void add${classUppercaseName}(@Valid ${classUppercaseName}AddDto dto) {
|
||||||
// 保存数据
|
// 保存数据
|
||||||
${originalName} ${lowercaseName} = new ${originalName}();
|
${classUppercaseName} ${classLowercaseName} =new ${classUppercaseName}();
|
||||||
BeanUtils.copyProperties(dto, ${lowercaseName});
|
BeanUtils.copyProperties(dto, ${classLowercaseName});
|
||||||
save(${lowercaseName});
|
save(${classLowercaseName});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新${classTitle}
|
* 更新${comment}
|
||||||
*
|
*
|
||||||
* @param dto ${classTitle}更新
|
* @param dto ${comment}更新
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update${originalName}(@Valid ${originalName}UpdateDto dto) {
|
public void update${classUppercaseName}(@Valid ${classUppercaseName}UpdateDto dto) {
|
||||||
// 更新内容
|
// 更新内容
|
||||||
${originalName} ${lowercaseName} = new ${originalName}();
|
${classUppercaseName} ${classLowercaseName} =new ${classUppercaseName}();
|
||||||
BeanUtils.copyProperties(dto, ${lowercaseName});
|
BeanUtils.copyProperties(dto, ${classLowercaseName});
|
||||||
updateById(${lowercaseName});
|
updateById(${classLowercaseName});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除|批量删除${classTitle}
|
* 删除|批量删除${comment}
|
||||||
*
|
*
|
||||||
* @param ids 删除id列表
|
* @param ids 删除id列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete${originalName}(List<Long> ids) {
|
public void delete${classUppercaseName}(List<Long> ids) {
|
||||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,22 +1,22 @@
|
||||||
import {http} from '@/api/service/request';
|
import {http} from '@/api/service/request';
|
||||||
import type {BaseResult, ResultTable} from '@/api/service/types';
|
import type {BaseResult, ResultTable} from '@/api/service/types';
|
||||||
|
|
||||||
/** ${classDescription}---获取${classDescription}列表 */
|
/** ${comment}---获取${comment}列表 */
|
||||||
export const fetchGet${originalName}List = (data: any) => {
|
export const fetchGet${classUppercaseName}List = (data: any) => {
|
||||||
return http.request<BaseResult<ResultTable>>('get', `${lowercaseName}/get${originalName}List/${data.currentPage}/${data.pageSize}`, { params: data });
|
return http.request<BaseResult<ResultTable>>('get', `${classLowercaseName}/get${classUppercaseName}List/${data.currentPage}/${data.pageSize}`, {params: data});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ${classDescription}---添加${classDescription} */
|
/** ${comment}---添加${comment} */
|
||||||
export const fetchAdd${originalName} = (data: any) => {
|
export const fetchAdd${classUppercaseName} = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('post', '${lowercaseName}/add${originalName}', { data });
|
return http.request<BaseResult<any>>('post', '${classLowercaseName}/add${classUppercaseName}', {data});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ${classDescription}---更新${classDescription} */
|
/** ${comment}---更新${comment} */
|
||||||
export const fetchUpdate${originalName} = (data: any) => {
|
export const fetchUpdate${classUppercaseName} = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('put', '${lowercaseName}/update${originalName}', { data });
|
return http.request<BaseResult<any>>('put', '${classLowercaseName}/update${classUppercaseName}', {data});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ${classDescription}---删除${classDescription} */
|
/** ${comment}---删除${comment} */
|
||||||
export const fetchDelete${originalName} = (data: any) => {
|
export const fetchDelete${classUppercaseName} = (data: any) => {
|
||||||
return http.request<BaseResult<object>>('delete', '${lowercaseName}/delete${originalName}', { data });
|
return http.request<BaseResult<any>>('delete', '${classLowercaseName}/delete${classUppercaseName}', {data});
|
||||||
};
|
};
|
|
@ -1,14 +1,13 @@
|
||||||
import { reactive, ref } from 'vue';
|
import {reactive} from 'vue';
|
||||||
import { $t } from '@/plugins/i18n';
|
|
||||||
import type {FormRules} from 'element-plus';
|
import type {FormRules} from 'element-plus';
|
||||||
|
import { $t } from '@/plugins/i18n';
|
||||||
|
|
||||||
// 表格列
|
|
||||||
export const columns: TableColumnList = [
|
export const columns: TableColumnList = [
|
||||||
{type: 'selection', align: 'left'},
|
{type: 'selection', align: 'left'},
|
||||||
{type: 'index', index: (index: number) => index + 1, label: '序号', width: 60},
|
{type: 'index', index: (index: number) => index + 1, label: '序号', width: 60},
|
||||||
#foreach($field in $baseFieldList)
|
#foreach($field in $columnInfoList)
|
||||||
// $field.annotation
|
// $field.comment
|
||||||
{ label: $t('$field.name'), prop: '$field.name' },
|
{label: $t('$field.fieldName'), prop: '$field.fieldName'},
|
||||||
#end
|
#end
|
||||||
{label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160},
|
{label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160},
|
||||||
{label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160},
|
{label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160},
|
||||||
|
@ -18,10 +17,15 @@ export const columns: TableColumnList = [
|
||||||
];
|
];
|
||||||
|
|
||||||
// 添加规则
|
// 添加规则
|
||||||
export const rules = reactive
|
export const rules = reactive < FormRules > ({
|
||||||
<FormRules>({
|
#foreach($field in $columnInfoList)
|
||||||
#foreach($field in $baseFieldList)
|
// $field.comment
|
||||||
// $field.annotation
|
$field.fieldName: [{
|
||||||
$field.name: [{ required: true, message: `$leftBrace$t('input')}$leftBrace$t('${field.name}')}`, trigger: 'blur' }],
|
required: true,
|
||||||
|
message: `$leftBrace$t('input')}$leftBrace$t('${field.fieldName}')}`,
|
||||||
|
trigger: 'blur'
|
||||||
|
}],
|
||||||
#end
|
#end
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {ref} from 'vue';
|
import {ref} from 'vue';
|
||||||
import {FormInstance} from 'element-plus';
|
import {FormInstance} from 'element-plus';
|
||||||
import { rules } from '${columnsPath}';
|
import {FormProps} from '';
|
||||||
import { FormProps } from '${typesPath}';
|
|
||||||
import { frameSureOptions } from '@/enums';
|
|
||||||
import { $t } from '@/plugins/i18n';
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<FormProps>(), {
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
formInline: () => ({
|
formInline: () => ({
|
||||||
#foreach($item in $baseFieldList)
|
#foreach($item in $columnInfoList)
|
||||||
#if(${item.name})
|
#if(${item.fieldName})
|
||||||
// $!{item.annotation}
|
// $!{item.comment}
|
||||||
${item.name}: undefined,
|
${item.fieldName}: undefined,
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
}),
|
}),
|
||||||
|
@ -25,11 +22,12 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
|
||||||
#foreach($item in $baseFieldList)
|
#foreach($item in $columnInfoList)
|
||||||
|
|
||||||
<!-- $item.annotation -->
|
<!-- $item.comment -->
|
||||||
<el-form-item :label="$t('${item.name}')" prop="$item.name">
|
<el-form-item :label="$t('${item.fieldName}')" prop="$item.fieldName">
|
||||||
<el-input v-model="form.$item.name" autocomplete="off" type="text" :placeholder="$t('input') + $t('${item.name}')" />
|
<el-input v-model="form.$item.fieldName" autocomplete="off" type="text"
|
||||||
|
:placeholder="$t('input') + $t('${item.fieldName}')"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#end
|
#end
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
|
@ -1,48 +1,42 @@
|
||||||
import { deviceDetection } from '@pureadmin/utils';
|
|
||||||
import {addDialog} from '@/components/BaseDialog/index';
|
import {addDialog} from '@/components/BaseDialog/index';
|
||||||
import ${originalName}Dialog from '${dialogPath}';
|
|
||||||
import { use${originalName}Store } from '${storePath}';
|
|
||||||
import {h, ref} from 'vue';
|
import {h, ref} from 'vue';
|
||||||
import { messageBox } from '@/utils/message';
|
import {message, messageBox} from '@/utils/message';
|
||||||
import type { FormItemProps } from '${typesPath}';
|
|
||||||
import { $t } from '@/plugins/i18n';
|
|
||||||
import { message, messageBox } from "@/utils/message";
|
|
||||||
import DeleteBatchDialog from "@/components/Table/DeleteBatchDialog.vue";
|
import DeleteBatchDialog from "@/components/Table/DeleteBatchDialog.vue";
|
||||||
|
|
||||||
export const formRef = ref();
|
export const formRef = ref();
|
||||||
// 删除ids
|
// 删除ids
|
||||||
export const deleteIds = ref([]);
|
export const deleteIds = ref([]);
|
||||||
const ${lowercaseName}Store = use${originalName}Store();
|
const ${classLowercaseName}Store = use${classUppercaseName}Store();
|
||||||
|
|
||||||
/** 搜索初始化${classTitle} */
|
/** 搜索初始化${comment} */
|
||||||
export async function onSearch() {
|
export async function onSearch() {
|
||||||
${lowercaseName}Store.loading = true;
|
${classLowercaseName}Store.loading = true;
|
||||||
await ${lowercaseName}Store.get${originalName}List();
|
await ${classLowercaseName}Store.get${classUppercaseName}List();
|
||||||
${lowercaseName}Store.loading = false;
|
${classLowercaseName}Store.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加${classTitle} */
|
/** 添加${comment} */
|
||||||
export function onAdd() {
|
export function onAdd() {
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `$leftBrace $t("addNew")}$leftBrace$t("${lowercaseName}")}`,
|
title: `$leftBrace $t("addNew")}$leftBrace$t("${classLowercaseName}")}`,
|
||||||
width: '30%',
|
width: '30%',
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
#foreach($item in $addFormList)
|
#foreach($item in $columnInfoList)
|
||||||
$!{item}: undefined,
|
$!{item.fieldName}: undefined,
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
draggable: true,
|
draggable: true,
|
||||||
fullscreenIcon: true,
|
fullscreenIcon: true,
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(${originalName}Dialog, { ref: formRef }),
|
contentRenderer: () => h(${classUppercaseName}Dialog, {ref: formRef}),
|
||||||
beforeSure: (done, {options}) => {
|
beforeSure: (done, {options}) => {
|
||||||
const form = options.props.formInline as FormItemProps;
|
const form = options.props.formInline as FormItemProps;
|
||||||
formRef.value.formRef.validate(async (valid: any) => {
|
formRef.value.formRef.validate(async (valid: any) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
const result = await ${lowercaseName}Store.add${originalName}(form);
|
const result = await ${classLowercaseName}Store.add${classUppercaseName}(form);
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
done();
|
done();
|
||||||
await onSearch();
|
await onSearch();
|
||||||
|
@ -51,28 +45,28 @@ export function onAdd() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 更新${classTitle} */
|
/** 更新${comment} */
|
||||||
export function onUpdate(row: any) {
|
export function onUpdate(row: any) {
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `$leftBrace$t("modify")}$leftBrace$t("${lowercaseName}")}`,
|
title: `$leftBrace$t("modify")}$leftBrace$t("${classLowercaseName}")}`,
|
||||||
width: '30%',
|
width: '30%',
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
#foreach($item in $addFormList)
|
#foreach($item in $columnInfoList)
|
||||||
$!{item}: row.$!{item},
|
$!{item.fieldName}: row.$!{item.fieldName},
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
draggable: true,
|
draggable: true,
|
||||||
fullscreenIcon: true,
|
fullscreenIcon: true,
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(${originalName}Dialog, { ref: formRef }),
|
contentRenderer: () => h(${classUppercaseName}Dialog, {ref: formRef}),
|
||||||
beforeSure: (done, {options}) => {
|
beforeSure: (done, {options}) => {
|
||||||
const form = options.props.formInline as FormItemProps;
|
const form = options.props.formInline as FormItemProps;
|
||||||
formRef.value.formRef.validate(async (valid: any) => {
|
formRef.value.formRef.validate(async (valid: any) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
const result = await ${lowercaseName}Store.update${originalName}({ ...form, id: row.id });
|
const result = await ${classLowercaseName}Store.update${classUppercaseName}({...form, id: row.id});
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
done();
|
done();
|
||||||
await onSearch();
|
await onSearch();
|
||||||
|
@ -81,7 +75,7 @@ export function onUpdate(row: any) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除${classTitle} */
|
/** 删除${comment} */
|
||||||
export const onDelete = async (row: any) => {
|
export const onDelete = async (row: any) => {
|
||||||
const id = row.id;
|
const id = row.id;
|
||||||
|
|
||||||
|
@ -95,7 +89,7 @@ export const onDelete = async (row: any) => {
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
|
|
||||||
// 删除数据
|
// 删除数据
|
||||||
await ${lowercaseName}Store.delete${originalName}([id]);
|
await ${classLowercaseName}Store.delete${classUppercaseName}([id]);
|
||||||
await onSearch();
|
await onSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,7 +113,7 @@ export const onDeleteBatch = async () => {
|
||||||
const text = options.props.formInline.confirmText.toLowerCase();
|
const text = options.props.formInline.confirmText.toLowerCase();
|
||||||
if (text === 'yes' || text === 'y') {
|
if (text === 'yes' || text === 'y') {
|
||||||
// 删除数据
|
// 删除数据
|
||||||
await ${lowercaseName}Store.delete${originalName}(ids);
|
await ${classLowercaseName}Store.delete${classUppercaseName}(ids);
|
||||||
await onSearch();
|
await onSearch();
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
|
|
@ -5,17 +5,17 @@
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const ${lowercaseName}Store = use${originalName}Store();
|
const ${classLowercaseName}Store = use${classUppercaseName}Store();
|
||||||
|
|
||||||
/** 当前页改变时 */
|
/** 当前页改变时 */
|
||||||
const onCurrentPageChange = async (value: number) => {
|
const onCurrentPageChange = async (value: number) => {
|
||||||
${lowercaseName}Store.pagination.currentPage = value;
|
${classLowercaseName}Store.pagination.currentPage = value;
|
||||||
await onSearch();
|
await onSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 当分页发生变化 */
|
/** 当分页发生变化 */
|
||||||
const onPageSizeChange = async (value: number) => {
|
const onPageSizeChange = async (value: number) => {
|
||||||
${lowercaseName}Store.pagination.pageSize = value;
|
${classLowercaseName}Store.pagination.pageSize = value;
|
||||||
await onSearch();
|
await onSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,24 +38,28 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<el-form ref="formRef" :inline="true" :model="${lowercaseName}Store.form" class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
|
<el-form ref="formRef" :inline="true" :model="${classLowercaseName}Store.form"
|
||||||
#foreach($item in $formList)
|
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
|
||||||
|
#foreach($item in $columnInfoList)
|
||||||
|
|
||||||
<!-- $item.annotation -->
|
<!-- $item.comment -->
|
||||||
<el-form-item :label="$t('${item.name}')" prop="${item.name}">
|
<el-form-item :label="$t('${item.fieldName}')" prop="${item.fieldName}">
|
||||||
<el-input v-model="${lowercaseName}Store.form.${item.name}" :placeholder="`$leftBrace$t('input')}$leftBrace$t('${item.name}')}`"
|
<el-input v-model="${classLowercaseName}Store.form.${item.fieldName}"
|
||||||
|
:placeholder="`$leftBrace$t('input')}$leftBrace$t('${item.fieldName}')}`"
|
||||||
class="!w-[180px]" clearable/>
|
class="!w-[180px]" clearable/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#end
|
#end
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="${lowercaseName}Store.loading" type="primary" @click="onSearch"> {{ $t('search')
|
<el-button :icon="useRenderIcon('ri:search-line')" :loading="${classLowercaseName}Store.loading" type="primary"
|
||||||
|
@click="onSearch"> {{ $t('search')
|
||||||
}}
|
}}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> {{ $t('buttons.reset') }}</el-button>
|
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> {{ $t('buttons.reset') }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<PureTableBar :columns="columns" title="${classDescription}" @fullscreen="tableRef.setAdaptive()" @refresh="onSearch">
|
<PureTableBar :columns="columns" title="${classDescription}" @fullscreen="tableRef.setAdaptive()"
|
||||||
|
@refresh="onSearch">
|
||||||
<template #buttons>
|
<template #buttons>
|
||||||
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }}</el-button>
|
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }}</el-button>
|
||||||
|
|
||||||
|
@ -70,9 +74,9 @@
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:adaptiveConfig="{ offsetBottom: 96 }"
|
:adaptiveConfig="{ offsetBottom: 96 }"
|
||||||
:columns="dynamicColumns"
|
:columns="dynamicColumns"
|
||||||
:data="${lowercaseName}Store.datalist"
|
:data="${classLowercaseName}Store.datalist"
|
||||||
:header-cell-style="{ background: 'var(--el-fill-color-light)', color: 'var(--el-text-color-primary)' }"
|
:header-cell-style="{ background: 'var(--el-fill-color-light)', color: 'var(--el-text-color-primary)' }"
|
||||||
:loading="${lowercaseName}Store.loading"
|
:loading="${classLowercaseName}Store.loading"
|
||||||
:size="size"
|
:size="size"
|
||||||
adaptive
|
adaptive
|
||||||
align-whole="center"
|
align-whole="center"
|
||||||
|
@ -81,7 +85,7 @@
|
||||||
row-key="id"
|
row-key="id"
|
||||||
showOverflowTooltip
|
showOverflowTooltip
|
||||||
table-layout="auto"
|
table-layout="auto"
|
||||||
:pagination="${lowercaseName}Store.pagination"
|
:pagination="${classLowercaseName}Store.pagination"
|
||||||
@page-size-change="onPageSizeChange"
|
@page-size-change="onPageSizeChange"
|
||||||
@selection-change="onSelectionChange"
|
@selection-change="onSelectionChange"
|
||||||
@page-current-change="onCurrentPageChange"
|
@page-current-change="onCurrentPageChange"
|
||||||
|
@ -100,10 +104,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #operation="{ row }">
|
<template #operation="{ row }">
|
||||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify')
|
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary"
|
||||||
|
@click="onUpdate(row)"> {{ $t('modify')
|
||||||
}}
|
}}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button :icon="useRenderIcon(AddFill)" :size="size" class="reset-margin" link type="primary" @click="onAdd"> {{ $t('addNew') }}
|
<el-button :icon="useRenderIcon(AddFill)" :size="size" class="reset-margin" link type="primary"
|
||||||
|
@click="onAdd"> {{ $t('addNew') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- TODO 待完成 -->
|
<!-- TODO 待完成 -->
|
||||||
<el-popconfirm :title="`${leftBrace}$t('delete')}${row.email}?`" @confirm="onDelete(row)">
|
<el-popconfirm :title="`${leftBrace}$t('delete')}${row.email}?`" @confirm="onDelete(row)">
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
import {defineStore} from 'pinia';
|
import {defineStore} from 'pinia';
|
||||||
import { fetchAdd${originalName}, fetchDelete${originalName}, fetchGet${originalName}List, fetchUpdate${originalName} } from '${apiPath}';
|
import {fetchAdd${classUppercaseName}, fetchDelete${classUppercaseName}, fetchUpdate${classUppercaseName}} from '';
|
||||||
import {pageSizes} from '@/enums/baseConstant';
|
import {pageSizes} from '@/enums/baseConstant';
|
||||||
import {storeMessage} from '@/utils/message';
|
import {storeMessage} from '@/utils/message';
|
||||||
import {storePagination} from '@/store/useStorePagination';
|
import {storePagination} from '@/store/useStorePagination';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${classTitle} Store
|
* ${comment} Store
|
||||||
*/
|
*/
|
||||||
export const use${originalName}Store = defineStore('${lowercaseName}Store', {
|
export const use${classUppercaseName}Store = defineStore('${lowercaseName}Store', {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
// ${classTitle}列表
|
// ${comment}列表
|
||||||
datalist: [],
|
datalist: [],
|
||||||
// 查询表单
|
// 查询表单
|
||||||
form: {
|
form: {
|
||||||
#foreach($item in $formList)
|
#foreach($item in $columnInfoList)
|
||||||
// $!{item.annotation}
|
// $!{item.comment}
|
||||||
$!{item.name}: undefined,
|
$!{item.fieldName}: undefined,
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
// 分页查询结果
|
// 分页查询结果
|
||||||
|
@ -32,37 +32,37 @@ loading: false,
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
/** 获取${classTitle} */
|
/** 获取${comment} */
|
||||||
async get${originalName}List() {
|
async get${classUppercaseName}List() {
|
||||||
// 整理请求参数
|
// 整理请求参数
|
||||||
const data = {...this.pagination, ...this.form};
|
const data = {...this.pagination, ...this.form};
|
||||||
delete data.pageSizes;
|
delete data.pageSizes;
|
||||||
delete data.total;
|
delete data.total;
|
||||||
delete data.background;
|
delete data.background;
|
||||||
|
|
||||||
// 获取${classTitle}列表
|
// 获取${comment}列表
|
||||||
const result = await fetchGet${originalName}List(data);
|
const result = await fetchGet${classUppercaseName}List(data);
|
||||||
|
|
||||||
// 公共页面函数hook
|
// 公共页面函数hook
|
||||||
const pagination = storePagination.bind(this);
|
const pagination = storePagination.bind(this);
|
||||||
return pagination(result);
|
return pagination(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 添加${classTitle} */
|
/** 添加${comment} */
|
||||||
async add${originalName}(data: any) {
|
async add${classUppercaseName}(data: any) {
|
||||||
const result = await fetchAdd${originalName}(data);
|
const result = await fetchAdd${classUppercaseName}(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 修改${classTitle} */
|
/** 修改${comment} */
|
||||||
async update${originalName}(data: any) {
|
async update${classUppercaseName}(data: any) {
|
||||||
const result = await fetchUpdate${originalName}(data);
|
const result = await fetchUpdate${classUppercaseName}(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 删除${classTitle} */
|
/** 删除${comment} */
|
||||||
async delete${originalName}(data: any) {
|
async delete${classUppercaseName}(data: any) {
|
||||||
const result = await fetchDelete${originalName}(data);
|
const result = await fetchDelete${classUppercaseName}(data);
|
||||||
return storeMessage(result);
|
return storeMessage(result);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
// 添加或者修改表单元素
|
// 添加或者修改表单元素
|
||||||
export interface FormItemProps {
|
export interface FormItemProps {
|
||||||
#foreach($field in $baseFieldList)
|
#foreach($field in $columnInfoList)
|
||||||
// $field.annotation
|
// $field.comment
|
||||||
$field.name: $field.type;
|
#if($field.javascriptType == "object")
|
||||||
|
$field.fieldName: any
|
||||||
|
#else
|
||||||
|
$field.fieldName: $field.javascriptType
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,34 @@
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.bunny</groupId>
|
||||||
|
<artifactId>dao</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- hutool -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- mysql连接驱动 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- mysql连接池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zaxxer</groupId>
|
||||||
|
<artifactId>HikariCP</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.xml.bind</groupId>
|
<groupId>javax.xml.bind</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
|
|
@ -12,38 +12,7 @@
|
||||||
<name>common Maven Webapp</name>
|
<name>common Maven Webapp</name>
|
||||||
<url>https://maven.apache.org</url>
|
<url>https://maven.apache.org</url>
|
||||||
<modules>
|
<modules>
|
||||||
<!-- <module>service-utils</module> -->
|
<module>generator-code</module>
|
||||||
<module>generator-v1</module>
|
<module>generator-v1</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.bunny</groupId>
|
|
||||||
<artifactId>dao</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- hutool -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.hutool</groupId>
|
|
||||||
<artifactId>hutool-all</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- mysql连接驱动 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- mysql连接池 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zaxxer</groupId>
|
|
||||||
<artifactId>HikariCP</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue