diff --git a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue
index 4f5381068..3e6ec8eed 100644
--- a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue
+++ b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue
@@ -51,6 +51,18 @@
+
+
+
+ 业务包
+
+
+
+
+
+
+
+
@@ -252,6 +264,9 @@ export default {
businessName: [
{ required: true, message: "请输入生成业务名", trigger: "blur" }
],
+ businessPackage: [
+ { required: true, message: "请输入生成业务包", trigger: "blur" }
+ ],
className: [
{ required: true, message: "请输入生成类名称", trigger: "blur" }
],
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/SysTestDemoController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/SysTestDemoController.java
deleted file mode 100644
index 0ea760f6a..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/SysTestDemoController.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package cn.iocoder.dashboard.modules.system.controller.test;
-
-import cn.iocoder.dashboard.common.pojo.CommonResult;
-import cn.iocoder.dashboard.common.pojo.PageResult;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoCreateReqVO;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoPageReqVO;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoRespVO;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoUpdateReqVO;
-import cn.iocoder.dashboard.modules.system.convert.test.SysTestDemoConvert;
-import cn.iocoder.dashboard.modules.system.dal.dataobject.test.SysTestDemoDO;
-import cn.iocoder.dashboard.modules.system.service.test.SysTestDemoService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-import java.util.Collection;
-import java.util.List;
-
-import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
-
-@Api(tags = "字典类型")
-@RestController
-@RequestMapping("/system/test-demo")
-@Validated
-public class SysTestDemoController {
-
- @Resource
- private SysTestDemoService testDemoService;
-
- @ApiOperation("创建字典类型")
- @PostMapping("/create")
- public CommonResult createTestDemo(@Valid SysTestDemoCreateReqVO createReqVO) {
- return success(testDemoService.createTestDemo(createReqVO));
- }
-
- @ApiOperation("更新字典类型")
- @PutMapping("/update")
- public CommonResult updateTestDemo(@Valid SysTestDemoUpdateReqVO updateReqVO) {
- testDemoService.updateTestDemo(updateReqVO);
- return success(true);
- }
-
- @ApiOperation("删除字典类型")
- @DeleteMapping("/delete")
- @ApiImplicitParam(name = "id", value = "编号", required = true)
- public CommonResult deleteTestDemo(@RequestParam("id") Long id) {
- testDemoService.deleteTestDemo(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @ApiOperation("获得字典类型")
- @ApiImplicitParam(name = "id", value = "编号", required = true)
- public CommonResult getTestDemo(@RequestParam("id") Long id) {
- SysTestDemoDO testDemo = testDemoService.getTestDemo(id);
- return success(SysTestDemoConvert.INSTANCE.convert(testDemo));
- }
-
- @GetMapping("/list")
- @ApiOperation("获得字典类型列表")
- @ApiImplicitParam(name = "ids", value = "编号列表", required = true)
- public CommonResult> getTestDemoList(@RequestParam("ids") Collection ids) {
- List list = testDemoService.getTestDemoList(ids);
- return success(SysTestDemoConvert.INSTANCE.convertList(list));
- }
-
- @ApiOperation("获得字典类型分页")
- @GetMapping("/page")
- public CommonResult> getTestDemoPage(@Valid SysTestDemoPageReqVO pageVO) {
- PageResult pageResult = testDemoService.getTestDemoPage(pageVO);
- return success(SysTestDemoConvert.INSTANCE.convertPage(pageResult));
- }
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/package-info.java
deleted file mode 100644
index 93a04d264..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package cn.iocoder.dashboard.modules.system.controller.test;
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoBaseVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoBaseVO.java
deleted file mode 100644
index 72cad4bde..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoBaseVO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package cn.iocoder.dashboard.modules.system.controller.test.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-
-/**
-* 字典类型 Base VO,提供给添加、修改、详细的子 VO 使用
-* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
-*/
-@Data
-public class SysTestDemoBaseVO {
-
- @ApiModelProperty(value = "字典名称", required = true, example = "性别额")
- @NotNull(message = "字典名称不能为空")
- private String name;
-
- @ApiModelProperty(value = "字典类型", required = true, example = "sys_sex")
- @NotNull(message = "字典类型不能为空")
- private String dictType;
-
- @ApiModelProperty(value = "状态", required = true, example = "1")
- @NotNull(message = "状态不能为空")
- private Integer status;
-
- @ApiModelProperty(value = "备注", example = "我是备注")
- private String remark;
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoCreateReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoCreateReqVO.java
deleted file mode 100644
index 112822987..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoCreateReqVO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package cn.iocoder.dashboard.modules.system.controller.test.vo;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-@ApiModel("字典类型创建 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class SysTestDemoCreateReqVO extends SysTestDemoBaseVO {
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoPageReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoPageReqVO.java
deleted file mode 100644
index 8818bdbcf..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoPageReqVO.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package cn.iocoder.dashboard.modules.system.controller.test.vo;
-
-import cn.iocoder.dashboard.common.pojo.PageParam;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-
-import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@ApiModel("字典类型分页 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class SysTestDemoPageReqVO extends PageParam {
-
- @ApiModelProperty(value = "字典名称", example = "性别额")
- private String name;
-
- @ApiModelProperty(value = "字典类型", example = "sys_sex")
- private String dictType;
-
- @ApiModelProperty(value = "状态", example = "1")
- private Integer status;
-
- @ApiModelProperty(value = "备注", example = "我是备注")
- private String remark;
-
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @ApiModelProperty(value = "开始创建时间")
- private Date beginCreateTime;
-
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @ApiModelProperty(value = "结束创建时间")
- private Date endCreateTime;
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoRespVO.java
deleted file mode 100644
index c0b8e5f46..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoRespVO.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package cn.iocoder.dashboard.modules.system.controller.test.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-
-@ApiModel("字典类型 Response VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class SysTestDemoRespVO extends SysTestDemoBaseVO {
-
- @ApiModelProperty(value = "字典主键", required = true, example = "1")
- private Long id;
-
- @ApiModelProperty(value = "创建时间", required = true)
- private Date createTime;
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoUpdateReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoUpdateReqVO.java
deleted file mode 100644
index e0343d7e2..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/test/vo/SysTestDemoUpdateReqVO.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cn.iocoder.dashboard.modules.system.controller.test.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-import javax.validation.constraints.NotNull;
-
-@ApiModel("字典类型更新 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class SysTestDemoUpdateReqVO extends SysTestDemoBaseVO {
-
- @ApiModelProperty(value = "字典主键", required = true, example = "1")
- @NotNull(message = "字典主键不能为空")
- private Long id;
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java
index 432736e9c..94c564f2e 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java
@@ -124,7 +124,8 @@ public class SysUserController {
@GetMapping("/export")
// @PreAuthorize("@ss.hasPermi('system:user:export')") , @Validated SysUserExportReqVO reqVO
// @Log(title = "用户管理", businessType = BusinessType.EXPORT)
- public void exportUsers(HttpServletResponse response, @Validated SysUserExportReqVO reqVO) throws IOException {
+ public void exportUsers(@Validated SysUserExportReqVO reqVO,
+ HttpServletResponse response) throws IOException {
// 获得用户列表
List users = userService.listUsers(reqVO);
@@ -143,8 +144,7 @@ public class SysUserController {
});
// 输出
- ExcelUtils.write(response, "用户数据.xls", "用户列表",
- SysUserExcelVO.class, excelUsers);
+ ExcelUtils.write(response, "用户数据.xls", "用户列表", SysUserExcelVO.class, excelUsers);
}
@ApiOperation("获得导入用户模板")
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/notice/SysNoticeDO.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/notice/SysNoticeDO.java
index 016d1be07..dc89207a7 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/notice/SysNoticeDO.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/notice/SysNoticeDO.java
@@ -25,7 +25,6 @@ public class SysNoticeDO extends BaseDO {
/**
* 公告标题
*/
-
private String title;
/**
* 公告类型
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/test/SysTestDemoDO.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/test/SysTestDemoDO.java
deleted file mode 100644
index d2b4fc8c4..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/test/SysTestDemoDO.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package cn.iocoder.dashboard.modules.system.dal.dataobject.test;
-
-import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.*;
-
-/**
-* 字典类型 DO
-*
-* @author 芋艿
-*/
-@TableName("sys_test_demo")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-public class SysTestDemoDO extends BaseDO {
-
- /**
- * 字典主键
- */
- @TableId
- private Long id;
- /**
- * 字典名称
- */
- private String name;
- /**
- * 字典类型
- */
- private String dictType;
- /**
- * 状态
- */
- private Integer status;
- /**
- * 备注
- */
- private String remark;
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/test/SysTestDemoMapper.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/test/SysTestDemoMapper.java
deleted file mode 100644
index f537a67a8..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/test/SysTestDemoMapper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package cn.iocoder.dashboard.modules.system.dal.mysql.test;
-
-import cn.iocoder.dashboard.common.pojo.PageResult;
-import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
-import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.dashboard.modules.system.dal.dataobject.test.SysTestDemoDO;
-import org.apache.ibatis.annotations.Mapper;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoPageReqVO;
-
-/**
-* 字典类型 Mapper
-*
-* @author 芋艿
-*/
-@Mapper
-public interface SysTestDemoMapper extends BaseMapperX {
-
- default PageResult selectPage(SysTestDemoPageReqVO reqVO) {
- return selectPage(reqVO, new QueryWrapperX()
- .likeIfPresent("name", reqVO.getName())
- .eqIfPresent("dict_type", reqVO.getDictType())
- .eqIfPresent("status", reqVO.getStatus())
- .eqIfPresent("remark", reqVO.getRemark())
- .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
- );
- }
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/test/SysTestDemoService.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/test/SysTestDemoService.java
deleted file mode 100644
index 9ee5f55fc..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/service/test/SysTestDemoService.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package cn.iocoder.dashboard.modules.system.service.test;
-
-import cn.iocoder.dashboard.common.pojo.PageResult;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoCreateReqVO;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoPageReqVO;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoUpdateReqVO;
-import cn.iocoder.dashboard.modules.system.dal.dataobject.test.SysTestDemoDO;
-
-import javax.validation.Valid;
-import java.util.Collection;
-import java.util.List;
-
-/**
-* 字典类型 Service 接口
-*
-* @author 芋艿
-*/
-public interface SysTestDemoService {
-
- /**
- * 创建字典类型
- *
- * @param createReqVO 创建信息
- * @return 编号
- */
- Long createTestDemo(@Valid SysTestDemoCreateReqVO createReqVO);
-
- /**
- * 更新字典类型
- *
- * @param updateReqVO 更新信息
- */
- void updateTestDemo(@Valid SysTestDemoUpdateReqVO updateReqVO);
-
- /**
- * 删除字典类型
- *
- * @param id 编号
- */
- void deleteTestDemo(Long id);
-
- /**
- * 获得字典类型
- *
- * @param id 编号
- * @return 字典类型
- */
- SysTestDemoDO getTestDemo(Long id);
-
- /**
- * 获得字典类型列表
- *
- * @param ids 编号
- * @return 字典类型列表
- */
- List getTestDemoList(Collection ids);
-
- /**
- * 获得字典类型分页
- *
- * @param pageReqVO 分页查询
- * @return 字典类型分页
- */
- PageResult getTestDemoPage(SysTestDemoPageReqVO pageReqVO);
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/test/impl/SysTestDemoServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/test/impl/SysTestDemoServiceImpl.java
deleted file mode 100644
index d5f70626d..000000000
--- a/src/main/java/cn/iocoder/dashboard/modules/system/service/test/impl/SysTestDemoServiceImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package cn.iocoder.dashboard.modules.system.service.test.impl;
-
-import cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil;
-import cn.iocoder.dashboard.common.pojo.PageResult;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoCreateReqVO;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoPageReqVO;
-import cn.iocoder.dashboard.modules.system.controller.test.vo.SysTestDemoUpdateReqVO;
-import cn.iocoder.dashboard.modules.system.convert.test.SysTestDemoConvert;
-import cn.iocoder.dashboard.modules.system.dal.mysql.test.SysTestDemoMapper;
-import cn.iocoder.dashboard.modules.system.dal.dataobject.test.SysTestDemoDO;
-import cn.iocoder.dashboard.modules.system.service.test.SysTestDemoService;
-import org.springframework.stereotype.Service;
-import org.springframework.validation.annotation.Validated;
-
-import javax.annotation.Resource;
-import java.util.Collection;
-import java.util.List;
-
-import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.TEST_DEMO_NOT_EXISTS;
-
-/**
-* 字典类型 Service 实现类
-*
-* @author 芋艿
-*/
-@Service
-@Validated
-public class SysTestDemoServiceImpl implements SysTestDemoService {
-
- @Resource
- private SysTestDemoMapper testDemoMapper;
-
- @Override
- public Long createTestDemo(SysTestDemoCreateReqVO createReqVO) {
- // 插入
- SysTestDemoDO testDemo = SysTestDemoConvert.INSTANCE.convert(createReqVO);
- testDemoMapper.insert(testDemo);
- // 返回
- return testDemo.getId();
- }
-
- @Override
- public void updateTestDemo(SysTestDemoUpdateReqVO updateReqVO) {
- // 校验存在
- this.validateTestDemoExists(updateReqVO.getId());
- // 更新
- SysTestDemoDO updateObj = SysTestDemoConvert.INSTANCE.convert(updateReqVO);
- testDemoMapper.updateById(updateObj);
- }
-
- @Override
- public void deleteTestDemo(Long id) {
- // 校验存在
- this.validateTestDemoExists(id);
- // 更新
- testDemoMapper.deleteById(id);
- }
-
- private void validateTestDemoExists(Long id) {
- if (testDemoMapper.selectById(id) == null) {
- throw ServiceExceptionUtil.exception(TEST_DEMO_NOT_EXISTS);
- }
- }
-
- @Override
- public SysTestDemoDO getTestDemo(Long id) {
- return testDemoMapper.selectById(id);
- }
-
- @Override
- public List getTestDemoList(Collection ids) {
- return testDemoMapper.selectBatchIds(ids);
- }
-
- @Override
- public PageResult getTestDemoPage(SysTestDemoPageReqVO pageReqVO) {
- return testDemoMapper.selectPage(pageReqVO);
- }
-
-}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/table/ToolCodegenTableBaseVO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/table/ToolCodegenTableBaseVO.java
index 72d409b47..de191ac2e 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/table/ToolCodegenTableBaseVO.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/controller/codegen/vo/table/ToolCodegenTableBaseVO.java
@@ -31,6 +31,10 @@ public class ToolCodegenTableBaseVO {
@NotNull(message = "业务名不能为空")
private String businessName;
+ @ApiModelProperty(value = "业务包", required = true, example = "codegen")
+ @NotNull(message = "业务包不能为空")
+ private String businessPackage;
+
@ApiModelProperty(value = "类名称", required = true, example = "ToolCodegenTable")
@NotNull(message = "类名称不能为空")
private String className;
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/dataobject/codegen/ToolCodegenTableDO.java b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/dataobject/codegen/ToolCodegenTableDO.java
index 9cf38f20d..1b8ae31bb 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/tool/dal/dataobject/codegen/ToolCodegenTableDO.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/dal/dataobject/codegen/ToolCodegenTableDO.java
@@ -52,6 +52,14 @@ public class ToolCodegenTableDO extends BaseDO {
* 例如说,user、permission、dict 等等
*/
private String businessName;
+ /**
+ * 业务包,自定义二级目录
+ *
+ * 例如说,我们希望将 dictType 和 dictData 归类成 dict 业务
+ *
+ * 如果不需要的情况下,businessName 和 businessPackage 是等价的
+ */
+ private String businessPackage;
/**
* 类名称(首字母大写)
*
diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenBuilder.java b/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenBuilder.java
index 9d76d72a4..b2d9e2901 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenBuilder.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenBuilder.java
@@ -128,6 +128,7 @@ public class ToolCodegenBuilder {
'_', false))); // 第一个 _ 前缀的前面,作为 module 名字
table.setBusinessName(toCamelCase(subAfter(table.getTableName(),
'_', false))); // 第一步,第一个 _ 前缀的后面,作为 module 名字; 第二步,可能存在多个 _ 的情况,转换成驼峰
+ table.setBusinessPackage(table.getBusinessPackage());
table.setClassName(upperFirst(toCamelCase(table.getTableName()))); // 驼峰 + 首字母大写
table.setClassComment(subBefore(table.getTableComment(), // 去除结尾的表,作为类描述
'表', true));
diff --git a/src/main/resources/codegen/java/controller/controller.vm b/src/main/resources/codegen/java/controller/controller.vm
index bbbcf8ab0..e443b7c9b 100644
--- a/src/main/resources/codegen/java/controller/controller.vm
+++ b/src/main/resources/codegen/java/controller/controller.vm
@@ -73,4 +73,6 @@ public class ${table.className}Controller {
return success(${table.className}Convert.INSTANCE.convertPage(pageResult));
}
+
+
}
diff --git a/src/main/resources/codegen/java/controller/vo/excelReqVO.vm b/src/main/resources/codegen/java/controller/vo/excelReqVO.vm
new file mode 100644
index 000000000..e0af63d13
--- /dev/null
+++ b/src/main/resources/codegen/java/controller/vo/excelReqVO.vm
@@ -0,0 +1,42 @@
+package ${basePackage}.${table.moduleName}.controller.${table.businessName}.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+import ${PageParamClassName};
+## 处理 Date 字段的引入
+#foreach ($column in $columns)
+ #if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型
+ import org.springframework.format.annotation.DateTimeFormat;
+
+ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+ #break
+ #end
+#end
+## 字段模板
+#macro(columnTpl $prefix $prefixStr)
+ #if (${column.javaType} == "Date")## 时间类型
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+ #end
+@ApiModelProperty(value = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
+private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
+#end
+
+@ApiModel(value = "${table.classComment} Excel 导出 Request VO", description = "参数和 ${table.className}PageReqVO 是一致的")
+@Data
+public class ${table.className}ExcelReqVO {
+
+#foreach ($column in $columns)
+ #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
+ #if (${column.listOperation})##查询操作
+ #if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
+ #columnTpl('begin', '开始')
+
+ #columnTpl('end', '结束')
+ #else##情况二,非 Between 的时间
+ #columnTpl('', '')
+ #end
+
+ #end
+#end
+}
diff --git a/src/main/resources/codegen/java/controller/vo/excelRespVO.vm b/src/main/resources/codegen/java/controller/vo/excelRespVO.vm
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/main/resources/codegen/java/dal/do.vm b/src/main/resources/codegen/java/dal/do.vm
index d6d35f4d3..ba0e81129 100644
--- a/src/main/resources/codegen/java/dal/do.vm
+++ b/src/main/resources/codegen/java/dal/do.vm
@@ -22,17 +22,15 @@ public class ${table.className}DO extends BaseDO {
#foreach ($column in $columns)
#if (!${baseDOFields.contains(${column.javaField})})##排除 BaseDO 的字段
/**
- * ${column.columnComment}
- */
-#if ("$!column.dictType" != "")##处理枚举值
- // TODO 枚举 ${column.dictType}
-#end
-#if (${column.primaryKey} && ${column.javaType} != 'String')##处理主键 + 非 String 的情况
- @TableId
-#end
-#if (${column.primaryKey} && ${column.javaType} == 'String')##处理主键 + String 的情况
- @TableId(type = IdType.INPUT)
-#end
+ * ${column.columnComment}
+ #if ("$!column.dictType" != "")##处理枚举值
+ *
+ * 枚举 {@link TODO ${column.dictType} 对应的类}
+ #end
+ */
+ #if (${column.primaryKey})##处理主键
+ @TableId#if (${column.javaType} == 'String')type = IdType.INPUT)#end
+ #end
private ${column.javaType} ${column.javaField};
#end
#end
diff --git a/src/main/resources/codegen/vue/api/api.js.vm b/src/main/resources/codegen/vue/api/api.js.vm
new file mode 100644
index 000000000..296d41aed
--- /dev/null
+++ b/src/main/resources/codegen/vue/api/api.js.vm
@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询${functionName}列表
+export function list${BusinessName}(query) {
+ return request({
+ url: '/${moduleName}/${businessName}/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询${functionName}详细
+export function get${BusinessName}(${pkColumn.javaField}) {
+ return request({
+ url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
+ method: 'get'
+ })
+}
+
+// 新增${functionName}
+export function add${BusinessName}(data) {
+ return request({
+ url: '/${moduleName}/${businessName}',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改${functionName}
+export function update${BusinessName}(data) {
+ return request({
+ url: '/${moduleName}/${businessName}',
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除${functionName}
+export function del${BusinessName}(${pkColumn.javaField}) {
+ return request({
+ url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
+ method: 'delete'
+ })
+}
+
+// 导出${functionName}
+export function export${BusinessName}(query) {
+ return request({
+ url: '/${moduleName}/${businessName}/export',
+ method: 'get',
+ params: query
+ })
+}
\ No newline at end of file
diff --git a/src/main/resources/codegen/vue/views/index.vue.vm b/src/main/resources/codegen/vue/views/index.vue.vm
index 95751b63a..ffa2ffced 100644
--- a/src/main/resources/codegen/vue/views/index.vue.vm
+++ b/src/main/resources/codegen/vue/views/index.vue.vm
@@ -9,8 +9,6 @@
#set ($javaField = $column.javaField)
#set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set ($comment=$column.columnComment)
- #set ($parentheseIndex=$column.columnComment.indexOf("("))
- #if ($parentheseIndex >= 0) #set($comment=$column.columnComment.substring(0, $parentheseIndex)) #end
#if ($column.htmlType == "input")
@@ -67,8 +65,6 @@
#set ($javaField = $column.javaField)
#set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set ($comment=$column.columnComment)
- #set ($parentheseIndex=$column.columnComment.indexOf("("))
- #if ($parentheseIndex >= 0) #set($comment=$column.columnComment.substring(0, $parentheseIndex)) #end
#if ($column.javaType == "Date")## 时间类型
@@ -108,8 +104,6 @@
#set ($javaField = $column.javaField)
#set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set ($comment = $column.columnComment)
- #set ($parentheseIndex = $column.columnComment.indexOf("("))
- #if ($parentheseIndex >= 0) #set($comment = $column.columnComment.substring(0, $parentheseIndex)) #end
#if ($column.htmlType == "input")
#if (!$column.primaryKey)## 忽略主键,不用在表单里
diff --git a/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java b/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java
index cd41bd133..77a76fb46 100644
--- a/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java
+++ b/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java
@@ -1,10 +1,10 @@
package cn.iocoder.dashboard.modules.tool.service.codegen.impl;
import cn.iocoder.dashboard.TestApplication;
-import cn.iocoder.dashboard.modules.tool.dal.mysql.coegen.ToolCodegenColumnMapper;
-import cn.iocoder.dashboard.modules.tool.dal.mysql.coegen.ToolCodegenTableMapper;
import cn.iocoder.dashboard.modules.tool.dal.dataobject.codegen.ToolCodegenColumnDO;
import cn.iocoder.dashboard.modules.tool.dal.dataobject.codegen.ToolCodegenTableDO;
+import cn.iocoder.dashboard.modules.tool.dal.mysql.coegen.ToolCodegenColumnMapper;
+import cn.iocoder.dashboard.modules.tool.dal.mysql.coegen.ToolCodegenTableMapper;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@@ -25,10 +25,11 @@ public class ToolCodegenEngineTest {
@Test
public void testExecute() {
- ToolCodegenTableDO table = codegenTableMapper.selectById(10);
+ ToolCodegenTableDO table = codegenTableMapper.selectById(20);
List columns = codegenColumnMapper.selectListByTableId(table.getId());
Map result = codegenEngine.execute(table, columns);
- System.out.println(result.get("vue/views/system/test/index.vue"));
+ result.forEach((s, s2) -> System.out.println(s2));
+// System.out.println(result.get("vue/views/system/test/index.vue"));
}
}
diff --git a/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenServiceImplTest.java b/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenServiceImplTest.java
index 22d0e676d..8b34be75f 100644
--- a/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenServiceImplTest.java
+++ b/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenServiceImplTest.java
@@ -14,9 +14,9 @@ class ToolCodegenServiceImplTest {
@Test
public void tetCreateCodegenTable() {
-// toolCodegenService.createCodegenTable("sys_test_demo");
+ toolCodegenService.createCodegen("tool_test_demo");
// toolCodegenService.createCodegenTable("tool_codegen_table");
- toolCodegenService.createCodegen("tool_codegen_column");
+// toolCodegenService.createCodegen("tool_codegen_column");
}
}