Commit f2f36bd617b6f181882aff2e8760271fd6cce441

Authored by YunaiV
1 parent db9bae05

多模块重构 11:修复代码生成的 BaseDO 模板不正确

Showing 18 changed files with 866 additions and 76 deletions
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/TestDemoController.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.annotations.*;
  8 +
  9 +import javax.validation.constraints.*;
  10 +import javax.validation.*;
  11 +import javax.servlet.http.*;
  12 +import java.util.*;
  13 +import java.io.IOException;
  14 +
  15 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  16 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  17 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  18 +
  19 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  20 +
  21 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  22 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  23 +
  24 +import cn.iocoder.yudao.module.tool.controller.admin.test.vo.*;
  25 +import cn.iocoder.yudao.module.tool.dal.dataobject.test.TestDemoDO;
  26 +import cn.iocoder.yudao.module.tool.convert.test.TestDemoConvert;
  27 +import cn.iocoder.yudao.module.tool.service.test.TestDemoService;
  28 +
  29 +@Api(tags = "管理后台 - 字典类型")
  30 +@RestController
  31 +@RequestMapping("/tool/test-demo")
  32 +@Validated
  33 +public class TestDemoController {
  34 +
  35 + @Resource
  36 + private TestDemoService testDemoService;
  37 +
  38 + @PostMapping("/create")
  39 + @ApiOperation("创建字典类型")
  40 + @PreAuthorize("@ss.hasPermission('tool:test-demo:create')") public CommonResult<Long> createTestDemo(@Valid @RequestBody TestDemoCreateReqVO createReqVO) {
  41 + return success(testDemoService.createTestDemo(createReqVO));
  42 + }
  43 +
  44 + @PutMapping("/update")
  45 + @ApiOperation("更新字典类型")
  46 + @PreAuthorize("@ss.hasPermission('tool:test-demo:update')") public CommonResult<Boolean> updateTestDemo(@Valid @RequestBody TestDemoUpdateReqVO updateReqVO) {
  47 + testDemoService.updateTestDemo(updateReqVO);
  48 + return success(true);
  49 + }
  50 +
  51 + @DeleteMapping("/delete")
  52 + @ApiOperation("删除字典类型")
  53 + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
  54 + @PreAuthorize("@ss.hasPermission('tool:test-demo:delete')") public CommonResult<Boolean> deleteTestDemo(@RequestParam("id") Long id) {
  55 + testDemoService.deleteTestDemo(id);
  56 + return success(true);
  57 + }
  58 +
  59 + @GetMapping("/get")
  60 + @ApiOperation("获得字典类型")
  61 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  62 + @PreAuthorize("@ss.hasPermission('tool:test-demo:query')")
  63 + public CommonResult<TestDemoRespVO> getTestDemo(@RequestParam("id") Long id) {
  64 + TestDemoDO testDemo = testDemoService.getTestDemo(id);
  65 + return success(TestDemoConvert.INSTANCE.convert(testDemo));
  66 + }
  67 +
  68 + @GetMapping("/list")
  69 + @ApiOperation("获得字典类型列表")
  70 + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
  71 + @PreAuthorize("@ss.hasPermission('tool:test-demo:query')") public CommonResult<List<TestDemoRespVO>> getTestDemoList(@RequestParam("ids") Collection<Long> ids) {
  72 + List<TestDemoDO> list = testDemoService.getTestDemoList(ids);
  73 + return success(TestDemoConvert.INSTANCE.convertList(list));
  74 + }
  75 +
  76 + @GetMapping("/page")
  77 + @ApiOperation("获得字典类型分页")
  78 + @PreAuthorize("@ss.hasPermission('tool:test-demo:query')") public CommonResult<PageResult<TestDemoRespVO>> getTestDemoPage(@Valid TestDemoPageReqVO pageVO) {
  79 + PageResult<TestDemoDO> pageResult = testDemoService.getTestDemoPage(pageVO);
  80 + return success(TestDemoConvert.INSTANCE.convertPage(pageResult));
  81 + }
  82 +
  83 + @GetMapping("/export-excel")
  84 + @ApiOperation("导出字典类型 Excel")
  85 + @PreAuthorize("@ss.hasPermission('tool:test-demo:export')") @OperateLog(type = EXPORT)
  86 + public void exportTestDemoExcel(@Valid TestDemoExportReqVO exportReqVO,
  87 + HttpServletResponse response) throws IOException {
  88 + List<TestDemoDO> list = testDemoService.getTestDemoList(exportReqVO);
  89 + // 导出 Excel
  90 + List<TestDemoExcelVO> datas = TestDemoConvert.INSTANCE.convertList02(list);
  91 + ExcelUtils.write(response, "字典类型.xls", "数据", TestDemoExcelVO.class, datas);
  92 + }
  93 +
  94 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/vo/TestDemoBaseVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +/**
  9 +* 字典类型 Base VO,提供给添加、修改、详细的子 VO 使用
  10 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  11 +*/
  12 +@Data
  13 +public class TestDemoBaseVO {
  14 +
  15 + @ApiModelProperty(value = "名字", required = true)
  16 + @NotNull(message = "名字不能为空")
  17 + private String name;
  18 +
  19 + @ApiModelProperty(value = "状态", required = true)
  20 + @NotNull(message = "状态不能为空")
  21 + private Integer status;
  22 +
  23 + @ApiModelProperty(value = "类型", required = true)
  24 + @NotNull(message = "类型不能为空")
  25 + private Integer type;
  26 +
  27 + @ApiModelProperty(value = "分类", required = true)
  28 + @NotNull(message = "分类不能为空")
  29 + private Integer category;
  30 +
  31 + @ApiModelProperty(value = "备注")
  32 + private String remark;
  33 +
  34 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/vo/TestDemoCreateReqVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@ApiModel("管理后台 - 字典类型创建 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class TestDemoCreateReqVO extends TestDemoBaseVO {
  13 +
  14 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/vo/TestDemoExcelVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +
  7 +import com.alibaba.excel.annotation.ExcelProperty;
  8 +
  9 +/**
  10 + * 字典类型 Excel VO
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +@Data
  15 +public class TestDemoExcelVO {
  16 +
  17 + @ExcelProperty("编号")
  18 + private Long id;
  19 +
  20 + @ExcelProperty("名字")
  21 + private String name;
  22 +
  23 + @ExcelProperty("状态")
  24 + private Integer status;
  25 +
  26 + @ExcelProperty("类型")
  27 + private Integer type;
  28 +
  29 + @ExcelProperty("分类")
  30 + private Integer category;
  31 +
  32 + @ExcelProperty("备注")
  33 + private String remark;
  34 +
  35 + @ExcelProperty("创建时间")
  36 + private Date createTime;
  37 +
  38 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/vo/TestDemoExportReqVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +import org.springframework.format.annotation.DateTimeFormat;
  8 +
  9 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  10 +
  11 +@ApiModel(value = "管理后台 - 字典类型 Excel 导出 Request VO", description = "参数和 TestDemoPageReqVO 是一致的")
  12 +@Data
  13 +public class TestDemoExportReqVO {
  14 +
  15 + @ApiModelProperty(value = "名字")
  16 + private String name;
  17 +
  18 + @ApiModelProperty(value = "状态")
  19 + private Integer status;
  20 +
  21 + @ApiModelProperty(value = "类型")
  22 + private Integer type;
  23 +
  24 + @ApiModelProperty(value = "分类")
  25 + private Integer category;
  26 +
  27 + @ApiModelProperty(value = "备注")
  28 + private String remark;
  29 +
  30 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  31 + @ApiModelProperty(value = "开始创建时间")
  32 + private Date beginCreateTime;
  33 +
  34 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  35 + @ApiModelProperty(value = "结束创建时间")
  36 + private Date endCreateTime;
  37 +
  38 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/vo/TestDemoPageReqVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +import org.springframework.format.annotation.DateTimeFormat;
  8 +
  9 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  10 +
  11 +@ApiModel("管理后台 - 字典类型分页 Request VO")
  12 +@Data
  13 +@EqualsAndHashCode(callSuper = true)
  14 +@ToString(callSuper = true)
  15 +public class TestDemoPageReqVO extends PageParam {
  16 +
  17 + @ApiModelProperty(value = "名字")
  18 + private String name;
  19 +
  20 + @ApiModelProperty(value = "状态")
  21 + private Integer status;
  22 +
  23 + @ApiModelProperty(value = "类型")
  24 + private Integer type;
  25 +
  26 + @ApiModelProperty(value = "分类")
  27 + private Integer category;
  28 +
  29 + @ApiModelProperty(value = "备注")
  30 + private String remark;
  31 +
  32 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  33 + @ApiModelProperty(value = "开始创建时间")
  34 + private Date beginCreateTime;
  35 +
  36 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  37 + @ApiModelProperty(value = "结束创建时间")
  38 + private Date endCreateTime;
  39 +
  40 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/vo/TestDemoRespVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +
  7 +@ApiModel("管理后台 - 字典类型 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class TestDemoRespVO extends TestDemoBaseVO {
  12 +
  13 + @ApiModelProperty(value = "编号", required = true)
  14 + private Long id;
  15 +
  16 + @ApiModelProperty(value = "创建时间", required = true)
  17 + private Date createTime;
  18 +
  19 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/controller/admin/test/vo/TestDemoUpdateReqVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.controller.admin.test.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@ApiModel("管理后台 - 字典类型更新 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class TestDemoUpdateReqVO extends TestDemoBaseVO {
  13 +
  14 + @ApiModelProperty(value = "编号", required = true)
  15 + @NotNull(message = "编号不能为空")
  16 + private Long id;
  17 +
  18 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/convert/test/TestDemoConvert.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.convert.test;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import org.mapstruct.Mapper;
  8 +import org.mapstruct.factory.Mappers;
  9 +import cn.iocoder.yudao.module.tool.controller.admin.test.vo.*;
  10 +import cn.iocoder.yudao.module.tool.dal.dataobject.test.TestDemoDO;
  11 +
  12 +/**
  13 + * 字典类型 Convert
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface TestDemoConvert {
  19 +
  20 + TestDemoConvert INSTANCE = Mappers.getMapper(TestDemoConvert.class);
  21 +
  22 + TestDemoDO convert(TestDemoCreateReqVO bean);
  23 +
  24 + TestDemoDO convert(TestDemoUpdateReqVO bean);
  25 +
  26 + TestDemoRespVO convert(TestDemoDO bean);
  27 +
  28 + List<TestDemoRespVO> convertList(List<TestDemoDO> list);
  29 +
  30 + PageResult<TestDemoRespVO> convertPage(PageResult<TestDemoDO> page);
  31 +
  32 + List<TestDemoExcelVO> convertList02(List<TestDemoDO> list);
  33 +
  34 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/dal/dataobject/test/TestDemoDO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.dal.dataobject.test;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import com.baomidou.mybatisplus.annotation.TableId;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import lombok.*;
  7 +
  8 +import java.util.Date;
  9 +
  10 +/**
  11 + * 字典类型 DO
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@TableName("tool_test_demo")
  16 +@Data
  17 +@EqualsAndHashCode(callSuper = true)
  18 +@ToString(callSuper = true)
  19 +@Builder
  20 +@NoArgsConstructor
  21 +@AllArgsConstructor
  22 +public class TestDemoDO extends BaseDO {
  23 +
  24 + /**
  25 + * 编号
  26 + */
  27 + @TableId
  28 + private Long id;
  29 + /**
  30 + * 名字
  31 + */
  32 + private String name;
  33 + /**
  34 + * 状态
  35 + */
  36 + private Integer status;
  37 + /**
  38 + * 类型
  39 + */
  40 + private Integer type;
  41 + /**
  42 + * 分类
  43 + */
  44 + private Integer category;
  45 + /**
  46 + * 备注
  47 + */
  48 + private String remark;
  49 + /**
  50 + * 创建者
  51 + */
  52 + private String creator;
  53 + /**
  54 + * 创建时间
  55 + */
  56 + private Date createTime;
  57 + /**
  58 + * 更新者
  59 + */
  60 + private String updater;
  61 + /**
  62 + * 更新时间
  63 + */
  64 + private Date updateTime;
  65 + /**
  66 + * 是否删除
  67 + */
  68 + private Boolean deleted;
  69 +
  70 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/dal/mysql/test/TestDemoMapper.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.dal.mysql.test;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.tool.dal.dataobject.test.TestDemoDO;
  9 +import org.apache.ibatis.annotations.Mapper;
  10 +import cn.iocoder.yudao.module.tool.controller.admin.test.vo.*;
  11 +
  12 +/**
  13 + * 字典类型 Mapper
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface TestDemoMapper extends BaseMapperX<TestDemoDO> {
  19 +
  20 + default PageResult<TestDemoDO> selectPage(TestDemoPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<TestDemoDO>()
  22 + .likeIfPresent(TestDemoDO::getName, reqVO.getName())
  23 + .eqIfPresent(TestDemoDO::getStatus, reqVO.getStatus())
  24 + .eqIfPresent(TestDemoDO::getType, reqVO.getType())
  25 + .eqIfPresent(TestDemoDO::getCategory, reqVO.getCategory())
  26 + .eqIfPresent(TestDemoDO::getRemark, reqVO.getRemark())
  27 + .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
  28 + .orderByDesc(TestDemoDO::getId));
  29 + }
  30 +
  31 + default List<TestDemoDO> selectList(TestDemoExportReqVO reqVO) {
  32 + return selectList(new LambdaQueryWrapperX<TestDemoDO>()
  33 + .likeIfPresent(TestDemoDO::getName, reqVO.getName())
  34 + .eqIfPresent(TestDemoDO::getStatus, reqVO.getStatus())
  35 + .eqIfPresent(TestDemoDO::getType, reqVO.getType())
  36 + .eqIfPresent(TestDemoDO::getCategory, reqVO.getCategory())
  37 + .eqIfPresent(TestDemoDO::getRemark, reqVO.getRemark())
  38 + .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
  39 + .orderByDesc(TestDemoDO::getId));
  40 + }
  41 +
  42 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/service/codegen/inner/CodegenEngine.java
... ... @@ -79,9 +79,9 @@ public class CodegenEngine {
79 79 javaModuleImplMainFilePath("service/${table.businessName}/${table.className}Service"))
80 80 // Java module-impl Test
81 81 .put(javaTemplatePath("test/serviceTest"),
82   - javaModuleImplTestFilePath("service/${table.businessName}/${table.className}ServiceTest"))
  82 + javaModuleImplTestFilePath("service/${table.businessName}/${table.className}ServiceImplTest"))
83 83 // Java module-api Main
84   - .put(javaTemplatePath("enums/errorcode"), javaModuleApiMainFilePath("enums/ErrorCodeConstants"))
  84 + .put(javaTemplatePath("enums/errorcode"), javaModuleApiMainFilePath("enums/ErrorCodeConstants_手动操作"))
85 85 // Vue
86 86 .put(vueTemplatePath("views/index.vue"),
87 87 vueFilePath("views/${table.moduleName}/${classNameVar}/index.vue"))
... ... @@ -158,11 +158,11 @@ public class CodegenEngine {
158 158  
159 159 // 如果多租户,则进行覆盖 DB 独有字段
160 160 if (CollectionUtils.findFirst(columns, column -> column.getColumnName().equals(CodegenBuilder.TENANT_ID_FIELD)) != null) {
161   - globalBindingMap.put("BaseDOClassName", TenantBaseDO.class.getName());
162   - globalBindingMap.put("BaseDOClassName_simple", TenantBaseDO.class.getSimpleName());
  161 + bindingMap.put("BaseDOClassName", TenantBaseDO.class.getName());
  162 + bindingMap.put("BaseDOClassName_simple", TenantBaseDO.class.getSimpleName());
163 163 } else {
164   - globalBindingMap.put("BaseDOClassName", BaseDO.class.getName());
165   - globalBindingMap.put("BaseDOClassName_simple", BaseDO.class.getSimpleName());
  164 + bindingMap.put("BaseDOClassName", BaseDO.class.getName());
  165 + bindingMap.put("BaseDOClassName_simple", BaseDO.class.getSimpleName());
166 166 }
167 167  
168 168 // 执行生成
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/service/test/TestDemoService.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.service.test;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.tool.controller.admin.test.vo.*;
  6 +import cn.iocoder.yudao.module.tool.dal.dataobject.test.TestDemoDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 字典类型 Service 接口
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +public interface TestDemoService {
  15 +
  16 + /**
  17 + * 创建字典类型
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Long createTestDemo(@Valid TestDemoCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新字典类型
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void updateTestDemo(@Valid TestDemoUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除字典类型
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void deleteTestDemo(Long id);
  37 +
  38 + /**
  39 + * 获得字典类型
  40 + *
  41 + * @param id 编号
  42 + * @return 字典类型
  43 + */
  44 + TestDemoDO getTestDemo(Long id);
  45 +
  46 + /**
  47 + * 获得字典类型列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 字典类型列表
  51 + */
  52 + List<TestDemoDO> getTestDemoList(Collection<Long> ids);
  53 +
  54 + /**
  55 + * 获得字典类型分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 字典类型分页
  59 + */
  60 + PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得字典类型列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 字典类型列表
  67 + */
  68 + List<TestDemoDO> getTestDemoList(TestDemoExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/main/java/cn/iocoder/yudao/module/tool/service/test/TestDemoServiceImpl.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.service.test;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +
  7 +import java.util.*;
  8 +import cn.iocoder.yudao.module.tool.controller.admin.test.vo.*;
  9 +import cn.iocoder.yudao.module.tool.dal.dataobject.test.TestDemoDO;
  10 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  11 +
  12 +import cn.iocoder.yudao.module.tool.convert.test.TestDemoConvert;
  13 +import cn.iocoder.yudao.module.tool.dal.mysql.test.TestDemoMapper;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  16 +import static cn.iocoder.yudao.module.tool.enums.ErrorCodeConstants.*;
  17 +
  18 +/**
  19 + * 字典类型 Service 实现类
  20 + *
  21 + * @author 芋道源码
  22 + */
  23 +@Service
  24 +@Validated
  25 +public class TestDemoServiceImpl implements TestDemoService {
  26 +
  27 + @Resource
  28 + private TestDemoMapper testDemoMapper;
  29 +
  30 + @Override
  31 + public Long createTestDemo(TestDemoCreateReqVO createReqVO) {
  32 + // 插入
  33 + TestDemoDO testDemo = TestDemoConvert.INSTANCE.convert(createReqVO);
  34 + testDemoMapper.insert(testDemo);
  35 + // 返回
  36 + return testDemo.getId();
  37 + }
  38 +
  39 + @Override
  40 + public void updateTestDemo(TestDemoUpdateReqVO updateReqVO) {
  41 + // 校验存在
  42 + this.validateTestDemoExists(updateReqVO.getId());
  43 + // 更新
  44 + TestDemoDO updateObj = TestDemoConvert.INSTANCE.convert(updateReqVO);
  45 + testDemoMapper.updateById(updateObj);
  46 + }
  47 +
  48 + @Override
  49 + public void deleteTestDemo(Long id) {
  50 + // 校验存在
  51 + this.validateTestDemoExists(id);
  52 + // 删除
  53 + testDemoMapper.deleteById(id);
  54 + }
  55 +
  56 + private void validateTestDemoExists(Long id) {
  57 + if (testDemoMapper.selectById(id) == null) {
  58 + throw exception(TEST_DEMO_NOT_EXISTS);
  59 + }
  60 + }
  61 +
  62 + @Override
  63 + public TestDemoDO getTestDemo(Long id) {
  64 + return testDemoMapper.selectById(id);
  65 + }
  66 +
  67 + @Override
  68 + public List<TestDemoDO> getTestDemoList(Collection<Long> ids) {
  69 + return testDemoMapper.selectBatchIds(ids);
  70 + }
  71 +
  72 + @Override
  73 + public PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO) {
  74 + return testDemoMapper.selectPage(pageReqVO);
  75 + }
  76 +
  77 + @Override
  78 + public List<TestDemoDO> getTestDemoList(TestDemoExportReqVO exportReqVO) {
  79 + return testDemoMapper.selectList(exportReqVO);
  80 + }
  81 +
  82 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/test/java/cn/iocoder/yudao/module/tool/service/test/TestDemoServiceImplTest.java 0 → 100755
  1 +package cn.iocoder.yudao.module.tool.service.test;
  2 +
  3 +import org.junit.jupiter.api.Test;
  4 +import org.springframework.boot.test.mock.mockito.MockBean;
  5 +
  6 +import javax.annotation.Resource;
  7 +
  8 +import cn.iocoder.yudao.module.tool.test.BaseDbUnitTest;
  9 +import cn.iocoder.yudao.module.tool.controller.admin.test.vo.*;
  10 +import cn.iocoder.yudao.module.tool.dal.dataobject.test.TestDemoDO;
  11 +import cn.iocoder.yudao.module.tool.dal.mysql.test.TestDemoMapper;
  12 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  13 +
  14 +import javax.annotation.Resource;
  15 +import org.springframework.context.annotation.Import;
  16 +import java.util.*;
  17 +
  18 +import static cn.hutool.core.util.RandomUtil.*;
  19 +import static cn.iocoder.yudao.module.tool.enums.ErrorCodeConstants.*;
  20 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
  21 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
  22 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
  23 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
  24 +import static org.junit.jupiter.api.Assertions.*;
  25 +import static org.mockito.Mockito.*;
  26 +
  27 +/**
  28 +* {@link TestDemoServiceImpl} 的单元测试类
  29 +*
  30 +* @author 芋道源码
  31 +*/
  32 +@Import(TestDemoServiceImpl.class)
  33 +public class TestDemoServiceImplTest extends BaseDbUnitTest {
  34 +
  35 + @Resource
  36 + private TestDemoServiceImpl testDemoService;
  37 +
  38 + @Resource
  39 + private TestDemoMapper testDemoMapper;
  40 +
  41 + @Test
  42 + public void testCreateTestDemo_success() {
  43 + // 准备参数
  44 + TestDemoCreateReqVO reqVO = randomPojo(TestDemoCreateReqVO.class);
  45 +
  46 + // 调用
  47 + Long testDemoId = testDemoService.createTestDemo(reqVO);
  48 + // 断言
  49 + assertNotNull(testDemoId);
  50 + // 校验记录的属性是否正确
  51 + TestDemoDO testDemo = testDemoMapper.selectById(testDemoId);
  52 + assertPojoEquals(reqVO, testDemo);
  53 + }
  54 +
  55 + @Test
  56 + public void testUpdateTestDemo_success() {
  57 + // mock 数据
  58 + TestDemoDO dbTestDemo = randomPojo(TestDemoDO.class);
  59 + testDemoMapper.insert(dbTestDemo);// @Sql: 先插入出一条存在的数据
  60 + // 准备参数
  61 + TestDemoUpdateReqVO reqVO = randomPojo(TestDemoUpdateReqVO.class, o -> {
  62 + o.setId(dbTestDemo.getId()); // 设置更新的 ID
  63 + });
  64 +
  65 + // 调用
  66 + testDemoService.updateTestDemo(reqVO);
  67 + // 校验是否更新正确
  68 + TestDemoDO testDemo = testDemoMapper.selectById(reqVO.getId()); // 获取最新的
  69 + assertPojoEquals(reqVO, testDemo);
  70 + }
  71 +
  72 + @Test
  73 + public void testUpdateTestDemo_notExists() {
  74 + // 准备参数
  75 + TestDemoUpdateReqVO reqVO = randomPojo(TestDemoUpdateReqVO.class);
  76 +
  77 + // 调用, 并断言异常
  78 + assertServiceException(() -> testDemoService.updateTestDemo(reqVO), TEST_DEMO_NOT_EXISTS);
  79 + }
  80 +
  81 + @Test
  82 + public void testDeleteTestDemo_success() {
  83 + // mock 数据
  84 + TestDemoDO dbTestDemo = randomPojo(TestDemoDO.class);
  85 + testDemoMapper.insert(dbTestDemo);// @Sql: 先插入出一条存在的数据
  86 + // 准备参数
  87 + Long id = dbTestDemo.getId();
  88 +
  89 + // 调用
  90 + testDemoService.deleteTestDemo(id);
  91 + // 校验数据不存在了
  92 + assertNull(testDemoMapper.selectById(id));
  93 + }
  94 +
  95 + @Test
  96 + public void testDeleteTestDemo_notExists() {
  97 + // 准备参数
  98 + Long id = randomLongId();
  99 +
  100 + // 调用, 并断言异常
  101 + assertServiceException(() -> testDemoService.deleteTestDemo(id), TEST_DEMO_NOT_EXISTS);
  102 + }
  103 +
  104 + @Test // TODO 请修改 null 为需要的值
  105 + public void testGetTestDemoPage() {
  106 + // mock 数据
  107 + TestDemoDO dbTestDemo = randomPojo(TestDemoDO.class, o -> { // 等会查询到
  108 + o.setName(null);
  109 + o.setStatus(null);
  110 + o.setType(null);
  111 + o.setCategory(null);
  112 + o.setRemark(null);
  113 + o.setCreateTime(null);
  114 + });
  115 + testDemoMapper.insert(dbTestDemo);
  116 + // 测试 name 不匹配
  117 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setName(null)));
  118 + // 测试 status 不匹配
  119 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setStatus(null)));
  120 + // 测试 type 不匹配
  121 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setType(null)));
  122 + // 测试 category 不匹配
  123 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCategory(null)));
  124 + // 测试 remark 不匹配
  125 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setRemark(null)));
  126 + // 测试 createTime 不匹配
  127 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(null)));
  128 + // 准备参数
  129 + TestDemoPageReqVO reqVO = new TestDemoPageReqVO();
  130 + reqVO.setName(null);
  131 + reqVO.setStatus(null);
  132 + reqVO.setType(null);
  133 + reqVO.setCategory(null);
  134 + reqVO.setRemark(null);
  135 + reqVO.setBeginCreateTime(null);
  136 + reqVO.setEndCreateTime(null);
  137 +
  138 + // 调用
  139 + PageResult<TestDemoDO> pageResult = testDemoService.getTestDemoPage(reqVO);
  140 + // 断言
  141 + assertEquals(1, pageResult.getTotal());
  142 + assertEquals(1, pageResult.getList().size());
  143 + assertPojoEquals(dbTestDemo, pageResult.getList().get(0));
  144 + }
  145 +
  146 + @Test // TODO 请修改 null 为需要的值
  147 + public void testGetTestDemoList() {
  148 + // mock 数据
  149 + TestDemoDO dbTestDemo = randomPojo(TestDemoDO.class, o -> { // 等会查询到
  150 + o.setName(null);
  151 + o.setStatus(null);
  152 + o.setType(null);
  153 + o.setCategory(null);
  154 + o.setRemark(null);
  155 + o.setCreateTime(null);
  156 + });
  157 + testDemoMapper.insert(dbTestDemo);
  158 + // 测试 name 不匹配
  159 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setName(null)));
  160 + // 测试 status 不匹配
  161 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setStatus(null)));
  162 + // 测试 type 不匹配
  163 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setType(null)));
  164 + // 测试 category 不匹配
  165 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCategory(null)));
  166 + // 测试 remark 不匹配
  167 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setRemark(null)));
  168 + // 测试 createTime 不匹配
  169 + testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(null)));
  170 + // 准备参数
  171 + TestDemoExportReqVO reqVO = new TestDemoExportReqVO();
  172 + reqVO.setName(null);
  173 + reqVO.setStatus(null);
  174 + reqVO.setType(null);
  175 + reqVO.setCategory(null);
  176 + reqVO.setRemark(null);
  177 + reqVO.setBeginCreateTime(null);
  178 + reqVO.setEndCreateTime(null);
  179 +
  180 + // 调用
  181 + List<TestDemoDO> list = testDemoService.getTestDemoList(reqVO);
  182 + // 断言
  183 + assertEquals(1, list.size());
  184 + assertPojoEquals(dbTestDemo, list.get(0));
  185 + }
  186 +
  187 +}
