From d83e0413b881222fce3de219db018290d7abd561 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 15 Nov 2023 21:46:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=B8=80=E6=B3=A2=20demo=20?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=87=86=E5=A4=87?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo01/InfraDemo01StudentController.java | 89 --------- .../demo01/vo/InfraDemo01StudentBaseVO.java | 52 ----- .../vo/InfraDemo01StudentCreateReqVO.java | 14 -- .../demo01/vo/InfraDemo01StudentExcelVO.java | 55 ------ .../vo/InfraDemo01StudentExportReqVO.java | 31 --- .../vo/InfraDemo01StudentPageReqVO.java | 36 ---- .../demo01/vo/InfraDemo01StudentRespVO.java | 19 -- .../vo/InfraDemo01StudentUpdateReqVO.java | 20 -- .../demo02/InfraDemoStudentController.java | 115 ----------- .../controller/admin/demo02/package-info.java | 1 - .../demo02/vo/InfraDemoStudentBaseVO.java | 21 -- .../vo/InfraDemoStudentCreateReqVO.java | 14 -- .../demo02/vo/InfraDemoStudentExcelVO.java | 20 -- .../vo/InfraDemoStudentExportReqVO.java | 12 -- .../demo02/vo/InfraDemoStudentPageReqVO.java | 14 -- .../demo02/vo/InfraDemoStudentRespVO.java | 15 -- .../vo/InfraDemoStudentUpdateReqVO.java | 18 -- .../demo11/InfraDemo11StudentController.java | 115 ----------- .../controller/admin/demo11/package-info.java | 6 - .../demo11/vo/InfraDemo11StudentBaseVO.java | 57 ------ .../vo/InfraDemo11StudentCreateReqVO.java | 14 -- .../demo11/vo/InfraDemo11StudentExcelVO.java | 53 ----- .../vo/InfraDemo11StudentExportReqVO.java | 32 --- .../vo/InfraDemo11StudentPageReqVO.java | 34 ---- .../demo11/vo/InfraDemo11StudentRespVO.java | 19 -- .../vo/InfraDemo11StudentUpdateReqVO.java | 18 -- .../demo12/InfraDemo12StudentController.java | 178 ----------------- .../demo12/vo/InfraDemo12StudentBaseVO.java | 53 ----- .../vo/InfraDemo12StudentCreateReqVO.java | 14 -- .../demo12/vo/InfraDemo12StudentExcelVO.java | 53 ----- .../vo/InfraDemo12StudentExportReqVO.java | 32 --- .../vo/InfraDemo12StudentPageReqVO.java | 34 ---- .../demo12/vo/InfraDemo12StudentRespVO.java | 19 -- .../vo/InfraDemo12StudentUpdateReqVO.java | 18 -- .../demo01/InfraDemo01StudentConvert.java | 34 ---- .../demo02/InfraDemoStudentConvert.java | 36 ---- .../demo11/InfraDemo11StudentConvert.java | 34 ---- .../demo12/InfraDemo12StudentConvert.java | 34 ---- .../demo01/InfraDemo01StudentMapper.java | 40 ---- .../demo02/InfraDemoStudentAddressMapper.java | 29 --- .../demo02/InfraDemoStudentContactMapper.java | 30 --- .../mysql/demo02/InfraDemoStudentMapper.java | 31 --- .../InfraDemo11StudentContactMapper.java | 28 --- .../demo11/InfraDemo11StudentMapper.java | 40 ---- .../InfraDemo11StudentTeacherMapper.java | 28 --- .../InfraDemo12StudentContactMapper.java | 30 --- .../demo12/InfraDemo12StudentMapper.java | 40 ---- .../InfraDemo12StudentTeacherMapper.java | 30 --- .../demo01/InfraDemo01StudentService.java | 62 ------ .../demo01/InfraDemo01StudentServiceImpl.java | 81 -------- .../demo02/InfraDemoStudentService.java | 86 -------- .../demo02/InfraDemoStudentServiceImpl.java | 146 -------------- .../demo11/InfraDemo11StudentService.java | 86 -------- .../demo11/InfraDemo11StudentServiceImpl.java | 153 --------------- .../demo12/InfraDemo12StudentService.java | 149 -------------- .../demo12/InfraDemo12StudentServiceImpl.java | 156 --------------- .../codegen/java/test/serviceTest.vm | 2 +- .../InfraDemo12StudentServiceImplTest.java | 183 ------------------ 58 files changed, 1 insertion(+), 2862 deletions(-) delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/InfraDemo01StudentController.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentBaseVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentCreateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExcelVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExportReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentPageReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentRespVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentUpdateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/InfraDemoStudentController.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/package-info.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentBaseVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentCreateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExcelVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExportReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentPageReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentRespVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentUpdateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/InfraDemo11StudentController.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/package-info.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentBaseVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentCreateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExcelVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExportReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentPageReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentRespVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentUpdateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentCreateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExcelVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExportReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentPageReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentRespVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentUpdateReqVO.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo01/InfraDemo01StudentConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo02/InfraDemoStudentConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo11/InfraDemo11StudentConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo01/InfraDemo01StudentMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentAddressMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentContactMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentContactMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentTeacherMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentService.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentService.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentService.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImplTest.java diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/InfraDemo01StudentController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/InfraDemo01StudentController.java deleted file mode 100644 index 41c58a2b6..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/InfraDemo01StudentController.java +++ /dev/null @@ -1,89 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01; - -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; -import cn.iocoder.yudao.module.infra.convert.demo01.InfraDemo01StudentConvert; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; -import cn.iocoder.yudao.module.infra.service.demo01.InfraDemo01StudentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -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; - -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; - -@Tag(name = "管理后台 - 学生") -@RestController -@RequestMapping("/infra/demo01-student") -@Validated -public class InfraDemo01StudentController { - - @Resource - private InfraDemo01StudentService demo01StudentService; - - @PostMapping("/create") - @Operation(summary = "创建学生") - @PreAuthorize("@ss.hasPermission('infra:demo01-student:create')") - public CommonResult createDemo01Student(@Valid @RequestBody InfraDemo01StudentCreateReqVO createReqVO) { - return success(demo01StudentService.createDemo01Student(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新学生") - @PreAuthorize("@ss.hasPermission('infra:demo01-student:update')") - public CommonResult updateDemo01Student(@Valid @RequestBody InfraDemo01StudentUpdateReqVO updateReqVO) { - demo01StudentService.updateDemo01Student(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除学生") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('infra:demo01-student:delete')") - public CommonResult deleteDemo01Student(@RequestParam("id") Long id) { - demo01StudentService.deleteDemo01Student(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得学生") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('infra:demo01-student:query')") - public CommonResult getDemo01Student(@RequestParam("id") Long id) { - InfraDemo01StudentDO demo01Student = demo01StudentService.getDemo01Student(id); - return success(InfraDemo01StudentConvert.INSTANCE.convert(demo01Student)); - } - - @GetMapping("/page") - @Operation(summary = "获得学生分页") - @PreAuthorize("@ss.hasPermission('infra:demo01-student:query')") - public CommonResult> getDemo01StudentPage(@Valid InfraDemo01StudentPageReqVO pageVO) { - PageResult pageResult = demo01StudentService.getDemo01StudentPage(pageVO); - return success(InfraDemo01StudentConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出学生 Excel") - @PreAuthorize("@ss.hasPermission('infra:demo01-student:export')") - @OperateLog(type = EXPORT) - public void exportDemo01StudentExcel(@Valid InfraDemo01StudentExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = demo01StudentService.getDemo01StudentList(exportReqVO); - // 导出 Excel - List datas = InfraDemo01StudentConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "学生.xls", "数据", InfraDemo01StudentExcelVO.class, datas); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentBaseVO.java deleted file mode 100644 index e7334b80b..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentBaseVO.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -/** - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 - */ -@Data -public class InfraDemo01StudentBaseVO { - - @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头") - @NotEmpty(message = "名字不能为空") - private String name; - - @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍") - @NotEmpty(message = "简介不能为空") - private String description; - - @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "出生日期不能为空") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime birthday; - - @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "性别不能为空") - private Integer sex; - - @Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "是否有效不能为空") - private Boolean enabled; - - @Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") - @NotEmpty(message = "头像不能为空") - private String avatar; - - @Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4") - private String video; - - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注") - @NotEmpty(message = "备注不能为空") - private String memo; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentCreateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentCreateReqVO.java deleted file mode 100644 index f4e20631a..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentCreateReqVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; - -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 InfraDemo01StudentCreateReqVO extends InfraDemo01StudentBaseVO { - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExcelVO.java deleted file mode 100644 index d9a15ddd9..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExcelVO.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; - -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import com.alibaba.excel.annotation.ExcelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - - -/** - * 学生 Excel VO - * - * @author 芋道源码 - */ -@Data -public class InfraDemo01StudentExcelVO { - - @ExcelProperty("编号") - private Long id; - - @ExcelProperty("名字") - private String name; - - @ExcelProperty("简介") - private String description; - - @ExcelProperty("出生日期") - private LocalDateTime birthday; - - @ExcelProperty(value = "性别", converter = DictConvert.class) - @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private Integer sex; - - @ExcelProperty(value = "是否有效", converter = DictConvert.class) - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private Boolean enabled; - - @ExcelProperty(value = "支付方式", converter = DictConvert.class) - @DictFormat("pay_channel_code") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private String payChannels; - - @ExcelProperty("头像") - private String avatar; - - @ExcelProperty("附件") - private String video; - - @ExcelProperty("备注") - private String memo; - - @ExcelProperty("创建时间") - private LocalDateTime createTime; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExportReqVO.java deleted file mode 100644 index de807fa22..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExportReqVO.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; - -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 = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo01StudentPageReqVO 是一致的") -@Data -public class InfraDemo01StudentExportReqVO { - - @Schema(description = "名字", example = "芋头") - private String name; - - @Schema(description = "出生日期") - private LocalDateTime birthday; - - @Schema(description = "性别", example = "1") - private Integer sex; - - @Schema(description = "是否有效", example = "true") - private Boolean enabled; - - @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/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentPageReqVO.java deleted file mode 100644 index cee743430..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentPageReqVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01.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; - -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 InfraDemo01StudentPageReqVO extends PageParam { - - @Schema(description = "名字", example = "芋头") - private String name; - - @Schema(description = "出生日期") - private LocalDateTime birthday; - - @Schema(description = "性别", example = "1") - private Integer sex; - - @Schema(description = "是否有效", example = "true") - private Boolean enabled; - - @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/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentRespVO.java deleted file mode 100644 index 05f66df67..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentRespVO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.time.LocalDateTime; - -@Schema(description = "管理后台 - 学生 Response VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo01StudentRespVO extends InfraDemo01StudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Long id; - - @Schema(description = "创建时间") - private LocalDateTime createTime; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentUpdateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentUpdateReqVO.java deleted file mode 100644 index 8ec28c0c9..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentUpdateReqVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import javax.validation.constraints.NotNull; - -@Schema(description = "管理后台 - 学生更新 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo01StudentUpdateReqVO extends InfraDemo01StudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - @NotNull(message = "编号不能为空") - private Long id; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/InfraDemoStudentController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/InfraDemoStudentController.java deleted file mode 100644 index ae4d48255..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/InfraDemoStudentController.java +++ /dev/null @@ -1,115 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; - -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; -import cn.iocoder.yudao.module.infra.convert.demo02.InfraDemoStudentConvert; -import cn.iocoder.yudao.module.infra.service.demo02.InfraDemoStudentService; - -@Tag(name = "管理后台 - 学生") -@RestController -@RequestMapping("/infra/demo-student") -@Validated -public class InfraDemoStudentController { - - @Resource - private InfraDemoStudentService demoStudentService; - - @PostMapping("/create") - @Operation(summary = "创建学生") - @PreAuthorize("@ss.hasPermission('infra:demo-student:create')") - public CommonResult createDemoStudent(@Valid @RequestBody InfraDemoStudentCreateReqVO createReqVO) { - return success(demoStudentService.createDemoStudent(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新学生") - @PreAuthorize("@ss.hasPermission('infra:demo-student:update')") - public CommonResult updateDemoStudent(@Valid @RequestBody InfraDemoStudentUpdateReqVO updateReqVO) { - demoStudentService.updateDemoStudent(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除学生") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('infra:demo-student:delete')") - public CommonResult deleteDemoStudent(@RequestParam("id") Long id) { - demoStudentService.deleteDemoStudent(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得学生") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") - public CommonResult getDemoStudent(@RequestParam("id") Long id) { - InfraDemoStudentDO demoStudent = demoStudentService.getDemoStudent(id); - return success(InfraDemoStudentConvert.INSTANCE.convert(demoStudent)); - } - - @GetMapping("/page") - @Operation(summary = "获得学生分页") - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") - public CommonResult> getDemoStudentPage(@Valid InfraDemoStudentPageReqVO pageVO) { - PageResult pageResult = demoStudentService.getDemoStudentPage(pageVO); - return success(InfraDemoStudentConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出学生 Excel") - @PreAuthorize("@ss.hasPermission('infra:demo-student:export')") - @OperateLog(type = EXPORT) - public void exportDemoStudentExcel(@Valid InfraDemoStudentExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = demoStudentService.getDemoStudentList(exportReqVO); - // 导出 Excel - List datas = InfraDemoStudentConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "学生.xls", "数据", InfraDemoStudentExcelVO.class, datas); - } - - // ==================== 子表(学生联系人) ==================== - - @GetMapping("/demo-student/list-by-student-id") - @Operation(summary = "获得学生联系人列表") - @Parameter(name = "studentId", description = "学生编号") - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") - public CommonResult> getDemoStudentContactListByStudentId(@RequestParam("studentId") Long studentId) { - return success(demoStudentService.getDemoStudentContactListByStudentId(studentId)); - } - - // ==================== 子表(学生地址) ==================== - - @GetMapping("/demo-student/get-by-student-id") - @Operation(summary = "获得学生地址") - @Parameter(name = "studentId", description = "学生编号") - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") - public CommonResult getDemoStudentAddressByStudentId(@RequestParam("studentId") Long studentId) { - return success(demoStudentService.getDemoStudentAddressByStudentId(studentId)); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/package-info.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/package-info.java deleted file mode 100644 index 783234155..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02; \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentBaseVO.java deleted file mode 100644 index 0832e3574..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentBaseVO.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; - -/** - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 - */ -@Data -public class InfraDemoStudentBaseVO { - - private List demoStudentContacts; - - private InfraDemoStudentAddressDO demoStudentAddress; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentCreateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentCreateReqVO.java deleted file mode 100644 index 5dcad45c5..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentCreateReqVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 学生创建 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemoStudentCreateReqVO extends InfraDemoStudentBaseVO { - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExcelVO.java deleted file mode 100644 index 64aadbd0b..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExcelVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; - -import com.alibaba.excel.annotation.ExcelProperty; - -/** - * 学生 Excel VO - * - * @author 芋道源码 - */ -@Data -public class InfraDemoStudentExcelVO { - - @ExcelProperty("编号") - private Long id; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExportReqVO.java deleted file mode 100644 index 23fb2d1f9..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExportReqVO.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; - -@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemoStudentPageReqVO 是一致的") -@Data -public class InfraDemoStudentExportReqVO { - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentPageReqVO.java deleted file mode 100644 index 648fa197a..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentPageReqVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; - -@Schema(description = "管理后台 - 学生分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemoStudentPageReqVO extends PageParam { - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentRespVO.java deleted file mode 100644 index f49dbfd03..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentRespVO.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; - -@Schema(description = "管理后台 - 学生 Response VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemoStudentRespVO extends InfraDemoStudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Long id; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentUpdateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentUpdateReqVO.java deleted file mode 100644 index 09313c1fc..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentUpdateReqVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 学生更新 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemoStudentUpdateReqVO extends InfraDemoStudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - @NotNull(message = "编号不能为空") - private Long id; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/InfraDemo11StudentController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/InfraDemo11StudentController.java deleted file mode 100644 index 2e1ef75e7..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/InfraDemo11StudentController.java +++ /dev/null @@ -1,115 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; - -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; -import cn.iocoder.yudao.module.infra.convert.demo11.InfraDemo11StudentConvert; -import cn.iocoder.yudao.module.infra.service.demo11.InfraDemo11StudentService; - -@Tag(name = "管理后台 - 学生") -@RestController -@RequestMapping("/infra/demo11-student") -@Validated -public class InfraDemo11StudentController { - - @Resource - private InfraDemo11StudentService demo11StudentService; - - @PostMapping("/create") - @Operation(summary = "创建学生") - @PreAuthorize("@ss.hasPermission('infra:demo11-student:create')") - public CommonResult createDemo11Student(@Valid @RequestBody InfraDemo11StudentCreateReqVO createReqVO) { - return success(demo11StudentService.createDemo11Student(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新学生") - @PreAuthorize("@ss.hasPermission('infra:demo11-student:update')") - public CommonResult updateDemo11Student(@Valid @RequestBody InfraDemo11StudentUpdateReqVO updateReqVO) { - demo11StudentService.updateDemo11Student(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除学生") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('infra:demo11-student:delete')") - public CommonResult deleteDemo11Student(@RequestParam("id") Long id) { - demo11StudentService.deleteDemo11Student(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得学生") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") - public CommonResult getDemo11Student(@RequestParam("id") Long id) { - InfraDemo11StudentDO demo11Student = demo11StudentService.getDemo11Student(id); - return success(InfraDemo11StudentConvert.INSTANCE.convert(demo11Student)); - } - - @GetMapping("/page") - @Operation(summary = "获得学生分页") - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") - public CommonResult> getDemo11StudentPage(@Valid InfraDemo11StudentPageReqVO pageVO) { - PageResult pageResult = demo11StudentService.getDemo11StudentPage(pageVO); - return success(InfraDemo11StudentConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出学生 Excel") - @PreAuthorize("@ss.hasPermission('infra:demo11-student:export')") - @OperateLog(type = EXPORT) - public void exportDemo11StudentExcel(@Valid InfraDemo11StudentExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = demo11StudentService.getDemo11StudentList(exportReqVO); - // 导出 Excel - List datas = InfraDemo11StudentConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "学生.xls", "数据", InfraDemo11StudentExcelVO.class, datas); - } - - // ==================== 子表(学生联系人) ==================== - - @GetMapping("/demo11-student/list-by-student-id") - @Operation(summary = "获得学生联系人列表") - @Parameter(name = "studentId", description = "学生编号") - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") - public CommonResult> getDemo11StudentContactListByStudentId(@RequestParam("studentId") Long studentId) { - return success(demo11StudentService.getDemo11StudentContactListByStudentId(studentId)); - } - - // ==================== 子表(学生班主任) ==================== - - @GetMapping("/demo11-student/get-by-student-id") - @Operation(summary = "获得学生班主任") - @Parameter(name = "studentId", description = "学生编号") - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") - public CommonResult getDemo11StudentTeacherByStudentId(@RequestParam("studentId") Long studentId) { - return success(demo11StudentService.getDemo11StudentTeacherByStudentId(studentId)); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/package-info.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/package-info.java deleted file mode 100644 index 8cdd04a7a..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * 代码生成示例:单表(增删改查) - * - * @see cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum#getType() - */ -package cn.iocoder.yudao.module.infra.controller.admin.demo11; \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentBaseVO.java deleted file mode 100644 index 9546c44d9..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentBaseVO.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import javax.validation.constraints.*; -import org.springframework.format.annotation.DateTimeFormat; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; - -/** - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 - */ -@Data -public class InfraDemo11StudentBaseVO { - - @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头") - @NotEmpty(message = "名字不能为空") - private String name; - - @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍") - @NotEmpty(message = "简介不能为空") - private String description; - - @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "出生日期不能为空") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime birthday; - - @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "性别不能为空") - private Integer sex; - - @Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "是否有效不能为空") - private Boolean enabled; - - @Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") - @NotEmpty(message = "头像不能为空") - private String avatar; - - @Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4") - private String video; - - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注") - @NotEmpty(message = "备注不能为空") - private String memo; - - private List demo11StudentContacts; - - private InfraDemo11StudentTeacherDO demo11StudentTeacher; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentCreateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentCreateReqVO.java deleted file mode 100644 index 9872be488..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentCreateReqVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 学生创建 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo11StudentCreateReqVO extends InfraDemo11StudentBaseVO { - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExcelVO.java deleted file mode 100644 index dde6a020e..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExcelVO.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; - -import com.alibaba.excel.annotation.ExcelProperty; -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; - - -/** - * 学生 Excel VO - * - * @author 芋道源码 - */ -@Data -public class InfraDemo11StudentExcelVO { - - @ExcelProperty("编号") - private Long id; - - @ExcelProperty("名字") - private String name; - - @ExcelProperty("简介") - private String description; - - @ExcelProperty("出生日期") - private LocalDateTime birthday; - - @ExcelProperty(value = "性别", converter = DictConvert.class) - @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private Integer sex; - - @ExcelProperty(value = "是否有效", converter = DictConvert.class) - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private Boolean enabled; - - @ExcelProperty("头像") - private String avatar; - - @ExcelProperty("附件") - private String video; - - @ExcelProperty("备注") - private String memo; - - @ExcelProperty("创建时间") - private LocalDateTime createTime; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExportReqVO.java deleted file mode 100644 index a79987886..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExportReqVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import java.time.LocalDateTime; -import org.springframework.format.annotation.DateTimeFormat; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo11StudentPageReqVO 是一致的") -@Data -public class InfraDemo11StudentExportReqVO { - - @Schema(description = "名字", example = "芋头") - private String name; - - @Schema(description = "出生日期") - private LocalDateTime birthday; - - @Schema(description = "性别", example = "1") - private Integer sex; - - @Schema(description = "是否有效", example = "true") - private Boolean enabled; - - @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/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentPageReqVO.java deleted file mode 100644 index 3c0d95ddb..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentPageReqVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -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 InfraDemo11StudentPageReqVO extends PageParam { - - @Schema(description = "名字", example = "芋头") - private String name; - - @Schema(description = "出生日期") - private LocalDateTime birthday; - - @Schema(description = "性别", example = "1") - private Integer sex; - - @Schema(description = "是否有效", example = "true") - private Boolean enabled; - - @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/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentRespVO.java deleted file mode 100644 index b22f38790..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentRespVO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.time.LocalDateTime; - -@Schema(description = "管理后台 - 学生 Response VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo11StudentRespVO extends InfraDemo11StudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Long id; - - @Schema(description = "创建时间") - private LocalDateTime createTime; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentUpdateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentUpdateReqVO.java deleted file mode 100644 index d496490e1..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentUpdateReqVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 学生更新 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo11StudentUpdateReqVO extends InfraDemo11StudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - @NotNull(message = "编号不能为空") - private Long id; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java deleted file mode 100644 index b678bb92a..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java +++ /dev/null @@ -1,178 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12; - -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.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; -import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; -import cn.iocoder.yudao.module.infra.service.demo12.InfraDemo12StudentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -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; - -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; - -@Tag(name = "管理后台 - 学生") -@RestController -@RequestMapping("/infra/demo12-student") -@Validated -public class InfraDemo12StudentController { - - @Resource - private InfraDemo12StudentService demo12StudentService; - - @PostMapping("/create") - @Operation(summary = "创建学生") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:create')") - public CommonResult createDemo12Student(@Valid @RequestBody InfraDemo12StudentCreateReqVO createReqVO) { - return success(demo12StudentService.createDemo12Student(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新学生") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:update')") - public CommonResult updateDemo12Student(@Valid @RequestBody InfraDemo12StudentUpdateReqVO updateReqVO) { - demo12StudentService.updateDemo12Student(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除学生") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')") - public CommonResult deleteDemo12Student(@RequestParam("id") Long id) { - demo12StudentService.deleteDemo12Student(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得学生") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult getDemo12Student(@RequestParam("id") Long id) { - InfraDemo12StudentDO demo12Student = demo12StudentService.getDemo12Student(id); - return success(InfraDemo12StudentConvert.INSTANCE.convert(demo12Student)); - } - - @GetMapping("/page") - @Operation(summary = "获得学生分页") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult> getDemo12StudentPage(@Valid InfraDemo12StudentPageReqVO pageVO) { - PageResult pageResult = demo12StudentService.getDemo12StudentPage(pageVO); - return success(InfraDemo12StudentConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出学生 Excel") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:export')") - @OperateLog(type = EXPORT) - public void exportDemo12StudentExcel(@Valid InfraDemo12StudentExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = demo12StudentService.getDemo12StudentList(exportReqVO); - // 导出 Excel - List datas = InfraDemo12StudentConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "学生.xls", "数据", InfraDemo12StudentExcelVO.class, datas); - } - - // ==================== 子表(学生联系人) ==================== - - @GetMapping("/demo12-student-contact/page") - @Operation(summary = "获得学生联系人分页") - @Parameter(name = "studentId", description = "学生编号") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult> getDemo12StudentContactPage(PageParam pageReqVO, - @RequestParam("studentId") Long studentId) { - return success(demo12StudentService.getDemo12StudentContactPage(pageReqVO, studentId)); - } - - @PostMapping("/demo12-student-contact/create") - @Operation(summary = "创建学生联系人") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:create')") - public CommonResult createDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) { - return success(demo12StudentService.createDemo12StudentContact(demo12StudentContact)); - } - - @PutMapping("/demo12-student-contact/update") - @Operation(summary = "更新学生联系人") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:update')") - public CommonResult updateDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) { - demo12StudentService.updateDemo12StudentContact(demo12StudentContact); - return success(true); - } - - @DeleteMapping("/demo12-student-contact/delete") - @Parameter(name = "id", description = "编号", required = true) - @Operation(summary = "删除学生联系人") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')") - public CommonResult deleteDemo12StudentContact(@RequestParam("id") Long id) { - demo12StudentService.deleteDemo12StudentContact(id); - return success(true); - } - - @GetMapping("/demo12-student-contact/get") - @Operation(summary = "获得学生联系人") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult getDemo12StudentContact(@RequestParam("id") Long id) { - return success(demo12StudentService.getDemo12StudentContact(id)); - } - - // ==================== 子表(学生班主任) ==================== - - @GetMapping("/demo12-student-teacher/page") - @Operation(summary = "获得学生班主任分页") - @Parameter(name = "studentId", description = "学生编号") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult> getDemo12StudentTeacherPage(PageParam pageReqVO, - @RequestParam("studentId") Long studentId) { - return success(demo12StudentService.getDemo12StudentTeacherPage(pageReqVO, studentId)); - } - - @PostMapping("/demo12-student-teacher/create") - @Operation(summary = "创建学生班主任") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:create')") - public CommonResult createDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) { - return success(demo12StudentService.createDemo12StudentTeacher(demo12StudentTeacher)); - } - - @PutMapping("/demo12-student-teacher/update") - @Operation(summary = "更新学生班主任") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:update')") - public CommonResult updateDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) { - demo12StudentService.updateDemo12StudentTeacher(demo12StudentTeacher); - return success(true); - } - - @DeleteMapping("/demo12-student-teacher/delete") - @Parameter(name = "id", description = "编号", required = true) - @Operation(summary = "删除学生班主任") - @PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')") - public CommonResult deleteDemo12StudentTeacher(@RequestParam("id") Long id) { - demo12StudentService.deleteDemo12StudentTeacher(id); - return success(true); - } - - @GetMapping("/demo12-student-teacher/get") - @Operation(summary = "获得学生班主任") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult getDemo12StudentTeacher(@RequestParam("id") Long id) { - return success(demo12StudentService.getDemo12StudentTeacher(id)); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java deleted file mode 100644 index 5544971cd..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import javax.validation.constraints.*; -import org.springframework.format.annotation.DateTimeFormat; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; - -/** - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 - */ -@Data -public class InfraDemo12StudentBaseVO { - - @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头") - @NotEmpty(message = "名字不能为空") - private String name; - - @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍") - @NotEmpty(message = "简介不能为空") - private String description; - - @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "出生日期不能为空") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime birthday; - - @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "性别不能为空") - private Integer sex; - - @Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "是否有效不能为空") - private Boolean enabled; - - @Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") - @NotEmpty(message = "头像不能为空") - private String avatar; - - @Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4") - private String video; - - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注") - @NotEmpty(message = "备注不能为空") - private String memo; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentCreateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentCreateReqVO.java deleted file mode 100644 index fb2ef6695..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentCreateReqVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 学生创建 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo12StudentCreateReqVO extends InfraDemo12StudentBaseVO { - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExcelVO.java deleted file mode 100644 index 3d803f728..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExcelVO.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; - -import com.alibaba.excel.annotation.ExcelProperty; -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; - - -/** - * 学生 Excel VO - * - * @author 芋道源码 - */ -@Data -public class InfraDemo12StudentExcelVO { - - @ExcelProperty("编号") - private Long id; - - @ExcelProperty("名字") - private String name; - - @ExcelProperty("简介") - private String description; - - @ExcelProperty("出生日期") - private LocalDateTime birthday; - - @ExcelProperty(value = "性别", converter = DictConvert.class) - @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private Integer sex; - - @ExcelProperty(value = "是否有效", converter = DictConvert.class) - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private Boolean enabled; - - @ExcelProperty("头像") - private String avatar; - - @ExcelProperty("附件") - private String video; - - @ExcelProperty("备注") - private String memo; - - @ExcelProperty("创建时间") - private LocalDateTime createTime; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExportReqVO.java deleted file mode 100644 index 13df7cf8b..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExportReqVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import java.time.LocalDateTime; -import org.springframework.format.annotation.DateTimeFormat; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo12StudentPageReqVO 是一致的") -@Data -public class InfraDemo12StudentExportReqVO { - - @Schema(description = "名字", example = "芋头") - private String name; - - @Schema(description = "出生日期") - private LocalDateTime birthday; - - @Schema(description = "性别", example = "1") - private Integer sex; - - @Schema(description = "是否有效", example = "true") - private Boolean enabled; - - @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/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentPageReqVO.java deleted file mode 100644 index ff614f97a..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentPageReqVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -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 InfraDemo12StudentPageReqVO extends PageParam { - - @Schema(description = "名字", example = "芋头") - private String name; - - @Schema(description = "出生日期") - private LocalDateTime birthday; - - @Schema(description = "性别", example = "1") - private Integer sex; - - @Schema(description = "是否有效", example = "true") - private Boolean enabled; - - @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/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentRespVO.java deleted file mode 100644 index b792f8cff..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentRespVO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.time.LocalDateTime; - -@Schema(description = "管理后台 - 学生 Response VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo12StudentRespVO extends InfraDemo12StudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Long id; - - @Schema(description = "创建时间") - private LocalDateTime createTime; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentUpdateReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentUpdateReqVO.java deleted file mode 100644 index 35e9ea3df..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentUpdateReqVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 学生更新 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class InfraDemo12StudentUpdateReqVO extends InfraDemo12StudentBaseVO { - - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - @NotNull(message = "编号不能为空") - private Long id; - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo01/InfraDemo01StudentConvert.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo01/InfraDemo01StudentConvert.java deleted file mode 100644 index e7252fa95..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo01/InfraDemo01StudentConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.demo01; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; - -/** - * 学生 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo01StudentConvert { - - InfraDemo01StudentConvert INSTANCE = Mappers.getMapper(InfraDemo01StudentConvert.class); - - InfraDemo01StudentDO convert(InfraDemo01StudentCreateReqVO bean); - - InfraDemo01StudentDO convert(InfraDemo01StudentUpdateReqVO bean); - - InfraDemo01StudentRespVO convert(InfraDemo01StudentDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo02/InfraDemoStudentConvert.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo02/InfraDemoStudentConvert.java deleted file mode 100644 index 97787a46b..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo02/InfraDemoStudentConvert.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.demo02; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentCreateReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentRespVO; -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentUpdateReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * 学生 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemoStudentConvert { - - InfraDemoStudentConvert INSTANCE = Mappers.getMapper(InfraDemoStudentConvert.class); - - InfraDemoStudentDO convert(InfraDemoStudentCreateReqVO bean); - - InfraDemoStudentDO convert(InfraDemoStudentUpdateReqVO bean); - - InfraDemoStudentRespVO convert(InfraDemoStudentDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo11/InfraDemo11StudentConvert.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo11/InfraDemo11StudentConvert.java deleted file mode 100644 index 3e60e9b64..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo11/InfraDemo11StudentConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.demo11; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; - -/** - * 学生 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo11StudentConvert { - - InfraDemo11StudentConvert INSTANCE = Mappers.getMapper(InfraDemo11StudentConvert.class); - - InfraDemo11StudentDO convert(InfraDemo11StudentCreateReqVO bean); - - InfraDemo11StudentDO convert(InfraDemo11StudentUpdateReqVO bean); - - InfraDemo11StudentRespVO convert(InfraDemo11StudentDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java deleted file mode 100644 index 656032462..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.demo12; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; - -/** - * 学生 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo12StudentConvert { - - InfraDemo12StudentConvert INSTANCE = Mappers.getMapper(InfraDemo12StudentConvert.class); - - InfraDemo12StudentDO convert(InfraDemo12StudentCreateReqVO bean); - - InfraDemo12StudentDO convert(InfraDemo12StudentUpdateReqVO bean); - - InfraDemo12StudentRespVO convert(InfraDemo12StudentDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo01/InfraDemo01StudentMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo01/InfraDemo01StudentMapper.java deleted file mode 100644 index 3f930feaf..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo01/InfraDemo01StudentMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo01; - -import java.util.*; - -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.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; - -/** - * 学生 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo01StudentMapper extends BaseMapperX { - - default PageResult selectPage(InfraDemo01StudentPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(InfraDemo01StudentDO::getName, reqVO.getName()) - .eqIfPresent(InfraDemo01StudentDO::getBirthday, reqVO.getBirthday()) - .eqIfPresent(InfraDemo01StudentDO::getSex, reqVO.getSex()) - .eqIfPresent(InfraDemo01StudentDO::getEnabled, reqVO.getEnabled()) - .betweenIfPresent(InfraDemo01StudentDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(InfraDemo01StudentDO::getId)); - } - - default List selectList(InfraDemo01StudentExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(InfraDemo01StudentDO::getName, reqVO.getName()) - .eqIfPresent(InfraDemo01StudentDO::getBirthday, reqVO.getBirthday()) - .eqIfPresent(InfraDemo01StudentDO::getSex, reqVO.getSex()) - .eqIfPresent(InfraDemo01StudentDO::getEnabled, reqVO.getEnabled()) - .betweenIfPresent(InfraDemo01StudentDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(InfraDemo01StudentDO::getId)); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentAddressMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentAddressMapper.java deleted file mode 100644 index 0ad50777c..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentAddressMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo02; - -import java.util.*; - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 学生地址 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemoStudentAddressMapper extends BaseMapperX { - - default InfraDemoStudentAddressDO selectByStudentId(Long studentId) { - return selectOne(InfraDemoStudentAddressDO::getStudentId, studentId); - } - - default List selectListByStudentId(List studentIds) { - return selectList(InfraDemoStudentAddressDO::getStudentId, studentIds); - } - - default int deleteByStudentId(Long studentId) { - return delete(InfraDemoStudentAddressDO::getStudentId, studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentContactMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentContactMapper.java deleted file mode 100644 index 335245832..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentContactMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo02; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * 学生联系人 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemoStudentContactMapper extends BaseMapperX { - - default List selectListByStudentId(Long studentId) { - return selectList(InfraDemoStudentContactDO::getStudentId, studentId); - } - - default List selectListByStudentId(List studentIds) { - return selectList(InfraDemoStudentContactDO::getStudentId, studentIds); - } - - default int deleteByStudentId(Long studentId) { - return delete(InfraDemoStudentContactDO::getStudentId, studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentMapper.java deleted file mode 100644 index 58904b978..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentMapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo02; - -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.demo02.vo.InfraDemoStudentExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentPageReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * 学生 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemoStudentMapper extends BaseMapperX { - - default PageResult selectPage(InfraDemoStudentPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .orderByDesc(InfraDemoStudentDO::getId)); - } - - default List selectList(InfraDemoStudentExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .orderByDesc(InfraDemoStudentDO::getId)); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentContactMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentContactMapper.java deleted file mode 100644 index 2f451095d..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentContactMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo11; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 学生联系人 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo11StudentContactMapper extends BaseMapperX { - - default List selectListByStudentId(Long studentId) { - return selectList(InfraDemo11StudentContactDO::getStudentId, studentId); - } - - default int deleteByStudentId(Long studentId) { - return delete(InfraDemo11StudentContactDO::getStudentId, studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentMapper.java deleted file mode 100644 index 4f568ed4d..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo11; - -import java.util.*; - -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.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; - -/** - * 学生 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo11StudentMapper extends BaseMapperX { - - default PageResult selectPage(InfraDemo11StudentPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(InfraDemo11StudentDO::getName, reqVO.getName()) - .eqIfPresent(InfraDemo11StudentDO::getBirthday, reqVO.getBirthday()) - .eqIfPresent(InfraDemo11StudentDO::getSex, reqVO.getSex()) - .eqIfPresent(InfraDemo11StudentDO::getEnabled, reqVO.getEnabled()) - .betweenIfPresent(InfraDemo11StudentDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(InfraDemo11StudentDO::getId)); - } - - default List selectList(InfraDemo11StudentExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(InfraDemo11StudentDO::getName, reqVO.getName()) - .eqIfPresent(InfraDemo11StudentDO::getBirthday, reqVO.getBirthday()) - .eqIfPresent(InfraDemo11StudentDO::getSex, reqVO.getSex()) - .eqIfPresent(InfraDemo11StudentDO::getEnabled, reqVO.getEnabled()) - .betweenIfPresent(InfraDemo11StudentDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(InfraDemo11StudentDO::getId)); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentTeacherMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentTeacherMapper.java deleted file mode 100644 index ad9a46ee5..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentTeacherMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo11; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 学生班主任 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo11StudentTeacherMapper extends BaseMapperX { - - default InfraDemo11StudentTeacherDO selectByStudentId(Long studentId) { - return selectOne(InfraDemo11StudentTeacherDO::getStudentId, studentId); - } - - default int deleteByStudentId(Long studentId) { - return delete(InfraDemo11StudentTeacherDO::getStudentId, studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java deleted file mode 100644 index e4206d98b..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo12; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 学生联系人 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo12StudentContactMapper extends BaseMapperX { - - default PageResult selectPage(PageParam reqVO, Long studentId) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eq(InfraDemo12StudentContactDO::getStudentId, studentId) - .orderByDesc(InfraDemo12StudentContactDO::getId)); - } - - default int deleteByStudentId(Long studentId) { - return delete(InfraDemo12StudentContactDO::getStudentId, studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentMapper.java deleted file mode 100644 index caa6e62ad..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo12; - -import java.util.*; - -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.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; - -/** - * 学生 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo12StudentMapper extends BaseMapperX { - - default PageResult selectPage(InfraDemo12StudentPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(InfraDemo12StudentDO::getName, reqVO.getName()) - .eqIfPresent(InfraDemo12StudentDO::getBirthday, reqVO.getBirthday()) - .eqIfPresent(InfraDemo12StudentDO::getSex, reqVO.getSex()) - .eqIfPresent(InfraDemo12StudentDO::getEnabled, reqVO.getEnabled()) - .betweenIfPresent(InfraDemo12StudentDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(InfraDemo12StudentDO::getId)); - } - - default List selectList(InfraDemo12StudentExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(InfraDemo12StudentDO::getName, reqVO.getName()) - .eqIfPresent(InfraDemo12StudentDO::getBirthday, reqVO.getBirthday()) - .eqIfPresent(InfraDemo12StudentDO::getSex, reqVO.getSex()) - .eqIfPresent(InfraDemo12StudentDO::getEnabled, reqVO.getEnabled()) - .betweenIfPresent(InfraDemo12StudentDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(InfraDemo12StudentDO::getId)); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java deleted file mode 100644 index 477207a98..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.demo12; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 学生班主任 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfraDemo12StudentTeacherMapper extends BaseMapperX { - - default PageResult selectPage(PageParam reqVO, Long studentId) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eq(InfraDemo12StudentTeacherDO::getStudentId, studentId) - .orderByDesc(InfraDemo12StudentTeacherDO::getId)); - } - - default int deleteByStudentId(Long studentId) { - return delete(InfraDemo12StudentTeacherDO::getStudentId, studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentService.java deleted file mode 100644 index e0ce1161b..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentService.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo01; - -import java.util.*; -import javax.validation.*; -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -/** - * 学生 Service 接口 - * - * @author 芋道源码 - */ -public interface InfraDemo01StudentService { - - /** - * 创建学生 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createDemo01Student(@Valid InfraDemo01StudentCreateReqVO createReqVO); - - /** - * 更新学生 - * - * @param updateReqVO 更新信息 - */ - void updateDemo01Student(@Valid InfraDemo01StudentUpdateReqVO updateReqVO); - - /** - * 删除学生 - * - * @param id 编号 - */ - void deleteDemo01Student(Long id); - - /** - * 获得学生 - * - * @param id 编号 - * @return 学生 - */ - InfraDemo01StudentDO getDemo01Student(Long id); - - /** - * 获得学生分页 - * - * @param pageReqVO 分页查询 - * @return 学生分页 - */ - PageResult getDemo01StudentPage(InfraDemo01StudentPageReqVO pageReqVO); - - /** - * 获得学生列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 学生列表 - */ - List getDemo01StudentList(InfraDemo01StudentExportReqVO exportReqVO); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentServiceImpl.java deleted file mode 100644 index e6faa56a0..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentServiceImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo01; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.infra.convert.demo01.InfraDemo01StudentConvert; -import cn.iocoder.yudao.module.infra.dal.mysql.demo01.InfraDemo01StudentMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.ListUtil; - -/** - * 学生 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class InfraDemo01StudentServiceImpl implements InfraDemo01StudentService { - - @Resource - private InfraDemo01StudentMapper demo01StudentMapper; - - @Override - public Long createDemo01Student(InfraDemo01StudentCreateReqVO createReqVO) { - // 插入 - InfraDemo01StudentDO demo01Student = InfraDemo01StudentConvert.INSTANCE.convert(createReqVO); - demo01StudentMapper.insert(demo01Student); - // 返回 - return demo01Student.getId(); - } - - @Override - public void updateDemo01Student(InfraDemo01StudentUpdateReqVO updateReqVO) { - // 校验存在 - validateDemo01StudentExists(updateReqVO.getId()); - // 更新 - InfraDemo01StudentDO updateObj = InfraDemo01StudentConvert.INSTANCE.convert(updateReqVO); - demo01StudentMapper.updateById(updateObj); - } - - @Override - public void deleteDemo01Student(Long id) { - // 校验存在 - validateDemo01StudentExists(id); - // 删除 - demo01StudentMapper.deleteById(id); - } - - private void validateDemo01StudentExists(Long id) { - if (demo01StudentMapper.selectById(id) == null) { - throw exception(DEMO01_STUDENT_NOT_EXISTS); - } - } - - @Override - public InfraDemo01StudentDO getDemo01Student(Long id) { - return demo01StudentMapper.selectById(id); - } - - @Override - public PageResult getDemo01StudentPage(InfraDemo01StudentPageReqVO pageReqVO) { - return demo01StudentMapper.selectPage(pageReqVO); - } - - @Override - public List getDemo01StudentList(InfraDemo01StudentExportReqVO exportReqVO) { - return demo01StudentMapper.selectList(exportReqVO); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentService.java deleted file mode 100644 index 8dc4b981a..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentService.java +++ /dev/null @@ -1,86 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo02; - -import java.util.*; -import javax.validation.*; -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -/** - * 学生 Service 接口 - * - * @author 芋道源码 - */ -public interface InfraDemoStudentService { - - /** - * 创建学生 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createDemoStudent(@Valid InfraDemoStudentCreateReqVO createReqVO); - - /** - * 更新学生 - * - * @param updateReqVO 更新信息 - */ - void updateDemoStudent(@Valid InfraDemoStudentUpdateReqVO updateReqVO); - - /** - * 删除学生 - * - * @param id 编号 - */ - void deleteDemoStudent(Long id); - - /** - * 获得学生 - * - * @param id 编号 - * @return 学生 - */ - InfraDemoStudentDO getDemoStudent(Long id); - - /** - * 获得学生分页 - * - * @param pageReqVO 分页查询 - * @return 学生分页 - */ - PageResult getDemoStudentPage(InfraDemoStudentPageReqVO pageReqVO); - - /** - * 获得学生列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 学生列表 - */ - List getDemoStudentList(InfraDemoStudentExportReqVO exportReqVO); - - - // ==================== 子表(学生联系人) ==================== - - /** - * 获得学生联系人列表 - * - * @param studentId 学生编号 - * @return 学生联系人列表 - */ - List getDemoStudentContactListByStudentId(Long studentId); - - - // ==================== 子表(学生地址) ==================== - - /** - * 获得学生地址 - * - * @param studentId 学生编号 - * @return 学生地址 - */ - InfraDemoStudentAddressDO getDemoStudentAddressByStudentId(Long studentId); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentServiceImpl.java deleted file mode 100644 index 94c8739fb..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentServiceImpl.java +++ /dev/null @@ -1,146 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo02; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.infra.convert.demo02.InfraDemoStudentConvert; -import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentMapper; -import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentContactMapper; -import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentAddressMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.ListUtil; - -/** - * 学生 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class InfraDemoStudentServiceImpl implements InfraDemoStudentService { - - @Resource - private InfraDemoStudentMapper demoStudentMapper; - @Resource - private InfraDemoStudentContactMapper demoStudentContactMapper; - @Resource - private InfraDemoStudentAddressMapper demoStudentAddressMapper; - - @Override - @Transactional(rollbackFor = Exception.class) - public Long createDemoStudent(InfraDemoStudentCreateReqVO createReqVO) { - // 插入 - InfraDemoStudentDO demoStudent = InfraDemoStudentConvert.INSTANCE.convert(createReqVO); - demoStudentMapper.insert(demoStudent); - - // 插入子表($subTable.classComment) - createDemoStudentContactList(demoStudent.getId(), createReqVO.getDemoStudentContacts()); - createDemoStudentAddress(demoStudent.getId(), createReqVO.getDemoStudentAddress()); - // 返回 - return demoStudent.getId(); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void updateDemoStudent(InfraDemoStudentUpdateReqVO updateReqVO) { - // 校验存在 - validateDemoStudentExists(updateReqVO.getId()); - // 更新 - InfraDemoStudentDO updateObj = InfraDemoStudentConvert.INSTANCE.convert(updateReqVO); - demoStudentMapper.updateById(updateObj); - - // 更新子表 - updateDemoStudentContactList(updateReqVO.getId(), updateReqVO.getDemoStudentContacts()); - updateDemoStudentAddress(updateReqVO.getId(), updateReqVO.getDemoStudentAddress()); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteDemoStudent(Long id) { - // 校验存在 - validateDemoStudentExists(id); - // 删除 - demoStudentMapper.deleteById(id); - - // 删除子表 - deleteDemoStudentContactByStudentId(id); - deleteDemoStudentAddressByStudentId(id); - } - - private void validateDemoStudentExists(Long id) { - if (demoStudentMapper.selectById(id) == null) { - throw exception(DEMO_STUDENT_NOT_EXISTS); - } - } - - @Override - public InfraDemoStudentDO getDemoStudent(Long id) { - return demoStudentMapper.selectById(id); - } - - @Override - public PageResult getDemoStudentPage(InfraDemoStudentPageReqVO pageReqVO) { - return demoStudentMapper.selectPage(pageReqVO); - } - - @Override - public List getDemoStudentList(InfraDemoStudentExportReqVO exportReqVO) { - return demoStudentMapper.selectList(exportReqVO); - } - - // ==================== 子表(学生联系人) ==================== - - @Override - public List getDemoStudentContactListByStudentId(Long studentId) { - return demoStudentContactMapper.selectListByStudentId(studentId); - } - - private void createDemoStudentContactList(Long studentId, List list) { - list.forEach(o -> o.setStudentId(studentId)); - demoStudentContactMapper.insertBatch(list); - } - - private void updateDemoStudentContactList(Long studentId, List list) { - deleteDemoStudentContactByStudentId(studentId); - createDemoStudentContactList(studentId, list); - } - - private void deleteDemoStudentContactByStudentId(Long studentId) { - demoStudentContactMapper.deleteByStudentId(studentId); - } - - // ==================== 子表(学生地址) ==================== - - @Override - public InfraDemoStudentAddressDO getDemoStudentAddressByStudentId(Long studentId) { - return demoStudentAddressMapper.selectByStudentId(studentId); - } - - private void createDemoStudentAddress(Long studentId, InfraDemoStudentAddressDO demoStudentAddress) { - demoStudentAddress.setStudentId(studentId); - demoStudentAddressMapper.insert(demoStudentAddress); - } - - private void updateDemoStudentAddress(Long studentId, InfraDemoStudentAddressDO demoStudentAddress) { - demoStudentAddress.setStudentId(studentId); - demoStudentAddressMapper.updateById(demoStudentAddress); - } - - private void deleteDemoStudentAddressByStudentId(Long studentId) { - demoStudentAddressMapper.deleteByStudentId(studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentService.java deleted file mode 100644 index 4f83514e0..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentService.java +++ /dev/null @@ -1,86 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo11; - -import java.util.*; -import javax.validation.*; -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -/** - * 学生 Service 接口 - * - * @author 芋道源码 - */ -public interface InfraDemo11StudentService { - - /** - * 创建学生 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createDemo11Student(@Valid InfraDemo11StudentCreateReqVO createReqVO); - - /** - * 更新学生 - * - * @param updateReqVO 更新信息 - */ - void updateDemo11Student(@Valid InfraDemo11StudentUpdateReqVO updateReqVO); - - /** - * 删除学生 - * - * @param id 编号 - */ - void deleteDemo11Student(Long id); - - /** - * 获得学生 - * - * @param id 编号 - * @return 学生 - */ - InfraDemo11StudentDO getDemo11Student(Long id); - - /** - * 获得学生分页 - * - * @param pageReqVO 分页查询 - * @return 学生分页 - */ - PageResult getDemo11StudentPage(InfraDemo11StudentPageReqVO pageReqVO); - - /** - * 获得学生列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 学生列表 - */ - List getDemo11StudentList(InfraDemo11StudentExportReqVO exportReqVO); - - - // ==================== 子表(学生联系人) ==================== - - /** - * 获得学生联系人列表 - * - * @param studentId 学生编号 - * @return 学生联系人列表 - */ - List getDemo11StudentContactListByStudentId(Long studentId); - - - // ==================== 子表(学生班主任) ==================== - - /** - * 获得学生班主任 - * - * @param studentId 学生编号 - * @return 学生班主任 - */ - InfraDemo11StudentTeacherDO getDemo11StudentTeacherByStudentId(Long studentId); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentServiceImpl.java deleted file mode 100644 index 7e036b30b..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentServiceImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo11; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentCreateReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentPageReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentUpdateReqVO; -import cn.iocoder.yudao.module.infra.convert.demo11.InfraDemo11StudentConvert; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; -import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentContactMapper; -import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentMapper; -import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentTeacherMapper; -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; -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DEMO11_STUDENT_NOT_EXISTS; - -/** - * 学生 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class InfraDemo11StudentServiceImpl implements InfraDemo11StudentService { - - @Resource - private InfraDemo11StudentMapper demo11StudentMapper; - @Resource - private InfraDemo11StudentContactMapper demo11StudentContactMapper; - @Resource - private InfraDemo11StudentTeacherMapper demo11StudentTeacherMapper; - - @Override - @Transactional(rollbackFor = Exception.class) - public Long createDemo11Student(InfraDemo11StudentCreateReqVO createReqVO) { - // 插入 - InfraDemo11StudentDO demo11Student = InfraDemo11StudentConvert.INSTANCE.convert(createReqVO); - demo11StudentMapper.insert(demo11Student); - - // 插入子表 - createDemo11StudentContactList(demo11Student.getId(), createReqVO.getDemo11StudentContacts()); - createDemo11StudentTeacher(demo11Student.getId(), createReqVO.getDemo11StudentTeacher()); - // 返回 - return demo11Student.getId(); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void updateDemo11Student(InfraDemo11StudentUpdateReqVO updateReqVO) { - // 校验存在 - validateDemo11StudentExists(updateReqVO.getId()); - // 更新 - InfraDemo11StudentDO updateObj = InfraDemo11StudentConvert.INSTANCE.convert(updateReqVO); - demo11StudentMapper.updateById(updateObj); - - // 更新子表 - updateDemo11StudentContactList(updateReqVO.getId(), updateReqVO.getDemo11StudentContacts()); - updateDemo11StudentTeacher(updateReqVO.getId(), updateReqVO.getDemo11StudentTeacher()); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteDemo11Student(Long id) { - // 校验存在 - validateDemo11StudentExists(id); - // 删除 - demo11StudentMapper.deleteById(id); - - // 删除子表 - deleteDemo11StudentContactByStudentId(id); - deleteDemo11StudentTeacherByStudentId(id); - } - - private void validateDemo11StudentExists(Long id) { - if (demo11StudentMapper.selectById(id) == null) { - throw exception(DEMO11_STUDENT_NOT_EXISTS); - } - } - - @Override - public InfraDemo11StudentDO getDemo11Student(Long id) { - return demo11StudentMapper.selectById(id); - } - - @Override - public PageResult getDemo11StudentPage(InfraDemo11StudentPageReqVO pageReqVO) { - return demo11StudentMapper.selectPage(pageReqVO); - } - - @Override - public List getDemo11StudentList(InfraDemo11StudentExportReqVO exportReqVO) { - return demo11StudentMapper.selectList(exportReqVO); - } - - // ==================== 子表(学生联系人) ==================== - - @Override - public List getDemo11StudentContactListByStudentId(Long studentId) { - return demo11StudentContactMapper.selectListByStudentId(studentId); - } - - private void createDemo11StudentContactList(Long studentId, List list) { - list.forEach(o -> o.setStudentId(studentId)); - demo11StudentContactMapper.insertBatch(list); - } - - private void updateDemo11StudentContactList(Long studentId, List list) { - deleteDemo11StudentContactByStudentId(studentId); - list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 - createDemo11StudentContactList(studentId, list); - } - - private void deleteDemo11StudentContactByStudentId(Long studentId) { - demo11StudentContactMapper.deleteByStudentId(studentId); - } - - // ==================== 子表(学生班主任) ==================== - - @Override - public InfraDemo11StudentTeacherDO getDemo11StudentTeacherByStudentId(Long studentId) { - return demo11StudentTeacherMapper.selectByStudentId(studentId); - } - - private void createDemo11StudentTeacher(Long studentId, InfraDemo11StudentTeacherDO demo11StudentTeacher) { - if (demo11StudentTeacher == null) { - return; - } - demo11StudentTeacher.setStudentId(studentId); - demo11StudentTeacherMapper.insert(demo11StudentTeacher); - } - - private void updateDemo11StudentTeacher(Long studentId, InfraDemo11StudentTeacherDO demo11StudentTeacher) { - if (demo11StudentTeacher == null) { - return; - } - demo11StudentTeacher.setStudentId(studentId); - demo11StudentTeacher.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新 - demo11StudentTeacherMapper.insertOrUpdate(demo11StudentTeacher); - } - - private void deleteDemo11StudentTeacherByStudentId(Long studentId) { - demo11StudentTeacherMapper.deleteByStudentId(studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java deleted file mode 100644 index a6b5a29fe..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java +++ /dev/null @@ -1,149 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo12; - -import java.util.*; -import javax.validation.*; -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; - -/** - * 学生 Service 接口 - * - * @author 芋道源码 - */ -public interface InfraDemo12StudentService { - - /** - * 创建学生 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createDemo12Student(@Valid InfraDemo12StudentCreateReqVO createReqVO); - - /** - * 更新学生 - * - * @param updateReqVO 更新信息 - */ - void updateDemo12Student(@Valid InfraDemo12StudentUpdateReqVO updateReqVO); - - /** - * 删除学生 - * - * @param id 编号 - */ - void deleteDemo12Student(Long id); - - /** - * 获得学生 - * - * @param id 编号 - * @return 学生 - */ - InfraDemo12StudentDO getDemo12Student(Long id); - - /** - * 获得学生分页 - * - * @param pageReqVO 分页查询 - * @return 学生分页 - */ - PageResult getDemo12StudentPage(InfraDemo12StudentPageReqVO pageReqVO); - - /** - * 获得学生列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 学生列表 - */ - List getDemo12StudentList(InfraDemo12StudentExportReqVO exportReqVO); - - - // ==================== 子表(学生联系人) ==================== - - /** - * 获得学生联系人分页 - * - * @param pageReqVO 分页查询 - * @param studentId 学生编号 - * @return 学生联系人分页 - */ - PageResult getDemo12StudentContactPage(PageParam pageReqVO, Long studentId); - - /** - * 创建学生联系人 - * - * @param demo12StudentContact 创建信息 - * @return 编号 - */ - Long createDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact); - - /** - * 更新学生联系人 - * - * @param demo12StudentContact 更新信息 - */ - void updateDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact); - - /** - * 删除学生联系人 - * - * @param id 编号 - */ - void deleteDemo12StudentContact(Long id); - - /** - * 获得学生联系人 - * - * @param id 编号 - * @return 学生联系人 - */ - InfraDemo12StudentContactDO getDemo12StudentContact(Long id); - - - // ==================== 子表(学生班主任) ==================== - - /** - * 获得学生班主任分页 - * - * @param pageReqVO 分页查询 - * @param studentId 学生编号 - * @return 学生班主任分页 - */ - PageResult getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId); - - /** - * 创建学生班主任 - * - * @param demo12StudentTeacher 创建信息 - * @return 编号 - */ - Long createDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher); - - /** - * 更新学生班主任 - * - * @param demo12StudentTeacher 更新信息 - */ - void updateDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher); - - /** - * 删除学生班主任 - * - * @param id 编号 - */ - void deleteDemo12StudentTeacher(Long id); - - /** - * 获得学生班主任 - * - * @param id 编号 - * @return 学生班主任 - */ - InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id); - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java deleted file mode 100644 index 8a7149fac..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo12; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; - -import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert; -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper; -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentContactMapper; -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentTeacherMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; - -/** - * 学生 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService { - - @Resource - private InfraDemo12StudentMapper demo12StudentMapper; - @Resource - private InfraDemo12StudentContactMapper demo12StudentContactMapper; - @Resource - private InfraDemo12StudentTeacherMapper demo12StudentTeacherMapper; - - @Override - public Long createDemo12Student(InfraDemo12StudentCreateReqVO createReqVO) { - // 插入 - InfraDemo12StudentDO demo12Student = InfraDemo12StudentConvert.INSTANCE.convert(createReqVO); - demo12StudentMapper.insert(demo12Student); - // 返回 - return demo12Student.getId(); - } - - @Override - public void updateDemo12Student(InfraDemo12StudentUpdateReqVO updateReqVO) { - // 校验存在 - validateDemo12StudentExists(updateReqVO.getId()); - // 更新 - InfraDemo12StudentDO updateObj = InfraDemo12StudentConvert.INSTANCE.convert(updateReqVO); - demo12StudentMapper.updateById(updateObj); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteDemo12Student(Long id) { - // 校验存在 - validateDemo12StudentExists(id); - // 删除 - demo12StudentMapper.deleteById(id); - - // 删除子表 - deleteDemo12StudentContactByStudentId(id); - deleteDemo12StudentTeacherByStudentId(id); - } - - private void validateDemo12StudentExists(Long id) { - if (demo12StudentMapper.selectById(id) == null) { - throw exception(DEMO12_STUDENT_NOT_EXISTS); - } - } - - @Override - public InfraDemo12StudentDO getDemo12Student(Long id) { - return demo12StudentMapper.selectById(id); - } - - @Override - public PageResult getDemo12StudentPage(InfraDemo12StudentPageReqVO pageReqVO) { - return demo12StudentMapper.selectPage(pageReqVO); - } - - @Override - public List getDemo12StudentList(InfraDemo12StudentExportReqVO exportReqVO) { - return demo12StudentMapper.selectList(exportReqVO); - } - - // ==================== 子表(学生联系人) ==================== - - @Override - public PageResult getDemo12StudentContactPage(PageParam pageReqVO, Long studentId) { - return demo12StudentContactMapper.selectPage(pageReqVO, studentId); - } - - @Override - public Long createDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) { - demo12StudentContactMapper.insert(demo12StudentContact); - return demo12StudentContact.getId(); - } - - @Override - public void updateDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) { - demo12StudentContactMapper.updateById(demo12StudentContact); - } - - @Override - public void deleteDemo12StudentContact(Long id) { - demo12StudentContactMapper.deleteById(id); - } - - @Override - public InfraDemo12StudentContactDO getDemo12StudentContact(Long id) { - return demo12StudentContactMapper.selectById(id); - } - - private void deleteDemo12StudentContactByStudentId(Long studentId) { - demo12StudentContactMapper.deleteByStudentId(studentId); - } - - // ==================== 子表(学生班主任) ==================== - - @Override - public PageResult getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId) { - return demo12StudentTeacherMapper.selectPage(pageReqVO, studentId); - } - - @Override - public Long createDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) { - demo12StudentTeacherMapper.insert(demo12StudentTeacher); - return demo12StudentTeacher.getId(); - } - - @Override - public void updateDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) { - demo12StudentTeacherMapper.updateById(demo12StudentTeacher); - } - - @Override - public void deleteDemo12StudentTeacher(Long id) { - demo12StudentTeacherMapper.deleteById(id); - } - - @Override - public InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id) { - return demo12StudentTeacherMapper.selectById(id); - } - - private void deleteDemo12StudentTeacherByStudentId(Long studentId) { - demo12StudentTeacherMapper.deleteByStudentId(studentId); - } - -} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm index daf33b340..eeac3ce66 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm @@ -85,7 +85,7 @@ public class ${table.className}ServiceImplTest extends BaseDbUnitTest { assertNotNull(${classNameVar}Id); // 校验记录的属性是否正确 ${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(${classNameVar}Id); - assertPojoEquals(createReqVO, ${classNameVar}); + assertPojoEquals(createReqVO, ${classNameVar}, "id"); } @Test diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImplTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImplTest.java deleted file mode 100644 index 8ee604c87..000000000 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImplTest.java +++ /dev/null @@ -1,183 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.demo12; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; - -import javax.annotation.Resource; - -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; - -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import javax.annotation.Resource; -import org.springframework.context.annotation.Import; -import java.util.*; -import java.time.LocalDateTime; - -import static cn.hutool.core.util.RandomUtil.*; -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - -/** - * {@link InfraDemo12StudentServiceImpl} 的单元测试类 - * - * @author 芋道源码 - */ -@Import(InfraDemo12StudentServiceImpl.class) -public class InfraDemo12StudentServiceImplTest extends BaseDbUnitTest { - - @Resource - private InfraDemo12StudentServiceImpl demo12StudentService; - - @Resource - private InfraDemo12StudentMapper demo12StudentMapper; - - @Test - public void testCreateDemo12Student_success() { - // 准备参数 - InfraDemo12StudentCreateReqVO reqVO = randomPojo(InfraDemo12StudentCreateReqVO.class); - - // 调用 - Long demo12StudentId = demo12StudentService.createDemo12Student(reqVO); - // 断言 - assertNotNull(demo12StudentId); - // 校验记录的属性是否正确 - InfraDemo12StudentDO demo12Student = demo12StudentMapper.selectById(demo12StudentId); - assertPojoEquals(reqVO, demo12Student); - } - - @Test - public void testUpdateDemo12Student_success() { - // mock 数据 - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class); - demo12StudentMapper.insert(dbDemo12Student);// @Sql: 先插入出一条存在的数据 - // 准备参数 - InfraDemo12StudentUpdateReqVO reqVO = randomPojo(InfraDemo12StudentUpdateReqVO.class, o -> { - o.setId(dbDemo12Student.getId()); // 设置更新的 ID - }); - - // 调用 - demo12StudentService.updateDemo12Student(reqVO); - // 校验是否更新正确 - InfraDemo12StudentDO demo12Student = demo12StudentMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, demo12Student); - } - - @Test - public void testUpdateDemo12Student_notExists() { - // 准备参数 - InfraDemo12StudentUpdateReqVO reqVO = randomPojo(InfraDemo12StudentUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> demo12StudentService.updateDemo12Student(reqVO), DEMO12_STUDENT_NOT_EXISTS); - } - - @Test - public void testDeleteDemo12Student_success() { - // mock 数据 - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class); - demo12StudentMapper.insert(dbDemo12Student);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbDemo12Student.getId(); - - // 调用 - demo12StudentService.deleteDemo12Student(id); - // 校验数据不存在了 - assertNull(demo12StudentMapper.selectById(id)); - } - - @Test - public void testDeleteDemo12Student_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> demo12StudentService.deleteDemo12Student(id), DEMO12_STUDENT_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetDemo12StudentPage() { - // mock 数据 - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class, o -> { // 等会查询到 - o.setName(null); - o.setBirthday(null); - o.setSex(null); - o.setEnabled(null); - o.setCreateTime(null); - }); - demo12StudentMapper.insert(dbDemo12Student); - // 测试 name 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setName(null))); - // 测试 birthday 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setBirthday(null))); - // 测试 sex 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setSex(null))); - // 测试 enabled 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setEnabled(null))); - // 测试 createTime 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setCreateTime(null))); - // 准备参数 - InfraDemo12StudentPageReqVO reqVO = new InfraDemo12StudentPageReqVO(); - reqVO.setName(null); - reqVO.setBirthday(null); - reqVO.setSex(null); - reqVO.setEnabled(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - - // 调用 - PageResult pageResult = demo12StudentService.getDemo12StudentPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbDemo12Student, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetDemo12StudentList() { - // mock 数据 - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class, o -> { // 等会查询到 - o.setName(null); - o.setBirthday(null); - o.setSex(null); - o.setEnabled(null); - o.setCreateTime(null); - }); - demo12StudentMapper.insert(dbDemo12Student); - // 测试 name 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setName(null))); - // 测试 birthday 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setBirthday(null))); - // 测试 sex 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setSex(null))); - // 测试 enabled 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setEnabled(null))); - // 测试 createTime 不匹配 - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setCreateTime(null))); - // 准备参数 - InfraDemo12StudentExportReqVO reqVO = new InfraDemo12StudentExportReqVO(); - reqVO.setName(null); - reqVO.setBirthday(null); - reqVO.setSex(null); - reqVO.setEnabled(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - - // 调用 - List list = demo12StudentService.getDemo12StudentList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbDemo12Student, list.get(0)); - } - -} \ No newline at end of file