From 90842542a93b73ff04713ed8aa3743afe2393737 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 13 Nov 2023 13:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=EF=BC=9A?= =?UTF-8?q?=E4=B8=BB=E5=AD=90=E8=A1=A8=EF=BC=88inner=EF=BC=89=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/enums/ErrorCodeConstants.java | 5 +- .../demo12/InfraDemo12StudentController.java | 115 +++++++++++ .../demo12/vo/InfraDemo12StudentBaseVO.java | 57 ++++++ .../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 ++ .../demo12/InfraDemo12StudentConvert.java | 34 ++++ .../demo12/InfraDemo12StudentContactDO.java | 71 +++++++ .../demo12/InfraDemo12StudentDO.java | 67 +++++++ .../demo12/InfraDemo12StudentTeacherDO.java | 71 +++++++ .../InfraDemo12StudentContactMapper.java | 28 +++ .../demo12/InfraDemo12StudentMapper.java | 40 ++++ .../InfraDemo12StudentTeacherMapper.java | 28 +++ .../demo12/InfraDemo12StudentService.java | 86 ++++++++ .../demo12/InfraDemo12StudentServiceImpl.java | 151 +++++++++++++++ .../vue3/views/components/list_sub_erp.vue.vm | 23 ++- .../demo12/InfraDemo12StudentMapper.xml | 12 ++ .../codegen/inner/CodegenEngineTest.java | 6 +- .../InfraDemo12StudentServiceImplTest.java | 183 ++++++++++++++++++ 22 files changed, 1134 insertions(+), 13 deletions(-) create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentCreateReqVO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExcelVO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExportReqVO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentPageReqVO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentRespVO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentUpdateReqVO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentContactDO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentDO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentTeacherDO.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentMapper.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/resources/mapper/demo12/InfraDemo12StudentMapper.xml create 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-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java index e443baf33..ff0b50b62 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java @@ -57,7 +57,10 @@ public interface ErrorCodeConstants { // ========== 学生(CodegenTemplateTypeEnum.ONE 示例) 1-001-201-000 ========== ErrorCode DEMO01_STUDENT_NOT_EXISTS = new ErrorCode(1_001_200_000, "学生不存在"); - // ========== 学生(CodegenTemplateTypeEnum.ONE 示例) 1-001-211-000 ========== + // ========== 学生(CodegenTemplateTypeEnum.MASTER_NORMAL 示例) 1-001-211-000 ========== ErrorCode DEMO11_STUDENT_NOT_EXISTS = new ErrorCode(1_001_211_000, "学生不存在"); + // ========== 学生(CodegenTemplateTypeEnum.MASTER_INNER 示例) 1-001-213-000 ========== + ErrorCode DEMO12_STUDENT_NOT_EXISTS = new ErrorCode(1_001_213_000, "学生不存在"); + } 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 new file mode 100644 index 000000000..7322f053c --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java @@ -0,0 +1,115 @@ +package cn.iocoder.yudao.module.infra.controller.admin.demo12; + +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.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.module.infra.convert.demo12.InfraDemo12StudentConvert; +import cn.iocoder.yudao.module.infra.service.demo12.InfraDemo12StudentService; + +@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/list-by-student-id") + @Operation(summary = "获得学生联系人列表") + @Parameter(name = "studentId", description = "学生编号") + @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") + public CommonResult> getDemo12StudentContactListByStudentId(@RequestParam("studentId") Long studentId) { + return success(demo12StudentService.getDemo12StudentContactListByStudentId(studentId)); + } + + // ==================== 子表(学生班主任) ==================== + + @GetMapping("/demo12-student/get-by-student-id") + @Operation(summary = "获得学生班主任") + @Parameter(name = "studentId", description = "学生编号") + @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") + public CommonResult getDemo12StudentTeacherByStudentId(@RequestParam("studentId") Long studentId) { + return success(demo12StudentService.getDemo12StudentTeacherByStudentId(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/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 new file mode 100644 index 000000000..4344edbb8 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java @@ -0,0 +1,57 @@ +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; + + private List demo12StudentContacts; + + private InfraDemo12StudentTeacherDO demo12StudentTeacher; + +} \ 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 new file mode 100644 index 000000000..fb2ef6695 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentCreateReqVO.java @@ -0,0 +1,14 @@ +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 new file mode 100644 index 000000000..3d803f728 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExcelVO.java @@ -0,0 +1,53 @@ +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 new file mode 100644 index 000000000..13df7cf8b --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExportReqVO.java @@ -0,0 +1,32 @@ +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 new file mode 100644 index 000000000..ff614f97a --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentPageReqVO.java @@ -0,0 +1,34 @@ +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 new file mode 100644 index 000000000..b792f8cff --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentRespVO.java @@ -0,0 +1,19 @@ +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 new file mode 100644 index 000000000..35e9ea3df --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentUpdateReqVO.java @@ -0,0 +1,18 @@ +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/demo12/InfraDemo12StudentConvert.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java new file mode 100644 index 000000000..656032462 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java @@ -0,0 +1,34 @@ +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/dataobject/demo12/InfraDemo12StudentContactDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentContactDO.java new file mode 100644 index 000000000..eda857a8d --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentContactDO.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.infra.dal.dataobject.demo12; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 学生联系人 DO + * + * @author 芋道源码 + */ +@TableName("infra_demo12_student_contact") +@KeySequence("infra_demo12_student_contact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class InfraDemo12StudentContactDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 学生编号 + */ + private Long studentId; + /** + * 名字 + */ + private String name; + /** + * 简介 + */ + private String description; + /** + * 出生日期 + */ + private LocalDateTime birthday; + /** + * 性别 + * + * 枚举 {@link TODO system_user_sex 对应的类} + */ + private Integer sex; + /** + * 是否有效 + * + * 枚举 {@link TODO infra_boolean_string 对应的类} + */ + private Boolean enabled; + /** + * 头像 + */ + private String avatar; + /** + * 附件 + */ + private String video; + /** + * 备注 + */ + 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/dal/dataobject/demo12/InfraDemo12StudentDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentDO.java new file mode 100644 index 000000000..cef77d6cf --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentDO.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.infra.dal.dataobject.demo12; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 学生 DO + * + * @author 芋道源码 + */ +@TableName("infra_demo12_student") +@KeySequence("infra_demo12_student_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class InfraDemo12StudentDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 名字 + */ + private String name; + /** + * 简介 + */ + private String description; + /** + * 出生日期 + */ + private LocalDateTime birthday; + /** + * 性别 + * + * 枚举 {@link TODO system_user_sex 对应的类} + */ + private Integer sex; + /** + * 是否有效 + * + * 枚举 {@link TODO infra_boolean_string 对应的类} + */ + private Boolean enabled; + /** + * 头像 + */ + private String avatar; + /** + * 附件 + */ + private String video; + /** + * 备注 + */ + 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/dal/dataobject/demo12/InfraDemo12StudentTeacherDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentTeacherDO.java new file mode 100644 index 000000000..e84ed8d27 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentTeacherDO.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.infra.dal.dataobject.demo12; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 学生班主任 DO + * + * @author 芋道源码 + */ +@TableName("infra_demo12_student_teacher") +@KeySequence("infra_demo12_student_teacher_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class InfraDemo12StudentTeacherDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 学生编号 + */ + private Long studentId; + /** + * 名字 + */ + private String name; + /** + * 简介 + */ + private String description; + /** + * 出生日期 + */ + private LocalDateTime birthday; + /** + * 性别 + * + * 枚举 {@link TODO system_user_sex 对应的类} + */ + private Integer sex; + /** + * 是否有效 + * + * 枚举 {@link TODO infra_boolean_string 对应的类} + */ + private Boolean enabled; + /** + * 头像 + */ + private String avatar; + /** + * 附件 + */ + private String video; + /** + * 备注 + */ + 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/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 new file mode 100644 index 000000000..1d28a06d5 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java @@ -0,0 +1,28 @@ +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 List selectListByStudentId(Long studentId) { + return selectList(InfraDemo12StudentContactDO::getStudentId, studentId); + } + + 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 new file mode 100644 index 000000000..caa6e62ad --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentMapper.java @@ -0,0 +1,40 @@ +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 new file mode 100644 index 000000000..05f86f9ab --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java @@ -0,0 +1,28 @@ +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 InfraDemo12StudentTeacherDO selectByStudentId(Long studentId) { + return selectOne(InfraDemo12StudentTeacherDO::getStudentId, studentId); + } + + 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/demo12/InfraDemo12StudentService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java new file mode 100644 index 000000000..2b20779a9 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java @@ -0,0 +1,86 @@ +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; + +/** + * 学生 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 studentId 学生编号 + * @return 学生联系人列表 + */ + List getDemo12StudentContactListByStudentId(Long studentId); + + + // ==================== 子表(学生班主任) ==================== + + /** + * 获得学生班主任 + * + * @param studentId 学生编号 + * @return 学生班主任 + */ + InfraDemo12StudentTeacherDO getDemo12StudentTeacherByStudentId(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/demo12/InfraDemo12StudentServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java new file mode 100644 index 000000000..07cef42d5 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java @@ -0,0 +1,151 @@ +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.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 + @Transactional(rollbackFor = Exception.class) + public Long createDemo12Student(InfraDemo12StudentCreateReqVO createReqVO) { + // 插入 + InfraDemo12StudentDO demo12Student = InfraDemo12StudentConvert.INSTANCE.convert(createReqVO); + demo12StudentMapper.insert(demo12Student); + + // 插入子表 + createDemo12StudentContactList(demo12Student.getId(), createReqVO.getDemo12StudentContacts()); + createDemo12StudentTeacher(demo12Student.getId(), createReqVO.getDemo12StudentTeacher()); + // 返回 + return demo12Student.getId(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateDemo12Student(InfraDemo12StudentUpdateReqVO updateReqVO) { + // 校验存在 + validateDemo12StudentExists(updateReqVO.getId()); + // 更新 + InfraDemo12StudentDO updateObj = InfraDemo12StudentConvert.INSTANCE.convert(updateReqVO); + demo12StudentMapper.updateById(updateObj); + + // 更新子表 + updateDemo12StudentContactList(updateReqVO.getId(), updateReqVO.getDemo12StudentContacts()); + updateDemo12StudentTeacher(updateReqVO.getId(), updateReqVO.getDemo12StudentTeacher()); + } + + @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 List getDemo12StudentContactListByStudentId(Long studentId) { + return demo12StudentContactMapper.selectListByStudentId(studentId); + } + + private void createDemo12StudentContactList(Long studentId, List list) { + list.forEach(o -> o.setStudentId(studentId)); + demo12StudentContactMapper.insertBatch(list); + } + + private void updateDemo12StudentContactList(Long studentId, List list) { + deleteDemo12StudentContactByStudentId(studentId); + list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 + createDemo12StudentContactList(studentId, list); + } + + private void deleteDemo12StudentContactByStudentId(Long studentId) { + demo12StudentContactMapper.deleteByStudentId(studentId); + } + + // ==================== 子表(学生班主任) ==================== + + @Override + public InfraDemo12StudentTeacherDO getDemo12StudentTeacherByStudentId(Long studentId) { + return demo12StudentTeacherMapper.selectByStudentId(studentId); + } + + private void createDemo12StudentTeacher(Long studentId, InfraDemo12StudentTeacherDO demo12StudentTeacher) { + if (demo12StudentTeacher == null) { + return; + } + demo12StudentTeacher.setStudentId(studentId); + demo12StudentTeacherMapper.insert(demo12StudentTeacher); + } + + private void updateDemo12StudentTeacher(Long studentId, InfraDemo12StudentTeacherDO demo12StudentTeacher) { + if (demo12StudentTeacher == null) { + return; + } + demo12StudentTeacher.setStudentId(studentId); + demo12StudentTeacher.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新 + demo12StudentTeacherMapper.insertOrUpdate(demo12StudentTeacher); + } + + 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/vue3/views/components/list_sub_erp.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm index d7ce1cebe..860927736 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm @@ -69,6 +69,8 @@