... ...
yudao-module-tool/yudao-module-tool-impl/src/test/java/cn/iocoder/yudao/module/tool/test/BaseDbUnitTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.tool.test;
  2 +
  3 +import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
  4 +import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
  5 +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
  6 +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
  7 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  8 +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
  9 +import org.springframework.boot.test.context.SpringBootTest;
  10 +import org.springframework.context.annotation.Import;
  11 +import org.springframework.test.context.ActiveProfiles;
  12 +import org.springframework.test.context.jdbc.Sql;
  13 +
  14 +/**
  15 + * 依赖内存 DB 的单元测试
  16 + *
  17 + * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法
  18 + *
  19 + * @author 芋道源码
  20 + */
  21 +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class)
  22 +@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
  23 +@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB
  24 +public class BaseDbUnitTest {
  25 +
  26 + @Import({
  27 + // DB 配置类
  28 + YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类
  29 + DataSourceAutoConfiguration.class, // Spring DB 自动配置类
  30 + DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类
  31 + DruidDataSourceAutoConfigure.class, // Druid 自动配置类
  32 + // MyBatis 配置类
  33 + YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
  34 + MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
  35 + })
  36 + public static class Application {
  37 + }
  38 +
  39 +}
... ...
yudao-ui-admin/src/api/tool/testDemo.js 100644 → 100755
... ... @@ -18,7 +18,6 @@ export function updateTestDemo(data) {
18 18 })
19 19 }
20 20  
21   -
22 21 // 删除字典类型
23 22 export function deleteTestDemo(id) {
24 23 return request({
... ...
yudao-ui-admin/src/views/tool/testDemo/index.vue 100644 → 100755
... ... @@ -8,21 +8,16 @@
8 8 </el-form-item>
9 9 <el-form-item label="状态" prop="status">
10 10 <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
11   - <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
12   - :key="dict.value" :label="dict.label" :value="dict.value"/>
  11 + <el-option label="请选择字典生成" value="" />
13 12 </el-select>
14 13 </el-form-item>
15 14 <el-form-item label="类型" prop="type">
16 15 <el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
17   - <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_OPERATE_TYPE)"
18   - :key="dict.value" :label="dict.label" :value="dict.value"/>
  16 + <el-option label="请选择字典生成" value="" />
19 17 </el-select>
20 18 </el-form-item>
21 19 <el-form-item label="分类" prop="category">
22   - <el-select v-model="queryParams.category" placeholder="请选择分类" clearable size="small">
23   - <el-option v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_REDIS_TIMEOUT_TYPE)"
24   - :key="dict.value" :label="dict.label" :value="dict.value"/>
25   - </el-select>
  20 + <el-input v-model="queryParams.category" placeholder="请输入分类" clearable size="small" @keyup.enter.native="handleQuery"/>
26 21 </el-form-item>
27 22 <el-form-item label="备注" prop="remark">
28 23 <el-input v-model="queryParams.remark" placeholder="请输入备注" clearable size="small" @keyup.enter.native="handleQuery"/>
... ... @@ -31,11 +26,6 @@
31 26 <el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
32 27 type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
33 28 </el-form-item>
34   - <el-form-item label="是否删除" prop="deleted">
35   - <el-select v-model="queryParams.deleted" placeholder="请选择是否删除" clearable size="small">
36   - <el-option label="请选择字典生成" value="" />
37   - </el-select>
38   - </el-form-item>
39 29 <el-form-item>
40 30 <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
41 31 <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
... ... @@ -59,25 +49,13 @@
59 49 <el-table v-loading="loading" :data="list">
60 50 <el-table-column label="编号" align="center" prop="id" />
61 51 <el-table-column label="名字" align="center" prop="name" />
62   - <el-table-column label="状态" align="center" prop="status">
63   - <template slot-scope="scope">
64   - <span>{{ getDictDataLabel(DICT_TYPE.COMMON_STATUS, scope.row.status) }}</span>
65   - </template>
66   - </el-table-column>>
67   - <el-table-column label="类型" align="center" prop="type">
68   - <template slot-scope="scope">
69   - <span>{{ getDictDataLabel(DICT_TYPE.SYSTEM_OPERATE_TYPE, scope.row.type) }}</span>
70   - </template>
71   - </el-table-column>>
72   - <el-table-column label="分类" align="center" prop="category">
73   - <template slot-scope="scope">
74   - <span>{{ getDictDataLabel(DICT_TYPE.INFRA_REDIS_TIMEOUT_TYPE, scope.row.category) }}</span>
75   - </template>
76   - </el-table-column>>
  52 + <el-table-column label="状态" align="center" prop="status" />
  53 + <el-table-column label="类型" align="center" prop="type" />
  54 + <el-table-column label="分类" align="center" prop="category" />
77 55 <el-table-column label="备注" align="center" prop="remark" />
78 56 <el-table-column label="创建时间" align="center" prop="createTime" width="180">
79 57 <template slot-scope="scope">
80   - <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  58 + <span>{{ parseTime(scope.row.createTime) }}</span>
81 59 </template>
82 60 </el-table-column>
83 61 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
... ... @@ -99,23 +77,18 @@
99 77 <el-form-item label="名字" prop="name">
100 78 <el-input v-model="form.name" placeholder="请输入名字" />
101 79 </el-form-item>
102   - <el-form-item label="状态">
  80 + <el-form-item label="状态" prop="status">
103 81 <el-radio-group v-model="form.status">
104   - <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
105   - :key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
  82 + <el-radio label="1">请选择字典生成</el-radio>
106 83 </el-radio-group>
107 84 </el-form-item>
108 85 <el-form-item label="类型" prop="type">
109 86 <el-select v-model="form.type" placeholder="请选择类型">
110   - <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_OPERATE_TYPE)"
111   - :key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
  87 + <el-option label="请选择字典生成" value="" />
