diff --git a/pom.xml b/pom.xml
index 4a8fb0c55b..779c830c3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
1.8
${java.version}
${java.version}
- 3.0.0-M5
+ 3.2.2
3.14.0
1.6.0
diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index e0c66c442d..590f6134cf 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -14,7 +14,7 @@
https://github.com/YunaiV/ruoyi-vue-pro
- 2.5.0-jdk8-SNAPSHOT
+ 2.6.0-jdk8-SNAPSHOT
1.6.0
5.3.39
diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java
index fc5f0a3014..7e07fd8e32 100644
--- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java
+++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java
@@ -53,4 +53,14 @@ public abstract class BaseDO implements Serializable, TransPojo {
@TableLogic
private Boolean deleted;
+ /**
+ * 把 creator、createTime、updateTime、updater 都清空,避免前端直接传递 creator 之类的字段,直接就被更新了
+ */
+ public void clean(){
+ this.creator = null;
+ this.createTime = null;
+ this.updater = null;
+ this.updateTime = null;
+ }
+
}
diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
index 167a0fc4ea..d7ad5fad8f 100644
--- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
+++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
@@ -215,4 +215,11 @@ public interface BaseMapperX extends MPJBaseMapper {
return delete(new LambdaQueryWrapper().eq(field, value));
}
+ default int deleteBatch(SFunction field, Collection> values) {
+ if (CollUtil.isEmpty(values)) {
+ return 0;
+ }
+ return delete(new LambdaQueryWrapper().in(field, values));
+ }
+
}
diff --git a/yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java b/yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java
index f81a57131c..ac3ff39a49 100644
--- a/yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java
+++ b/yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java
@@ -38,6 +38,7 @@ public class AiUtils {
public static ChatOptions buildChatOptions(AiPlatformEnum platform, String model, Double temperature, Integer maxTokens,
Set toolNames, Map toolContext) {
toolNames = ObjUtil.defaultIfNull(toolNames, Collections.emptySet());
+ toolContext = ObjUtil.defaultIfNull(toolContext, Collections.emptyMap());
// noinspection EnhancedSwitchMigration
switch (platform) {
case TONG_YI:
diff --git a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java
index 60e0fb15d6..adabbc8618 100644
--- a/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java
+++ b/yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java
@@ -51,7 +51,7 @@ public class BpmProcessIdRedisDAO {
String noPrefix = processIdRule.getPrefix() + infix + processIdRule.getPostfix();
String key = RedisKeyConstants.BPM_PROCESS_ID + noPrefix;
Long no = stringRedisTemplate.opsForValue().increment(key);
- if (StrUtil.isEmpty(infix)) {
+ if (StrUtil.isNotEmpty(infix)) {
// 特殊:没有前缀,则不能过期,不能每次都是从 0 开始
stringRedisTemplate.expire(key, Duration.ofDays(1L));
}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenCreateListReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenCreateListReqVO.java
index efce9ed58a..cd00e8a91b 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenCreateListReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenCreateListReqVO.java
@@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.infra.controller.admin.codegen.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 基于数据库的表结构,创建代码生成器的表和字段定义 Request VO")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenUpdateReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenUpdateReqVO.java
index 78db9fbfb6..d381ec6548 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenUpdateReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/CodegenUpdateReqVO.java
@@ -3,10 +3,10 @@ package cn.iocoder.yudao.module.infra.controller.admin.codegen.vo;
import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.column.CodegenColumnSaveReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.table.CodegenTableSaveReqVO;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 代码生成表和字段的修改 Request VO")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnSaveReqVO.java
index a236174bcd..9579d790b6 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnSaveReqVO.java
@@ -1,10 +1,9 @@
package cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.column;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
-
@Schema(description = "管理后台 - 代码生成字段定义创建/修改 Request VO")
@Data
public class CodegenColumnSaveReqVO {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java
index 032a9d82ff..7bd26d6ede 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java
@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.table;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Schema(description = "管理后台 - 表定义分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class CodegenTablePageReqVO extends PageParam {
@Schema(description = "表名称,模糊匹配", example = "yudao")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableSaveReqVO.java
index 19c75b042f..5f12e3dc71 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableSaveReqVO.java
@@ -5,11 +5,10 @@ import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.AssertTrue;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.AssertTrue;
-import javax.validation.constraints.NotNull;
-
@Schema(description = "管理后台 - 代码生成表定义创建/修改 Response VO")
@Data
public class CodegenTableSaveReqVO {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java
index 56216621d2..43e64c02a9 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java
@@ -5,7 +5,9 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
-import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*;
+import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO;
+import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
@@ -13,13 +15,13 @@ import cn.iocoder.yudao.module.infra.service.config.ConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java
index 8caec39d11..1a8a139651 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java
@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.config.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Schema(description = "管理后台 - 参数配置分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class ConfigPageReqVO extends PageParam {
@Schema(description = "数据源名称,模糊匹配", example = "名称")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigSaveReqVO.java
index 59aaa4848e..bbde578ce4 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigSaveReqVO.java
@@ -1,13 +1,12 @@
package cn.iocoder.yudao.module.infra.controller.admin.config.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
@Schema(description = "管理后台 - 参数配置创建/修改 Request VO")
@Data
public class ConfigSaveReqVO {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/DataSourceConfigController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/DataSourceConfigController.java
index 85a12279e8..ba952c9e93 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/DataSourceConfigController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/DataSourceConfigController.java
@@ -9,12 +9,12 @@ import cn.iocoder.yudao.module.infra.service.db.DataSourceConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.annotation.Resource;
-import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigSaveReqVO.java
index 54d231f6b5..def5eef575 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigSaveReqVO.java
@@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.infra.controller.admin.db.vo;
import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-import javax.validation.constraints.*;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
@Schema(description = "管理后台 - 数据源配置创建/修改 Request VO")
@Data
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/Demo01ContactController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/Demo01ContactController.java
index 0492ee500b..9198d39c5e 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/Demo01ContactController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/Demo01ContactController.java
@@ -60,6 +60,15 @@ public class Demo01ContactController {
return success(true);
}
+ @DeleteMapping("/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除示例联系人")
+ @PreAuthorize("@ss.hasPermission('infra:demo01-contact:delete')")
+ public CommonResult deleteDemo0iContactList(@RequestParam("ids") List ids) {
+ demo01ContactService.deleteDemo0iContactListByIds(ids);
+ return success(true);
+ }
+
@GetMapping("/get")
@Operation(summary = "获得示例联系人")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@@ -82,12 +91,12 @@ public class Demo01ContactController {
@PreAuthorize("@ss.hasPermission('infra:demo01-contact:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDemo01ContactExcel(@Valid Demo01ContactPageReqVO pageReqVO,
- HttpServletResponse response) throws IOException {
+ HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List list = demo01ContactService.getDemo01ContactPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "示例联系人.xls", "数据", Demo01ContactRespVO.class,
- BeanUtils.toBean(list, Demo01ContactRespVO.class));
+ BeanUtils.toBean(list, Demo01ContactRespVO.class));
}
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactPageReqVO.java
index d337d2d7db..07c4ba1756 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactPageReqVO.java
@@ -1,18 +1,16 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo;
-import lombok.*;
-import java.util.*;
-import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
+
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 示例联系人分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class Demo01ContactPageReqVO extends PageParam {
@Schema(description = "名字", example = "张三")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactRespVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactRespVO.java
index 5d176c262a..17ee9fef84 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactRespVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactRespVO.java
@@ -1,14 +1,13 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-import java.util.*;
-import java.util.*;
-import org.springframework.format.annotation.DateTimeFormat;
-import java.time.LocalDateTime;
-import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
@Schema(description = "管理后台 - 示例联系人 Response VO")
@Data
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactSaveReqVO.java
index 94157ed4df..15d2727663 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactSaveReqVO.java
@@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 示例联系人新增/修改 Request VO")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/Demo02CategoryController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/Demo02CategoryController.java
index 7cc35b71ee..f5f6b7ab1c 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/Demo02CategoryController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/Demo02CategoryController.java
@@ -80,11 +80,11 @@ public class Demo02CategoryController {
@PreAuthorize("@ss.hasPermission('infra:demo02-category:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDemo02CategoryExcel(@Valid Demo02CategoryListReqVO listReqVO,
- HttpServletResponse response) throws IOException {
+ HttpServletResponse response) throws IOException {
List list = demo02CategoryService.getDemo02CategoryList(listReqVO);
// 导出 Excel
ExcelUtils.write(response, "示例分类.xls", "数据", Demo02CategoryRespVO.class,
- BeanUtils.toBean(list, Demo02CategoryRespVO.class));
+ BeanUtils.toBean(list, Demo02CategoryRespVO.class));
}
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/vo/Demo02CategorySaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/vo/Demo02CategorySaveReqVO.java
index 3cc5012516..0bc1a785e7 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/vo/Demo02CategorySaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo02/vo/Demo02CategorySaveReqVO.java
@@ -1,11 +1,10 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-
@Schema(description = "管理后台 - 示例分类新增/修改 Request VO")
@Data
public class Demo02CategorySaveReqVO {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/Demo03StudentController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/Demo03StudentErpController.java
similarity index 65%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/Demo03StudentController.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/Demo03StudentErpController.java
index 1a7375ffe3..e8685033d4 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/Demo03StudentController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/Demo03StudentErpController.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03;
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@@ -6,13 +6,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.Demo03StudentPageReqVO;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.Demo03StudentRespVO;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.Demo03StudentSaveReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpRespVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
-import cn.iocoder.yudao.module.infra.service.demo.demo03.Demo03StudentService;
+import cn.iocoder.yudao.module.infra.service.demo.demo03.erp.Demo03StudentErpService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -31,25 +31,25 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 学生")
@RestController
-@RequestMapping("/infra/demo03-student")
+@RequestMapping("/infra/demo03-student-erp")
@Validated
-public class Demo03StudentController {
+public class Demo03StudentErpController {
@Resource
- private Demo03StudentService demo03StudentService;
+ private Demo03StudentErpService demo03StudentErpService;
@PostMapping("/create")
@Operation(summary = "创建学生")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
- public CommonResult createDemo03Student(@Valid @RequestBody Demo03StudentSaveReqVO createReqVO) {
- return success(demo03StudentService.createDemo03Student(createReqVO));
+ public CommonResult createDemo03Student(@Valid @RequestBody Demo03StudentErpSaveReqVO createReqVO) {
+ return success(demo03StudentErpService.createDemo03Student(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新学生")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
- public CommonResult updateDemo03Student(@Valid @RequestBody Demo03StudentSaveReqVO updateReqVO) {
- demo03StudentService.updateDemo03Student(updateReqVO);
+ public CommonResult updateDemo03Student(@Valid @RequestBody Demo03StudentErpSaveReqVO updateReqVO) {
+ demo03StudentErpService.updateDemo03Student(updateReqVO);
return success(true);
}
@@ -58,7 +58,17 @@ public class Demo03StudentController {
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
public CommonResult deleteDemo03Student(@RequestParam("id") Long id) {
- demo03StudentService.deleteDemo03Student(id);
+ demo03StudentErpService.deleteDemo03Student(id);
+ return success(true);
+ }
+
+ @DeleteMapping("/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除学生")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
+ public CommonResult deleteDemo03StudentList(@RequestParam("ids") List ids) {
+ // TODO @puhui999:deleteDemo03StudentList
+ demo03StudentErpService.deleteDemo03StudentListByIds(ids);
return success(true);
}
@@ -66,30 +76,30 @@ public class Demo03StudentController {
@Operation(summary = "获得学生")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
- public CommonResult getDemo03Student(@RequestParam("id") Long id) {
- Demo03StudentDO demo03Student = demo03StudentService.getDemo03Student(id);
- return success(BeanUtils.toBean(demo03Student, Demo03StudentRespVO.class));
+ public CommonResult getDemo03Student(@RequestParam("id") Long id) {
+ Demo03StudentDO demo03Student = demo03StudentErpService.getDemo03Student(id);
+ return success(BeanUtils.toBean(demo03Student, Demo03StudentErpRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得学生分页")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
- public CommonResult> getDemo03StudentPage(@Valid Demo03StudentPageReqVO pageReqVO) {
- PageResult pageResult = demo03StudentService.getDemo03StudentPage(pageReqVO);
- return success(BeanUtils.toBean(pageResult, Demo03StudentRespVO.class));
+ public CommonResult> getDemo03StudentPage(@Valid Demo03StudentErpPageReqVO pageReqVO) {
+ PageResult pageResult = demo03StudentErpService.getDemo03StudentPage(pageReqVO);
+ return success(BeanUtils.toBean(pageResult, Demo03StudentErpRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出学生 Excel")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:export')")
@ApiAccessLog(operateType = EXPORT)
- public void exportDemo03StudentExcel(@Valid Demo03StudentPageReqVO pageReqVO,
- HttpServletResponse response) throws IOException {
+ public void exportDemo03StudentExcel(@Valid Demo03StudentErpPageReqVO pageReqVO,
+ HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
- List list = demo03StudentService.getDemo03StudentPage(pageReqVO).getList();
+ List list = demo03StudentErpService.getDemo03StudentPage(pageReqVO).getList();
// 导出 Excel
- ExcelUtils.write(response, "学生.xls", "数据", Demo03StudentRespVO.class,
- BeanUtils.toBean(list, Demo03StudentRespVO.class));
+ ExcelUtils.write(response, "学生.xls", "数据", Demo03StudentErpRespVO.class,
+ BeanUtils.toBean(list, Demo03StudentErpRespVO.class));
}
// ==================== 子表(学生课程) ====================
@@ -100,21 +110,21 @@ public class Demo03StudentController {
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
public CommonResult> getDemo03CoursePage(PageParam pageReqVO,
@RequestParam("studentId") Long studentId) {
- return success(demo03StudentService.getDemo03CoursePage(pageReqVO, studentId));
+ return success(demo03StudentErpService.getDemo03CoursePage(pageReqVO, studentId));
}
@PostMapping("/demo03-course/create")
@Operation(summary = "创建学生课程")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
public CommonResult createDemo03Course(@Valid @RequestBody Demo03CourseDO demo03Course) {
- return success(demo03StudentService.createDemo03Course(demo03Course));
+ return success(demo03StudentErpService.createDemo03Course(demo03Course));
}
@PutMapping("/demo03-course/update")
@Operation(summary = "更新学生课程")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
public CommonResult updateDemo03Course(@Valid @RequestBody Demo03CourseDO demo03Course) {
- demo03StudentService.updateDemo03Course(demo03Course);
+ demo03StudentErpService.updateDemo03Course(demo03Course);
return success(true);
}
@@ -123,7 +133,16 @@ public class Demo03StudentController {
@Operation(summary = "删除学生课程")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
public CommonResult deleteDemo03Course(@RequestParam("id") Long id) {
- demo03StudentService.deleteDemo03Course(id);
+ demo03StudentErpService.deleteDemo03Course(id);
+ return success(true);
+ }
+
+ @DeleteMapping("/demo03-course/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除学生课程")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
+ public CommonResult deleteDemo03CourseList(@RequestParam("ids") List ids) {
+ demo03StudentErpService.deleteDemo03CourseListByIds(ids);
return success(true);
}
@@ -132,15 +151,7 @@ public class Demo03StudentController {
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
public CommonResult getDemo03Course(@RequestParam("id") Long id) {
- return success(demo03StudentService.getDemo03Course(id));
- }
-
- @GetMapping("/demo03-course/list-by-student-id")
- @Operation(summary = "获得学生课程列表")
- @Parameter(name = "studentId", description = "学生编号")
- @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
- public CommonResult> getDemo03CourseListByStudentId(@RequestParam("studentId") Long studentId) {
- return success(demo03StudentService.getDemo03CourseListByStudentId(studentId));
+ return success(demo03StudentErpService.getDemo03Course(id));
}
// ==================== 子表(学生班级) ====================
@@ -151,21 +162,21 @@ public class Demo03StudentController {
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
public CommonResult> getDemo03GradePage(PageParam pageReqVO,
@RequestParam("studentId") Long studentId) {
- return success(demo03StudentService.getDemo03GradePage(pageReqVO, studentId));
+ return success(demo03StudentErpService.getDemo03GradePage(pageReqVO, studentId));
}
@PostMapping("/demo03-grade/create")
@Operation(summary = "创建学生班级")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
public CommonResult createDemo03Grade(@Valid @RequestBody Demo03GradeDO demo03Grade) {
- return success(demo03StudentService.createDemo03Grade(demo03Grade));
+ return success(demo03StudentErpService.createDemo03Grade(demo03Grade));
}
@PutMapping("/demo03-grade/update")
@Operation(summary = "更新学生班级")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
public CommonResult updateDemo03Grade(@Valid @RequestBody Demo03GradeDO demo03Grade) {
- demo03StudentService.updateDemo03Grade(demo03Grade);
+ demo03StudentErpService.updateDemo03Grade(demo03Grade);
return success(true);
}
@@ -174,7 +185,16 @@ public class Demo03StudentController {
@Operation(summary = "删除学生班级")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
public CommonResult deleteDemo03Grade(@RequestParam("id") Long id) {
- demo03StudentService.deleteDemo03Grade(id);
+ demo03StudentErpService.deleteDemo03Grade(id);
+ return success(true);
+ }
+
+ @DeleteMapping("/demo03-grade/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除学生班级")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
+ public CommonResult deleteDemo03GradeList(@RequestParam("ids") List ids) {
+ demo03StudentErpService.deleteDemo03GradeListByIds(ids);
return success(true);
}
@@ -183,15 +203,7 @@ public class Demo03StudentController {
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
public CommonResult getDemo03Grade(@RequestParam("id") Long id) {
- return success(demo03StudentService.getDemo03Grade(id));
- }
-
- @GetMapping("/demo03-grade/get-by-student-id")
- @Operation(summary = "获得学生班级")
- @Parameter(name = "studentId", description = "学生编号")
- @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
- public CommonResult getDemo03GradeByStudentId(@RequestParam("studentId") Long studentId) {
- return success(demo03StudentService.getDemo03GradeByStudentId(studentId));
+ return success(demo03StudentErpService.getDemo03Grade(id));
}
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpPageReqVO.java
similarity index 85%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentPageReqVO.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpPageReqVO.java
index 6834991755..5fcb656789 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpPageReqVO.java
@@ -1,18 +1,17 @@
-package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo;
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo;
-import lombok.*;
-import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
+
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 学生分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class Demo03StudentPageReqVO extends PageParam {
+public class Demo03StudentErpPageReqVO extends PageParam {
@Schema(description = "名字", example = "芋艿")
private String name;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentRespVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpRespVO.java
similarity index 88%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentRespVO.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpRespVO.java
index 5ae784fa04..84dfe6e037 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentRespVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpRespVO.java
@@ -1,17 +1,18 @@
-package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo;
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-
-import java.time.LocalDateTime;
-import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
@Schema(description = "管理后台 - 学生 Response VO")
@Data
@ExcelIgnoreUnannotated
-public class Demo03StudentRespVO {
+public class Demo03StudentErpRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
@ExcelProperty("编号")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpSaveReqVO.java
new file mode 100644
index 0000000000..d68e9b5942
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/erp/vo/Demo03StudentErpSaveReqVO.java
@@ -0,0 +1,33 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 学生新增/修改 Request VO")
+@Data
+public class Demo03StudentErpSaveReqVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
+ private Long id;
+
+ @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
+ @NotEmpty(message = "名字不能为空")
+ private String name;
+
+ @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
+ @NotNull(message = "性别不能为空")
+ private Integer sex;
+
+ @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
+ @NotNull(message = "出生日期不能为空")
+ private LocalDateTime birthday;
+
+ @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
+ @NotEmpty(message = "简介不能为空")
+ private String description;
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/Demo03StudentInnerController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/Demo03StudentInnerController.java
new file mode 100644
index 0000000000..d76b3a89d0
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/Demo03StudentInnerController.java
@@ -0,0 +1,124 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerRespVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerSaveReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import cn.iocoder.yudao.module.infra.service.demo.demo03.inner.Demo03StudentInnerService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "管理后台 - 学生")
+@RestController
+@RequestMapping("/infra/demo03-student-inner")
+@Validated
+public class Demo03StudentInnerController {
+
+ @Resource
+ private Demo03StudentInnerService demo03StudentInnerService;
+
+ @PostMapping("/create")
+ @Operation(summary = "创建学生")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
+ public CommonResult createDemo03Student(@Valid @RequestBody Demo03StudentInnerSaveReqVO createReqVO) {
+ return success(demo03StudentInnerService.createDemo03Student(createReqVO));
+ }
+
+ @PutMapping("/update")
+ @Operation(summary = "更新学生")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
+ public CommonResult updateDemo03Student(@Valid @RequestBody Demo03StudentInnerSaveReqVO updateReqVO) {
+ demo03StudentInnerService.updateDemo03Student(updateReqVO);
+ return success(true);
+ }
+
+ @DeleteMapping("/delete")
+ @Operation(summary = "删除学生")
+ @Parameter(name = "id", description = "编号", required = true)
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
+ public CommonResult deleteDemo03Student(@RequestParam("id") Long id) {
+ demo03StudentInnerService.deleteDemo03Student(id);
+ return success(true);
+ }
+
+ @DeleteMapping("/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除学生")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
+ public CommonResult deleteDemo03StudentList(@RequestParam("ids") List ids) {
+ demo03StudentInnerService.deleteDemo03StudentListByIds(ids);
+ return success(true);
+ }
+
+ @GetMapping("/get")
+ @Operation(summary = "获得学生")
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult getDemo03Student(@RequestParam("id") Long id) {
+ Demo03StudentDO demo03Student = demo03StudentInnerService.getDemo03Student(id);
+ return success(BeanUtils.toBean(demo03Student, Demo03StudentInnerRespVO.class));
+ }
+
+ @GetMapping("/page")
+ @Operation(summary = "获得学生分页")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult> getDemo03StudentPage(@Valid Demo03StudentInnerPageReqVO pageReqVO) {
+ PageResult pageResult = demo03StudentInnerService.getDemo03StudentPage(pageReqVO);
+ return success(BeanUtils.toBean(pageResult, Demo03StudentInnerRespVO.class));
+ }
+
+ @GetMapping("/export-excel")
+ @Operation(summary = "导出学生 Excel")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:export')")
+ @ApiAccessLog(operateType = EXPORT)
+ public void exportDemo03StudentExcel(@Valid Demo03StudentInnerPageReqVO pageReqVO,
+ HttpServletResponse response) throws IOException {
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+ List list = demo03StudentInnerService.getDemo03StudentPage(pageReqVO).getList();
+ // 导出 Excel
+ ExcelUtils.write(response, "学生.xls", "数据", Demo03StudentInnerRespVO.class,
+ BeanUtils.toBean(list, Demo03StudentInnerRespVO.class));
+ }
+
+ // ==================== 子表(学生课程) ====================
+
+ @GetMapping("/demo03-course/list-by-student-id")
+ @Operation(summary = "获得学生课程列表")
+ @Parameter(name = "studentId", description = "学生编号")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult> getDemo03CourseListByStudentId(@RequestParam("studentId") Long studentId) {
+ return success(demo03StudentInnerService.getDemo03CourseListByStudentId(studentId));
+ }
+
+ // ==================== 子表(学生班级) ====================
+
+ @GetMapping("/demo03-grade/get-by-student-id")
+ @Operation(summary = "获得学生班级")
+ @Parameter(name = "studentId", description = "学生编号")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult getDemo03GradeByStudentId(@RequestParam("studentId") Long studentId) {
+ return success(demo03StudentInnerService.getDemo03GradeByStudentId(studentId));
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerPageReqVO.java
new file mode 100644
index 0000000000..82c7265938
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerPageReqVO.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 学生分页 Request VO")
+@Data
+public class Demo03StudentInnerPageReqVO extends PageParam {
+
+ @Schema(description = "名字", example = "芋艿")
+ private String name;
+
+ @Schema(description = "性别")
+ private Integer sex;
+
+ @Schema(description = "简介", example = "随便")
+ private String description;
+
+ @Schema(description = "创建时间")
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+ private LocalDateTime[] createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerRespVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerRespVO.java
new file mode 100644
index 0000000000..48d5e4889a
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerRespVO.java
@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo;
+
+import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
+import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 学生 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class Demo03StudentInnerRespVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
+ @ExcelProperty("编号")
+ private Long id;
+
+ @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
+ @ExcelProperty("名字")
+ private String name;
+
+ @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
+ @ExcelProperty(value = "性别", converter = DictConvert.class)
+ @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+ private Integer sex;
+
+ @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
+ @ExcelProperty("出生日期")
+ private LocalDateTime birthday;
+
+ @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
+ @ExcelProperty("简介")
+ private String description;
+
+ @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+ @ExcelProperty("创建时间")
+ private LocalDateTime createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerSaveReqVO.java
similarity index 81%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentSaveReqVO.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerSaveReqVO.java
index d3393a76d0..e181eeaea9 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/vo/Demo03StudentSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/inner/vo/Demo03StudentInnerSaveReqVO.java
@@ -1,16 +1,18 @@
-package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo;
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-import java.util.*;
-import javax.validation.constraints.*;
-import java.time.LocalDateTime;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
@Schema(description = "管理后台 - 学生新增/修改 Request VO")
@Data
-public class Demo03StudentSaveReqVO {
+public class Demo03StudentInnerSaveReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
private Long id;
@@ -31,9 +33,10 @@ public class Demo03StudentSaveReqVO {
@NotEmpty(message = "简介不能为空")
private String description;
-
+ @Schema(description = "学生课程列表")
private List demo03Courses;
+ @Schema(description = "学生班级")
private Demo03GradeDO demo03Grade;
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/Demo03StudentNormalController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/Demo03StudentNormalController.java
new file mode 100644
index 0000000000..e52160ca77
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/Demo03StudentNormalController.java
@@ -0,0 +1,124 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalRespVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalSaveReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import cn.iocoder.yudao.module.infra.service.demo.demo03.normal.Demo03StudentNormalService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "管理后台 - 学生")
+@RestController
+@RequestMapping("/infra/demo03-student-normal")
+@Validated
+public class Demo03StudentNormalController {
+
+ @Resource
+ private Demo03StudentNormalService demo03StudentNormalService;
+
+ @PostMapping("/create")
+ @Operation(summary = "创建学生")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:create')")
+ public CommonResult createDemo03Student(@Valid @RequestBody Demo03StudentNormalSaveReqVO createReqVO) {
+ return success(demo03StudentNormalService.createDemo03Student(createReqVO));
+ }
+
+ @PutMapping("/update")
+ @Operation(summary = "更新学生")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:update')")
+ public CommonResult updateDemo03Student(@Valid @RequestBody Demo03StudentNormalSaveReqVO updateReqVO) {
+ demo03StudentNormalService.updateDemo03Student(updateReqVO);
+ return success(true);
+ }
+
+ @DeleteMapping("/delete")
+ @Operation(summary = "删除学生")
+ @Parameter(name = "id", description = "编号", required = true)
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
+ public CommonResult deleteDemo03Student(@RequestParam("id") Long id) {
+ demo03StudentNormalService.deleteDemo03Student(id);
+ return success(true);
+ }
+
+ @DeleteMapping("/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除学生")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
+ public CommonResult deleteDemo03StudentList(@RequestParam("ids") List ids) {
+ demo03StudentNormalService.deleteDemo03StudentListByIds(ids);
+ return success(true);
+ }
+
+ @GetMapping("/get")
+ @Operation(summary = "获得学生")
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult getDemo03Student(@RequestParam("id") Long id) {
+ Demo03StudentDO demo03Student = demo03StudentNormalService.getDemo03Student(id);
+ return success(BeanUtils.toBean(demo03Student, Demo03StudentNormalRespVO.class));
+ }
+
+ @GetMapping("/page")
+ @Operation(summary = "获得学生分页")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult> getDemo03StudentPage(@Valid Demo03StudentNormalPageReqVO pageReqVO) {
+ PageResult pageResult = demo03StudentNormalService.getDemo03StudentPage(pageReqVO);
+ return success(BeanUtils.toBean(pageResult, Demo03StudentNormalRespVO.class));
+ }
+
+ @GetMapping("/export-excel")
+ @Operation(summary = "导出学生 Excel")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:export')")
+ @ApiAccessLog(operateType = EXPORT)
+ public void exportDemo03StudentExcel(@Valid Demo03StudentNormalPageReqVO pageReqVO,
+ HttpServletResponse response) throws IOException {
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+ List list = demo03StudentNormalService.getDemo03StudentPage(pageReqVO).getList();
+ // 导出 Excel
+ ExcelUtils.write(response, "学生.xls", "数据", Demo03StudentNormalRespVO.class,
+ BeanUtils.toBean(list, Demo03StudentNormalRespVO.class));
+ }
+
+ // ==================== 子表(学生课程) ====================
+
+ @GetMapping("/demo03-course/list-by-student-id")
+ @Operation(summary = "获得学生课程列表")
+ @Parameter(name = "studentId", description = "学生编号")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult> getDemo03CourseListByStudentId(@RequestParam("studentId") Long studentId) {
+ return success(demo03StudentNormalService.getDemo03CourseListByStudentId(studentId));
+ }
+
+ // ==================== 子表(学生班级) ====================
+
+ @GetMapping("/demo03-grade/get-by-student-id")
+ @Operation(summary = "获得学生班级")
+ @Parameter(name = "studentId", description = "学生编号")
+ @PreAuthorize("@ss.hasPermission('infra:demo03-student:query')")
+ public CommonResult getDemo03GradeByStudentId(@RequestParam("studentId") Long studentId) {
+ return success(demo03StudentNormalService.getDemo03GradeByStudentId(studentId));
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalPageReqVO.java
new file mode 100644
index 0000000000..8d6c76c846
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalPageReqVO.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 学生分页 Request VO")
+@Data
+public class Demo03StudentNormalPageReqVO extends PageParam {
+
+ @Schema(description = "名字", example = "芋艿")
+ private String name;
+
+ @Schema(description = "性别")
+ private Integer sex;
+
+ @Schema(description = "简介", example = "随便")
+ private String description;
+
+ @Schema(description = "创建时间")
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+ private LocalDateTime[] createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalRespVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalRespVO.java
new file mode 100644
index 0000000000..e36a7965c1
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalRespVO.java
@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo;
+
+import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
+import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 学生 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class Demo03StudentNormalRespVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
+ @ExcelProperty("编号")
+ private Long id;
+
+ @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
+ @ExcelProperty("名字")
+ private String name;
+
+ @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
+ @ExcelProperty(value = "性别", converter = DictConvert.class)
+ @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+ private Integer sex;
+
+ @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
+ @ExcelProperty("出生日期")
+ private LocalDateTime birthday;
+
+ @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
+ @ExcelProperty("简介")
+ private String description;
+
+ @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+ @ExcelProperty("创建时间")
+ private LocalDateTime createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalSaveReqVO.java
new file mode 100644
index 0000000000..1b3edd9196
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/normal/vo/Demo03StudentNormalSaveReqVO.java
@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo;
+
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Schema(description = "管理后台 - 学生新增/修改 Request VO")
+@Data
+public class Demo03StudentNormalSaveReqVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8525")
+ private Long id;
+
+ @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
+ @NotEmpty(message = "名字不能为空")
+ private String name;
+
+ @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
+ @NotNull(message = "性别不能为空")
+ private Integer sex;
+
+ @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
+ @NotNull(message = "出生日期不能为空")
+ private LocalDateTime birthday;
+
+ @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
+ @NotEmpty(message = "简介不能为空")
+ private String description;
+
+ @Schema(description = "学生课程列表")
+ private List demo03Courses;
+
+ @Schema(description = "学生班级")
+ private Demo03GradeDO demo03Grade;
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/package-info.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/package-info.java
deleted file mode 100644
index 79682e2034..0000000000
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo03/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03;
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java
index eb51f08c3a..a2e12c4e11 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java
@@ -11,13 +11,12 @@ import cn.iocoder.yudao.module.infra.service.file.FileConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 文件配置")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java
index 481fa2af52..23b3077040 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java
@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Schema(description = "管理后台 - 文件配置分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class FileConfigPageReqVO extends PageParam {
@Schema(description = "配置名", example = "S3 - 阿里云")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigSaveReqVO.java
index b346ee60aa..211bee5de6 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigSaveReqVO.java
@@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
import java.util.Map;
@Schema(description = "管理后台 - 文件配置创建/修改 Request VO")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java
index 21c117867e..48d4c4377f 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java
@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.file.vo.file;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Schema(description = "管理后台 - 文件分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class FilePageReqVO extends PageParam {
@Schema(description = "文件路径,模糊匹配", example = "yudao")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileUploadReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileUploadReqVO.java
index 918ea89028..4096f477e3 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileUploadReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileUploadReqVO.java
@@ -1,11 +1,10 @@
package cn.iocoder.yudao.module.infra.controller.admin.file.vo.file;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
-import javax.validation.constraints.NotNull;
-
@Schema(description = "管理后台 - 上传文件 Request VO")
@Data
public class FileUploadReqVO {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java
index 9b01ce7711..b03eae21a7 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java
@@ -71,10 +71,10 @@ public class JobController {
return success(true);
}
- @DeleteMapping("/delete")
+ @DeleteMapping("/delete")
@Operation(summary = "删除定时任务")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('infra:job:delete')")
+ @PreAuthorize("@ss.hasPermission('infra:job:delete')")
public CommonResult deleteJob(@RequestParam("id") Long id)
throws SchedulerException {
jobService.deleteJob(id);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java
index 332833519c..67a6aaeee0 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java
@@ -3,13 +3,9 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
@Schema(description = "管理后台 - 定时任务分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class JobPageReqVO extends PageParam {
@Schema(description = "任务名称,模糊匹配", example = "测试任务")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java
index 25683f89c9..aee0d9bcf1 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java
@@ -6,9 +6,9 @@ import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 定时任务 Response VO")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobSaveReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobSaveReqVO.java
index 0fb986e63a..a8e20fc7de 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobSaveReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobSaveReqVO.java
@@ -1,11 +1,10 @@
package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-
@Schema(description = "管理后台 - 定时任务创建/修改 Request VO")
@Data
public class JobSaveReqVO {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java
index 1d3d49600f..2d8c30e448 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java
@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Schema(description = "管理后台 - 定时任务日志分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class JobLogPageReqVO extends PageParam {
@Schema(description = "任务编号", example = "10")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java
index 81b0ee9d84..513b3ef21b 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java
@@ -12,15 +12,15 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java
index 726215a8ae..525bb9eda8 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java
@@ -14,13 +14,13 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
@@ -63,7 +63,7 @@ public class ApiErrorLogController {
@PreAuthorize("@ss.hasPermission('infra:api-error-log:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportApiErrorLogExcel(@Valid ApiErrorLogPageReqVO exportReqVO,
- HttpServletResponse response) throws IOException {
+ HttpServletResponse response) throws IOException {
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List list = apiErrorLogService.getApiErrorLogPage(exportReqVO).getList();
// 导出 Excel
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java
index c17c111220..1da136bc5c 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java
@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Schema(description = "管理后台 - API 访问日志分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class ApiAccessLogPageReqVO extends PageParam {
@Schema(description = "用户编号", example = "666")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java
index 2ceb0d033d..9611f69c9b 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java
@@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Schema(description = "管理后台 - API 错误日志分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class ApiErrorLogPageReqVO extends PageParam {
@Schema(description = "用户编号", example = "666")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java
index 57a3d6b891..7ddfc0bea7 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisMonitorRespV
import cn.iocoder.yudao.module.infra.convert.redis.RedisConvert;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.StringRedisTemplate;
@@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.annotation.Resource;
import java.util.Properties;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -34,7 +34,7 @@ public class RedisController {
Properties info = stringRedisTemplate.execute((RedisCallback) RedisServerCommands::info);
Long dbSize = stringRedisTemplate.execute(RedisServerCommands::dbSize);
Properties commandStats = stringRedisTemplate.execute((
- RedisCallback) connection -> connection.info("commandstats"));
+ RedisCallback) connection -> connection.serverCommands().info("commandstats"));
assert commandStats != null; // 断言,避免警告
// 拼接结果返回
return success(RedisConvert.INSTANCE.build(info, dbSize, commandStats));
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/vo/AppFileUploadReqVO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/vo/AppFileUploadReqVO.java
index c274652220..fde120a067 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/vo/AppFileUploadReqVO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/vo/AppFileUploadReqVO.java
@@ -1,11 +1,10 @@
package cn.iocoder.yudao.module.infra.controller.app.file.vo;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
-import javax.validation.constraints.NotNull;
-
@Schema(description = "用户 App - 上传文件 Request VO")
@Data
public class AppFileUploadReqVO {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileConfigDO.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileConfigDO.java
index 6df2144f44..4387983a0d 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileConfigDO.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileConfigDO.java
@@ -79,7 +79,8 @@ public class FileConfigDO extends BaseDO {
@Override
public Object parse(String json) {
- FileClientConfig config = JsonUtils.parseObjectQuietly(json, new TypeReference() {});
+ FileClientConfig config = JsonUtils.parseObjectQuietly(json, new TypeReference<>() {
+ });
if (config != null) {
return config;
}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo01/Demo01ContactMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo01/Demo01ContactMapper.java
index f5f3cdbbe8..916dcfc2c2 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo01/Demo01ContactMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo01/Demo01ContactMapper.java
@@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo01;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
import org.apache.ibatis.annotations.Mapper;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo02/Demo02CategoryMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo02/Demo02CategoryMapper.java
index b16e18feee..72dea775fa 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo02/Demo02CategoryMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo02/Demo02CategoryMapper.java
@@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo02;
-import java.util.*;
-
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* 示例分类 Mapper
*
@@ -24,9 +24,9 @@ public interface Demo02CategoryMapper extends BaseMapperX {
.orderByDesc(Demo02CategoryDO::getId));
}
- default Demo02CategoryDO selectByParentIdAndName(Long parentId, String name) {
- return selectOne(Demo02CategoryDO::getParentId, parentId, Demo02CategoryDO::getName, name);
- }
+ default Demo02CategoryDO selectByParentIdAndName(Long parentId, String name) {
+ return selectOne(Demo02CategoryDO::getParentId, parentId, Demo02CategoryDO::getName, name);
+ }
default Long selectCountByParentId(Long parentId) {
return selectCount(Demo02CategoryDO::getParentId, parentId);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03CourseMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03CourseErpMapper.java
similarity index 76%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03CourseMapper.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03CourseErpMapper.java
index 3cb3aa5920..cbd8707fb1 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03CourseMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03CourseErpMapper.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03;
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.erp;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -15,7 +15,7 @@ import java.util.List;
* @author 芋道源码
*/
@Mapper
-public interface Demo03CourseMapper extends BaseMapperX {
+public interface Demo03CourseErpMapper extends BaseMapperX {
default PageResult selectPage(PageParam reqVO, Long studentId) {
return selectPage(reqVO, new LambdaQueryWrapperX()
@@ -23,12 +23,12 @@ public interface Demo03CourseMapper extends BaseMapperX {
.orderByDesc(Demo03CourseDO::getId));
}
- default List selectListByStudentId(Long studentId) {
- return selectList(Demo03CourseDO::getStudentId, studentId);
- }
-
default int deleteByStudentId(Long studentId) {
return delete(Demo03CourseDO::getStudentId, studentId);
}
-}
\ No newline at end of file
+ default int deleteByStudentIds(List studentIds) {
+ return deleteBatch(Demo03CourseDO::getStudentId, studentIds);
+ }
+
+}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03GradeMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03GradeErpMapper.java
similarity index 76%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03GradeMapper.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03GradeErpMapper.java
index 0440cc49e3..cf61430817 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03GradeMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03GradeErpMapper.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03;
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.erp;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -7,13 +7,15 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* 学生班级 Mapper
*
* @author 芋道源码
*/
@Mapper
-public interface Demo03GradeMapper extends BaseMapperX {
+public interface Demo03GradeErpMapper extends BaseMapperX {
default PageResult selectPage(PageParam reqVO, Long studentId) {
return selectPage(reqVO, new LambdaQueryWrapperX()
@@ -29,4 +31,8 @@ public interface Demo03GradeMapper extends BaseMapperX {
return delete(Demo03GradeDO::getStudentId, studentId);
}
-}
\ No newline at end of file
+ default int deleteByStudentIds(List studentIds) {
+ return deleteBatch(Demo03GradeDO::getStudentId, studentIds);
+ }
+
+}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03StudentMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03StudentErpMapper.java
similarity index 82%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03StudentMapper.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03StudentErpMapper.java
index 00659d0520..4387ef5c69 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/Demo03StudentMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/erp/Demo03StudentErpMapper.java
@@ -1,11 +1,11 @@
-package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03;
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.erp;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import org.apache.ibatis.annotations.Mapper;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.*;
/**
* 学生 Mapper
@@ -13,9 +13,9 @@ import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.*;
* @author 芋道源码
*/
@Mapper
-public interface Demo03StudentMapper extends BaseMapperX {
+public interface Demo03StudentErpMapper extends BaseMapperX {
- default PageResult selectPage(Demo03StudentPageReqVO reqVO) {
+ default PageResult selectPage(Demo03StudentErpPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX()
.likeIfPresent(Demo03StudentDO::getName, reqVO.getName())
.eqIfPresent(Demo03StudentDO::getSex, reqVO.getSex())
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03CourseInnerMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03CourseInnerMapper.java
new file mode 100644
index 0000000000..74e45c4d9f
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03CourseInnerMapper.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.inner;
+
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 学生课程 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface Demo03CourseInnerMapper extends BaseMapperX {
+
+ default List selectListByStudentId(Long studentId) {
+ return selectList(Demo03CourseDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentId(Long studentId) {
+ return delete(Demo03CourseDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentIds(List studentIds) {
+ return deleteBatch(Demo03CourseDO::getStudentId, studentIds);
+ }
+
+}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03GradeInnerMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03GradeInnerMapper.java
new file mode 100644
index 0000000000..bb91d24330
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03GradeInnerMapper.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.inner;
+
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 学生班级 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface Demo03GradeInnerMapper extends BaseMapperX {
+
+ default Demo03GradeDO selectByStudentId(Long studentId) {
+ return selectOne(Demo03GradeDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentId(Long studentId) {
+ return delete(Demo03GradeDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentIds(List studentIds) {
+ return deleteBatch(Demo03GradeDO::getStudentId, studentIds);
+ }
+
+}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03StudentInnerMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03StudentInnerMapper.java
new file mode 100644
index 0000000000..6a329fd1c3
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/inner/Demo03StudentInnerMapper.java
@@ -0,0 +1,27 @@
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.inner;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerPageReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 学生 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface Demo03StudentInnerMapper extends BaseMapperX {
+
+ default PageResult selectPage(Demo03StudentInnerPageReqVO reqVO) {
+ return selectPage(reqVO, new LambdaQueryWrapperX()
+ .likeIfPresent(Demo03StudentDO::getName, reqVO.getName())
+ .eqIfPresent(Demo03StudentDO::getSex, reqVO.getSex())
+ .eqIfPresent(Demo03StudentDO::getDescription, reqVO.getDescription())
+ .betweenIfPresent(Demo03StudentDO::getCreateTime, reqVO.getCreateTime())
+ .orderByDesc(Demo03StudentDO::getId));
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03CourseNormalMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03CourseNormalMapper.java
new file mode 100644
index 0000000000..91ea89217a
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03CourseNormalMapper.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal;
+
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 学生课程 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface Demo03CourseNormalMapper extends BaseMapperX {
+
+ default List selectListByStudentId(Long studentId) {
+ return selectList(Demo03CourseDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentId(Long studentId) {
+ return delete(Demo03CourseDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentIds(List studentIds) {
+ return deleteBatch(Demo03CourseDO::getStudentId, studentIds);
+ }
+
+}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03GradeNormalMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03GradeNormalMapper.java
new file mode 100644
index 0000000000..c883f90874
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03GradeNormalMapper.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal;
+
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 学生班级 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface Demo03GradeNormalMapper extends BaseMapperX {
+
+ default Demo03GradeDO selectByStudentId(Long studentId) {
+ return selectOne(Demo03GradeDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentId(Long studentId) {
+ return delete(Demo03GradeDO::getStudentId, studentId);
+ }
+
+ default int deleteByStudentIds(List studentIds) {
+ return deleteBatch(Demo03GradeDO::getStudentId, studentIds);
+ }
+
+}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03StudentNormalMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03StudentNormalMapper.java
new file mode 100644
index 0000000000..268b1de50b
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo03/normal/Demo03StudentNormalMapper.java
@@ -0,0 +1,27 @@
+package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalPageReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 学生 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface Demo03StudentNormalMapper extends BaseMapperX {
+
+ default PageResult selectPage(Demo03StudentNormalPageReqVO reqVO) {
+ return selectPage(reqVO, new LambdaQueryWrapperX()
+ .likeIfPresent(Demo03StudentDO::getName, reqVO.getName())
+ .eqIfPresent(Demo03StudentDO::getSex, reqVO.getSex())
+ .eqIfPresent(Demo03StudentDO::getDescription, reqVO.getDescription())
+ .betweenIfPresent(Demo03StudentDO::getCreateTime, reqVO.getCreateTime())
+ .orderByDesc(Demo03StudentDO::getId));
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java
index 58ac6daf15..3902339aec 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java
@@ -34,7 +34,7 @@ public interface JobLogMapper extends BaseMapperX {
* 物理删除指定时间之前的日志
*
* @param createTime 最大时间
- * @param limit 删除条数,防止一次删除太多
+ * @param limit 删除条数,防止一次删除太多
* @return 删除条数
*/
@Delete("DELETE FROM infra_job_log WHERE create_time < #{createTime} LIMIT #{limit}")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java
index dce30829f5..820c4b1416 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java
@@ -36,7 +36,7 @@ public interface ApiAccessLogMapper extends BaseMapperX {
* 物理删除指定时间之前的日志
*
* @param createTime 最大时间
- * @param limit 删除条数,防止一次删除太多
+ * @param limit 删除条数,防止一次删除太多
* @return 删除条数
*/
@Delete("DELETE FROM infra_api_access_log WHERE create_time < #{createTime} LIMIT #{limit}")
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java
index b597d79294..f220696aed 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java
@@ -35,10 +35,10 @@ public interface ApiErrorLogMapper extends BaseMapperX {
* 物理删除指定时间之前的日志
*
* @param createTime 最大时间
- * @param limit 删除条数,防止一次删除太多
+ * @param limit 删除条数,防止一次删除太多
* @return 删除条数
*/
@Delete("DELETE FROM infra_api_error_log WHERE create_time < #{createTime} LIMIT #{limit}")
- Integer deleteByCreateTimeLt(@Param("createTime") LocalDateTime createTime, @Param("limit")Integer limit);
+ Integer deleteByCreateTimeLt(@Param("createTime") LocalDateTime createTime, @Param("limit") Integer limit);
}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java
index 4cce820b77..2233f353e7 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java
@@ -65,7 +65,8 @@ public interface ErrorCodeConstants {
ErrorCode DEMO02_CATEGORY_NAME_DUPLICATE = new ErrorCode(1_001_201_005, "已经存在该名字的示例分类");
ErrorCode DEMO02_CATEGORY_PARENT_IS_CHILD = new ErrorCode(1_001_201_006, "不能设置自己的子示例分类为父示例分类");
ErrorCode DEMO03_STUDENT_NOT_EXISTS = new ErrorCode(1_001_201_007, "学生不存在");
- ErrorCode DEMO03_GRADE_NOT_EXISTS = new ErrorCode(1_001_201_008, "学生班级不存在");
- ErrorCode DEMO03_GRADE_EXISTS = new ErrorCode(1_001_201_009, "学生班级已存在");
+ ErrorCode DEMO03_COURSE_NOT_EXISTS = new ErrorCode(1_001_201_008, "学生课程不存在");
+ ErrorCode DEMO03_GRADE_NOT_EXISTS = new ErrorCode(1_001_201_009, "学生班级不存在");
+ ErrorCode DEMO03_GRADE_EXISTS = new ErrorCode(1_001_201_010, "学生班级已存在");
}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/codegen/CodegenVOTypeEnum.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/codegen/CodegenVOTypeEnum.java
new file mode 100644
index 0000000000..60b4790533
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/codegen/CodegenVOTypeEnum.java
@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.infra.enums.codegen;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 代码生成的 VO 类型枚举
+ *
+ * 目前的作用:Controller 新增、修改、响应时,使用 VO 还是 DO
+ * 注意:不包括 Controller 的分页参数!
+ *
+ * @author 芋道源码
+ */
+@AllArgsConstructor
+@Getter
+public enum CodegenVOTypeEnum {
+
+ VO(10, "VO"),
+ DO(20, "DO");
+
+ /**
+ * 场景
+ */
+ private final Integer type;
+ /**
+ * 场景名
+ */
+ private final String name;
+
+}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/codegen/config/CodegenProperties.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/codegen/config/CodegenProperties.java
index 7447e1d52a..d673950a94 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/codegen/config/CodegenProperties.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/codegen/config/CodegenProperties.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.infra.framework.codegen.config;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenFrontTypeEnum;
+import cn.iocoder.yudao.module.infra.enums.codegen.CodegenVOTypeEnum;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
@@ -34,6 +35,20 @@ public class CodegenProperties {
@NotNull(message = "代码生成的前端类型不能为空")
private Integer frontType;
+ /**
+ * 代码生成的 VO 类型
+ *
+ * 枚举 {@link CodegenVOTypeEnum#getType()}
+ */
+ @NotNull(message = "代码生成的 VO 类型不能为空")
+ private Integer voType;
+
+ /**
+ * 是否生成批量删除接口
+ */
+ @NotNull(message = "是否生成批量删除接口不能为空")
+ private Boolean deleteBatchEnable;
+
/**
* 是否生成单元测试
*/
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FileTypeUtils.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FileTypeUtils.java
index a53f7058d6..0ba0bfcd1f 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FileTypeUtils.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FileTypeUtils.java
@@ -21,7 +21,7 @@ import java.io.IOException;
@Slf4j
public class FileTypeUtils {
- private static final ThreadLocal TIKA = TransmittableThreadLocal.withInitial(Tika::new);
+ private static final Tika TIKA = new Tika();
/**
* 获得文件的 mineType,对于 doc,jar 等文件会有误差
@@ -31,7 +31,7 @@ public class FileTypeUtils {
*/
@SneakyThrows
public static String getMineType(byte[] data) {
- return TIKA.get().detect(data);
+ return TIKA.detect(data);
}
/**
@@ -41,7 +41,7 @@ public class FileTypeUtils {
* @return mineType 无法识别时会返回“application/octet-stream”
*/
public static String getMineType(String name) {
- return TIKA.get().detect(name);
+ return TIKA.detect(name);
}
/**
@@ -52,7 +52,7 @@ public class FileTypeUtils {
* @return mineType 无法识别时会返回“application/octet-stream”
*/
public static String getMineType(byte[] data, String name) {
- return TIKA.get().detect(data, name);
+ return TIKA.detect(data, name);
}
/**
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenService.java
index 0d15c9db25..7adc9f7f1c 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenService.java
@@ -22,7 +22,7 @@ public interface CodegenService {
* 基于数据库的表结构,创建代码生成器的表定义
*
* @param author 作者
- * @param reqVO 表信息
+ * @param reqVO 表信息
* @return 创建的表定义的编号数组
*/
List createCodegenList(String author, CodegenCreateListReqVO reqVO);
@@ -92,8 +92,8 @@ public interface CodegenService {
* 获得数据库自带的表定义列表
*
* @param dataSourceConfigId 数据源的配置编号
- * @param name 表名称
- * @param comment 表描述
+ * @param name 表名称
+ * @param comment 表描述
* @return 表定义列表
*/
List getDatabaseTableList(Long dataSourceConfigId, String name, String comment);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java
index b529c49818..06f0478f7c 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java
@@ -214,7 +214,6 @@ public class CodegenBuilder {
// description、memo、remark
if (StrUtil.endWithAnyIgnoreCase(column.getColumnName(), "description", "memo", "remark")) {
column.setExample(randomEle(new String[]{"你猜", "随便", "你说的对"}));
- return;
}
}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java
index cde17e0a52..339cea7052 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java
@@ -31,6 +31,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenTableDO;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenFrontTypeEnum;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
+import cn.iocoder.yudao.module.infra.enums.codegen.CodegenVOTypeEnum;
import cn.iocoder.yudao.module.infra.framework.codegen.config.CodegenProperties;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableTable;
@@ -220,7 +221,7 @@ public class CodegenEngine {
this.templateEngine = new VelocityEngine(config);
// 设置 javaxEnable,按照是否使用 JDK17 来判断
this.jakartaEnable = SystemUtil.getJavaInfo().isJavaVersionAtLeast(1700) // 17.00 * 100
- && ClassUtils.isPresent("jakarta.annotation.Resource", ClassUtils.getDefaultClassLoader());
+ && ClassUtils.isPresent("jakarta.annotation.Resource", ClassUtils.getDefaultClassLoader());
// 设置 cloudEnable,按照是否使用 Spring Cloud 来判断
this.cloudEnable = ClassUtils.isPresent("cn.iocoder.yudao.module.infra.framework.rpc.config.RpcConfiguration",
ClassUtils.getDefaultClassLoader());
@@ -234,6 +235,8 @@ public class CodegenEngine {
globalBindingMap.put("baseFrameworkPackage", codegenProperties.getBasePackage()
+ '.' + "framework"); // 用于后续获取测试类的 package 地址
globalBindingMap.put("jakartaPackage", jakartaEnable ? "jakarta" : "javax");
+ globalBindingMap.put("voType", codegenProperties.getVoType());
+ globalBindingMap.put("deleteBatchEnable", codegenProperties.getDeleteBatchEnable());
// 全局 Java Bean
globalBindingMap.put("CommonResultClassName", CommonResult.class.getName());
globalBindingMap.put("PageResultClassName", PageResult.class.getName());
@@ -255,14 +258,15 @@ public class CodegenEngine {
globalBindingMap.put("ApiAccessLogClassName", ApiAccessLog.class.getName());
globalBindingMap.put("OperateTypeEnumClassName", OperateTypeEnum.class.getName());
globalBindingMap.put("BeanUtils", BeanUtils.class.getName());
+ globalBindingMap.put("CollectionUtilsClassName", CollectionUtils.class.getName());
}
/**
* 生成代码
*
- * @param table 表定义
- * @param columns table 的字段定义数组
- * @param subTables 子表数组,当且仅当主子表时使用
+ * @param table 表定义
+ * @param columns table 的字段定义数组
+ * @param subTables 子表数组,当且仅当主子表时使用
* @param subColumnsList subTables 的字段定义数组
* @return 生成的代码,key 是路径,value 是对应代码
*/
@@ -380,14 +384,15 @@ public class CodegenEngine {
bindingMap.put("columns", columns);
bindingMap.put("primaryColumn", CollectionUtils.findFirst(columns, CodegenColumnDO::getPrimaryKey)); // 主键字段
bindingMap.put("sceneEnum", CodegenSceneEnum.valueOf(table.getScene()));
-
// className 相关
// 去掉指定前缀,将 TestDictType 转换成 DictType. 因为在 create 等方法后,不需要带上 Test 前缀
+ String className = table.getClassName();
String simpleClassName = equalsAnyIgnoreCase(table.getClassName(), table.getModuleName()) ? table.getClassName()
: removePrefix(table.getClassName(), upperFirst(table.getModuleName()));
+ String classNameVar = lowerFirst(simpleClassName);
bindingMap.put("simpleClassName", simpleClassName);
bindingMap.put("simpleClassName_underlineCase", toUnderlineCase(simpleClassName)); // 将 DictType 转换成 dict_type
- bindingMap.put("classNameVar", lowerFirst(simpleClassName)); // 将 DictType 转换成 dictType,用于变量
+ bindingMap.put("classNameVar", classNameVar); // 将 DictType 转换成 dictType,用于变量
// 将 DictType 转换成 dict-type
String simpleClassNameStrikeCase = toSymbolCase(simpleClassName, '-');
bindingMap.put("simpleClassName_strikeCase", simpleClassNameStrikeCase);
@@ -441,6 +446,22 @@ public class CodegenEngine {
bindingMap.put("subClassNameVars", subClassNameVars);
bindingMap.put("subSimpleClassName_strikeCases", subSimpleClassNameStrikeCases);
}
+
+ // 多个 vm 公用的 VO 变量
+ if (ObjectUtil.equal(codegenProperties.getVoType(), CodegenVOTypeEnum.VO.getType())) {
+ String prefixClass = CodegenSceneEnum.valueOf(table.getScene()).getPrefixClass();
+ bindingMap.put("saveReqVOClass", prefixClass + className + "SaveReqVO");
+ bindingMap.put("updateReqVOClass", prefixClass + className + "SaveReqVO");
+ bindingMap.put("respVOClass", prefixClass + className + "RespVO");
+ bindingMap.put("saveReqVOVar", "createReqVO");
+ bindingMap.put("updateReqVOVar", "updateReqVO");
+ } else if (ObjectUtil.equal(codegenProperties.getVoType(), CodegenVOTypeEnum.DO.getType())) {
+ bindingMap.put("saveReqVOClass", className + "DO");
+ bindingMap.put("updateReqVOClass", className + "DO");
+ bindingMap.put("respVOClass", className + "DO");
+ bindingMap.put("saveReqVOVar", classNameVar);
+ bindingMap.put("updateReqVOVar", classNameVar);
+ }
return bindingMap;
}
@@ -461,6 +482,11 @@ public class CodegenEngine {
templates.remove(javaTemplatePath("test/serviceTest"));
templates.remove("codegen/sql/h2.vm");
}
+ // 如果禁用 VO 类型,则移除对应的模版
+ if (ObjectUtil.notEqual(codegenProperties.getVoType(), CodegenVOTypeEnum.VO.getType())) {
+ templates.remove(javaTemplatePath("controller/vo/respVO"));
+ templates.remove(javaTemplatePath("controller/vo/saveReqVO"));
+ }
return templates;
}
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java
index a555c74c33..0087b83b92 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java
@@ -4,8 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
-
-import javax.validation.Valid;
+import jakarta.validation.Valid;
/**
* 参数配置 Service 接口
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java
index 6d14ad9fcf..b0e5c53bef 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java
@@ -8,12 +8,11 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
-import javax.annotation.Resource;
-
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigService.java
index 2838f44d76..bb741660e8 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigService.java
@@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.service.db;
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
+import jakarta.validation.Valid;
-import javax.validation.Valid;
import java.util.List;
/**
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImpl.java
index c5bcecef4c..3e9ed4ff3c 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImpl.java
@@ -7,10 +7,10 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
+import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
-import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableService.java
index 9fd2ee9d6d..c58b125c14 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableService.java
@@ -15,8 +15,8 @@ public interface DatabaseTableService {
* 获得表列表,基于表名称 + 表描述进行模糊匹配
*
* @param dataSourceConfigId 数据源配置的编号
- * @param nameLike 表名称,模糊匹配
- * @param commentLike 表描述,模糊匹配
+ * @param nameLike 表名称,模糊匹配
+ * @param commentLike 表描述,模糊匹配
* @return 表列表
*/
List getTableList(Long dataSourceConfigId, String nameLike, String commentLike);
@@ -25,7 +25,7 @@ public interface DatabaseTableService {
* 获得指定表名
*
* @param dataSourceConfigId 数据源配置的编号
- * @param tableName 表名称
+ * @param tableName 表名称
* @return 表
*/
TableInfo getTable(Long dataSourceConfigId, String tableName);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactService.java
index e3a1b6dd5b..9c1c072afd 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactService.java
@@ -1,11 +1,12 @@
package cn.iocoder.yudao.module.infra.service.demo.demo01;
-import javax.validation.*;
-
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import jakarta.validation.Valid;
+
+import java.util.List;
/**
* 示例联系人 Service 接口
@@ -36,6 +37,13 @@ public interface Demo01ContactService {
*/
void deleteDemo01Contact(Long id);
+ /**
+ * 批量删除示例联系人
+ *
+ * @param ids 编号
+ */
+ void deleteDemo0iContactListByIds(List ids);
+
/**
* 获得示例联系人
*
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactServiceImpl.java
index cde4906381..fb6e19f967 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactServiceImpl.java
@@ -1,19 +1,20 @@
package cn.iocoder.yudao.module.infra.service.demo.demo01;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-
-import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
+import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo01.Demo01ContactMapper;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
+import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DEMO01_CONTACT_NOT_EXISTS;
/**
* 示例联系人 Service 实现类
@@ -53,6 +54,21 @@ public class Demo01ContactServiceImpl implements Demo01ContactService {
demo01ContactMapper.deleteById(id);
}
+ @Override
+ public void deleteDemo0iContactListByIds(List ids) {
+ // 校验存在
+ validateDemo01ContactExists(ids);
+ // 删除
+ demo01ContactMapper.deleteByIds(ids);
+ }
+
+ private void validateDemo01ContactExists(List ids) {
+ List list = demo01ContactMapper.selectByIds(ids);
+ if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
+ throw exception(DEMO01_CONTACT_NOT_EXISTS);
+ }
+ }
+
private void validateDemo01ContactExists(Long id) {
if (demo01ContactMapper.selectById(id) == null) {
throw exception(DEMO01_CONTACT_NOT_EXISTS);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryService.java
index 7980fdb8a4..e280f6f61a 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryService.java
@@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.infra.service.demo.demo02;
-import java.util.*;
-import javax.validation.*;
-
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategorySaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
+import jakarta.validation.Valid;
+
+import java.util.List;
/**
* 示例分类 Service 接口
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryServiceImpl.java
index 7ab4ec56be..d9a9eddceb 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryServiceImpl.java
@@ -5,10 +5,10 @@ import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02Categ
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategorySaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo02.Demo02CategoryMapper;
+import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
-import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/Demo03StudentService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/erp/Demo03StudentErpService.java
similarity index 80%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/Demo03StudentService.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/erp/Demo03StudentErpService.java
index c9a4c592ee..8a03586206 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/Demo03StudentService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/erp/Demo03StudentErpService.java
@@ -1,14 +1,14 @@
-package cn.iocoder.yudao.module.infra.service.demo.demo03;
+package cn.iocoder.yudao.module.infra.service.demo.demo03.erp;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.Demo03StudentPageReqVO;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.Demo03StudentSaveReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import jakarta.validation.Valid;
-import javax.validation.Valid;
import java.util.List;
/**
@@ -16,7 +16,7 @@ import java.util.List;
*
* @author 芋道源码
*/
-public interface Demo03StudentService {
+public interface Demo03StudentErpService {
/**
* 创建学生
@@ -24,14 +24,14 @@ public interface Demo03StudentService {
* @param createReqVO 创建信息
* @return 编号
*/
- Long createDemo03Student(@Valid Demo03StudentSaveReqVO createReqVO);
+ Long createDemo03Student(@Valid Demo03StudentErpSaveReqVO createReqVO);
/**
* 更新学生
*
* @param updateReqVO 更新信息
*/
- void updateDemo03Student(@Valid Demo03StudentSaveReqVO updateReqVO);
+ void updateDemo03Student(@Valid Demo03StudentErpSaveReqVO updateReqVO);
/**
* 删除学生
@@ -40,6 +40,13 @@ public interface Demo03StudentService {
*/
void deleteDemo03Student(Long id);
+ /**
+ * 批量删除学生
+ *
+ * @param ids 编号
+ */
+ void deleteDemo03StudentListByIds(List ids);
+
/**
* 获得学生
*
@@ -54,19 +61,10 @@ public interface Demo03StudentService {
* @param pageReqVO 分页查询
* @return 学生分页
*/
- PageResult getDemo03StudentPage(Demo03StudentPageReqVO pageReqVO);
-
+ PageResult getDemo03StudentPage(Demo03StudentErpPageReqVO pageReqVO);
// ==================== 子表(学生课程) ====================
- /**
- * 获得学生课程列表
- *
- * @param studentId 学生编号
- * @return 学生课程列表
- */
- List getDemo03CourseListByStudentId(Long studentId);
-
/**
* 获得学生课程分页
*
@@ -98,6 +96,13 @@ public interface Demo03StudentService {
*/
void deleteDemo03Course(Long id);
+ /**
+ * 批量删除学生课程
+ *
+ * @param ids 编号
+ */
+ void deleteDemo03CourseListByIds(List ids);
+
/**
* 获得学生课程
*
@@ -108,14 +113,6 @@ public interface Demo03StudentService {
// ==================== 子表(学生班级) ====================
- /**
- * 获得学生班级
- *
- * @param studentId 学生编号
- * @return 学生班级
- */
- Demo03GradeDO getDemo03GradeByStudentId(Long studentId);
-
/**
* 获得学生班级分页
*
@@ -147,6 +144,13 @@ public interface Demo03StudentService {
*/
void deleteDemo03Grade(Long id);
+ /**
+ * 批量删除学生班级
+ *
+ * @param ids 编号
+ */
+ void deleteDemo03GradeListByIds(List ids);
+
/**
* 获得学生班级
*
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/Demo03StudentServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/erp/Demo03StudentErpServiceImpl.java
similarity index 50%
rename from yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/Demo03StudentServiceImpl.java
rename to yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/erp/Demo03StudentErpServiceImpl.java
index 7b69e4ac76..a8317fd92b 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/Demo03StudentServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/erp/Demo03StudentErpServiceImpl.java
@@ -1,21 +1,22 @@
-package cn.iocoder.yudao.module.infra.service.demo.demo03;
+package cn.iocoder.yudao.module.infra.service.demo.demo03.erp;
+import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.Demo03StudentPageReqVO;
-import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.vo.Demo03StudentSaveReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
-import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.Demo03CourseMapper;
-import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.Demo03GradeMapper;
-import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.Demo03StudentMapper;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.erp.Demo03CourseErpMapper;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.erp.Demo03GradeErpMapper;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.erp.Demo03StudentErpMapper;
+import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
-import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -28,41 +29,31 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
*/
@Service
@Validated
-public class Demo03StudentServiceImpl implements Demo03StudentService {
+public class Demo03StudentErpServiceImpl implements Demo03StudentErpService {
@Resource
- private Demo03StudentMapper demo03StudentMapper;
+ private Demo03StudentErpMapper demo03StudentErpMapper;
@Resource
- private Demo03CourseMapper demo03CourseMapper;
+ private Demo03CourseErpMapper demo03CourseErpMapper;
@Resource
- private Demo03GradeMapper demo03GradeMapper;
+ private Demo03GradeErpMapper demo03GradeErpMapper;
@Override
- @Transactional(rollbackFor = Exception.class)
- public Long createDemo03Student(Demo03StudentSaveReqVO createReqVO) {
+ public Long createDemo03Student(Demo03StudentErpSaveReqVO createReqVO) {
// 插入
Demo03StudentDO demo03Student = BeanUtils.toBean(createReqVO, Demo03StudentDO.class);
- demo03StudentMapper.insert(demo03Student);
-
- // 插入子表
- createDemo03CourseList(demo03Student.getId(), createReqVO.getDemo03Courses());
- createDemo03Grade(demo03Student.getId(), createReqVO.getDemo03Grade());
+ demo03StudentErpMapper.insert(demo03Student);
// 返回
return demo03Student.getId();
}
@Override
- @Transactional(rollbackFor = Exception.class)
- public void updateDemo03Student(Demo03StudentSaveReqVO updateReqVO) {
+ public void updateDemo03Student(Demo03StudentErpSaveReqVO updateReqVO) {
// 校验存在
validateDemo03StudentExists(updateReqVO.getId());
// 更新
Demo03StudentDO updateObj = BeanUtils.toBean(updateReqVO, Demo03StudentDO.class);
- demo03StudentMapper.updateById(updateObj);
-
- // 更新子表
- updateDemo03CourseList(updateReqVO.getId(), updateReqVO.getDemo03Courses());
- updateDemo03Grade(updateReqVO.getId(), updateReqVO.getDemo03Grade());
+ demo03StudentErpMapper.updateById(updateObj);
}
@Override
@@ -71,119 +62,117 @@ public class Demo03StudentServiceImpl implements Demo03StudentService {
// 校验存在
validateDemo03StudentExists(id);
// 删除
- demo03StudentMapper.deleteById(id);
+ demo03StudentErpMapper.deleteById(id);
// 删除子表
deleteDemo03CourseByStudentId(id);
deleteDemo03GradeByStudentId(id);
}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteDemo03StudentListByIds(List ids) {
+ // 校验存在
+ validateDemo03StudentExists(ids);
+ // 删除
+ demo03StudentErpMapper.deleteByIds(ids);
+
+ // 删除子表
+ deleteDemo03CourseByStudentIds(ids);
+ deleteDemo03GradeByStudentIds(ids);
+ }
+
+ private void validateDemo03StudentExists(List ids) {
+ List list = demo03StudentErpMapper.selectByIds(ids);
+ if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
+ throw exception(DEMO03_STUDENT_NOT_EXISTS);
+ }
+ }
+
private void validateDemo03StudentExists(Long id) {
- if (demo03StudentMapper.selectById(id) == null) {
+ if (demo03StudentErpMapper.selectById(id) == null) {
throw exception(DEMO03_STUDENT_NOT_EXISTS);
}
}
@Override
public Demo03StudentDO getDemo03Student(Long id) {
- return demo03StudentMapper.selectById(id);
+ return demo03StudentErpMapper.selectById(id);
}
@Override
- public PageResult getDemo03StudentPage(Demo03StudentPageReqVO pageReqVO) {
- return demo03StudentMapper.selectPage(pageReqVO);
+ public PageResult getDemo03StudentPage(Demo03StudentErpPageReqVO pageReqVO) {
+ return demo03StudentErpMapper.selectPage(pageReqVO);
}
// ==================== 子表(学生课程) ====================
- @Override
- public List getDemo03CourseListByStudentId(Long studentId) {
- return demo03CourseMapper.selectListByStudentId(studentId);
- }
-
- private void createDemo03CourseList(Long studentId, List list) {
- if (list != null) {
- list.forEach(o -> o.setStudentId(studentId));
- }
- demo03CourseMapper.insertBatch(list);
- }
-
- private void updateDemo03CourseList(Long studentId, List list) {
- deleteDemo03CourseByStudentId(studentId);
- list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
- createDemo03CourseList(studentId, list);
- }
-
- private void deleteDemo03CourseByStudentId(Long studentId) {
- demo03CourseMapper.deleteByStudentId(studentId);
- }
-
@Override
public PageResult getDemo03CoursePage(PageParam pageReqVO, Long studentId) {
- return demo03CourseMapper.selectPage(pageReqVO, studentId);
+ return demo03CourseErpMapper.selectPage(pageReqVO, studentId);
}
@Override
public Long createDemo03Course(Demo03CourseDO demo03Course) {
- demo03CourseMapper.insert(demo03Course);
+ demo03CourseErpMapper.insert(demo03Course);
return demo03Course.getId();
}
@Override
public void updateDemo03Course(Demo03CourseDO demo03Course) {
- demo03CourseMapper.updateById(demo03Course);
+ // 校验存在
+ validateDemo03CourseExists(demo03Course.getId());
+ // 更新
+ demo03Course.clean();
+ demo03CourseErpMapper.updateById(demo03Course);
}
@Override
public void deleteDemo03Course(Long id) {
- demo03CourseMapper.deleteById(id);
+ // 删除
+ demo03CourseErpMapper.deleteById(id);
+ }
+
+ @Override
+ public void deleteDemo03CourseListByIds(List ids) {
+ // 删除
+ demo03CourseErpMapper.deleteByIds(ids);
}
@Override
public Demo03CourseDO getDemo03Course(Long id) {
- return demo03CourseMapper.selectById(id);
+ return demo03CourseErpMapper.selectById(id);
+ }
+
+ private void validateDemo03CourseExists(Long id) {
+ if (demo03CourseErpMapper.selectById(id) == null) {
+ throw exception(DEMO03_COURSE_NOT_EXISTS);
+ }
+ }
+
+ private void deleteDemo03CourseByStudentId(Long studentId) {
+ demo03CourseErpMapper.deleteByStudentId(studentId);
+ }
+
+ private void deleteDemo03CourseByStudentIds(List studentIds) {
+ demo03CourseErpMapper.deleteByStudentIds(studentIds);
}
// ==================== 子表(学生班级) ====================
- @Override
- public Demo03GradeDO getDemo03GradeByStudentId(Long studentId) {
- return demo03GradeMapper.selectByStudentId(studentId);
- }
-
- private void createDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
- if (demo03Grade == null) {
- return;
- }
- demo03Grade.setStudentId(studentId);
- demo03GradeMapper.insert(demo03Grade);
- }
-
- private void updateDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
- if (demo03Grade == null) {
- return;
- }
- demo03Grade.setStudentId(studentId);
- demo03Grade.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
- demo03GradeMapper.insertOrUpdate(demo03Grade);
- }
-
- private void deleteDemo03GradeByStudentId(Long studentId) {
- demo03GradeMapper.deleteByStudentId(studentId);
- }
-
@Override
public PageResult getDemo03GradePage(PageParam pageReqVO, Long studentId) {
- return demo03GradeMapper.selectPage(pageReqVO, studentId);
+ return demo03GradeErpMapper.selectPage(pageReqVO, studentId);
}
@Override
public Long createDemo03Grade(Demo03GradeDO demo03Grade) {
// 校验是否已经存在
- if (demo03GradeMapper.selectByStudentId(demo03Grade.getStudentId()) != null) {
+ if (demo03GradeErpMapper.selectByStudentId(demo03Grade.getStudentId()) != null) {
throw exception(DEMO03_GRADE_EXISTS);
}
- demo03GradeMapper.insert(demo03Grade);
+ // 插入
+ demo03GradeErpMapper.insert(demo03Grade);
return demo03Grade.getId();
}
@@ -192,26 +181,39 @@ public class Demo03StudentServiceImpl implements Demo03StudentService {
// 校验存在
validateDemo03GradeExists(demo03Grade.getId());
// 更新
- demo03GradeMapper.updateById(demo03Grade);
+ demo03Grade.clean();
+ demo03GradeErpMapper.updateById(demo03Grade);
}
@Override
public void deleteDemo03Grade(Long id) {
- // 校验存在
- validateDemo03GradeExists(id);
// 删除
- demo03GradeMapper.deleteById(id);
+ demo03GradeErpMapper.deleteById(id);
+ }
+
+ @Override
+ public void deleteDemo03GradeListByIds(List ids) {
+ // 删除
+ demo03GradeErpMapper.deleteByIds(ids);
}
@Override
public Demo03GradeDO getDemo03Grade(Long id) {
- return demo03GradeMapper.selectById(id);
+ return demo03GradeErpMapper.selectById(id);
}
private void validateDemo03GradeExists(Long id) {
- if (demo03GradeMapper.selectById(id) == null) {
+ if (demo03GradeErpMapper.selectById(id) == null) {
throw exception(DEMO03_GRADE_NOT_EXISTS);
}
}
+ private void deleteDemo03GradeByStudentId(Long studentId) {
+ demo03GradeErpMapper.deleteByStudentId(studentId);
+ }
+
+ private void deleteDemo03GradeByStudentIds(List studentIds) {
+ demo03GradeErpMapper.deleteByStudentIds(studentIds);
+ }
+
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/inner/Demo03StudentInnerService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/inner/Demo03StudentInnerService.java
new file mode 100644
index 0000000000..8c616022eb
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/inner/Demo03StudentInnerService.java
@@ -0,0 +1,85 @@
+package cn.iocoder.yudao.module.infra.service.demo.demo03.inner;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerSaveReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import jakarta.validation.Valid;
+
+import java.util.List;
+
+/**
+ * 学生 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface Demo03StudentInnerService {
+
+ /**
+ * 创建学生
+ *
+ * @param createReqVO 创建信息
+ * @return 编号
+ */
+ Long createDemo03Student(@Valid Demo03StudentInnerSaveReqVO createReqVO);
+
+ /**
+ * 更新学生
+ *
+ * @param updateReqVO 更新信息
+ */
+ void updateDemo03Student(@Valid Demo03StudentInnerSaveReqVO updateReqVO);
+
+ /**
+ * 删除学生
+ *
+ * @param id 编号
+ */
+ void deleteDemo03Student(Long id);
+
+ /**
+ * 批量删除学生
+ *
+ * @param ids 编号
+ */
+ void deleteDemo03StudentListByIds(List ids);
+
+ /**
+ * 获得学生
+ *
+ * @param id 编号
+ * @return 学生
+ */
+ Demo03StudentDO getDemo03Student(Long id);
+
+ /**
+ * 获得学生分页
+ *
+ * @param pageReqVO 分页查询
+ * @return 学生分页
+ */
+ PageResult getDemo03StudentPage(Demo03StudentInnerPageReqVO pageReqVO);
+
+ // ==================== 子表(学生课程) ====================
+
+ /**
+ * 获得学生课程列表
+ *
+ * @param studentId 学生编号
+ * @return 学生课程列表
+ */
+ List getDemo03CourseListByStudentId(Long studentId);
+
+ // ==================== 子表(学生班级) ====================
+
+ /**
+ * 获得学生班级
+ *
+ * @param studentId 学生编号
+ * @return 学生班级
+ */
+ Demo03GradeDO getDemo03GradeByStudentId(Long studentId);
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/inner/Demo03StudentInnerServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/inner/Demo03StudentInnerServiceImpl.java
new file mode 100644
index 0000000000..6faf857030
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/inner/Demo03StudentInnerServiceImpl.java
@@ -0,0 +1,194 @@
+package cn.iocoder.yudao.module.infra.service.demo.demo03.inner;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.inner.vo.Demo03StudentInnerSaveReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.inner.Demo03CourseInnerMapper;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.inner.Demo03GradeInnerMapper;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.inner.Demo03StudentInnerMapper;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
+import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DEMO03_STUDENT_NOT_EXISTS;
+
+/**
+ * 学生 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class Demo03StudentInnerServiceImpl implements Demo03StudentInnerService {
+
+ @Resource
+ private Demo03StudentInnerMapper demo03StudentInnerMapper;
+ @Resource
+ private Demo03CourseInnerMapper demo03CourseInnerMapper;
+ @Resource
+ private Demo03GradeInnerMapper demo03GradeInnerMapper;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Long createDemo03Student(Demo03StudentInnerSaveReqVO createReqVO) {
+ // 插入
+ Demo03StudentDO demo03Student = BeanUtils.toBean(createReqVO, Demo03StudentDO.class);
+ demo03StudentInnerMapper.insert(demo03Student);
+
+ // 插入子表
+ createDemo03CourseList(demo03Student.getId(), createReqVO.getDemo03Courses());
+ createDemo03Grade(demo03Student.getId(), createReqVO.getDemo03Grade());
+ // 返回
+ return demo03Student.getId();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void updateDemo03Student(Demo03StudentInnerSaveReqVO updateReqVO) {
+ // 校验存在
+ validateDemo03StudentExists(updateReqVO.getId());
+ // 更新
+ Demo03StudentDO updateObj = BeanUtils.toBean(updateReqVO, Demo03StudentDO.class);
+ demo03StudentInnerMapper.updateById(updateObj);
+
+ // 更新子表
+ updateDemo03CourseList(updateReqVO.getId(), updateReqVO.getDemo03Courses());
+ updateDemo03Grade(updateReqVO.getId(), updateReqVO.getDemo03Grade());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteDemo03Student(Long id) {
+ // 校验存在
+ validateDemo03StudentExists(id);
+ // 删除
+ demo03StudentInnerMapper.deleteById(id);
+
+ // 删除子表
+ deleteDemo03CourseByStudentId(id);
+ deleteDemo03GradeByStudentId(id);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteDemo03StudentListByIds(List ids) {
+ // 校验存在
+ validateDemo03StudentExists(ids);
+ // 删除
+ demo03StudentInnerMapper.deleteByIds(ids);
+
+ // 删除子表
+ deleteDemo03CourseByStudentIds(ids);
+ deleteDemo03GradeByStudentIds(ids);
+ }
+
+ private void validateDemo03StudentExists(List ids) {
+ List list = demo03StudentInnerMapper.selectByIds(ids);
+ if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
+ throw exception(DEMO03_STUDENT_NOT_EXISTS);
+ }
+ }
+
+ private void validateDemo03StudentExists(Long id) {
+ if (demo03StudentInnerMapper.selectById(id) == null) {
+ throw exception(DEMO03_STUDENT_NOT_EXISTS);
+ }
+ }
+
+ @Override
+ public Demo03StudentDO getDemo03Student(Long id) {
+ return demo03StudentInnerMapper.selectById(id);
+ }
+
+ @Override
+ public PageResult getDemo03StudentPage(Demo03StudentInnerPageReqVO pageReqVO) {
+ return demo03StudentInnerMapper.selectPage(pageReqVO);
+ }
+
+ // ==================== 子表(学生课程) ====================
+
+ @Override
+ public List getDemo03CourseListByStudentId(Long studentId) {
+ return demo03CourseInnerMapper.selectListByStudentId(studentId);
+ }
+
+ private void createDemo03CourseList(Long studentId, List list) {
+ list.forEach(o -> o.setStudentId(studentId).clean());
+ demo03CourseInnerMapper.insertBatch(list);
+ }
+
+ private void updateDemo03CourseList(Long studentId, List list) {
+ list.forEach(o -> o.setStudentId(studentId).clean());
+ List oldList = demo03CourseInnerMapper.selectListByStudentId(studentId);
+ List> diffList = diffList(oldList, list, (oldVal, newVal) -> {
+ boolean same = ObjectUtil.equal(oldVal.getId(), newVal.getId());
+ if (same) {
+ newVal.setId(oldVal.getId());
+ }
+ return same;
+ });
+
+ // 第二步,批量添加、修改、删除
+ if (CollUtil.isNotEmpty(diffList.get(0))) {
+ demo03CourseInnerMapper.insertBatch(diffList.get(0));
+ }
+ if (CollUtil.isNotEmpty(diffList.get(1))) {
+ demo03CourseInnerMapper.updateBatch(diffList.get(1));
+ }
+ if (CollUtil.isNotEmpty(diffList.get(2))) {
+ demo03CourseInnerMapper.deleteByIds(convertList(diffList.get(2), Demo03CourseDO::getId));
+ }
+ }
+
+ private void deleteDemo03CourseByStudentId(Long studentId) {
+ demo03CourseInnerMapper.deleteByStudentId(studentId);
+ }
+
+ private void deleteDemo03CourseByStudentIds(List studentIds) {
+ demo03CourseInnerMapper.deleteByStudentIds(studentIds);
+ }
+
+ // ==================== 子表(学生班级) ====================
+
+ @Override
+ public Demo03GradeDO getDemo03GradeByStudentId(Long studentId) {
+ return demo03GradeInnerMapper.selectByStudentId(studentId);
+ }
+
+ private void createDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
+ if (demo03Grade == null) {
+ return;
+ }
+ demo03Grade.setStudentId(studentId);
+ demo03GradeInnerMapper.insert(demo03Grade);
+ }
+
+ private void updateDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
+ if (demo03Grade == null) {
+ return;
+ }
+ demo03Grade.setStudentId(studentId).clean();
+ demo03GradeInnerMapper.insertOrUpdate(demo03Grade);
+ }
+
+ private void deleteDemo03GradeByStudentId(Long studentId) {
+ demo03GradeInnerMapper.deleteByStudentId(studentId);
+ }
+
+ private void deleteDemo03GradeByStudentIds(List studentIds) {
+ demo03GradeInnerMapper.deleteByStudentIds(studentIds);
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/normal/Demo03StudentNormalService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/normal/Demo03StudentNormalService.java
new file mode 100644
index 0000000000..5833509ddb
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/normal/Demo03StudentNormalService.java
@@ -0,0 +1,85 @@
+package cn.iocoder.yudao.module.infra.service.demo.demo03.normal;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalSaveReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import jakarta.validation.Valid;
+
+import java.util.List;
+
+/**
+ * 学生 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface Demo03StudentNormalService {
+
+ /**
+ * 创建学生
+ *
+ * @param createReqVO 创建信息
+ * @return 编号
+ */
+ Long createDemo03Student(@Valid Demo03StudentNormalSaveReqVO createReqVO);
+
+ /**
+ * 更新学生
+ *
+ * @param updateReqVO 更新信息
+ */
+ void updateDemo03Student(@Valid Demo03StudentNormalSaveReqVO updateReqVO);
+
+ /**
+ * 删除学生
+ *
+ * @param id 编号
+ */
+ void deleteDemo03Student(Long id);
+
+ /**
+ * 批量删除学生
+ *
+ * @param ids 编号
+ */
+ void deleteDemo03StudentListByIds(List ids);
+
+ /**
+ * 获得学生
+ *
+ * @param id 编号
+ * @return 学生
+ */
+ Demo03StudentDO getDemo03Student(Long id);
+
+ /**
+ * 获得学生分页
+ *
+ * @param pageReqVO 分页查询
+ * @return 学生分页
+ */
+ PageResult getDemo03StudentPage(Demo03StudentNormalPageReqVO pageReqVO);
+
+ // ==================== 子表(学生课程) ====================
+
+ /**
+ * 获得学生课程列表
+ *
+ * @param studentId 学生编号
+ * @return 学生课程列表
+ */
+ List getDemo03CourseListByStudentId(Long studentId);
+
+ // ==================== 子表(学生班级) ====================
+
+ /**
+ * 获得学生班级
+ *
+ * @param studentId 学生编号
+ * @return 学生班级
+ */
+ Demo03GradeDO getDemo03GradeByStudentId(Long studentId);
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/normal/Demo03StudentNormalServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/normal/Demo03StudentNormalServiceImpl.java
new file mode 100644
index 0000000000..ad3a663827
--- /dev/null
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo03/normal/Demo03StudentNormalServiceImpl.java
@@ -0,0 +1,194 @@
+package cn.iocoder.yudao.module.infra.service.demo.demo03.normal;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalPageReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalSaveReqVO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
+import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal.Demo03CourseNormalMapper;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal.Demo03GradeNormalMapper;
+import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal.Demo03StudentNormalMapper;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
+import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DEMO03_STUDENT_NOT_EXISTS;
+
+/**
+ * 学生 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class Demo03StudentNormalServiceImpl implements Demo03StudentNormalService {
+
+ @Resource
+ private Demo03StudentNormalMapper demo03StudentNormalMapper;
+ @Resource
+ private Demo03CourseNormalMapper demo03CourseNormalMapper;
+ @Resource
+ private Demo03GradeNormalMapper demo03GradeNormalMapper;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Long createDemo03Student(Demo03StudentNormalSaveReqVO createReqVO) {
+ // 插入
+ Demo03StudentDO demo03Student = BeanUtils.toBean(createReqVO, Demo03StudentDO.class);
+ demo03StudentNormalMapper.insert(demo03Student);
+
+ // 插入子表
+ createDemo03CourseList(demo03Student.getId(), createReqVO.getDemo03Courses());
+ createDemo03Grade(demo03Student.getId(), createReqVO.getDemo03Grade());
+ // 返回
+ return demo03Student.getId();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void updateDemo03Student(Demo03StudentNormalSaveReqVO updateReqVO) {
+ // 校验存在
+ validateDemo03StudentExists(updateReqVO.getId());
+ // 更新
+ Demo03StudentDO updateObj = BeanUtils.toBean(updateReqVO, Demo03StudentDO.class);
+ demo03StudentNormalMapper.updateById(updateObj);
+
+ // 更新子表
+ updateDemo03CourseList(updateReqVO.getId(), updateReqVO.getDemo03Courses());
+ updateDemo03Grade(updateReqVO.getId(), updateReqVO.getDemo03Grade());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteDemo03Student(Long id) {
+ // 校验存在
+ validateDemo03StudentExists(id);
+ // 删除
+ demo03StudentNormalMapper.deleteById(id);
+
+ // 删除子表
+ deleteDemo03CourseByStudentId(id);
+ deleteDemo03GradeByStudentId(id);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteDemo03StudentListByIds(List ids) {
+ // 校验存在
+ validateDemo03StudentExists(ids);
+ // 删除
+ demo03StudentNormalMapper.deleteByIds(ids);
+
+ // 删除子表
+ deleteDemo03CourseByStudentIds(ids);
+ deleteDemo03GradeByStudentIds(ids);
+ }
+
+ private void validateDemo03StudentExists(List ids) {
+ List list = demo03StudentNormalMapper.selectByIds(ids);
+ if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
+ throw exception(DEMO03_STUDENT_NOT_EXISTS);
+ }
+ }
+
+ private void validateDemo03StudentExists(Long id) {
+ if (demo03StudentNormalMapper.selectById(id) == null) {
+ throw exception(DEMO03_STUDENT_NOT_EXISTS);
+ }
+ }
+
+ @Override
+ public Demo03StudentDO getDemo03Student(Long id) {
+ return demo03StudentNormalMapper.selectById(id);
+ }
+
+ @Override
+ public PageResult getDemo03StudentPage(Demo03StudentNormalPageReqVO pageReqVO) {
+ return demo03StudentNormalMapper.selectPage(pageReqVO);
+ }
+
+ // ==================== 子表(学生课程) ====================
+
+ @Override
+ public List getDemo03CourseListByStudentId(Long studentId) {
+ return demo03CourseNormalMapper.selectListByStudentId(studentId);
+ }
+
+ private void createDemo03CourseList(Long studentId, List list) {
+ list.forEach(o -> o.setStudentId(studentId).clean());
+ demo03CourseNormalMapper.insertBatch(list);
+ }
+
+ private void updateDemo03CourseList(Long studentId, List list) {
+ list.forEach(o -> o.setStudentId(studentId).clean());
+ List oldList = demo03CourseNormalMapper.selectListByStudentId(studentId);
+ List> diffList = diffList(oldList, list, (oldVal, newVal) -> {
+ boolean same = ObjectUtil.equal(oldVal.getId(), newVal.getId());
+ if (same) {
+ newVal.setId(oldVal.getId());
+ }
+ return same;
+ });
+
+ // 第二步,批量添加、修改、删除
+ if (CollUtil.isNotEmpty(diffList.get(0))) {
+ demo03CourseNormalMapper.insertBatch(diffList.get(0));
+ }
+ if (CollUtil.isNotEmpty(diffList.get(1))) {
+ demo03CourseNormalMapper.updateBatch(diffList.get(1));
+ }
+ if (CollUtil.isNotEmpty(diffList.get(2))) {
+ demo03CourseNormalMapper.deleteByIds(convertList(diffList.get(2), Demo03CourseDO::getId));
+ }
+ }
+
+ private void deleteDemo03CourseByStudentId(Long studentId) {
+ demo03CourseNormalMapper.deleteByStudentId(studentId);
+ }
+
+ private void deleteDemo03CourseByStudentIds(List studentIds) {
+ demo03CourseNormalMapper.deleteByStudentIds(studentIds);
+ }
+
+ // ==================== 子表(学生班级) ====================
+
+ @Override
+ public Demo03GradeDO getDemo03GradeByStudentId(Long studentId) {
+ return demo03GradeNormalMapper.selectByStudentId(studentId);
+ }
+
+ private void createDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
+ if (demo03Grade == null) {
+ return;
+ }
+ demo03Grade.setStudentId(studentId);
+ demo03GradeNormalMapper.insert(demo03Grade);
+ }
+
+ private void updateDemo03Grade(Long studentId, Demo03GradeDO demo03Grade) {
+ if (demo03Grade == null) {
+ return;
+ }
+ demo03Grade.setStudentId(studentId).clean();
+ demo03GradeNormalMapper.insertOrUpdate(demo03Grade);
+ }
+
+ private void deleteDemo03GradeByStudentId(Long studentId) {
+ demo03GradeNormalMapper.deleteByStudentId(studentId);
+ }
+
+ private void deleteDemo03GradeByStudentIds(List studentIds) {
+ demo03GradeNormalMapper.deleteByStudentIds(studentIds);
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java
index 23a7228cc1..b2bf491441 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java
@@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.infra.service.file;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
-
-import javax.validation.Valid;
+import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
+import jakarta.validation.Valid;
/**
* 文件配置 Service 接口
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java
index 7d84bffc9f..4e7bf47cc1 100755
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java
@@ -4,27 +4,26 @@ import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.IdUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
-import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
-import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig;
-import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientFactory;
-import cn.iocoder.yudao.module.infra.framework.file.core.enums.FileStorageEnum;
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
import cn.iocoder.yudao.module.infra.convert.file.FileConfigConvert;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
import cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper;
+import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
+import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig;
+import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientFactory;
+import cn.iocoder.yudao.module.infra.framework.file.core.enums.FileStorageEnum;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
+import jakarta.annotation.Resource;
+import jakarta.validation.Validator;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
-import javax.annotation.Resource;
-import javax.validation.Validator;
import java.time.Duration;
import java.util.Map;
import java.util.Objects;
@@ -138,7 +137,7 @@ public class FileConfigServiceImpl implements FileConfigService {
/**
* 清空指定文件配置
*
- * @param id 配置编号
+ * @param id 配置编号
* @param master 是否主配置
*/
private void clearCache(Long id, Boolean master) {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java
index 2ec919ed68..3e7519017c 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java
@@ -25,10 +25,10 @@ public interface FileService {
/**
* 保存文件,并返回文件的访问路径
*
- * @param content 文件内容
- * @param name 文件名称,允许空
+ * @param content 文件内容
+ * @param name 文件名称,允许空
* @param directory 目录,允许空
- * @param type 文件的 MIME 类型,允许空
+ * @param type 文件的 MIME 类型,允许空
* @return 文件路径
*/
String createFile(@NotEmpty(message = "文件内容不能为空") byte[] content,
@@ -37,7 +37,7 @@ public interface FileService {
/**
* 生成文件预签名地址信息
*
- * @param name 文件名
+ * @param name 文件名
* @param directory 目录
* @return 预签名地址信息
*/
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java
index f1e7e7c67e..2efff754a2 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java
@@ -31,7 +31,7 @@ public interface JobLogService extends JobLogFrameworkService {
/**
* 清理 exceedDay 天前的任务日志
*
- * @param exceedDay 超过多少天就进行清理
+ * @param exceedDay 超过多少天就进行清理
* @param deleteLimit 清理的间隔条数
*/
Integer cleanJobLog(Integer exceedDay, Integer deleteLimit);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java
index 868fd1bb2f..a2abaff3b4 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java
@@ -5,12 +5,12 @@ import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper;
import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum;
+import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
-import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java
index ff1cca55f1..bce2a95570 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java
@@ -4,10 +4,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
+import jakarta.validation.Valid;
import org.quartz.SchedulerException;
-import javax.validation.Valid;
-
/**
* 定时任务 Service 接口
*
@@ -33,7 +32,7 @@ public interface JobService {
/**
* 更新定时任务的状态
*
- * @param id 任务编号
+ * @param id 任务编号
* @param status 状态
*/
void updateJobStatus(Long id, Integer status) throws SchedulerException;
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java
index 0687d13e90..8d180dbaa7 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java
@@ -190,7 +190,7 @@ public class JobServiceImpl implements JobService {
@Override
public PageResult getJobPage(JobPageReqVO pageReqVO) {
- return jobMapper.selectPage(pageReqVO);
+ return jobMapper.selectPage(pageReqVO);
}
private static void fillJobMonitorTimeoutEmpty(JobDO job) {
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java
index 186d115250..65faa3f333 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java
@@ -30,7 +30,7 @@ public interface ApiAccessLogService {
/**
* 清理 exceedDay 天前的访问日志
*
- * @param exceedDay 超过多少天就进行清理
+ * @param exceedDay 超过多少天就进行清理
* @param deleteLimit 清理的间隔条数
*/
Integer cleanAccessLog(Integer exceedDay, Integer deleteLimit);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java
index fd635b0904..b05ccf3d89 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.infra.service.logger;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.biz.infra.logger.dto.ApiErrorLogCreateReqDTO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
@@ -30,7 +30,7 @@ public interface ApiErrorLogService {
/**
* 更新 API 错误日志已处理
*
- * @param id API 日志编号
+ * @param id API 日志编号
* @param processStatus 处理结果
* @param processUserId 处理人
*/
@@ -39,7 +39,7 @@ public interface ApiErrorLogService {
/**
* 清理 exceedDay 天前的错误日志
*
- * @param exceedDay 超过多少天就进行清理
+ * @param exceedDay 超过多少天就进行清理
* @param deleteLimit 清理的间隔条数
*/
Integer cleanErrorLog(Integer exceedDay, Integer deleteLimit);
diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
index 64f22e548f..ee41d48762 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
@@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.infra.service.logger;
+import cn.iocoder.yudao.framework.common.biz.infra.logger.dto.ApiErrorLogCreateReqDTO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
-import cn.iocoder.yudao.framework.common.biz.infra.logger.dto.ApiErrorLogCreateReqDTO;
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
diff --git a/yudao-module-infra/src/main/resources/codegen/java/controller/controller.vm b/yudao-module-infra/src/main/resources/codegen/java/controller/controller.vm
index 5aa3baef83..9f63e240da 100644
--- a/yudao-module-infra/src/main/resources/codegen/java/controller/controller.vm
+++ b/yudao-module-infra/src/main/resources/codegen/java/controller/controller.vm
@@ -49,8 +49,8 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
#if ($sceneEnum.scene == 1)
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:create')")
#end
- public CommonResult<${primaryColumn.javaType}> create${simpleClassName}(@Valid @RequestBody ${sceneEnum.prefixClass}${table.className}SaveReqVO createReqVO) {
- return success(${classNameVar}Service.create${simpleClassName}(createReqVO));
+ public CommonResult<${primaryColumn.javaType}> create${simpleClassName}(@Valid @RequestBody ${saveReqVOClass} ${saveReqVOVar}) {
+ return success(${classNameVar}Service.create${simpleClassName}(${saveReqVOVar}));
}
@PutMapping("/update")
@@ -58,8 +58,8 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
#if ($sceneEnum.scene == 1)
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:update')")
#end
- public CommonResult update${simpleClassName}(@Valid @RequestBody ${sceneEnum.prefixClass}${table.className}SaveReqVO updateReqVO) {
- ${classNameVar}Service.update${simpleClassName}(updateReqVO);
+ public CommonResult update${simpleClassName}(@Valid @RequestBody ${updateReqVOClass} ${updateReqVOVar}) {
+ ${classNameVar}Service.update${simpleClassName}(${updateReqVOVar});
return success(true);
}
@@ -74,15 +74,32 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
return success(true);
}
+#if ( $table.templateType != 2 && $deleteBatchEnable)
+ @DeleteMapping("/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除${table.classComment}")
+ #if ($sceneEnum.scene == 1)
+ @PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')")
+ #end
+ public CommonResult delete${simpleClassName}List(@RequestParam("ids") List<${primaryColumn.javaType}> ids) {
+ ${classNameVar}Service.delete${simpleClassName}ListByIds(ids);
+ return success(true);
+ }
+#end
+
@GetMapping("/get")
@Operation(summary = "获得${table.classComment}")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
#if ($sceneEnum.scene == 1)
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
#end
- public CommonResult<${sceneEnum.prefixClass}${table.className}RespVO> get${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) {
+ public CommonResult<${respVOClass}> get${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) {
${table.className}DO ${classNameVar} = ${classNameVar}Service.get${simpleClassName}(id);
- return success(BeanUtils.toBean(${classNameVar}, ${sceneEnum.prefixClass}${table.className}RespVO.class));
+#if ($voType == 10)
+ return success(BeanUtils.toBean(${classNameVar}, ${respVOClass}.class));
+#else
+ return success(${classNameVar});
+#end
}
#if ( $table.templateType != 2 )
@@ -91,9 +108,13 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
#if ($sceneEnum.scene == 1)
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
#end
- public CommonResult> get${simpleClassName}Page(@Valid ${sceneEnum.prefixClass}${table.className}PageReqVO pageReqVO) {
+ public CommonResult> get${simpleClassName}Page(@Valid ${sceneEnum.prefixClass}${table.className}PageReqVO pageReqVO) {
PageResult<${table.className}DO> pageResult = ${classNameVar}Service.get${simpleClassName}Page(pageReqVO);
- return success(BeanUtils.toBean(pageResult, ${sceneEnum.prefixClass}${table.className}RespVO.class));
+#if ($voType == 10)
+ return success(BeanUtils.toBean(pageResult, ${respVOClass}.class));
+#else
+ return success(pageResult);
+#end
}
## 特殊:树表专属逻辑(树不需要分页接口)
@@ -103,9 +124,13 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
#if ($sceneEnum.scene == 1)
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
#end
- public CommonResult> get${simpleClassName}List(@Valid ${sceneEnum.prefixClass}${table.className}ListReqVO listReqVO) {
+ public CommonResult> get${simpleClassName}List(@Valid ${sceneEnum.prefixClass}${table.className}ListReqVO listReqVO) {
List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(listReqVO);
- return success(BeanUtils.toBean(list, ${sceneEnum.prefixClass}${table.className}RespVO.class));
+#if ($voType == 10)
+ return success(BeanUtils.toBean(list, ${respVOClass}.class));
+#else
+ return success(list);
+#end
}
#end
@@ -121,8 +146,8 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}Page(pageReqVO).getList();
// 导出 Excel
- ExcelUtils.write(response, "${table.classComment}.xls", "数据", ${sceneEnum.prefixClass}${table.className}RespVO.class,
- BeanUtils.toBean(list, ${sceneEnum.prefixClass}${table.className}RespVO.class));
+ ExcelUtils.write(response, "${table.classComment}.xls", "数据", ${respVOClass}.class,
+ BeanUtils.toBean(list, ${respVOClass}.class));
}
## 特殊:树表专属逻辑(树不需要分页接口)
#else
@@ -218,6 +243,19 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
return success(true);
}
+#if ($deleteBatchEnable)
+ @DeleteMapping("/${subSimpleClassName_strikeCase}/delete-list")
+ @Parameter(name = "ids", description = "编号", required = true)
+ @Operation(summary = "批量删除${subTable.classComment}")
+#if ($sceneEnum.scene == 1)
+ @PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')")
+#end
+ public CommonResult delete${subSimpleClassName}List(@RequestParam("ids") List<${subPrimaryColumn.javaType}> ids) {
+ ${classNameVar}Service.delete${subSimpleClassName}ListByIds(ids);
+ return success(true);
+ }
+#end
+
@GetMapping("/${subSimpleClassName_strikeCase}/get")
@Operation(summary = "获得${subTable.classComment}")
@Parameter(name = "id", description = "编号", required = true)
diff --git a/yudao-module-infra/src/main/resources/codegen/java/controller/vo/pageReqVO.vm b/yudao-module-infra/src/main/resources/codegen/java/controller/vo/pageReqVO.vm
index 003bac902f..d0367a3df2 100644
--- a/yudao-module-infra/src/main/resources/codegen/java/controller/vo/pageReqVO.vm
+++ b/yudao-module-infra/src/main/resources/codegen/java/controller/vo/pageReqVO.vm
@@ -28,8 +28,6 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "${sceneEnum.name} - ${table.classComment}分页 Request VO")
@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
public class ${sceneEnum.prefixClass}${table.className}PageReqVO extends PageParam {
#foreach ($column in $columns)
diff --git a/yudao-module-infra/src/main/resources/codegen/java/dal/do.vm b/yudao-module-infra/src/main/resources/codegen/java/dal/do.vm
index b019d6e12f..baf53f5986 100644
--- a/yudao-module-infra/src/main/resources/codegen/java/dal/do.vm
+++ b/yudao-module-infra/src/main/resources/codegen/java/dal/do.vm
@@ -12,6 +12,18 @@ import java.time.LocalDateTime;
#end
import com.baomidou.mybatisplus.annotation.*;
import ${BaseDOClassName};
+## 处理 Excel 导出 + Schema 注解(仅 DO 模式)
+#if ($voType == 20)
+import io.swagger.v3.oas.annotations.media.Schema;
+import com.alibaba.excel.annotation.*;
+#foreach ($column in $columns)
+ #if ("$!column.dictType" != "")## 有设置数据字典
+ import ${DictFormatClassName};
+ import ${DictConvertClassName};
+ #break
+ #end
+#end
+#end
/**
* ${table.classComment} DO
@@ -26,6 +38,11 @@ import ${BaseDOClassName};
@Builder
@NoArgsConstructor
@AllArgsConstructor
+## 处理 Excel 导出 + Schema 注解(仅 DO 模式)
+#if ($voType == 20)
+@Schema(description = "${sceneEnum.name} - ${table.classComment} Response VO")
+@ExcelIgnoreUnannotated
+#end
public class ${table.className}DO extends BaseDO {
## 特殊:树表专属逻辑
@@ -45,8 +62,42 @@ public class ${table.className}DO extends BaseDO {
#if (${column.primaryKey})##处理主键
@TableId#if (${column.javaType} == 'String')(type = IdType.INPUT)#end
#end
+#if ($voType == 20)
+## 1. 处理 Swagger 注解
+ @Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end)
+## 2. 处理 Excel 导出
+#if ("$!column.dictType" != "")##处理枚举值
+ @ExcelProperty(value = "${column.columnComment}", converter = DictConvert.class)
+ @DictFormat("${column.dictType}") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+#else
+ @ExcelProperty("${column.columnComment}")
+#end
+#end
+## 3. 处理字段定义
private ${column.javaType} ${column.javaField};
#end
#end
+## 特殊:主子表专属逻辑(非 ERP 模式)
+#if ( $voType == 20 && $subTables && $subTables.size() > 0 && $table.templateType != 11 )
+ #foreach ($subTable in $subTables)
+ #set ($index = $foreach.count - 1)
+ #if ( $subTable.subJoinMany)
+ /**
+ * ${subTable.classComment}列表
+ */
+ @Schema(description = "${subTable.classComment}列表")
+ @TableField(exist = false)
+ private List<${subTable.className}DO> ${subClassNameVars.get($index)}s;
+ #else
+ /**
+ * ${subTable.classComment}
+ */
+ @Schema(description = "${subTable.classComment}")
+ @TableField(exist = false)
+ private ${subTable.className}DO ${subClassNameVars.get($index)};
+ #end
+ #end
+#end
+
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/resources/codegen/java/dal/do_sub.vm b/yudao-module-infra/src/main/resources/codegen/java/dal/do_sub.vm
index 16be55e8a5..0dfc38ffef 100644
--- a/yudao-module-infra/src/main/resources/codegen/java/dal/do_sub.vm
+++ b/yudao-module-infra/src/main/resources/codegen/java/dal/do_sub.vm
@@ -14,6 +14,17 @@ import java.time.LocalDateTime;
#end
import com.baomidou.mybatisplus.annotation.*;
import ${BaseDOClassName};
+## 处理 Schema 注解(仅 DO 模式)
+#if ($voType == 20)
+import io.swagger.v3.oas.annotations.media.Schema;
+#foreach ($column in $columns)
+ #if ("$!column.dictType" != "")## 有设置数据字典
+ import ${DictFormatClassName};
+ import ${DictConvertClassName};
+ #break
+ #end
+#end
+#end
/**
* ${subTable.classComment} DO
@@ -28,6 +39,10 @@ import ${BaseDOClassName};
@Builder
@NoArgsConstructor
@AllArgsConstructor
+## 处理 Schema 注解(仅 DO 模式)
+#if ($voType == 20)
+@Schema(description = "${sceneEnum.name} - ${table.classComment} Response VO")
+#end
public class ${subTable.className}DO extends BaseDO {
#foreach ($column in $subColumns)
@@ -42,6 +57,11 @@ public class ${subTable.className}DO extends BaseDO {
#if (${column.primaryKey})##处理主键
@TableId#if (${column.javaType} == 'String')(type = IdType.INPUT)#end
#end
+#if ($voType == 20)
+## 1. 处理 Swagger 注解
+ @Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end)
+#end
+## 2. 处理字段定义
private ${column.javaType} ${column.javaField};
#end
#end
diff --git a/yudao-module-infra/src/main/resources/codegen/java/dal/mapper_sub.vm b/yudao-module-infra/src/main/resources/codegen/java/dal/mapper_sub.vm
index 6ccaea79ea..40f2ff5491 100644
--- a/yudao-module-infra/src/main/resources/codegen/java/dal/mapper_sub.vm
+++ b/yudao-module-infra/src/main/resources/codegen/java/dal/mapper_sub.vm
@@ -54,4 +54,10 @@ public interface ${subTable.className}Mapper extends BaseMapperX<${subTable.clas
return delete(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField});
}
+#if ( $table.templateType != 2 && $deleteBatchEnable)
+ default int deleteBy${SubJoinColumnName}s(List<${subJoinColumn.javaType}> ${subJoinColumn.javaField}s) {
+ return deleteBatch(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}s);
+ }
+#end
+
}
diff --git a/yudao-module-infra/src/main/resources/codegen/java/service/service.vm b/yudao-module-infra/src/main/resources/codegen/java/service/service.vm
index c4ee4f0f64..1cc68bf363 100644
--- a/yudao-module-infra/src/main/resources/codegen/java/service/service.vm
+++ b/yudao-module-infra/src/main/resources/codegen/java/service/service.vm
@@ -21,17 +21,17 @@ public interface ${table.className}Service {
/**
* 创建${table.classComment}
*
- * @param createReqVO 创建信息
+ * @param ${saveReqVOVar} 创建信息
* @return 编号
*/
- ${primaryColumn.javaType} create${simpleClassName}(@Valid ${sceneEnum.prefixClass}${table.className}SaveReqVO createReqVO);
+ ${primaryColumn.javaType} create${simpleClassName}(@Valid ${saveReqVOClass} ${saveReqVOVar});
/**
* 更新${table.classComment}
*
- * @param updateReqVO 更新信息
+ * @param ${updateReqVOVar} 更新信息
*/
- void update${simpleClassName}(@Valid ${sceneEnum.prefixClass}${table.className}SaveReqVO updateReqVO);
+ void update${simpleClassName}(@Valid ${updateReqVOClass} ${updateReqVOVar});
/**
* 删除${table.classComment}
@@ -40,6 +40,15 @@ public interface ${table.className}Service {
*/
void delete${simpleClassName}(${primaryColumn.javaType} id);
+#if ( $table.templateType != 2 && $deleteBatchEnable)
+ /**
+ * 批量删除${table.classComment}
+ *
+ * @param ids 编号
+ */
+ void delete${simpleClassName}ListByIds(List<${primaryColumn.javaType}> ids);
+#end
+
/**
* 获得${table.classComment}
*
@@ -134,6 +143,15 @@ public interface ${table.className}Service {
*/
void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id);
+#if ($deleteBatchEnable)
+ /**
+ * 批量删除${subTable.classComment}
+ *
+ * @param ids 编号
+ */
+ void delete${subSimpleClassName}ListByIds(List<${subPrimaryColumn.javaType}> ids);
+#end
+
/**
* 获得${subTable.classComment}
*
diff --git a/yudao-module-infra/src/main/resources/codegen/java/service/serviceImpl.vm b/yudao-module-infra/src/main/resources/codegen/java/service/serviceImpl.vm
index 80bc71b026..edea2e7ab5 100644
--- a/yudao-module-infra/src/main/resources/codegen/java/service/serviceImpl.vm
+++ b/yudao-module-infra/src/main/resources/codegen/java/service/serviceImpl.vm
@@ -1,5 +1,6 @@
package ${basePackage}.module.${table.moduleName}.service.${table.businessName};
+import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import ${jakartaPackage}.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -24,6 +25,8 @@ import ${basePackage}.module.${subTable.moduleName}.dal.mysql.${subTable.busines
#end
import static ${ServiceExceptionUtilClassName}.exception;
+import static ${CollectionUtilsClassName}.convertList;
+import static ${CollectionUtilsClassName}.diffList;
import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*;
/**
@@ -49,19 +52,22 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 )
@Transactional(rollbackFor = Exception.class)
#end
- public ${primaryColumn.javaType} create${simpleClassName}(${sceneEnum.prefixClass}${table.className}SaveReqVO createReqVO) {
+ public ${primaryColumn.javaType} create${simpleClassName}(${saveReqVOClass} ${saveReqVOVar}) {
## 特殊:树表专属逻辑
#if ( $table.templateType == 2 )
#set ($TreeParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写
#set ($TreeNameJavaField = $treeNameColumn.javaField.substring(0,1).toUpperCase() + ${treeNameColumn.javaField.substring(1)})##首字母大写
// 校验${treeParentColumn.columnComment}的有效性
- validateParent${simpleClassName}(null, createReqVO.get${TreeParentJavaField}());
+ validateParent${simpleClassName}(null, ${saveReqVOVar}.get${TreeParentJavaField}());
// 校验${treeNameColumn.columnComment}的唯一性
- validate${simpleClassName}${TreeNameJavaField}Unique(null, createReqVO.get${TreeParentJavaField}(), createReqVO.get${TreeNameJavaField}());
+ validate${simpleClassName}${TreeNameJavaField}Unique(null, ${saveReqVOVar}.get${TreeParentJavaField}(), ${saveReqVOVar}.get${TreeNameJavaField}());
#end
// 插入
+#if ($voType == 10)
+## TODO @puhui999:insert 也要加下 clean。万一前端乱传递,哈哈哈。这个就是 do 模式的缺点;(只在 do 模式下);看看主子表,是不是也可能存在,insert 的时候;
${table.className}DO ${classNameVar} = BeanUtils.toBean(createReqVO, ${table.className}DO.class);
+#end
${classNameVar}Mapper.insert(${classNameVar});
## 特殊:主子表专属逻辑(非 ERP 模式)
#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 )
@@ -73,9 +79,9 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
#if ( $subTable.subJoinMany)
- create${subSimpleClassName}List(${classNameVar}.getId(), createReqVO.get${subSimpleClassNames.get($index)}s());
+ create${subSimpleClassName}List(${classNameVar}.getId(), ${saveReqVOVar}.get${subSimpleClassNames.get($index)}s());
#else
- create${subSimpleClassName}(${classNameVar}.getId(), createReqVO.get${subSimpleClassNames.get($index)}());
+ create${subSimpleClassName}(${classNameVar}.getId(), ${saveReqVOVar}.get${subSimpleClassNames.get($index)}());
#end
#end
#end
@@ -88,22 +94,26 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 )
@Transactional(rollbackFor = Exception.class)
#end
- public void update${simpleClassName}(${sceneEnum.prefixClass}${table.className}SaveReqVO updateReqVO) {
+ public void update${simpleClassName}(${updateReqVOClass} ${updateReqVOVar}) {
// 校验存在
- validate${simpleClassName}Exists(updateReqVO.getId());
+ validate${simpleClassName}Exists(${updateReqVOVar}.getId());
## 特殊:树表专属逻辑
#if ( $table.templateType == 2 )
#set ($TreeParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写
#set ($TreeNameJavaField = $treeNameColumn.javaField.substring(0,1).toUpperCase() + ${treeNameColumn.javaField.substring(1)})##首字母大写
// 校验${treeParentColumn.columnComment}的有效性
- validateParent${simpleClassName}(updateReqVO.getId(), updateReqVO.get${TreeParentJavaField}());
+ validateParent${simpleClassName}(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${TreeParentJavaField}());
// 校验${treeNameColumn.columnComment}的唯一性
- validate${simpleClassName}${TreeNameJavaField}Unique(updateReqVO.getId(), updateReqVO.get${TreeParentJavaField}(), updateReqVO.get${TreeNameJavaField}());
+ validate${simpleClassName}${TreeNameJavaField}Unique(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${TreeParentJavaField}(), ${updateReqVOVar}.get${TreeNameJavaField}());
#end
// 更新
+#if ($voType == 10)
${table.className}DO updateObj = BeanUtils.toBean(updateReqVO, ${table.className}DO.class);
${classNameVar}Mapper.updateById(updateObj);
+#else
+ ${classNameVar}Mapper.updateById(${updateReqVOVar});
+#end
## 特殊:主子表专属逻辑(非 ERP 模式)
#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11)
@@ -114,9 +124,9 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
#if ( $subTable.subJoinMany)
- update${subSimpleClassName}List(updateReqVO.getId(), updateReqVO.get${subSimpleClassNames.get($index)}s());
+ update${subSimpleClassName}List(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${subSimpleClassNames.get($index)}s());
#else
- update${subSimpleClassName}(updateReqVO.getId(), updateReqVO.get${subSimpleClassNames.get($index)}());
+ update${subSimpleClassName}(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${subSimpleClassNames.get($index)}());
#end
#end
#end
@@ -154,6 +164,39 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
#end
}
+#if ( $table.templateType != 2 && $deleteBatchEnable)
+ @Override
+ ## 特殊:主子表专属逻辑
+ #if ( $subTables && $subTables.size() > 0)
+ @Transactional(rollbackFor = Exception.class)
+ #end
+ public void delete${simpleClassName}ListByIds(List<${primaryColumn.javaType}> ids) {
+ // 校验存在
+ validate${simpleClassName}Exists(ids);
+ // 删除
+ ${classNameVar}Mapper.deleteByIds(ids);
+ ## 特殊:主子表专属逻辑
+ #if ( $subTables && $subTables.size() > 0)
+
+ // 删除子表
+ #foreach ($subTable in $subTables)
+ #set ($index = $foreach.count - 1)
+ #set ($subSimpleClassName = $subSimpleClassNames.get($index))
+ #set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
+ #set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
+ delete${subSimpleClassName}By${SubJoinColumnName}s(ids);
+ #end
+ #end
+ }
+
+ private void validate${simpleClassName}Exists(List<${primaryColumn.javaType}> ids) {
+ List<${table.className}DO> list = ${classNameVar}Mapper.selectByIds(ids);
+ if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
+ throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
+ }
+ }
+#end
+
private void validate${simpleClassName}Exists(${primaryColumn.javaType} id) {
if (${classNameVar}Mapper.selectById(id) == null) {
throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
@@ -286,18 +329,24 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
// 校验存在
validate${subSimpleClassName}Exists(${subClassNameVar}.getId());
// 更新
- ${subClassNameVar}.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
+ ${subClassNameVar}.clean(); // 解决更新情况下:updateTime 不更新
${subClassNameVars.get($index)}Mapper.updateById(${subClassNameVar});
}
@Override
public void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id) {
- // 校验存在
- validate${subSimpleClassName}Exists(id);
// 删除
${subClassNameVars.get($index)}Mapper.deleteById(id);
}
+#if ($deleteBatchEnable)
+ @Override
+ public void delete${subSimpleClassName}ListByIds(List<${subPrimaryColumn.javaType}> ids) {
+ // 删除
+ ${subClassNameVars.get($index)}Mapper.deleteByIds(ids);
+ }
+#end
+
@Override
public ${subTable.className}DO get${subSimpleClassName}(${subPrimaryColumn.javaType} id) {
return ${subClassNameVars.get($index)}Mapper.selectById(id);
@@ -313,14 +362,31 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
#else
#if ( $subTable.subJoinMany)
private void create${subSimpleClassName}List(${primaryColumn.javaType} ${subJoinColumn.javaField}, List<${subTable.className}DO> list) {
- list.forEach(o -> o.set$SubJoinColumnName(${subJoinColumn.javaField}));
+ list.forEach(o -> o.set${SubJoinColumnName}(${subJoinColumn.javaField}).clean());
${subClassNameVars.get($index)}Mapper.insertBatch(list);
}
private void update${subSimpleClassName}List(${primaryColumn.javaType} ${subJoinColumn.javaField}, List<${subTable.className}DO> list) {
- delete${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField});
- list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
- create${subSimpleClassName}List(${subJoinColumn.javaField}, list);
+ list.forEach(o -> o.set${SubJoinColumnName}(${subJoinColumn.javaField}).clean());
+ List<${subTable.className}DO> oldList = ${subClassNameVar}Mapper.selectListBy${SubJoinColumnName}(${subJoinColumn.javaField});
+ List> diffList = diffList(oldList, list, (oldVal, newVal) -> {
+ boolean same = ObjectUtil.equal(oldVal.getId(), newVal.getId());
+ if (same) {
+ newVal.setId(oldVal.getId()).clean(); // 解决更新情况下:updateTime 不更新
+ }
+ return same;
+ });
+
+ // 第二步,批量添加、修改、删除
+ if (CollUtil.isNotEmpty(diffList.get(0))) {
+ ${subClassNameVar}Mapper.insertBatch(diffList.get(0));
+ }
+ if (CollUtil.isNotEmpty(diffList.get(1))) {
+ ${subClassNameVar}Mapper.updateBatch(diffList.get(1));
+ }
+ if (CollUtil.isNotEmpty(diffList.get(2))) {
+ ${subClassNameVar}Mapper.deleteByIds(convertList(diffList.get(2), ${subTable.className}DO::getId));
+ }
}
#else
@@ -336,8 +402,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
if (${subClassNameVar} == null) {
return;
}
- ${subClassNameVar}.set$SubJoinColumnName(${subJoinColumn.javaField});
- ${subClassNameVar}.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
+ ${subClassNameVar}.set$SubJoinColumnName(${subJoinColumn.javaField}).clean();// 解决更新情况下:updateTime 不更新
${subClassNameVars.get($index)}Mapper.insertOrUpdate(${subClassNameVar});
}
@@ -347,5 +412,11 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
${subClassNameVars.get($index)}Mapper.deleteBy${SubJoinColumnName}(${subJoinColumn.javaField});
}
+#if ( $table.templateType != 2 && $deleteBatchEnable)
+ private void delete${subSimpleClassName}By${SubJoinColumnName}s(List<${primaryColumn.javaType}> ${subJoinColumn.javaField}s) {
+ ${subClassNameVars.get($index)}Mapper.deleteBy${SubJoinColumnName}s(${subJoinColumn.javaField}s);
+ }
+#end
+
#end
}
\ No newline at end of file
diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm
index d3342f1fc8..f65994b8cc 100644
--- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm
+++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/api/api.ts.vm
@@ -5,14 +5,30 @@ import { requestClient } from '#/api/request';
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
export namespace ${simpleClassName}Api {
-## 特殊:主子表专属逻辑
-#foreach ($subTable in $subTables)
- #set ($index = $foreach.count - 1)
- #set ($subSimpleClassName = $subSimpleClassNames.get($index))
- #set ($subColumns = $subColumnsList.get($index))##当前字段数组
- /** ${subTable.classComment}信息 */
- export interface ${subSimpleClassName} {
- #foreach ($column in $subColumns)
+ ## 特殊:主子表专属逻辑
+ #foreach ($subTable in $subTables)
+ #set ($index = $foreach.count - 1)
+ #set ($subSimpleClassName = $subSimpleClassNames.get($index))
+ #set ($subColumns = $subColumnsList.get($index))##当前字段数组
+ /** ${subTable.classComment}信息 */
+ export interface ${subSimpleClassName} {
+ #foreach ($column in $subColumns)
+ #if ($column.createOperation || $column.updateOperation)
+ #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
+ ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment}
+ #elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime")
+ ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment}
+ #else
+ ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment}
+ #end
+ #end
+ #end
+ }
+
+ #end
+ /** ${table.classComment}信息 */
+ export interface ${simpleClassName} {
+ #foreach ($column in $columns)
#if ($column.createOperation || $column.updateOperation)
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment}
@@ -23,37 +39,21 @@ export namespace ${simpleClassName}Api {
#end
#end
#end
- }
-
-#end
- /** ${table.classComment}信息 */
- export interface ${simpleClassName} {
-#foreach ($column in $columns)
-#if ($column.createOperation || $column.updateOperation)
-#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
- ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment}
-#elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime")
- ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment}
-#else
- ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment}
-#end
-#end
-#end
-#if ( $table.templateType == 2 )
- children?: ${simpleClassName}[];
-#end
-## 特殊:主子表专属逻辑
-#if ( $table.templateType == 10 || $table.templateType == 12 )
- #foreach ($subTable in $subTables)
- #set ($index = $foreach.count - 1)
- #set ($subSimpleClassName = $subSimpleClassNames.get($index))
- #if ( $subTable.subJoinMany )
- ${subSimpleClassName.toLowerCase()}s?: ${subSimpleClassName}[]
- #else
- ${subSimpleClassName.toLowerCase()}?: ${subSimpleClassName}
+ #if ( $table.templateType == 2 )
+ children?: ${simpleClassName}[];
+ #end
+ ## 特殊:主子表专属逻辑
+ #if ( $table.templateType == 10 || $table.templateType == 12 )
+ #foreach ($subTable in $subTables)
+ #set ($index = $foreach.count - 1)
+ #set ($subSimpleClassName = $subSimpleClassNames.get($index))
+ #if ( $subTable.subJoinMany )
+ ${subSimpleClassName.toLowerCase()}s?: ${subSimpleClassName}[]
+ #else
+ ${subSimpleClassName.toLowerCase()}?: ${subSimpleClassName}
+ #end
+ #end
#end
- #end
-#end
}
}
@@ -89,65 +89,80 @@ export function delete${simpleClassName}(id: number) {
return requestClient.delete(`${baseURL}/delete?id=${id}`);
}
+#if ( $table.templateType != 2 && $deleteBatchEnable)
+/** 批量删除${table.classComment} */
+export function delete${simpleClassName}ListByIds(ids: number[]) {
+ return requestClient.delete(`${baseURL}/delete-list?ids=${ids.join(',')}`)
+}
+#end
+
/** 导出${table.classComment} */
export function export${simpleClassName}(params: any) {
return requestClient.download('${baseURL}/export-excel', params);
}
## 特殊:主子表专属逻辑
+## TODO @puhui999:下面这块缩进调整了,会乱掉么?
#foreach ($subTable in $subTables)
-#set ($index = $foreach.count - 1)
-#set ($subSimpleClassName = $subSimpleClassNames.get($index))
-#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段
-#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
-#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
-#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index))
-#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
-#set ($subClassNameVar = $subClassNameVars.get($index))
+ #set ($index = $foreach.count - 1)
+ #set ($subSimpleClassName = $subSimpleClassNames.get($index))
+ #set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段
+ #set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
+ #set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
+ #set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index))
+ #set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
+ #set ($subClassNameVar = $subClassNameVars.get($index))
// ==================== 子表($subTable.classComment) ====================
-## 情况一:MASTER_ERP 时,需要分查询页子表
-#if ( $table.templateType == 11 )
-/** 获得${subTable.classComment}分页 */
-export function get${subSimpleClassName}Page(params: PageParam) {
- return requestClient.get>(`${baseURL}/${subSimpleClassName_strikeCase}/page`, { params });
-}
-## 情况二:非 MASTER_ERP 时,需要列表查询子表
-#else
- #if ( $subTable.subJoinMany )
-/** 获得${subTable.classComment}列表 */
-export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
- return requestClient.get<${simpleClassName}Api.${subSimpleClassName}[]>(`${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
-}
+ ## 情况一:MASTER_ERP 时,需要分查询页子表
+ #if ( $table.templateType == 11 )
+ /** 获得${subTable.classComment}分页 */
+ export function get${subSimpleClassName}Page(params: PageParam) {
+ return requestClient.get>(`${baseURL}/${subSimpleClassName_strikeCase}/page`, { params });
+ }
+ ## 情况二:非 MASTER_ERP 时,需要列表查询子表
#else
-/** 获得${subTable.classComment} */
-export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
- return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
-}
+ #if ( $subTable.subJoinMany )
+ /** 获得${subTable.classComment}列表 */
+ export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
+ return requestClient.get<${simpleClassName}Api.${subSimpleClassName}[]>(`${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
+ }
+ #else
+ /** 获得${subTable.classComment} */
+ export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
+ return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
+ }
+ #end
+ #end
+ ## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
+ #if ( $table.templateType == 11 )
+ /** 新增${subTable.classComment} */
+ export function create${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
+ return requestClient.post(`${baseURL}/${subSimpleClassName_strikeCase}/create`, data);
+ }
+
+ /** 修改${subTable.classComment} */
+ export function update${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
+ return requestClient.put(`${baseURL}/${subSimpleClassName_strikeCase}/update`, data);
+ }
+
+ /** 删除${subTable.classComment} */
+ export function delete${subSimpleClassName}(id: number) {
+ return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete?id=${id}`);
+ }
+
+ #if ($deleteBatchEnable)
+ /** 批量删除${subTable.classComment} */
+ export function delete${subSimpleClassName}ListByIds(ids: number[]) {
+ return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`)
+ }
+ #end
+
+ /** 获得${subTable.classComment} */
+ export function get${subSimpleClassName}(id: number) {
+ return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`);
+ }
#end
#end
-## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
-#if ( $table.templateType == 11 )
-/** 新增${subTable.classComment} */
-export function create${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
- return requestClient.post(`${baseURL}/${subSimpleClassName_strikeCase}/create`, data);
-}
-
-/** 修改${subTable.classComment} */
-export function update${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
- return requestClient.put(`${baseURL}/${subSimpleClassName_strikeCase}/update`, data);
-}
-
-/** 删除${subTable.classComment} */
-export function delete${subSimpleClassName}(id: number) {
- return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete?id=${id}`);
-}
-
-/** 获得${subTable.classComment} */
-export function get${subSimpleClassName}(id: number) {
- return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`);
-}
-#end
-#end
diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
index 1888a7c37f..c70bca31e8 100644
--- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
+++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
@@ -8,7 +8,7 @@ import { Button, message,Tabs,Pagination,Form,RangePicker,DatePicker,Select,Inpu
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
import ${simpleClassName}Form from './modules/form.vue';
-import { Download, Plus, RefreshCw, Search } from '@vben/icons';
+import { Download, Plus, RefreshCw, Search, Trash2 } from '@vben/icons';
import { ContentWrap } from '#/components/content-wrap';
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import { TableToolbar } from '#/components/table-toolbar';
@@ -29,7 +29,8 @@ import { $t } from '#/locales';
import { handleTree,isEmpty } from '@vben/utils'
import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
#else## 标准表接口
-import { get${simpleClassName}Page, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
+import { isEmpty } from '@vben/utils';
+import { get${simpleClassName}Page, delete${simpleClassName},#if ($deleteBatchEnable) delete${simpleClassName}ListByIds,#end export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
#end
import { downloadFileFromBlobPart } from '@vben/utils';
@@ -152,11 +153,38 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) {
key: 'action_process_msg',
});
await getList();
- } catch {
+ } finally {
hideLoading();
}
}
+#if ($table.templateType != 2 && $deleteBatchEnable)
+/** 批量删除${table.classComment} */
+async function onDeleteBatch() {
+ const hideLoading = message.loading({
+ content: $t('ui.actionMessage.deleting'),
+ duration: 0,
+ key: 'action_process_msg',
+ });
+ try {
+ await delete${simpleClassName}ListByIds(deleteIds.value);
+ message.success( $t('ui.actionMessage.deleteSuccess') );
+ await getList();
+ } finally {
+ hideLoading();
+ }
+}
+
+const deleteIds = ref([]) // 待删除${table.classComment} ID
+function setDeleteIds({
+ records,
+}: {
+ records: ${simpleClassName}Api.${simpleClassName}[];
+}) {
+ deleteIds.value = records.map((item) => item.id);
+}
+#end
+
/** 导出表格 */
async function onExport() {
try {
@@ -302,6 +330,19 @@ onMounted(() => {
>
{{ $t('ui.actionTitle.export') }}
+ #if ($table.templateType != 2 && $deleteBatchEnable)
+
+ #end
{
#end
show-overflow
:loading="loading"
+#if ($table.templateType != 2 && $deleteBatchEnable)
+ @checkboxAll="setDeleteIds"
+ @checkboxChange="setDeleteIds"
+#end
>
+#if ($table.templateType != 2 && $deleteBatchEnable)
+
+#end
## 特殊:主子表专属逻辑
#if ( $table.templateType == 12 && $subTables && $subTables.size() > 0 )
@@ -421,7 +469,6 @@ onMounted(() => {
#end
-
#if ($table.templateType == 11) ## erp情况
diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
index 9ee3364b5b..5e69257458 100644
--- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
+++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
@@ -10,7 +10,7 @@
import type { VxeTableInstance } from '#/adapter/vxe-table';
import { DictTag } from '#/components/dict-tag';
- import { DICT_TYPE, getDictOptions } from '#/utils';
+ import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import { reactive,ref, h, nextTick,watch,onMounted } from 'vue';
import { cloneDeep, formatDateTime } from '@vben/utils';
@@ -22,15 +22,15 @@
import { Tinymce as RichTextarea } from '#/components/tinymce';
import { ImageUpload, FileUpload } from "#/components/upload";
import { message,Button, Tabs,Pagination, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox,RangePicker, DatePicker, TreeSelect } from 'ant-design-vue';
- import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
- import { Plus } from '@vben/icons';
+ import { Plus, Trash2 } from '@vben/icons';
import { $t } from '#/locales';
import { TableToolbar } from '#/components/table-toolbar';
import { useTableToolbar } from '#/hooks';
#end
#if ($table.templateType == 11) ## erp
- import { delete${subSimpleClassName}, get${subSimpleClassName}Page } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
+ import { delete${subSimpleClassName},#if ($deleteBatchEnable) delete${subSimpleClassName}ListByIds,#end get${subSimpleClassName}Page } from '#/api/${table.moduleName}/${table.businessName}';
+ import { isEmpty } from '@vben/utils';
#else
#if ($subTable.subJoinMany) ## 一对多
import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
@@ -76,11 +76,38 @@ async function onDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
key: 'action_process_msg',
});
- getList();
- } catch {
+ await getList();
+ } finally {
hideLoading();
}
}
+
+#if ($deleteBatchEnable)
+/** 批量删除${subTable.classComment} */
+async function onDeleteBatch() {
+ const hideLoading = message.loading({
+ content: $t('ui.actionMessage.deleting'),
+ duration: 0,
+ key: 'action_process_msg',
+ });
+ try {
+ await delete${subSimpleClassName}ListByIds(deleteIds.value);
+ message.success( $t('ui.actionMessage.deleteSuccess') );
+ await getList();
+ } finally {
+ hideLoading();
+ }
+}
+
+const deleteIds = ref([]) // 待删除${subTable.classComment} ID
+function setDeleteIds({
+ records,
+}: {
+ records: ${simpleClassName}Api.${subSimpleClassName}[];
+}) {
+ deleteIds.value = records.map((item) => item.id);
+}
+#end
#end
const loading = ref(true) // 列表的加载中
@@ -277,6 +304,19 @@ onMounted(() => {
>
{{ $t('ui.actionTitle.create', ['${table.classComment}']) }}
+ #if ($deleteBatchEnable)
+
+ #end
{
:data="list"
show-overflow
:loading="loading"
+ #if ($deleteBatchEnable)
+ @checkboxAll="setDeleteIds"
+ @checkboxChange="setDeleteIds"
+ #end
>
+ #if ($deleteBatchEnable)
+
+ #end
#foreach($column in $subColumns)
#if ($column.listOperationResult)
#set ($dictType=$column.dictType)
diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm
index d3342f1fc8..5a7602818e 100644
--- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm
+++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/api/api.ts.vm
@@ -89,6 +89,13 @@ export function delete${simpleClassName}(id: number) {
return requestClient.delete(`${baseURL}/delete?id=${id}`);
}
+#if ( $table.templateType != 2 && $deleteBatchEnable)
+/** 批量删除${table.classComment} */
+export function delete${simpleClassName}ListByIds(ids: number[]) {
+ return requestClient.delete(`${baseURL}/delete-list?ids=${ids.join(',')}`)
+}
+#end
+
/** 导出${table.classComment} */
export function export${simpleClassName}(params: any) {
return requestClient.download('${baseURL}/export-excel', params);
@@ -144,6 +151,13 @@ export function delete${subSimpleClassName}(id: number) {
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete?id=${id}`);
}
+#if ($deleteBatchEnable)
+/** 批量删除${subTable.classComment} */
+export function delete${subSimpleClassName}ListByIds(ids: number[]) {
+ return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`)
+}
+#end
+
/** 获得${subTable.classComment} */
export function get${subSimpleClassName}(id: number) {
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`);
diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm
index 5ca4c08d6e..113061e29a 100644
--- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm
+++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm
@@ -1,18 +1,17 @@
import type { VbenFormSchema } from '#/adapter/form';
-import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
import { z } from '#/adapter/form';
-import { getRangePickerDefaultProps } from '#/utils/date';
-import { DICT_TYPE, getDictOptions } from '#/utils/dict';
-
+import {
+ DICT_TYPE,
+ getDictOptions,
+ getRangePickerDefaultProps,
+} from '#/utils';
#if(${table.templateType} == 2)## 树表需要导入这些
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}';
import { handleTree } from '@vben/utils';
#end
-import { useAccess } from '@vben/access';
-
-const { hasAccessByCodes } = useAccess();
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -187,10 +186,11 @@ export function useGridFormSchema(): VbenFormSchema[] {
}
/** 列表的字段 */
-export function useGridColumns(
- onActionClick?: OnActionClickFn<${simpleClassName}Api.${simpleClassName}>,
-): VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>['columns'] {
+export function useGridColumns(): VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>['columns'] {
return [
+#if ($table.templateType != 2 && $deleteBatchEnable)
+ { type: 'checkbox', width: 40 },
+#end
#if ($table.templateType == 12) ## 内嵌情况
{ type: 'expand', width: 80, slots: { content: 'expand_content' } },
#end
@@ -218,43 +218,10 @@ export function useGridColumns(
#end
#end
{
- field: 'operation',
title: '操作',
- minWidth: 200,
- align: 'center',
+ width: 200,
fixed: 'right',
- headerAlign: 'center',
- showOverflow: false,
- cellRender: {
- attrs: {
- nameField: '${columns[0].javaField}',
- nameTitle: '${table.classComment}',
- onClick: onActionClick,
- },
- name: 'CellOperation',
- options: [
-#if (${table.templateType} == 2)## 树表特有操作
- {
- code: 'append',
- text: '新增下级',
- show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:create']),
- },
-#end
- {
- code: 'edit',
- show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:update']),
- },
- {
- code: 'delete',
- show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:delete']),
-#if (${table.templateType} == 2)## 树表禁止删除带有子节点的数据
- disabled: (row: ${simpleClassName}Api.${simpleClassName}) => {
- return !!(row.children && row.children.length > 0);
- },
-#end
- },
- ],
- },
+ slots: { default: 'actions' },
},
];
}
@@ -422,10 +389,11 @@ export function use${subSimpleClassName}GridFormSchema(): VbenFormSchema[] {
}
/** 列表的字段 */
-export function use${subSimpleClassName}GridColumns(
- onActionClick?: OnActionClickFn<${simpleClassName}Api.${subSimpleClassName}>,
-): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] {
+export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] {
return [
+ #if ($table.templateType != 2 && $deleteBatchEnable)
+ { type: 'checkbox', width: 40 },
+ #end
#foreach($column in $subColumns)
#if ($column.listOperationResult)
#set ($dictType = $column.dictType)
@@ -447,31 +415,10 @@ export function use${subSimpleClassName}GridColumns(
#end
#end
{
- field: 'operation',
title: '操作',
- minWidth: 200,
- align: 'center',
+ width: 200,
fixed: 'right',
- headerAlign: 'center',
- showOverflow: false,
- cellRender: {
- attrs: {
- nameField: '${columns[0].javaField}',
- nameTitle: '${subTable.classComment}',
- onClick: onActionClick,
- },
- name: 'CellOperation',
- options: [
- {
- code: 'edit',
- show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:update']),
- },
- {
- code: 'delete',
- show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:delete']),
- },
- ],
- },
+ slots: { default: 'actions' },
},
];
}
@@ -517,27 +464,10 @@ export function use${subSimpleClassName}GridColumns(
#end
#end
{
- field: 'operation',
title: '操作',
- minWidth: 60,
- align: 'center',
+ width: 200,
fixed: 'right',
- headerAlign: 'center',
- showOverflow: false,
- cellRender: {
- attrs: {
- nameField: '${columns[0].javaField}',
- nameTitle: '${table.classComment}',
- onClick: onActionClick,
- },
- name: 'CellOperation',
- options: [
- {
- code: 'delete',
- show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:delete']),
- },
- ],
- },
+ slots: { default: 'actions' },
},
];
}
@@ -672,7 +602,6 @@ export function use${subSimpleClassName}GridColumns(
#end
];
}
-
#end
#end
#end
diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm
index 1d8700eaa2..2cfa0ed690 100644
--- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm
+++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm
@@ -1,10 +1,9 @@
@@ -170,9 +189,52 @@ const onRefresh = async ()=> {
-
+
+
+
+
#else
diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml
index bdb30b49f0..37b783d57d 100644
--- a/yudao-server/src/main/resources/application.yaml
+++ b/yudao-server/src/main/resources/application.yaml
@@ -269,6 +269,8 @@ yudao:
base-package: ${yudao.info.base-package}
db-schemas: ${spring.datasource.dynamic.datasource.master.name}
front-type: 20 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类
+ vo-type: 10 # VO 的类型,参见 CodegenVOTypeEnum 枚举类
+ delete-batch-enable: true # 是否生成批量删除接口
unit-test-enable: false # 是否生成单元测试
tenant: # 多租户相关配置项
enable: true