mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-22 15:05:06 +08:00
分页 request vo 的编写
增加 example 字段,用于生成 swagger 示例
This commit is contained in:
@ -22,11 +22,11 @@ public class InfConfigExportReqVO {
|
||||
@ApiModelProperty(value = "参数类型", example = "1", notes = "参见 SysConfigTypeEnum 枚举")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24 00:00:00")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24 23:59:59")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
|
@ -25,11 +25,11 @@ public class InfConfigPageReqVO extends PageParam {
|
||||
@ApiModelProperty(value = "参数类型", example = "1", notes = "参见 SysConfigTypeEnum 枚举")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24 00:00:00")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24 23:59:59")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
|
@ -83,6 +83,10 @@ public class ToolCodegenColumnDO extends BaseDO {
|
||||
* 关联 {@link SysDictTypeDO#getType()}
|
||||
*/
|
||||
private String dictType;
|
||||
/**
|
||||
* 数据示例,主要用于生成 Swagger 注解的 example 字段
|
||||
*/
|
||||
private String example;
|
||||
|
||||
// ========== CRUD 相关字段 ==========
|
||||
|
||||
|
@ -48,6 +48,8 @@ public class ToolCodegenBuilder {
|
||||
.put("image", ToolCodegenColumnHtmlTypeEnum.UPLOAD_IMAGE)
|
||||
.put("file", ToolCodegenColumnHtmlTypeEnum.UPLOAD_FILE)
|
||||
.put("content", ToolCodegenColumnHtmlTypeEnum.EDITOR)
|
||||
.put("time", ToolCodegenColumnHtmlTypeEnum.DATETIME)
|
||||
.put("date", ToolCodegenColumnHtmlTypeEnum.DATETIME)
|
||||
.build();
|
||||
|
||||
/**
|
||||
|
@ -3,12 +3,13 @@ package cn.iocoder.dashboard.modules.tool.service.codegen.impl;
|
||||
import cn.hutool.extra.template.TemplateConfig;
|
||||
import cn.hutool.extra.template.TemplateEngine;
|
||||
import cn.hutool.extra.template.TemplateUtil;
|
||||
import cn.iocoder.dashboard.common.pojo.PageParam;
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen.ToolCodegenColumnDO;
|
||||
import cn.iocoder.dashboard.modules.tool.dal.mysql.dataobject.codegen.ToolCodegenTableDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -49,11 +50,13 @@ public class ToolCodegenEngine {
|
||||
globalBindingMap.put("basePackage", "cn.iocoder.dashboard.modules"); // TODO 基础包
|
||||
// 全局 Java Bean
|
||||
globalBindingMap.put("pageResultClassName", PageResult.class.getName());
|
||||
// VO 类,独有字段
|
||||
globalBindingMap.put("pageParamClassName", PageParam.class.getName());
|
||||
// DO 类,独有字段
|
||||
globalBindingMap.put("baseDOFields", ToolCodegenBuilder.BASE_DO_FIELDS);
|
||||
globalBindingMap.put("baseDOClassName", BaseDO.class.getName());
|
||||
globalBindingMap.put("QueryWrapperClassName", QueryWrapperX.class.getName());
|
||||
globalBindingMap.put("BaseMapperClassName", BaseMapper.class.getName());
|
||||
globalBindingMap.put("BaseMapperClassName", BaseMapperX.class.getName());
|
||||
}
|
||||
|
||||
public void execute(ToolCodegenTableDO table, List<ToolCodegenColumnDO> columns) {
|
||||
@ -64,7 +67,8 @@ public class ToolCodegenEngine {
|
||||
bindingMap.putAll(globalBindingMap);
|
||||
// 执行生成
|
||||
// String result = templateEngine.getTemplate("codegen/dal/do.vm").render(bindingMap);
|
||||
String result = templateEngine.getTemplate("codegen/dal/mapper.vm").render(bindingMap);
|
||||
// String result = templateEngine.getTemplate("codegen/dal/mapper.vm").render(bindingMap);
|
||||
String result = templateEngine.getTemplate("codegen/controller/vo/pageReqVO.vm").render(bindingMap);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user