112 88 </el-select>
113 89 </el-form-item>
114   - <el-form-item label="分类">
115   - <el-radio-group v-model="form.category">
116   - <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_REDIS_TIMEOUT_TYPE)"
117   - :key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
118   - </el-radio-group>
  90 + <el-form-item label="分类" prop="category">
  91 + <el-input v-model="form.category" placeholder="请输入分类" />
119 92 </el-form-item>
120 93 <el-form-item label="备注" prop="remark">
121 94 <el-input v-model="form.remark" placeholder="请输入备注" />
... ... @@ -144,7 +117,7 @@ export default {
144 117 showSearch: true,
145 118 // 总条数
146 119 total: 0,
147   - // 测试示例列表
  120 + // 字典类型列表
148 121 list: [],
149 122 // 弹出层标题
150 123 title: "",
... ... @@ -160,7 +133,6 @@ export default {
160 133 type: null,
161 134 category: null,
162 135 remark: null,
163   - deleted: null,
164 136 },
165 137 // 表单参数
166 138 form: {},
... ... @@ -180,6 +152,7 @@ export default {
180 152 /** 查询列表 */
181 153 getList() {
182 154 this.loading = true;
  155 + // 处理查询参数
183 156 let params = {...this.queryParams};
184 157 this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
185 158 // 执行查询
... ... @@ -189,12 +162,12 @@ export default {
189 162 this.loading = false;
190 163 });
191 164 },
192   - // 取消按钮
  165 + /** 取消按钮 */
193 166 cancel() {
194 167 this.open = false;
195 168 this.reset();
196 169 },
197   - // 表单重置
  170 + /** 表单重置 */
198 171 reset() {
199 172 this.form = {
200 173 id: undefined,
... ... @@ -203,11 +176,6 @@ export default {
203 176 type: undefined,
204 177 category: undefined,
205 178 remark: undefined,
206   - createBy: undefined,
207   - createTime: undefined,
208   - updateBy: undefined,
209   - updateTime: undefined,
210   - deleted: undefined,
211 179 };
212 180 this.resetForm("form");
213 181 },
... ... @@ -226,7 +194,7 @@ export default {
226 194 handleAdd() {
227 195 this.reset();
228 196 this.open = true;
229   - this.title = "添加测试示例";
  197 + this.title = "添加字典类型";
230 198 },
231 199 /** 修改按钮操作 */
232 200 handleUpdate(row) {
... ... @@ -235,7 +203,7 @@ export default {
235 203 getTestDemo(id).then(response => {
236 204 this.form = response.data;
237 205 this.open = true;
238   - this.title = "修改测试示例";
  206 + this.title = "修改字典类型";
239 207 });
240 208 },
241 209 /** 提交按钮 */
... ... @@ -264,30 +232,34 @@ export default {
264 232 /** 删除按钮操作 */
265 233 handleDelete(row) {
266 234 const id = row.id;
267   - this.$confirm('是否确认删除测试示例编号为"' + id + '"的数据项?', "警告", {
268   - confirmButtonText: "确定",
269   - cancelButtonText: "取消",
270   - type: "warning"
271   - }).then(function() {
272   - return deleteTestDemo(id);
273   - }).then(() => {
274   - this.getList();
275   - this.msgSuccess("删除成功");
276   - })
  235 + this.$confirm('是否确认删除字典类型编号为"' + id + '"的数据项?', "警告", {
  236 + confirmButtonText: "确定",
  237 + cancelButtonText: "取消",
  238 + type: "warning"
  239 + }).then(function() {
  240 + return deleteTestDemo(id);
  241 + }).then(() => {
  242 + this.getList();
  243 + this.msgSuccess("删除成功");
  244 + })
277 245 },
278 246 /** 导出按钮操作 */
279 247 handleExport() {
  248 + // 处理查询参数
280 249 let params = {...this.queryParams};
  250 + params.pageNo = undefined;
  251 + params.pageSize = undefined;
281 252 this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
282   - this.$confirm('是否确认导出所有测试示例数据项?', "警告", {
283   - confirmButtonText: "确定",
284   - cancelButtonText: "取消",
285   - type: "warning"
286   - }).then(function() {
287   - return exportTestDemoExcel(params);
288   - }).then(response => {
289   - this.downloadExcel(response, '测试示例.xls');
290   - })
  253 + // 执行导出
  254 + this.$confirm('是否确认导出所有字典类型数据项?', "警告", {
  255 + confirmButtonText: "确定",
  256 + cancelButtonText: "取消",
  257 + type: "warning"
  258 + }).then(function() {
  259 + return exportTestDemoExcel(params);
  260 + }).then(response => {
  261 + this.downloadExcel(response, '字典类型.xls');
  262 + })
291 263 }
292 264 }
293 265 };
... ...