Commit d83e0413b881222fce3de219db018290d7abd561
1 parent
413640f5
清理一波 demo 示例代码,准备重新生成
Showing
58 changed files
with
1 additions
and
2862 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/InfraDemo01StudentController.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 6 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; | |
| 8 | -import cn.iocoder.yudao.module.infra.convert.demo01.InfraDemo01StudentConvert; | |
| 9 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; | |
| 10 | -import cn.iocoder.yudao.module.infra.service.demo01.InfraDemo01StudentService; | |
| 11 | -import io.swagger.v3.oas.annotations.Operation; | |
| 12 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | -import org.springframework.validation.annotation.Validated; | |
| 16 | -import org.springframework.web.bind.annotation.*; | |
| 17 | - | |
| 18 | -import javax.annotation.Resource; | |
| 19 | -import javax.servlet.http.HttpServletResponse; | |
| 20 | -import javax.validation.Valid; | |
| 21 | -import java.io.IOException; | |
| 22 | -import java.util.List; | |
| 23 | - | |
| 24 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 25 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 26 | - | |
| 27 | -@Tag(name = "管理后台 - 学生") | |
| 28 | -@RestController | |
| 29 | -@RequestMapping("/infra/demo01-student") | |
| 30 | -@Validated | |
| 31 | -public class InfraDemo01StudentController { | |
| 32 | - | |
| 33 | - @Resource | |
| 34 | - private InfraDemo01StudentService demo01StudentService; | |
| 35 | - | |
| 36 | - @PostMapping("/create") | |
| 37 | - @Operation(summary = "创建学生") | |
| 38 | - @PreAuthorize("@ss.hasPermission('infra:demo01-student:create')") | |
| 39 | - public CommonResult<Long> createDemo01Student(@Valid @RequestBody InfraDemo01StudentCreateReqVO createReqVO) { | |
| 40 | - return success(demo01StudentService.createDemo01Student(createReqVO)); | |
| 41 | - } | |
| 42 | - | |
| 43 | - @PutMapping("/update") | |
| 44 | - @Operation(summary = "更新学生") | |
| 45 | - @PreAuthorize("@ss.hasPermission('infra:demo01-student:update')") | |
| 46 | - public CommonResult<Boolean> updateDemo01Student(@Valid @RequestBody InfraDemo01StudentUpdateReqVO updateReqVO) { | |
| 47 | - demo01StudentService.updateDemo01Student(updateReqVO); | |
| 48 | - return success(true); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @DeleteMapping("/delete") | |
| 52 | - @Operation(summary = "删除学生") | |
| 53 | - @Parameter(name = "id", description = "编号", required = true) | |
| 54 | - @PreAuthorize("@ss.hasPermission('infra:demo01-student:delete')") | |
| 55 | - public CommonResult<Boolean> deleteDemo01Student(@RequestParam("id") Long id) { | |
| 56 | - demo01StudentService.deleteDemo01Student(id); | |
| 57 | - return success(true); | |
| 58 | - } | |
| 59 | - | |
| 60 | - @GetMapping("/get") | |
| 61 | - @Operation(summary = "获得学生") | |
| 62 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 63 | - @PreAuthorize("@ss.hasPermission('infra:demo01-student:query')") | |
| 64 | - public CommonResult<InfraDemo01StudentRespVO> getDemo01Student(@RequestParam("id") Long id) { | |
| 65 | - InfraDemo01StudentDO demo01Student = demo01StudentService.getDemo01Student(id); | |
| 66 | - return success(InfraDemo01StudentConvert.INSTANCE.convert(demo01Student)); | |
| 67 | - } | |
| 68 | - | |
| 69 | - @GetMapping("/page") | |
| 70 | - @Operation(summary = "获得学生分页") | |
| 71 | - @PreAuthorize("@ss.hasPermission('infra:demo01-student:query')") | |
| 72 | - public CommonResult<PageResult<InfraDemo01StudentRespVO>> getDemo01StudentPage(@Valid InfraDemo01StudentPageReqVO pageVO) { | |
| 73 | - PageResult<InfraDemo01StudentDO> pageResult = demo01StudentService.getDemo01StudentPage(pageVO); | |
| 74 | - return success(InfraDemo01StudentConvert.INSTANCE.convertPage(pageResult)); | |
| 75 | - } | |
| 76 | - | |
| 77 | - @GetMapping("/export-excel") | |
| 78 | - @Operation(summary = "导出学生 Excel") | |
| 79 | - @PreAuthorize("@ss.hasPermission('infra:demo01-student:export')") | |
| 80 | - @OperateLog(type = EXPORT) | |
| 81 | - public void exportDemo01StudentExcel(@Valid InfraDemo01StudentExportReqVO exportReqVO, | |
| 82 | - HttpServletResponse response) throws IOException { | |
| 83 | - List<InfraDemo01StudentDO> list = demo01StudentService.getDemo01StudentList(exportReqVO); | |
| 84 | - // 导出 Excel | |
| 85 | - List<InfraDemo01StudentExcelVO> datas = InfraDemo01StudentConvert.INSTANCE.convertList02(list); | |
| 86 | - ExcelUtils.write(response, "学生.xls", "数据", InfraDemo01StudentExcelVO.class, datas); | |
| 87 | - } | |
| 88 | - | |
| 89 | -} | |
| 90 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | - | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | - | |
| 11 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 15 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 16 | - */ | |
| 17 | -@Data | |
| 18 | -public class InfraDemo01StudentBaseVO { | |
| 19 | - | |
| 20 | - @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头") | |
| 21 | - @NotEmpty(message = "名字不能为空") | |
| 22 | - private String name; | |
| 23 | - | |
| 24 | - @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍") | |
| 25 | - @NotEmpty(message = "简介不能为空") | |
| 26 | - private String description; | |
| 27 | - | |
| 28 | - @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 29 | - @NotNull(message = "出生日期不能为空") | |
| 30 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 31 | - private LocalDateTime birthday; | |
| 32 | - | |
| 33 | - @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 34 | - @NotNull(message = "性别不能为空") | |
| 35 | - private Integer sex; | |
| 36 | - | |
| 37 | - @Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 38 | - @NotNull(message = "是否有效不能为空") | |
| 39 | - private Boolean enabled; | |
| 40 | - | |
| 41 | - @Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") | |
| 42 | - @NotEmpty(message = "头像不能为空") | |
| 43 | - private String avatar; | |
| 44 | - | |
| 45 | - @Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4") | |
| 46 | - private String video; | |
| 47 | - | |
| 48 | - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注") | |
| 49 | - @NotEmpty(message = "备注不能为空") | |
| 50 | - private String memo; | |
| 51 | - | |
| 52 | -} | |
| 53 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | -import lombok.ToString; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生创建 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemo01StudentCreateReqVO extends InfraDemo01StudentBaseVO { | |
| 13 | - | |
| 14 | -} | |
| 15 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 4 | -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 5 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 6 | -import lombok.Data; | |
| 7 | - | |
| 8 | -import java.time.LocalDateTime; | |
| 9 | - | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 学生 Excel VO | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Data | |
| 17 | -public class InfraDemo01StudentExcelVO { | |
| 18 | - | |
| 19 | - @ExcelProperty("编号") | |
| 20 | - private Long id; | |
| 21 | - | |
| 22 | - @ExcelProperty("名字") | |
| 23 | - private String name; | |
| 24 | - | |
| 25 | - @ExcelProperty("简介") | |
| 26 | - private String description; | |
| 27 | - | |
| 28 | - @ExcelProperty("出生日期") | |
| 29 | - private LocalDateTime birthday; | |
| 30 | - | |
| 31 | - @ExcelProperty(value = "性别", converter = DictConvert.class) | |
| 32 | - @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 33 | - private Integer sex; | |
| 34 | - | |
| 35 | - @ExcelProperty(value = "是否有效", converter = DictConvert.class) | |
| 36 | - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 37 | - private Boolean enabled; | |
| 38 | - | |
| 39 | - @ExcelProperty(value = "支付方式", converter = DictConvert.class) | |
| 40 | - @DictFormat("pay_channel_code") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 41 | - private String payChannels; | |
| 42 | - | |
| 43 | - @ExcelProperty("头像") | |
| 44 | - private String avatar; | |
| 45 | - | |
| 46 | - @ExcelProperty("附件") | |
| 47 | - private String video; | |
| 48 | - | |
| 49 | - @ExcelProperty("备注") | |
| 50 | - private String memo; | |
| 51 | - | |
| 52 | - @ExcelProperty("创建时间") | |
| 53 | - private LocalDateTime createTime; | |
| 54 | - | |
| 55 | -} | |
| 56 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | - | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | - | |
| 9 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 10 | - | |
| 11 | -@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo01StudentPageReqVO 是一致的") | |
| 12 | -@Data | |
| 13 | -public class InfraDemo01StudentExportReqVO { | |
| 14 | - | |
| 15 | - @Schema(description = "名字", example = "芋头") | |
| 16 | - private String name; | |
| 17 | - | |
| 18 | - @Schema(description = "出生日期") | |
| 19 | - private LocalDateTime birthday; | |
| 20 | - | |
| 21 | - @Schema(description = "性别", example = "1") | |
| 22 | - private Integer sex; | |
| 23 | - | |
| 24 | - @Schema(description = "是否有效", example = "true") | |
| 25 | - private Boolean enabled; | |
| 26 | - | |
| 27 | - @Schema(description = "创建时间") | |
| 28 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 29 | - private LocalDateTime[] createTime; | |
| 30 | - | |
| 31 | -} | |
| 32 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import lombok.Data; | |
| 6 | -import lombok.EqualsAndHashCode; | |
| 7 | -import lombok.ToString; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | - | |
| 14 | -@Schema(description = "管理后台 - 学生分页 Request VO") | |
| 15 | -@Data | |
| 16 | -@EqualsAndHashCode(callSuper = true) | |
| 17 | -@ToString(callSuper = true) | |
| 18 | -public class InfraDemo01StudentPageReqVO extends PageParam { | |
| 19 | - | |
| 20 | - @Schema(description = "名字", example = "芋头") | |
| 21 | - private String name; | |
| 22 | - | |
| 23 | - @Schema(description = "出生日期") | |
| 24 | - private LocalDateTime birthday; | |
| 25 | - | |
| 26 | - @Schema(description = "性别", example = "1") | |
| 27 | - private Integer sex; | |
| 28 | - | |
| 29 | - @Schema(description = "是否有效", example = "true") | |
| 30 | - private Boolean enabled; | |
| 31 | - | |
| 32 | - @Schema(description = "创建时间") | |
| 33 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 34 | - private LocalDateTime[] createTime; | |
| 35 | - | |
| 36 | -} | |
| 37 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | - | |
| 7 | -@Schema(description = "管理后台 - 学生 Response VO") | |
| 8 | -@Data | |
| 9 | -@EqualsAndHashCode(callSuper = true) | |
| 10 | -@ToString(callSuper = true) | |
| 11 | -public class InfraDemo01StudentRespVO extends InfraDemo01StudentBaseVO { | |
| 12 | - | |
| 13 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "创建时间") | |
| 17 | - private LocalDateTime createTime; | |
| 18 | - | |
| 19 | -} | |
| 20 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo01/vo/InfraDemo01StudentUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | -import lombok.ToString; | |
| 7 | - | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -@Schema(description = "管理后台 - 学生更新 Request VO") | |
| 11 | -@Data | |
| 12 | -@EqualsAndHashCode(callSuper = true) | |
| 13 | -@ToString(callSuper = true) | |
| 14 | -public class InfraDemo01StudentUpdateReqVO extends InfraDemo01StudentBaseVO { | |
| 15 | - | |
| 16 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 17 | - @NotNull(message = "编号不能为空") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | -} | |
| 21 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/InfraDemoStudentController.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02; | |
| 2 | - | |
| 3 | -import org.springframework.web.bind.annotation.*; | |
| 4 | -import javax.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | -import io.swagger.v3.oas.annotations.Operation; | |
| 10 | - | |
| 11 | -import javax.validation.constraints.*; | |
| 12 | -import javax.validation.*; | |
| 13 | -import javax.servlet.http.*; | |
| 14 | -import java.util.*; | |
| 15 | -import java.io.IOException; | |
| 16 | - | |
| 17 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 18 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 22 | - | |
| 23 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 24 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 25 | - | |
| 26 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*; | |
| 27 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; | |
| 28 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; | |
| 29 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; | |
| 30 | -import cn.iocoder.yudao.module.infra.convert.demo02.InfraDemoStudentConvert; | |
| 31 | -import cn.iocoder.yudao.module.infra.service.demo02.InfraDemoStudentService; | |
| 32 | - | |
| 33 | -@Tag(name = "管理后台 - 学生") | |
| 34 | -@RestController | |
| 35 | -@RequestMapping("/infra/demo-student") | |
| 36 | -@Validated | |
| 37 | -public class InfraDemoStudentController { | |
| 38 | - | |
| 39 | - @Resource | |
| 40 | - private InfraDemoStudentService demoStudentService; | |
| 41 | - | |
| 42 | - @PostMapping("/create") | |
| 43 | - @Operation(summary = "创建学生") | |
| 44 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:create')") | |
| 45 | - public CommonResult<Long> createDemoStudent(@Valid @RequestBody InfraDemoStudentCreateReqVO createReqVO) { | |
| 46 | - return success(demoStudentService.createDemoStudent(createReqVO)); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @PutMapping("/update") | |
| 50 | - @Operation(summary = "更新学生") | |
| 51 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:update')") | |
| 52 | - public CommonResult<Boolean> updateDemoStudent(@Valid @RequestBody InfraDemoStudentUpdateReqVO updateReqVO) { | |
| 53 | - demoStudentService.updateDemoStudent(updateReqVO); | |
| 54 | - return success(true); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @DeleteMapping("/delete") | |
| 58 | - @Operation(summary = "删除学生") | |
| 59 | - @Parameter(name = "id", description = "编号", required = true) | |
| 60 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:delete')") | |
| 61 | - public CommonResult<Boolean> deleteDemoStudent(@RequestParam("id") Long id) { | |
| 62 | - demoStudentService.deleteDemoStudent(id); | |
| 63 | - return success(true); | |
| 64 | - } | |
| 65 | - | |
| 66 | - @GetMapping("/get") | |
| 67 | - @Operation(summary = "获得学生") | |
| 68 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 69 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") | |
| 70 | - public CommonResult<InfraDemoStudentRespVO> getDemoStudent(@RequestParam("id") Long id) { | |
| 71 | - InfraDemoStudentDO demoStudent = demoStudentService.getDemoStudent(id); | |
| 72 | - return success(InfraDemoStudentConvert.INSTANCE.convert(demoStudent)); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @GetMapping("/page") | |
| 76 | - @Operation(summary = "获得学生分页") | |
| 77 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") | |
| 78 | - public CommonResult<PageResult<InfraDemoStudentRespVO>> getDemoStudentPage(@Valid InfraDemoStudentPageReqVO pageVO) { | |
| 79 | - PageResult<InfraDemoStudentDO> pageResult = demoStudentService.getDemoStudentPage(pageVO); | |
| 80 | - return success(InfraDemoStudentConvert.INSTANCE.convertPage(pageResult)); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @GetMapping("/export-excel") | |
| 84 | - @Operation(summary = "导出学生 Excel") | |
| 85 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:export')") | |
| 86 | - @OperateLog(type = EXPORT) | |
| 87 | - public void exportDemoStudentExcel(@Valid InfraDemoStudentExportReqVO exportReqVO, | |
| 88 | - HttpServletResponse response) throws IOException { | |
| 89 | - List<InfraDemoStudentDO> list = demoStudentService.getDemoStudentList(exportReqVO); | |
| 90 | - // 导出 Excel | |
| 91 | - List<InfraDemoStudentExcelVO> datas = InfraDemoStudentConvert.INSTANCE.convertList02(list); | |
| 92 | - ExcelUtils.write(response, "学生.xls", "数据", InfraDemoStudentExcelVO.class, datas); | |
| 93 | - } | |
| 94 | - | |
| 95 | - // ==================== 子表(学生联系人) ==================== | |
| 96 | - | |
| 97 | - @GetMapping("/demo-student/list-by-student-id") | |
| 98 | - @Operation(summary = "获得学生联系人列表") | |
| 99 | - @Parameter(name = "studentId", description = "学生编号") | |
| 100 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") | |
| 101 | - public CommonResult<List<InfraDemoStudentContactDO>> getDemoStudentContactListByStudentId(@RequestParam("studentId") Long studentId) { | |
| 102 | - return success(demoStudentService.getDemoStudentContactListByStudentId(studentId)); | |
| 103 | - } | |
| 104 | - | |
| 105 | - // ==================== 子表(学生地址) ==================== | |
| 106 | - | |
| 107 | - @GetMapping("/demo-student/get-by-student-id") | |
| 108 | - @Operation(summary = "获得学生地址") | |
| 109 | - @Parameter(name = "studentId", description = "学生编号") | |
| 110 | - @PreAuthorize("@ss.hasPermission('infra:demo-student:query')") | |
| 111 | - public CommonResult<InfraDemoStudentAddressDO> getDemoStudentAddressByStudentId(@RequestParam("studentId") Long studentId) { | |
| 112 | - return success(demoStudentService.getDemoStudentAddressByStudentId(studentId)); | |
| 113 | - } | |
| 114 | - | |
| 115 | -} | |
| 116 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/package-info.java deleted
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 12 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 13 | - */ | |
| 14 | -@Data | |
| 15 | -public class InfraDemoStudentBaseVO { | |
| 16 | - | |
| 17 | - private List<InfraDemoStudentContactDO> demoStudentContacts; | |
| 18 | - | |
| 19 | - private InfraDemoStudentAddressDO demoStudentAddress; | |
| 20 | - | |
| 21 | -} | |
| 22 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生创建 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemoStudentCreateReqVO extends InfraDemoStudentBaseVO { | |
| 13 | - | |
| 14 | -} | |
| 15 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 学生 Excel VO | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@Data | |
| 15 | -public class InfraDemoStudentExcelVO { | |
| 16 | - | |
| 17 | - @ExcelProperty("编号") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | -} | |
| 21 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemoStudentPageReqVO 是一致的") | |
| 9 | -@Data | |
| 10 | -public class InfraDemoStudentExportReqVO { | |
| 11 | - | |
| 12 | -} | |
| 13 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生分页 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemoStudentPageReqVO extends PageParam { | |
| 13 | - | |
| 14 | -} | |
| 15 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | - | |
| 6 | -@Schema(description = "管理后台 - 学生 Response VO") | |
| 7 | -@Data | |
| 8 | -@EqualsAndHashCode(callSuper = true) | |
| 9 | -@ToString(callSuper = true) | |
| 10 | -public class InfraDemoStudentRespVO extends InfraDemoStudentBaseVO { | |
| 11 | - | |
| 12 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 13 | - private Long id; | |
| 14 | - | |
| 15 | -} | |
| 16 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo02/vo/InfraDemoStudentUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生更新 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemoStudentUpdateReqVO extends InfraDemoStudentBaseVO { | |
| 13 | - | |
| 14 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 15 | - @NotNull(message = "编号不能为空") | |
| 16 | - private Long id; | |
| 17 | - | |
| 18 | -} | |
| 19 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/InfraDemo11StudentController.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11; | |
| 2 | - | |
| 3 | -import org.springframework.web.bind.annotation.*; | |
| 4 | -import javax.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | -import io.swagger.v3.oas.annotations.Operation; | |
| 10 | - | |
| 11 | -import javax.validation.constraints.*; | |
| 12 | -import javax.validation.*; | |
| 13 | -import javax.servlet.http.*; | |
| 14 | -import java.util.*; | |
| 15 | -import java.io.IOException; | |
| 16 | - | |
| 17 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 18 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 22 | - | |
| 23 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 24 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 25 | - | |
| 26 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; | |
| 27 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; | |
| 28 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; | |
| 29 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; | |
| 30 | -import cn.iocoder.yudao.module.infra.convert.demo11.InfraDemo11StudentConvert; | |
| 31 | -import cn.iocoder.yudao.module.infra.service.demo11.InfraDemo11StudentService; | |
| 32 | - | |
| 33 | -@Tag(name = "管理后台 - 学生") | |
| 34 | -@RestController | |
| 35 | -@RequestMapping("/infra/demo11-student") | |
| 36 | -@Validated | |
| 37 | -public class InfraDemo11StudentController { | |
| 38 | - | |
| 39 | - @Resource | |
| 40 | - private InfraDemo11StudentService demo11StudentService; | |
| 41 | - | |
| 42 | - @PostMapping("/create") | |
| 43 | - @Operation(summary = "创建学生") | |
| 44 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:create')") | |
| 45 | - public CommonResult<Long> createDemo11Student(@Valid @RequestBody InfraDemo11StudentCreateReqVO createReqVO) { | |
| 46 | - return success(demo11StudentService.createDemo11Student(createReqVO)); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @PutMapping("/update") | |
| 50 | - @Operation(summary = "更新学生") | |
| 51 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:update')") | |
| 52 | - public CommonResult<Boolean> updateDemo11Student(@Valid @RequestBody InfraDemo11StudentUpdateReqVO updateReqVO) { | |
| 53 | - demo11StudentService.updateDemo11Student(updateReqVO); | |
| 54 | - return success(true); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @DeleteMapping("/delete") | |
| 58 | - @Operation(summary = "删除学生") | |
| 59 | - @Parameter(name = "id", description = "编号", required = true) | |
| 60 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:delete')") | |
| 61 | - public CommonResult<Boolean> deleteDemo11Student(@RequestParam("id") Long id) { | |
| 62 | - demo11StudentService.deleteDemo11Student(id); | |
| 63 | - return success(true); | |
| 64 | - } | |
| 65 | - | |
| 66 | - @GetMapping("/get") | |
| 67 | - @Operation(summary = "获得学生") | |
| 68 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 69 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") | |
| 70 | - public CommonResult<InfraDemo11StudentRespVO> getDemo11Student(@RequestParam("id") Long id) { | |
| 71 | - InfraDemo11StudentDO demo11Student = demo11StudentService.getDemo11Student(id); | |
| 72 | - return success(InfraDemo11StudentConvert.INSTANCE.convert(demo11Student)); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @GetMapping("/page") | |
| 76 | - @Operation(summary = "获得学生分页") | |
| 77 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") | |
| 78 | - public CommonResult<PageResult<InfraDemo11StudentRespVO>> getDemo11StudentPage(@Valid InfraDemo11StudentPageReqVO pageVO) { | |
| 79 | - PageResult<InfraDemo11StudentDO> pageResult = demo11StudentService.getDemo11StudentPage(pageVO); | |
| 80 | - return success(InfraDemo11StudentConvert.INSTANCE.convertPage(pageResult)); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @GetMapping("/export-excel") | |
| 84 | - @Operation(summary = "导出学生 Excel") | |
| 85 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:export')") | |
| 86 | - @OperateLog(type = EXPORT) | |
| 87 | - public void exportDemo11StudentExcel(@Valid InfraDemo11StudentExportReqVO exportReqVO, | |
| 88 | - HttpServletResponse response) throws IOException { | |
| 89 | - List<InfraDemo11StudentDO> list = demo11StudentService.getDemo11StudentList(exportReqVO); | |
| 90 | - // 导出 Excel | |
| 91 | - List<InfraDemo11StudentExcelVO> datas = InfraDemo11StudentConvert.INSTANCE.convertList02(list); | |
| 92 | - ExcelUtils.write(response, "学生.xls", "数据", InfraDemo11StudentExcelVO.class, datas); | |
| 93 | - } | |
| 94 | - | |
| 95 | - // ==================== 子表(学生联系人) ==================== | |
| 96 | - | |
| 97 | - @GetMapping("/demo11-student/list-by-student-id") | |
| 98 | - @Operation(summary = "获得学生联系人列表") | |
| 99 | - @Parameter(name = "studentId", description = "学生编号") | |
| 100 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") | |
| 101 | - public CommonResult<List<InfraDemo11StudentContactDO>> getDemo11StudentContactListByStudentId(@RequestParam("studentId") Long studentId) { | |
| 102 | - return success(demo11StudentService.getDemo11StudentContactListByStudentId(studentId)); | |
| 103 | - } | |
| 104 | - | |
| 105 | - // ==================== 子表(学生班主任) ==================== | |
| 106 | - | |
| 107 | - @GetMapping("/demo11-student/get-by-student-id") | |
| 108 | - @Operation(summary = "获得学生班主任") | |
| 109 | - @Parameter(name = "studentId", description = "学生编号") | |
| 110 | - @PreAuthorize("@ss.hasPermission('infra:demo11-student:query')") | |
| 111 | - public CommonResult<InfraDemo11StudentTeacherDO> getDemo11StudentTeacherByStudentId(@RequestParam("studentId") Long studentId) { | |
| 112 | - return success(demo11StudentService.getDemo11StudentTeacherByStudentId(studentId)); | |
| 113 | - } | |
| 114 | - | |
| 115 | -} | |
| 116 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/package-info.java deleted
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import javax.validation.constraints.*; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; | |
| 12 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 16 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 17 | - */ | |
| 18 | -@Data | |
| 19 | -public class InfraDemo11StudentBaseVO { | |
| 20 | - | |
| 21 | - @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头") | |
| 22 | - @NotEmpty(message = "名字不能为空") | |
| 23 | - private String name; | |
| 24 | - | |
| 25 | - @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍") | |
| 26 | - @NotEmpty(message = "简介不能为空") | |
| 27 | - private String description; | |
| 28 | - | |
| 29 | - @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 30 | - @NotNull(message = "出生日期不能为空") | |
| 31 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 32 | - private LocalDateTime birthday; | |
| 33 | - | |
| 34 | - @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 35 | - @NotNull(message = "性别不能为空") | |
| 36 | - private Integer sex; | |
| 37 | - | |
| 38 | - @Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 39 | - @NotNull(message = "是否有效不能为空") | |
| 40 | - private Boolean enabled; | |
| 41 | - | |
| 42 | - @Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") | |
| 43 | - @NotEmpty(message = "头像不能为空") | |
| 44 | - private String avatar; | |
| 45 | - | |
| 46 | - @Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4") | |
| 47 | - private String video; | |
| 48 | - | |
| 49 | - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注") | |
| 50 | - @NotEmpty(message = "备注不能为空") | |
| 51 | - private String memo; | |
| 52 | - | |
| 53 | - private List<InfraDemo11StudentContactDO> demo11StudentContacts; | |
| 54 | - | |
| 55 | - private InfraDemo11StudentTeacherDO demo11StudentTeacher; | |
| 56 | - | |
| 57 | -} | |
| 58 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生创建 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemo11StudentCreateReqVO extends InfraDemo11StudentBaseVO { | |
| 13 | - | |
| 14 | -} | |
| 15 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | - | |
| 8 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 9 | -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 10 | -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 11 | - | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 学生 Excel VO | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -@Data | |
| 19 | -public class InfraDemo11StudentExcelVO { | |
| 20 | - | |
| 21 | - @ExcelProperty("编号") | |
| 22 | - private Long id; | |
| 23 | - | |
| 24 | - @ExcelProperty("名字") | |
| 25 | - private String name; | |
| 26 | - | |
| 27 | - @ExcelProperty("简介") | |
| 28 | - private String description; | |
| 29 | - | |
| 30 | - @ExcelProperty("出生日期") | |
| 31 | - private LocalDateTime birthday; | |
| 32 | - | |
| 33 | - @ExcelProperty(value = "性别", converter = DictConvert.class) | |
| 34 | - @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 35 | - private Integer sex; | |
| 36 | - | |
| 37 | - @ExcelProperty(value = "是否有效", converter = DictConvert.class) | |
| 38 | - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 39 | - private Boolean enabled; | |
| 40 | - | |
| 41 | - @ExcelProperty("头像") | |
| 42 | - private String avatar; | |
| 43 | - | |
| 44 | - @ExcelProperty("附件") | |
| 45 | - private String video; | |
| 46 | - | |
| 47 | - @ExcelProperty("备注") | |
| 48 | - private String memo; | |
| 49 | - | |
| 50 | - @ExcelProperty("创建时间") | |
| 51 | - private LocalDateTime createTime; | |
| 52 | - | |
| 53 | -} | |
| 54 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | - | |
| 12 | -@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo11StudentPageReqVO 是一致的") | |
| 13 | -@Data | |
| 14 | -public class InfraDemo11StudentExportReqVO { | |
| 15 | - | |
| 16 | - @Schema(description = "名字", example = "芋头") | |
| 17 | - private String name; | |
| 18 | - | |
| 19 | - @Schema(description = "出生日期") | |
| 20 | - private LocalDateTime birthday; | |
| 21 | - | |
| 22 | - @Schema(description = "性别", example = "1") | |
| 23 | - private Integer sex; | |
| 24 | - | |
| 25 | - @Schema(description = "是否有效", example = "true") | |
| 26 | - private Boolean enabled; | |
| 27 | - | |
| 28 | - @Schema(description = "创建时间") | |
| 29 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 30 | - private LocalDateTime[] createTime; | |
| 31 | - | |
| 32 | -} | |
| 33 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | -import java.time.LocalDateTime; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | - | |
| 12 | -@Schema(description = "管理后台 - 学生分页 Request VO") | |
| 13 | -@Data | |
| 14 | -@EqualsAndHashCode(callSuper = true) | |
| 15 | -@ToString(callSuper = true) | |
| 16 | -public class InfraDemo11StudentPageReqVO extends PageParam { | |
| 17 | - | |
| 18 | - @Schema(description = "名字", example = "芋头") | |
| 19 | - private String name; | |
| 20 | - | |
| 21 | - @Schema(description = "出生日期") | |
| 22 | - private LocalDateTime birthday; | |
| 23 | - | |
| 24 | - @Schema(description = "性别", example = "1") | |
| 25 | - private Integer sex; | |
| 26 | - | |
| 27 | - @Schema(description = "是否有效", example = "true") | |
| 28 | - private Boolean enabled; | |
| 29 | - | |
| 30 | - @Schema(description = "创建时间") | |
| 31 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 32 | - private LocalDateTime[] createTime; | |
| 33 | - | |
| 34 | -} | |
| 35 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | - | |
| 7 | -@Schema(description = "管理后台 - 学生 Response VO") | |
| 8 | -@Data | |
| 9 | -@EqualsAndHashCode(callSuper = true) | |
| 10 | -@ToString(callSuper = true) | |
| 11 | -public class InfraDemo11StudentRespVO extends InfraDemo11StudentBaseVO { | |
| 12 | - | |
| 13 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "创建时间") | |
| 17 | - private LocalDateTime createTime; | |
| 18 | - | |
| 19 | -} | |
| 20 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo11/vo/InfraDemo11StudentUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生更新 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemo11StudentUpdateReqVO extends InfraDemo11StudentBaseVO { | |
| 13 | - | |
| 14 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 15 | - @NotNull(message = "编号不能为空") | |
| 16 | - private Long id; | |
| 17 | - | |
| 18 | -} | |
| 19 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 7 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 8 | -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; | |
| 9 | -import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; | |
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; | |
| 12 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; | |
| 13 | -import cn.iocoder.yudao.module.infra.service.demo12.InfraDemo12StudentService; | |
| 14 | -import io.swagger.v3.oas.annotations.Operation; | |
| 15 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 16 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 17 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 18 | -import org.springframework.validation.annotation.Validated; | |
| 19 | -import org.springframework.web.bind.annotation.*; | |
| 20 | - | |
| 21 | -import javax.annotation.Resource; | |
| 22 | -import javax.servlet.http.HttpServletResponse; | |
| 23 | -import javax.validation.Valid; | |
| 24 | -import java.io.IOException; | |
| 25 | -import java.util.List; | |
| 26 | - | |
| 27 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 28 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 29 | - | |
| 30 | -@Tag(name = "管理后台 - 学生") | |
| 31 | -@RestController | |
| 32 | -@RequestMapping("/infra/demo12-student") | |
| 33 | -@Validated | |
| 34 | -public class InfraDemo12StudentController { | |
| 35 | - | |
| 36 | - @Resource | |
| 37 | - private InfraDemo12StudentService demo12StudentService; | |
| 38 | - | |
| 39 | - @PostMapping("/create") | |
| 40 | - @Operation(summary = "创建学生") | |
| 41 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:create')") | |
| 42 | - public CommonResult<Long> createDemo12Student(@Valid @RequestBody InfraDemo12StudentCreateReqVO createReqVO) { | |
| 43 | - return success(demo12StudentService.createDemo12Student(createReqVO)); | |
| 44 | - } | |
| 45 | - | |
| 46 | - @PutMapping("/update") | |
| 47 | - @Operation(summary = "更新学生") | |
| 48 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:update')") | |
| 49 | - public CommonResult<Boolean> updateDemo12Student(@Valid @RequestBody InfraDemo12StudentUpdateReqVO updateReqVO) { | |
| 50 | - demo12StudentService.updateDemo12Student(updateReqVO); | |
| 51 | - return success(true); | |
| 52 | - } | |
| 53 | - | |
| 54 | - @DeleteMapping("/delete") | |
| 55 | - @Operation(summary = "删除学生") | |
| 56 | - @Parameter(name = "id", description = "编号", required = true) | |
| 57 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')") | |
| 58 | - public CommonResult<Boolean> deleteDemo12Student(@RequestParam("id") Long id) { | |
| 59 | - demo12StudentService.deleteDemo12Student(id); | |
| 60 | - return success(true); | |
| 61 | - } | |
| 62 | - | |
| 63 | - @GetMapping("/get") | |
| 64 | - @Operation(summary = "获得学生") | |
| 65 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 66 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") | |
| 67 | - public CommonResult<InfraDemo12StudentRespVO> getDemo12Student(@RequestParam("id") Long id) { | |
| 68 | - InfraDemo12StudentDO demo12Student = demo12StudentService.getDemo12Student(id); | |
| 69 | - return success(InfraDemo12StudentConvert.INSTANCE.convert(demo12Student)); | |
| 70 | - } | |
| 71 | - | |
| 72 | - @GetMapping("/page") | |
| 73 | - @Operation(summary = "获得学生分页") | |
| 74 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") | |
| 75 | - public CommonResult<PageResult<InfraDemo12StudentRespVO>> getDemo12StudentPage(@Valid InfraDemo12StudentPageReqVO pageVO) { | |
| 76 | - PageResult<InfraDemo12StudentDO> pageResult = demo12StudentService.getDemo12StudentPage(pageVO); | |
| 77 | - return success(InfraDemo12StudentConvert.INSTANCE.convertPage(pageResult)); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @GetMapping("/export-excel") | |
| 81 | - @Operation(summary = "导出学生 Excel") | |
| 82 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:export')") | |
| 83 | - @OperateLog(type = EXPORT) | |
| 84 | - public void exportDemo12StudentExcel(@Valid InfraDemo12StudentExportReqVO exportReqVO, | |
| 85 | - HttpServletResponse response) throws IOException { | |
| 86 | - List<InfraDemo12StudentDO> list = demo12StudentService.getDemo12StudentList(exportReqVO); | |
| 87 | - // 导出 Excel | |
| 88 | - List<InfraDemo12StudentExcelVO> datas = InfraDemo12StudentConvert.INSTANCE.convertList02(list); | |
| 89 | - ExcelUtils.write(response, "学生.xls", "数据", InfraDemo12StudentExcelVO.class, datas); | |
| 90 | - } | |
| 91 | - | |
| 92 | - // ==================== 子表(学生联系人) ==================== | |
| 93 | - | |
| 94 | - @GetMapping("/demo12-student-contact/page") | |
| 95 | - @Operation(summary = "获得学生联系人分页") | |
| 96 | - @Parameter(name = "studentId", description = "学生编号") | |
| 97 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") | |
| 98 | - public CommonResult<PageResult<InfraDemo12StudentContactDO>> getDemo12StudentContactPage(PageParam pageReqVO, | |
| 99 | - @RequestParam("studentId") Long studentId) { | |
| 100 | - return success(demo12StudentService.getDemo12StudentContactPage(pageReqVO, studentId)); | |
| 101 | - } | |
| 102 | - | |
| 103 | - @PostMapping("/demo12-student-contact/create") | |
| 104 | - @Operation(summary = "创建学生联系人") | |
| 105 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:create')") | |
| 106 | - public CommonResult<Long> createDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) { | |
| 107 | - return success(demo12StudentService.createDemo12StudentContact(demo12StudentContact)); | |
| 108 | - } | |
| 109 | - | |
| 110 | - @PutMapping("/demo12-student-contact/update") | |
| 111 | - @Operation(summary = "更新学生联系人") | |
| 112 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:update')") | |
| 113 | - public CommonResult<Boolean> updateDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) { | |
| 114 | - demo12StudentService.updateDemo12StudentContact(demo12StudentContact); | |
| 115 | - return success(true); | |
| 116 | - } | |
| 117 | - | |
| 118 | - @DeleteMapping("/demo12-student-contact/delete") | |
| 119 | - @Parameter(name = "id", description = "编号", required = true) | |
| 120 | - @Operation(summary = "删除学生联系人") | |
| 121 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')") | |
| 122 | - public CommonResult<Boolean> deleteDemo12StudentContact(@RequestParam("id") Long id) { | |
| 123 | - demo12StudentService.deleteDemo12StudentContact(id); | |
| 124 | - return success(true); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @GetMapping("/demo12-student-contact/get") | |
| 128 | - @Operation(summary = "获得学生联系人") | |
| 129 | - @Parameter(name = "id", description = "编号", required = true) | |
| 130 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") | |
| 131 | - public CommonResult<InfraDemo12StudentContactDO> getDemo12StudentContact(@RequestParam("id") Long id) { | |
| 132 | - return success(demo12StudentService.getDemo12StudentContact(id)); | |
| 133 | - } | |
| 134 | - | |
| 135 | - // ==================== 子表(学生班主任) ==================== | |
| 136 | - | |
| 137 | - @GetMapping("/demo12-student-teacher/page") | |
| 138 | - @Operation(summary = "获得学生班主任分页") | |
| 139 | - @Parameter(name = "studentId", description = "学生编号") | |
| 140 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") | |
| 141 | - public CommonResult<PageResult<InfraDemo12StudentTeacherDO>> getDemo12StudentTeacherPage(PageParam pageReqVO, | |
| 142 | - @RequestParam("studentId") Long studentId) { | |
| 143 | - return success(demo12StudentService.getDemo12StudentTeacherPage(pageReqVO, studentId)); | |
| 144 | - } | |
| 145 | - | |
| 146 | - @PostMapping("/demo12-student-teacher/create") | |
| 147 | - @Operation(summary = "创建学生班主任") | |
| 148 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:create')") | |
| 149 | - public CommonResult<Long> createDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) { | |
| 150 | - return success(demo12StudentService.createDemo12StudentTeacher(demo12StudentTeacher)); | |
| 151 | - } | |
| 152 | - | |
| 153 | - @PutMapping("/demo12-student-teacher/update") | |
| 154 | - @Operation(summary = "更新学生班主任") | |
| 155 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:update')") | |
| 156 | - public CommonResult<Boolean> updateDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) { | |
| 157 | - demo12StudentService.updateDemo12StudentTeacher(demo12StudentTeacher); | |
| 158 | - return success(true); | |
| 159 | - } | |
| 160 | - | |
| 161 | - @DeleteMapping("/demo12-student-teacher/delete") | |
| 162 | - @Parameter(name = "id", description = "编号", required = true) | |
| 163 | - @Operation(summary = "删除学生班主任") | |
| 164 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')") | |
| 165 | - public CommonResult<Boolean> deleteDemo12StudentTeacher(@RequestParam("id") Long id) { | |
| 166 | - demo12StudentService.deleteDemo12StudentTeacher(id); | |
| 167 | - return success(true); | |
| 168 | - } | |
| 169 | - | |
| 170 | - @GetMapping("/demo12-student-teacher/get") | |
| 171 | - @Operation(summary = "获得学生班主任") | |
| 172 | - @Parameter(name = "id", description = "编号", required = true) | |
| 173 | - @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") | |
| 174 | - public CommonResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacher(@RequestParam("id") Long id) { | |
| 175 | - return success(demo12StudentService.getDemo12StudentTeacher(id)); | |
| 176 | - } | |
| 177 | - | |
| 178 | -} | |
| 179 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import javax.validation.constraints.*; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; | |
| 12 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 学生 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 16 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 17 | - */ | |
| 18 | -@Data | |
| 19 | -public class InfraDemo12StudentBaseVO { | |
| 20 | - | |
| 21 | - @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头") | |
| 22 | - @NotEmpty(message = "名字不能为空") | |
| 23 | - private String name; | |
| 24 | - | |
| 25 | - @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍") | |
| 26 | - @NotEmpty(message = "简介不能为空") | |
| 27 | - private String description; | |
| 28 | - | |
| 29 | - @Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 30 | - @NotNull(message = "出生日期不能为空") | |
| 31 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 32 | - private LocalDateTime birthday; | |
| 33 | - | |
| 34 | - @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 35 | - @NotNull(message = "性别不能为空") | |
| 36 | - private Integer sex; | |
| 37 | - | |
| 38 | - @Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 39 | - @NotNull(message = "是否有效不能为空") | |
| 40 | - private Boolean enabled; | |
| 41 | - | |
| 42 | - @Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") | |
| 43 | - @NotEmpty(message = "头像不能为空") | |
| 44 | - private String avatar; | |
| 45 | - | |
| 46 | - @Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4") | |
| 47 | - private String video; | |
| 48 | - | |
| 49 | - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注") | |
| 50 | - @NotEmpty(message = "备注不能为空") | |
| 51 | - private String memo; | |
| 52 | - | |
| 53 | -} | |
| 54 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生创建 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemo12StudentCreateReqVO extends InfraDemo12StudentBaseVO { | |
| 13 | - | |
| 14 | -} | |
| 15 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | - | |
| 8 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 9 | -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 10 | -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 11 | - | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 学生 Excel VO | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -@Data | |
| 19 | -public class InfraDemo12StudentExcelVO { | |
| 20 | - | |
| 21 | - @ExcelProperty("编号") | |
| 22 | - private Long id; | |
| 23 | - | |
| 24 | - @ExcelProperty("名字") | |
| 25 | - private String name; | |
| 26 | - | |
| 27 | - @ExcelProperty("简介") | |
| 28 | - private String description; | |
| 29 | - | |
| 30 | - @ExcelProperty("出生日期") | |
| 31 | - private LocalDateTime birthday; | |
| 32 | - | |
| 33 | - @ExcelProperty(value = "性别", converter = DictConvert.class) | |
| 34 | - @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 35 | - private Integer sex; | |
| 36 | - | |
| 37 | - @ExcelProperty(value = "是否有效", converter = DictConvert.class) | |
| 38 | - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 39 | - private Boolean enabled; | |
| 40 | - | |
| 41 | - @ExcelProperty("头像") | |
| 42 | - private String avatar; | |
| 43 | - | |
| 44 | - @ExcelProperty("附件") | |
| 45 | - private String video; | |
| 46 | - | |
| 47 | - @ExcelProperty("备注") | |
| 48 | - private String memo; | |
| 49 | - | |
| 50 | - @ExcelProperty("创建时间") | |
| 51 | - private LocalDateTime createTime; | |
| 52 | - | |
| 53 | -} | |
| 54 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | - | |
| 12 | -@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo12StudentPageReqVO 是一致的") | |
| 13 | -@Data | |
| 14 | -public class InfraDemo12StudentExportReqVO { | |
| 15 | - | |
| 16 | - @Schema(description = "名字", example = "芋头") | |
| 17 | - private String name; | |
| 18 | - | |
| 19 | - @Schema(description = "出生日期") | |
| 20 | - private LocalDateTime birthday; | |
| 21 | - | |
| 22 | - @Schema(description = "性别", example = "1") | |
| 23 | - private Integer sex; | |
| 24 | - | |
| 25 | - @Schema(description = "是否有效", example = "true") | |
| 26 | - private Boolean enabled; | |
| 27 | - | |
| 28 | - @Schema(description = "创建时间") | |
| 29 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 30 | - private LocalDateTime[] createTime; | |
| 31 | - | |
| 32 | -} | |
| 33 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | -import java.time.LocalDateTime; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | - | |
| 12 | -@Schema(description = "管理后台 - 学生分页 Request VO") | |
| 13 | -@Data | |
| 14 | -@EqualsAndHashCode(callSuper = true) | |
| 15 | -@ToString(callSuper = true) | |
| 16 | -public class InfraDemo12StudentPageReqVO extends PageParam { | |
| 17 | - | |
| 18 | - @Schema(description = "名字", example = "芋头") | |
| 19 | - private String name; | |
| 20 | - | |
| 21 | - @Schema(description = "出生日期") | |
| 22 | - private LocalDateTime birthday; | |
| 23 | - | |
| 24 | - @Schema(description = "性别", example = "1") | |
| 25 | - private Integer sex; | |
| 26 | - | |
| 27 | - @Schema(description = "是否有效", example = "true") | |
| 28 | - private Boolean enabled; | |
| 29 | - | |
| 30 | - @Schema(description = "创建时间") | |
| 31 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 32 | - private LocalDateTime[] createTime; | |
| 33 | - | |
| 34 | -} | |
| 35 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | - | |
| 7 | -@Schema(description = "管理后台 - 学生 Response VO") | |
| 8 | -@Data | |
| 9 | -@EqualsAndHashCode(callSuper = true) | |
| 10 | -@ToString(callSuper = true) | |
| 11 | -public class InfraDemo12StudentRespVO extends InfraDemo12StudentBaseVO { | |
| 12 | - | |
| 13 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "创建时间") | |
| 17 | - private LocalDateTime createTime; | |
| 18 | - | |
| 19 | -} | |
| 20 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 学生更新 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class InfraDemo12StudentUpdateReqVO extends InfraDemo12StudentBaseVO { | |
| 13 | - | |
| 14 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 15 | - @NotNull(message = "编号不能为空") | |
| 16 | - private Long id; | |
| 17 | - | |
| 18 | -} | |
| 19 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo01/InfraDemo01StudentConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.demo01; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | - | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生 Convert | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo01StudentConvert { | |
| 19 | - | |
| 20 | - InfraDemo01StudentConvert INSTANCE = Mappers.getMapper(InfraDemo01StudentConvert.class); | |
| 21 | - | |
| 22 | - InfraDemo01StudentDO convert(InfraDemo01StudentCreateReqVO bean); | |
| 23 | - | |
| 24 | - InfraDemo01StudentDO convert(InfraDemo01StudentUpdateReqVO bean); | |
| 25 | - | |
| 26 | - InfraDemo01StudentRespVO convert(InfraDemo01StudentDO bean); | |
| 27 | - | |
| 28 | - List<InfraDemo01StudentRespVO> convertList(List<InfraDemo01StudentDO> list); | |
| 29 | - | |
| 30 | - PageResult<InfraDemo01StudentRespVO> convertPage(PageResult<InfraDemo01StudentDO> page); | |
| 31 | - | |
| 32 | - List<InfraDemo01StudentExcelVO> convertList02(List<InfraDemo01StudentDO> list); | |
| 33 | - | |
| 34 | -} | |
| 35 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo02/InfraDemoStudentConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.demo02; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentExcelVO; | |
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentRespVO; | |
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; | |
| 9 | -import org.mapstruct.Mapper; | |
| 10 | -import org.mapstruct.factory.Mappers; | |
| 11 | - | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 学生 Convert | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -@Mapper | |
| 20 | -public interface InfraDemoStudentConvert { | |
| 21 | - | |
| 22 | - InfraDemoStudentConvert INSTANCE = Mappers.getMapper(InfraDemoStudentConvert.class); | |
| 23 | - | |
| 24 | - InfraDemoStudentDO convert(InfraDemoStudentCreateReqVO bean); | |
| 25 | - | |
| 26 | - InfraDemoStudentDO convert(InfraDemoStudentUpdateReqVO bean); | |
| 27 | - | |
| 28 | - InfraDemoStudentRespVO convert(InfraDemoStudentDO bean); | |
| 29 | - | |
| 30 | - List<InfraDemoStudentRespVO> convertList(List<InfraDemoStudentDO> list); | |
| 31 | - | |
| 32 | - PageResult<InfraDemoStudentRespVO> convertPage(PageResult<InfraDemoStudentDO> page); | |
| 33 | - | |
| 34 | - List<InfraDemoStudentExcelVO> convertList02(List<InfraDemoStudentDO> list); | |
| 35 | - | |
| 36 | -} | |
| 37 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo11/InfraDemo11StudentConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.demo11; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | - | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生 Convert | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo11StudentConvert { | |
| 19 | - | |
| 20 | - InfraDemo11StudentConvert INSTANCE = Mappers.getMapper(InfraDemo11StudentConvert.class); | |
| 21 | - | |
| 22 | - InfraDemo11StudentDO convert(InfraDemo11StudentCreateReqVO bean); | |
| 23 | - | |
| 24 | - InfraDemo11StudentDO convert(InfraDemo11StudentUpdateReqVO bean); | |
| 25 | - | |
| 26 | - InfraDemo11StudentRespVO convert(InfraDemo11StudentDO bean); | |
| 27 | - | |
| 28 | - List<InfraDemo11StudentRespVO> convertList(List<InfraDemo11StudentDO> list); | |
| 29 | - | |
| 30 | - PageResult<InfraDemo11StudentRespVO> convertPage(PageResult<InfraDemo11StudentDO> page); | |
| 31 | - | |
| 32 | - List<InfraDemo11StudentExcelVO> convertList02(List<InfraDemo11StudentDO> list); | |
| 33 | - | |
| 34 | -} | |
| 35 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/demo12/InfraDemo12StudentConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.demo12; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | - | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生 Convert | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo12StudentConvert { | |
| 19 | - | |
| 20 | - InfraDemo12StudentConvert INSTANCE = Mappers.getMapper(InfraDemo12StudentConvert.class); | |
| 21 | - | |
| 22 | - InfraDemo12StudentDO convert(InfraDemo12StudentCreateReqVO bean); | |
| 23 | - | |
| 24 | - InfraDemo12StudentDO convert(InfraDemo12StudentUpdateReqVO bean); | |
| 25 | - | |
| 26 | - InfraDemo12StudentRespVO convert(InfraDemo12StudentDO bean); | |
| 27 | - | |
| 28 | - List<InfraDemo12StudentRespVO> convertList(List<InfraDemo12StudentDO> list); | |
| 29 | - | |
| 30 | - PageResult<InfraDemo12StudentRespVO> convertPage(PageResult<InfraDemo12StudentDO> page); | |
| 31 | - | |
| 32 | - List<InfraDemo12StudentExcelVO> convertList02(List<InfraDemo12StudentDO> list); | |
| 33 | - | |
| 34 | -} | |
| 35 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo01/InfraDemo01StudentMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo01; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo01StudentMapper extends BaseMapperX<InfraDemo01StudentDO> { | |
| 19 | - | |
| 20 | - default PageResult<InfraDemo01StudentDO> selectPage(InfraDemo01StudentPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo01StudentDO>() | |
| 22 | - .likeIfPresent(InfraDemo01StudentDO::getName, reqVO.getName()) | |
| 23 | - .eqIfPresent(InfraDemo01StudentDO::getBirthday, reqVO.getBirthday()) | |
| 24 | - .eqIfPresent(InfraDemo01StudentDO::getSex, reqVO.getSex()) | |
| 25 | - .eqIfPresent(InfraDemo01StudentDO::getEnabled, reqVO.getEnabled()) | |
| 26 | - .betweenIfPresent(InfraDemo01StudentDO::getCreateTime, reqVO.getCreateTime()) | |
| 27 | - .orderByDesc(InfraDemo01StudentDO::getId)); | |
| 28 | - } | |
| 29 | - | |
| 30 | - default List<InfraDemo01StudentDO> selectList(InfraDemo01StudentExportReqVO reqVO) { | |
| 31 | - return selectList(new LambdaQueryWrapperX<InfraDemo01StudentDO>() | |
| 32 | - .likeIfPresent(InfraDemo01StudentDO::getName, reqVO.getName()) | |
| 33 | - .eqIfPresent(InfraDemo01StudentDO::getBirthday, reqVO.getBirthday()) | |
| 34 | - .eqIfPresent(InfraDemo01StudentDO::getSex, reqVO.getSex()) | |
| 35 | - .eqIfPresent(InfraDemo01StudentDO::getEnabled, reqVO.getEnabled()) | |
| 36 | - .betweenIfPresent(InfraDemo01StudentDO::getCreateTime, reqVO.getCreateTime()) | |
| 37 | - .orderByDesc(InfraDemo01StudentDO::getId)); | |
| 38 | - } | |
| 39 | - | |
| 40 | -} | |
| 41 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentAddressMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo02; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 6 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; | |
| 7 | -import org.apache.ibatis.annotations.Mapper; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 学生地址 Mapper | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@Mapper | |
| 15 | -public interface InfraDemoStudentAddressMapper extends BaseMapperX<InfraDemoStudentAddressDO> { | |
| 16 | - | |
| 17 | - default InfraDemoStudentAddressDO selectByStudentId(Long studentId) { | |
| 18 | - return selectOne(InfraDemoStudentAddressDO::getStudentId, studentId); | |
| 19 | - } | |
| 20 | - | |
| 21 | - default List<InfraDemoStudentAddressDO> selectListByStudentId(List<Long> studentIds) { | |
| 22 | - return selectList(InfraDemoStudentAddressDO::getStudentId, studentIds); | |
| 23 | - } | |
| 24 | - | |
| 25 | - default int deleteByStudentId(Long studentId) { | |
| 26 | - return delete(InfraDemoStudentAddressDO::getStudentId, studentId); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} | |
| 30 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentContactMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo02; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; | |
| 6 | -import org.apache.ibatis.annotations.Mapper; | |
| 7 | - | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 学生联系人 Mapper | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -@Mapper | |
| 16 | -public interface InfraDemoStudentContactMapper extends BaseMapperX<InfraDemoStudentContactDO> { | |
| 17 | - | |
| 18 | - default List<InfraDemoStudentContactDO> selectListByStudentId(Long studentId) { | |
| 19 | - return selectList(InfraDemoStudentContactDO::getStudentId, studentId); | |
| 20 | - } | |
| 21 | - | |
| 22 | - default List<InfraDemoStudentContactDO> selectListByStudentId(List<Long> studentIds) { | |
| 23 | - return selectList(InfraDemoStudentContactDO::getStudentId, studentIds); | |
| 24 | - } | |
| 25 | - | |
| 26 | - default int deleteByStudentId(Long studentId) { | |
| 27 | - return delete(InfraDemoStudentContactDO::getStudentId, studentId); | |
| 28 | - } | |
| 29 | - | |
| 30 | -} | |
| 31 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo02/InfraDemoStudentMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo02; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentExportReqVO; | |
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | - | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 学生 Mapper | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -@Mapper | |
| 19 | -public interface InfraDemoStudentMapper extends BaseMapperX<InfraDemoStudentDO> { | |
| 20 | - | |
| 21 | - default PageResult<InfraDemoStudentDO> selectPage(InfraDemoStudentPageReqVO reqVO) { | |
| 22 | - return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemoStudentDO>() | |
| 23 | - .orderByDesc(InfraDemoStudentDO::getId)); | |
| 24 | - } | |
| 25 | - | |
| 26 | - default List<InfraDemoStudentDO> selectList(InfraDemoStudentExportReqVO reqVO) { | |
| 27 | - return selectList(new LambdaQueryWrapperX<InfraDemoStudentDO>() | |
| 28 | - .orderByDesc(InfraDemoStudentDO::getId)); | |
| 29 | - } | |
| 30 | - | |
| 31 | -} | |
| 32 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentContactMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo11; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 9 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生联系人 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo11StudentContactMapper extends BaseMapperX<InfraDemo11StudentContactDO> { | |
| 19 | - | |
| 20 | - default List<InfraDemo11StudentContactDO> selectListByStudentId(Long studentId) { | |
| 21 | - return selectList(InfraDemo11StudentContactDO::getStudentId, studentId); | |
| 22 | - } | |
| 23 | - | |
| 24 | - default int deleteByStudentId(Long studentId) { | |
| 25 | - return delete(InfraDemo11StudentContactDO::getStudentId, studentId); | |
| 26 | - } | |
| 27 | - | |
| 28 | -} | |
| 29 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo11; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo11StudentMapper extends BaseMapperX<InfraDemo11StudentDO> { | |
| 19 | - | |
| 20 | - default PageResult<InfraDemo11StudentDO> selectPage(InfraDemo11StudentPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo11StudentDO>() | |
| 22 | - .likeIfPresent(InfraDemo11StudentDO::getName, reqVO.getName()) | |
| 23 | - .eqIfPresent(InfraDemo11StudentDO::getBirthday, reqVO.getBirthday()) | |
| 24 | - .eqIfPresent(InfraDemo11StudentDO::getSex, reqVO.getSex()) | |
| 25 | - .eqIfPresent(InfraDemo11StudentDO::getEnabled, reqVO.getEnabled()) | |
| 26 | - .betweenIfPresent(InfraDemo11StudentDO::getCreateTime, reqVO.getCreateTime()) | |
| 27 | - .orderByDesc(InfraDemo11StudentDO::getId)); | |
| 28 | - } | |
| 29 | - | |
| 30 | - default List<InfraDemo11StudentDO> selectList(InfraDemo11StudentExportReqVO reqVO) { | |
| 31 | - return selectList(new LambdaQueryWrapperX<InfraDemo11StudentDO>() | |
| 32 | - .likeIfPresent(InfraDemo11StudentDO::getName, reqVO.getName()) | |
| 33 | - .eqIfPresent(InfraDemo11StudentDO::getBirthday, reqVO.getBirthday()) | |
| 34 | - .eqIfPresent(InfraDemo11StudentDO::getSex, reqVO.getSex()) | |
| 35 | - .eqIfPresent(InfraDemo11StudentDO::getEnabled, reqVO.getEnabled()) | |
| 36 | - .betweenIfPresent(InfraDemo11StudentDO::getCreateTime, reqVO.getCreateTime()) | |
| 37 | - .orderByDesc(InfraDemo11StudentDO::getId)); | |
| 38 | - } | |
| 39 | - | |
| 40 | -} | |
| 41 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo11/InfraDemo11StudentTeacherMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo11; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 9 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生班主任 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo11StudentTeacherMapper extends BaseMapperX<InfraDemo11StudentTeacherDO> { | |
| 19 | - | |
| 20 | - default InfraDemo11StudentTeacherDO selectByStudentId(Long studentId) { | |
| 21 | - return selectOne(InfraDemo11StudentTeacherDO::getStudentId, studentId); | |
| 22 | - } | |
| 23 | - | |
| 24 | - default int deleteByStudentId(Long studentId) { | |
| 25 | - return delete(InfraDemo11StudentTeacherDO::getStudentId, studentId); | |
| 26 | - } | |
| 27 | - | |
| 28 | -} | |
| 29 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo12; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 9 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生联系人 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo12StudentContactMapper extends BaseMapperX<InfraDemo12StudentContactDO> { | |
| 19 | - | |
| 20 | - default PageResult<InfraDemo12StudentContactDO> selectPage(PageParam reqVO, Long studentId) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentContactDO>() | |
| 22 | - .eq(InfraDemo12StudentContactDO::getStudentId, studentId) | |
| 23 | - .orderByDesc(InfraDemo12StudentContactDO::getId)); | |
| 24 | - } | |
| 25 | - | |
| 26 | - default int deleteByStudentId(Long studentId) { | |
| 27 | - return delete(InfraDemo12StudentContactDO::getStudentId, studentId); | |
| 28 | - } | |
| 29 | - | |
| 30 | -} | |
| 31 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo12; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo12StudentMapper extends BaseMapperX<InfraDemo12StudentDO> { | |
| 19 | - | |
| 20 | - default PageResult<InfraDemo12StudentDO> selectPage(InfraDemo12StudentPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentDO>() | |
| 22 | - .likeIfPresent(InfraDemo12StudentDO::getName, reqVO.getName()) | |
| 23 | - .eqIfPresent(InfraDemo12StudentDO::getBirthday, reqVO.getBirthday()) | |
| 24 | - .eqIfPresent(InfraDemo12StudentDO::getSex, reqVO.getSex()) | |
| 25 | - .eqIfPresent(InfraDemo12StudentDO::getEnabled, reqVO.getEnabled()) | |
| 26 | - .betweenIfPresent(InfraDemo12StudentDO::getCreateTime, reqVO.getCreateTime()) | |
| 27 | - .orderByDesc(InfraDemo12StudentDO::getId)); | |
| 28 | - } | |
| 29 | - | |
| 30 | - default List<InfraDemo12StudentDO> selectList(InfraDemo12StudentExportReqVO reqVO) { | |
| 31 | - return selectList(new LambdaQueryWrapperX<InfraDemo12StudentDO>() | |
| 32 | - .likeIfPresent(InfraDemo12StudentDO::getName, reqVO.getName()) | |
| 33 | - .eqIfPresent(InfraDemo12StudentDO::getBirthday, reqVO.getBirthday()) | |
| 34 | - .eqIfPresent(InfraDemo12StudentDO::getSex, reqVO.getSex()) | |
| 35 | - .eqIfPresent(InfraDemo12StudentDO::getEnabled, reqVO.getEnabled()) | |
| 36 | - .betweenIfPresent(InfraDemo12StudentDO::getCreateTime, reqVO.getCreateTime()) | |
| 37 | - .orderByDesc(InfraDemo12StudentDO::getId)); | |
| 38 | - } | |
| 39 | - | |
| 40 | -} | |
| 41 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.demo12; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 9 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生班主任 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface InfraDemo12StudentTeacherMapper extends BaseMapperX<InfraDemo12StudentTeacherDO> { | |
| 19 | - | |
| 20 | - default PageResult<InfraDemo12StudentTeacherDO> selectPage(PageParam reqVO, Long studentId) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentTeacherDO>() | |
| 22 | - .eq(InfraDemo12StudentTeacherDO::getStudentId, studentId) | |
| 23 | - .orderByDesc(InfraDemo12StudentTeacherDO::getId)); | |
| 24 | - } | |
| 25 | - | |
| 26 | - default int deleteByStudentId(Long studentId) { | |
| 27 | - return delete(InfraDemo12StudentTeacherDO::getStudentId, studentId); | |
| 28 | - } | |
| 29 | - | |
| 30 | -} | |
| 31 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentService.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo01; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; | |
| 6 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; | |
| 7 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 学生 Service 接口 | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -public interface InfraDemo01StudentService { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 创建学生 | |
| 18 | - * | |
| 19 | - * @param createReqVO 创建信息 | |
| 20 | - * @return 编号 | |
| 21 | - */ | |
| 22 | - Long createDemo01Student(@Valid InfraDemo01StudentCreateReqVO createReqVO); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 更新学生 | |
| 26 | - * | |
| 27 | - * @param updateReqVO 更新信息 | |
| 28 | - */ | |
| 29 | - void updateDemo01Student(@Valid InfraDemo01StudentUpdateReqVO updateReqVO); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 删除学生 | |
| 33 | - * | |
| 34 | - * @param id 编号 | |
| 35 | - */ | |
| 36 | - void deleteDemo01Student(Long id); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 获得学生 | |
| 40 | - * | |
| 41 | - * @param id 编号 | |
| 42 | - * @return 学生 | |
| 43 | - */ | |
| 44 | - InfraDemo01StudentDO getDemo01Student(Long id); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 获得学生分页 | |
| 48 | - * | |
| 49 | - * @param pageReqVO 分页查询 | |
| 50 | - * @return 学生分页 | |
| 51 | - */ | |
| 52 | - PageResult<InfraDemo01StudentDO> getDemo01StudentPage(InfraDemo01StudentPageReqVO pageReqVO); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 获得学生列表, 用于 Excel 导出 | |
| 56 | - * | |
| 57 | - * @param exportReqVO 查询条件 | |
| 58 | - * @return 学生列表 | |
| 59 | - */ | |
| 60 | - List<InfraDemo01StudentDO> getDemo01StudentList(InfraDemo01StudentExportReqVO exportReqVO); | |
| 61 | - | |
| 62 | -} | |
| 63 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo01/InfraDemo01StudentServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo01; | |
| 2 | - | |
| 3 | -import org.springframework.stereotype.Service; | |
| 4 | -import javax.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.transaction.annotation.Transactional; | |
| 7 | - | |
| 8 | -import java.util.*; | |
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO; | |
| 11 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 12 | - | |
| 13 | -import cn.iocoder.yudao.module.infra.convert.demo01.InfraDemo01StudentConvert; | |
| 14 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo01.InfraDemo01StudentMapper; | |
| 15 | - | |
| 16 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 17 | -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | |
| 18 | - | |
| 19 | -import cn.hutool.core.collection.CollUtil; | |
| 20 | -import cn.hutool.core.collection.ListUtil; | |
| 21 | - | |
| 22 | -/** | |
| 23 | - * 学生 Service 实现类 | |
| 24 | - * | |
| 25 | - * @author 芋道源码 | |
| 26 | - */ | |
| 27 | -@Service | |
| 28 | -@Validated | |
| 29 | -public class InfraDemo01StudentServiceImpl implements InfraDemo01StudentService { | |
| 30 | - | |
| 31 | - @Resource | |
| 32 | - private InfraDemo01StudentMapper demo01StudentMapper; | |
| 33 | - | |
| 34 | - @Override | |
| 35 | - public Long createDemo01Student(InfraDemo01StudentCreateReqVO createReqVO) { | |
| 36 | - // 插入 | |
| 37 | - InfraDemo01StudentDO demo01Student = InfraDemo01StudentConvert.INSTANCE.convert(createReqVO); | |
| 38 | - demo01StudentMapper.insert(demo01Student); | |
| 39 | - // 返回 | |
| 40 | - return demo01Student.getId(); | |
| 41 | - } | |
| 42 | - | |
| 43 | - @Override | |
| 44 | - public void updateDemo01Student(InfraDemo01StudentUpdateReqVO updateReqVO) { | |
| 45 | - // 校验存在 | |
| 46 | - validateDemo01StudentExists(updateReqVO.getId()); | |
| 47 | - // 更新 | |
| 48 | - InfraDemo01StudentDO updateObj = InfraDemo01StudentConvert.INSTANCE.convert(updateReqVO); | |
| 49 | - demo01StudentMapper.updateById(updateObj); | |
| 50 | - } | |
| 51 | - | |
| 52 | - @Override | |
| 53 | - public void deleteDemo01Student(Long id) { | |
| 54 | - // 校验存在 | |
| 55 | - validateDemo01StudentExists(id); | |
| 56 | - // 删除 | |
| 57 | - demo01StudentMapper.deleteById(id); | |
| 58 | - } | |
| 59 | - | |
| 60 | - private void validateDemo01StudentExists(Long id) { | |
| 61 | - if (demo01StudentMapper.selectById(id) == null) { | |
| 62 | - throw exception(DEMO01_STUDENT_NOT_EXISTS); | |
| 63 | - } | |
| 64 | - } | |
| 65 | - | |
| 66 | - @Override | |
| 67 | - public InfraDemo01StudentDO getDemo01Student(Long id) { | |
| 68 | - return demo01StudentMapper.selectById(id); | |
| 69 | - } | |
| 70 | - | |
| 71 | - @Override | |
| 72 | - public PageResult<InfraDemo01StudentDO> getDemo01StudentPage(InfraDemo01StudentPageReqVO pageReqVO) { | |
| 73 | - return demo01StudentMapper.selectPage(pageReqVO); | |
| 74 | - } | |
| 75 | - | |
| 76 | - @Override | |
| 77 | - public List<InfraDemo01StudentDO> getDemo01StudentList(InfraDemo01StudentExportReqVO exportReqVO) { | |
| 78 | - return demo01StudentMapper.selectList(exportReqVO); | |
| 79 | - } | |
| 80 | - | |
| 81 | -} | |
| 82 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentService.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo02; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*; | |
| 6 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; | |
| 7 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; | |
| 9 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 学生 Service 接口 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -public interface InfraDemoStudentService { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 创建学生 | |
| 20 | - * | |
| 21 | - * @param createReqVO 创建信息 | |
| 22 | - * @return 编号 | |
| 23 | - */ | |
| 24 | - Long createDemoStudent(@Valid InfraDemoStudentCreateReqVO createReqVO); | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 更新学生 | |
| 28 | - * | |
| 29 | - * @param updateReqVO 更新信息 | |
| 30 | - */ | |
| 31 | - void updateDemoStudent(@Valid InfraDemoStudentUpdateReqVO updateReqVO); | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 删除学生 | |
| 35 | - * | |
| 36 | - * @param id 编号 | |
| 37 | - */ | |
| 38 | - void deleteDemoStudent(Long id); | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 获得学生 | |
| 42 | - * | |
| 43 | - * @param id 编号 | |
| 44 | - * @return 学生 | |
| 45 | - */ | |
| 46 | - InfraDemoStudentDO getDemoStudent(Long id); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得学生分页 | |
| 50 | - * | |
| 51 | - * @param pageReqVO 分页查询 | |
| 52 | - * @return 学生分页 | |
| 53 | - */ | |
| 54 | - PageResult<InfraDemoStudentDO> getDemoStudentPage(InfraDemoStudentPageReqVO pageReqVO); | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 获得学生列表, 用于 Excel 导出 | |
| 58 | - * | |
| 59 | - * @param exportReqVO 查询条件 | |
| 60 | - * @return 学生列表 | |
| 61 | - */ | |
| 62 | - List<InfraDemoStudentDO> getDemoStudentList(InfraDemoStudentExportReqVO exportReqVO); | |
| 63 | - | |
| 64 | - | |
| 65 | - // ==================== 子表(学生联系人) ==================== | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 获得学生联系人列表 | |
| 69 | - * | |
| 70 | - * @param studentId 学生编号 | |
| 71 | - * @return 学生联系人列表 | |
| 72 | - */ | |
| 73 | - List<InfraDemoStudentContactDO> getDemoStudentContactListByStudentId(Long studentId); | |
| 74 | - | |
| 75 | - | |
| 76 | - // ==================== 子表(学生地址) ==================== | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 获得学生地址 | |
| 80 | - * | |
| 81 | - * @param studentId 学生编号 | |
| 82 | - * @return 学生地址 | |
| 83 | - */ | |
| 84 | - InfraDemoStudentAddressDO getDemoStudentAddressByStudentId(Long studentId); | |
| 85 | - | |
| 86 | -} | |
| 87 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo02/InfraDemoStudentServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo02; | |
| 2 | - | |
| 3 | -import org.springframework.stereotype.Service; | |
| 4 | -import javax.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.transaction.annotation.Transactional; | |
| 7 | - | |
| 8 | -import java.util.*; | |
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO; | |
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO; | |
| 12 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO; | |
| 13 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 14 | - | |
| 15 | -import cn.iocoder.yudao.module.infra.convert.demo02.InfraDemoStudentConvert; | |
| 16 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentMapper; | |
| 17 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentContactMapper; | |
| 18 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentAddressMapper; | |
| 19 | - | |
| 20 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 21 | -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | |
| 22 | - | |
| 23 | -import cn.hutool.core.collection.CollUtil; | |
| 24 | -import cn.hutool.core.collection.ListUtil; | |
| 25 | - | |
| 26 | -/** | |
| 27 | - * 学生 Service 实现类 | |
| 28 | - * | |
| 29 | - * @author 芋道源码 | |
| 30 | - */ | |
| 31 | -@Service | |
| 32 | -@Validated | |
| 33 | -public class InfraDemoStudentServiceImpl implements InfraDemoStudentService { | |
| 34 | - | |
| 35 | - @Resource | |
| 36 | - private InfraDemoStudentMapper demoStudentMapper; | |
| 37 | - @Resource | |
| 38 | - private InfraDemoStudentContactMapper demoStudentContactMapper; | |
| 39 | - @Resource | |
| 40 | - private InfraDemoStudentAddressMapper demoStudentAddressMapper; | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - @Transactional(rollbackFor = Exception.class) | |
| 44 | - public Long createDemoStudent(InfraDemoStudentCreateReqVO createReqVO) { | |
| 45 | - // 插入 | |
| 46 | - InfraDemoStudentDO demoStudent = InfraDemoStudentConvert.INSTANCE.convert(createReqVO); | |
| 47 | - demoStudentMapper.insert(demoStudent); | |
| 48 | - | |
| 49 | - // 插入子表($subTable.classComment) | |
| 50 | - createDemoStudentContactList(demoStudent.getId(), createReqVO.getDemoStudentContacts()); | |
| 51 | - createDemoStudentAddress(demoStudent.getId(), createReqVO.getDemoStudentAddress()); | |
| 52 | - // 返回 | |
| 53 | - return demoStudent.getId(); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Override | |
| 57 | - @Transactional(rollbackFor = Exception.class) | |
| 58 | - public void updateDemoStudent(InfraDemoStudentUpdateReqVO updateReqVO) { | |
| 59 | - // 校验存在 | |
| 60 | - validateDemoStudentExists(updateReqVO.getId()); | |
| 61 | - // 更新 | |
| 62 | - InfraDemoStudentDO updateObj = InfraDemoStudentConvert.INSTANCE.convert(updateReqVO); | |
| 63 | - demoStudentMapper.updateById(updateObj); | |
| 64 | - | |
| 65 | - // 更新子表 | |
| 66 | - updateDemoStudentContactList(updateReqVO.getId(), updateReqVO.getDemoStudentContacts()); | |
| 67 | - updateDemoStudentAddress(updateReqVO.getId(), updateReqVO.getDemoStudentAddress()); | |
| 68 | - } | |
| 69 | - | |
| 70 | - @Override | |
| 71 | - @Transactional(rollbackFor = Exception.class) | |
| 72 | - public void deleteDemoStudent(Long id) { | |
| 73 | - // 校验存在 | |
| 74 | - validateDemoStudentExists(id); | |
| 75 | - // 删除 | |
| 76 | - demoStudentMapper.deleteById(id); | |
| 77 | - | |
| 78 | - // 删除子表 | |
| 79 | - deleteDemoStudentContactByStudentId(id); | |
| 80 | - deleteDemoStudentAddressByStudentId(id); | |
| 81 | - } | |
| 82 | - | |
| 83 | - private void validateDemoStudentExists(Long id) { | |
| 84 | - if (demoStudentMapper.selectById(id) == null) { | |
| 85 | - throw exception(DEMO_STUDENT_NOT_EXISTS); | |
| 86 | - } | |
| 87 | - } | |
| 88 | - | |
| 89 | - @Override | |
| 90 | - public InfraDemoStudentDO getDemoStudent(Long id) { | |
| 91 | - return demoStudentMapper.selectById(id); | |
| 92 | - } | |
| 93 | - | |
| 94 | - @Override | |
| 95 | - public PageResult<InfraDemoStudentDO> getDemoStudentPage(InfraDemoStudentPageReqVO pageReqVO) { | |
| 96 | - return demoStudentMapper.selectPage(pageReqVO); | |
| 97 | - } | |
| 98 | - | |
| 99 | - @Override | |
| 100 | - public List<InfraDemoStudentDO> getDemoStudentList(InfraDemoStudentExportReqVO exportReqVO) { | |
| 101 | - return demoStudentMapper.selectList(exportReqVO); | |
| 102 | - } | |
| 103 | - | |
| 104 | - // ==================== 子表(学生联系人) ==================== | |
| 105 | - | |
| 106 | - @Override | |
| 107 | - public List<InfraDemoStudentContactDO> getDemoStudentContactListByStudentId(Long studentId) { | |
| 108 | - return demoStudentContactMapper.selectListByStudentId(studentId); | |
| 109 | - } | |
| 110 | - | |
| 111 | - private void createDemoStudentContactList(Long studentId, List<InfraDemoStudentContactDO> list) { | |
| 112 | - list.forEach(o -> o.setStudentId(studentId)); | |
| 113 | - demoStudentContactMapper.insertBatch(list); | |
| 114 | - } | |
| 115 | - | |
| 116 | - private void updateDemoStudentContactList(Long studentId, List<InfraDemoStudentContactDO> list) { | |
| 117 | - deleteDemoStudentContactByStudentId(studentId); | |
| 118 | - createDemoStudentContactList(studentId, list); | |
| 119 | - } | |
| 120 | - | |
| 121 | - private void deleteDemoStudentContactByStudentId(Long studentId) { | |
| 122 | - demoStudentContactMapper.deleteByStudentId(studentId); | |
| 123 | - } | |
| 124 | - | |
| 125 | - // ==================== 子表(学生地址) ==================== | |
| 126 | - | |
| 127 | - @Override | |
| 128 | - public InfraDemoStudentAddressDO getDemoStudentAddressByStudentId(Long studentId) { | |
| 129 | - return demoStudentAddressMapper.selectByStudentId(studentId); | |
| 130 | - } | |
| 131 | - | |
| 132 | - private void createDemoStudentAddress(Long studentId, InfraDemoStudentAddressDO demoStudentAddress) { | |
| 133 | - demoStudentAddress.setStudentId(studentId); | |
| 134 | - demoStudentAddressMapper.insert(demoStudentAddress); | |
| 135 | - } | |
| 136 | - | |
| 137 | - private void updateDemoStudentAddress(Long studentId, InfraDemoStudentAddressDO demoStudentAddress) { | |
| 138 | - demoStudentAddress.setStudentId(studentId); | |
| 139 | - demoStudentAddressMapper.updateById(demoStudentAddress); | |
| 140 | - } | |
| 141 | - | |
| 142 | - private void deleteDemoStudentAddressByStudentId(Long studentId) { | |
| 143 | - demoStudentAddressMapper.deleteByStudentId(studentId); | |
| 144 | - } | |
| 145 | - | |
| 146 | -} | |
| 147 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentService.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo11; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*; | |
| 6 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; | |
| 7 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; | |
| 9 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 学生 Service 接口 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -public interface InfraDemo11StudentService { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 创建学生 | |
| 20 | - * | |
| 21 | - * @param createReqVO 创建信息 | |
| 22 | - * @return 编号 | |
| 23 | - */ | |
| 24 | - Long createDemo11Student(@Valid InfraDemo11StudentCreateReqVO createReqVO); | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 更新学生 | |
| 28 | - * | |
| 29 | - * @param updateReqVO 更新信息 | |
| 30 | - */ | |
| 31 | - void updateDemo11Student(@Valid InfraDemo11StudentUpdateReqVO updateReqVO); | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 删除学生 | |
| 35 | - * | |
| 36 | - * @param id 编号 | |
| 37 | - */ | |
| 38 | - void deleteDemo11Student(Long id); | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 获得学生 | |
| 42 | - * | |
| 43 | - * @param id 编号 | |
| 44 | - * @return 学生 | |
| 45 | - */ | |
| 46 | - InfraDemo11StudentDO getDemo11Student(Long id); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得学生分页 | |
| 50 | - * | |
| 51 | - * @param pageReqVO 分页查询 | |
| 52 | - * @return 学生分页 | |
| 53 | - */ | |
| 54 | - PageResult<InfraDemo11StudentDO> getDemo11StudentPage(InfraDemo11StudentPageReqVO pageReqVO); | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 获得学生列表, 用于 Excel 导出 | |
| 58 | - * | |
| 59 | - * @param exportReqVO 查询条件 | |
| 60 | - * @return 学生列表 | |
| 61 | - */ | |
| 62 | - List<InfraDemo11StudentDO> getDemo11StudentList(InfraDemo11StudentExportReqVO exportReqVO); | |
| 63 | - | |
| 64 | - | |
| 65 | - // ==================== 子表(学生联系人) ==================== | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 获得学生联系人列表 | |
| 69 | - * | |
| 70 | - * @param studentId 学生编号 | |
| 71 | - * @return 学生联系人列表 | |
| 72 | - */ | |
| 73 | - List<InfraDemo11StudentContactDO> getDemo11StudentContactListByStudentId(Long studentId); | |
| 74 | - | |
| 75 | - | |
| 76 | - // ==================== 子表(学生班主任) ==================== | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 获得学生班主任 | |
| 80 | - * | |
| 81 | - * @param studentId 学生编号 | |
| 82 | - * @return 学生班主任 | |
| 83 | - */ | |
| 84 | - InfraDemo11StudentTeacherDO getDemo11StudentTeacherByStudentId(Long studentId); | |
| 85 | - | |
| 86 | -} | |
| 87 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo11/InfraDemo11StudentServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo11; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentExportReqVO; | |
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.infra.convert.demo11.InfraDemo11StudentConvert; | |
| 9 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO; | |
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO; | |
| 12 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentContactMapper; | |
| 13 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentMapper; | |
| 14 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentTeacherMapper; | |
| 15 | -import org.springframework.stereotype.Service; | |
| 16 | -import org.springframework.transaction.annotation.Transactional; | |
| 17 | -import org.springframework.validation.annotation.Validated; | |
| 18 | - | |
| 19 | -import javax.annotation.Resource; | |
| 20 | -import java.util.List; | |
| 21 | - | |
| 22 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 23 | -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DEMO11_STUDENT_NOT_EXISTS; | |
| 24 | - | |
| 25 | -/** | |
| 26 | - * 学生 Service 实现类 | |
| 27 | - * | |
| 28 | - * @author 芋道源码 | |
| 29 | - */ | |
| 30 | -@Service | |
| 31 | -@Validated | |
| 32 | -public class InfraDemo11StudentServiceImpl implements InfraDemo11StudentService { | |
| 33 | - | |
| 34 | - @Resource | |
| 35 | - private InfraDemo11StudentMapper demo11StudentMapper; | |
| 36 | - @Resource | |
| 37 | - private InfraDemo11StudentContactMapper demo11StudentContactMapper; | |
| 38 | - @Resource | |
| 39 | - private InfraDemo11StudentTeacherMapper demo11StudentTeacherMapper; | |
| 40 | - | |
| 41 | - @Override | |
| 42 | - @Transactional(rollbackFor = Exception.class) | |
| 43 | - public Long createDemo11Student(InfraDemo11StudentCreateReqVO createReqVO) { | |
| 44 | - // 插入 | |
| 45 | - InfraDemo11StudentDO demo11Student = InfraDemo11StudentConvert.INSTANCE.convert(createReqVO); | |
| 46 | - demo11StudentMapper.insert(demo11Student); | |
| 47 | - | |
| 48 | - // 插入子表 | |
| 49 | - createDemo11StudentContactList(demo11Student.getId(), createReqVO.getDemo11StudentContacts()); | |
| 50 | - createDemo11StudentTeacher(demo11Student.getId(), createReqVO.getDemo11StudentTeacher()); | |
| 51 | - // 返回 | |
| 52 | - return demo11Student.getId(); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @Override | |
| 56 | - @Transactional(rollbackFor = Exception.class) | |
| 57 | - public void updateDemo11Student(InfraDemo11StudentUpdateReqVO updateReqVO) { | |
| 58 | - // 校验存在 | |
| 59 | - validateDemo11StudentExists(updateReqVO.getId()); | |
| 60 | - // 更新 | |
| 61 | - InfraDemo11StudentDO updateObj = InfraDemo11StudentConvert.INSTANCE.convert(updateReqVO); | |
| 62 | - demo11StudentMapper.updateById(updateObj); | |
| 63 | - | |
| 64 | - // 更新子表 | |
| 65 | - updateDemo11StudentContactList(updateReqVO.getId(), updateReqVO.getDemo11StudentContacts()); | |
| 66 | - updateDemo11StudentTeacher(updateReqVO.getId(), updateReqVO.getDemo11StudentTeacher()); | |
| 67 | - } | |
| 68 | - | |
| 69 | - @Override | |
| 70 | - @Transactional(rollbackFor = Exception.class) | |
| 71 | - public void deleteDemo11Student(Long id) { | |
| 72 | - // 校验存在 | |
| 73 | - validateDemo11StudentExists(id); | |
| 74 | - // 删除 | |
| 75 | - demo11StudentMapper.deleteById(id); | |
| 76 | - | |
| 77 | - // 删除子表 | |
| 78 | - deleteDemo11StudentContactByStudentId(id); | |
| 79 | - deleteDemo11StudentTeacherByStudentId(id); | |
| 80 | - } | |
| 81 | - | |
| 82 | - private void validateDemo11StudentExists(Long id) { | |
| 83 | - if (demo11StudentMapper.selectById(id) == null) { | |
| 84 | - throw exception(DEMO11_STUDENT_NOT_EXISTS); | |
| 85 | - } | |
| 86 | - } | |
| 87 | - | |
| 88 | - @Override | |
| 89 | - public InfraDemo11StudentDO getDemo11Student(Long id) { | |
| 90 | - return demo11StudentMapper.selectById(id); | |
| 91 | - } | |
| 92 | - | |
| 93 | - @Override | |
| 94 | - public PageResult<InfraDemo11StudentDO> getDemo11StudentPage(InfraDemo11StudentPageReqVO pageReqVO) { | |
| 95 | - return demo11StudentMapper.selectPage(pageReqVO); | |
| 96 | - } | |
| 97 | - | |
| 98 | - @Override | |
| 99 | - public List<InfraDemo11StudentDO> getDemo11StudentList(InfraDemo11StudentExportReqVO exportReqVO) { | |
| 100 | - return demo11StudentMapper.selectList(exportReqVO); | |
| 101 | - } | |
| 102 | - | |
| 103 | - // ==================== 子表(学生联系人) ==================== | |
| 104 | - | |
| 105 | - @Override | |
| 106 | - public List<InfraDemo11StudentContactDO> getDemo11StudentContactListByStudentId(Long studentId) { | |
| 107 | - return demo11StudentContactMapper.selectListByStudentId(studentId); | |
| 108 | - } | |
| 109 | - | |
| 110 | - private void createDemo11StudentContactList(Long studentId, List<InfraDemo11StudentContactDO> list) { | |
| 111 | - list.forEach(o -> o.setStudentId(studentId)); | |
| 112 | - demo11StudentContactMapper.insertBatch(list); | |
| 113 | - } | |
| 114 | - | |
| 115 | - private void updateDemo11StudentContactList(Long studentId, List<InfraDemo11StudentContactDO> list) { | |
| 116 | - deleteDemo11StudentContactByStudentId(studentId); | |
| 117 | - list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 | |
| 118 | - createDemo11StudentContactList(studentId, list); | |
| 119 | - } | |
| 120 | - | |
| 121 | - private void deleteDemo11StudentContactByStudentId(Long studentId) { | |
| 122 | - demo11StudentContactMapper.deleteByStudentId(studentId); | |
| 123 | - } | |
| 124 | - | |
| 125 | - // ==================== 子表(学生班主任) ==================== | |
| 126 | - | |
| 127 | - @Override | |
| 128 | - public InfraDemo11StudentTeacherDO getDemo11StudentTeacherByStudentId(Long studentId) { | |
| 129 | - return demo11StudentTeacherMapper.selectByStudentId(studentId); | |
| 130 | - } | |
| 131 | - | |
| 132 | - private void createDemo11StudentTeacher(Long studentId, InfraDemo11StudentTeacherDO demo11StudentTeacher) { | |
| 133 | - if (demo11StudentTeacher == null) { | |
| 134 | - return; | |
| 135 | - } | |
| 136 | - demo11StudentTeacher.setStudentId(studentId); | |
| 137 | - demo11StudentTeacherMapper.insert(demo11StudentTeacher); | |
| 138 | - } | |
| 139 | - | |
| 140 | - private void updateDemo11StudentTeacher(Long studentId, InfraDemo11StudentTeacherDO demo11StudentTeacher) { | |
| 141 | - if (demo11StudentTeacher == null) { | |
| 142 | - return; | |
| 143 | - } | |
| 144 | - demo11StudentTeacher.setStudentId(studentId); | |
| 145 | - demo11StudentTeacher.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新 | |
| 146 | - demo11StudentTeacherMapper.insertOrUpdate(demo11StudentTeacher); | |
| 147 | - } | |
| 148 | - | |
| 149 | - private void deleteDemo11StudentTeacherByStudentId(Long studentId) { | |
| 150 | - demo11StudentTeacherMapper.deleteByStudentId(studentId); | |
| 151 | - } | |
| 152 | - | |
| 153 | -} | |
| 154 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo12; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; | |
| 6 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; | |
| 7 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; | |
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; | |
| 9 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 10 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 学生 Service 接口 | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -public interface InfraDemo12StudentService { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 创建学生 | |
| 21 | - * | |
| 22 | - * @param createReqVO 创建信息 | |
| 23 | - * @return 编号 | |
| 24 | - */ | |
| 25 | - Long createDemo12Student(@Valid InfraDemo12StudentCreateReqVO createReqVO); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 更新学生 | |
| 29 | - * | |
| 30 | - * @param updateReqVO 更新信息 | |
| 31 | - */ | |
| 32 | - void updateDemo12Student(@Valid InfraDemo12StudentUpdateReqVO updateReqVO); | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 删除学生 | |
| 36 | - * | |
| 37 | - * @param id 编号 | |
| 38 | - */ | |
| 39 | - void deleteDemo12Student(Long id); | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 获得学生 | |
| 43 | - * | |
| 44 | - * @param id 编号 | |
| 45 | - * @return 学生 | |
| 46 | - */ | |
| 47 | - InfraDemo12StudentDO getDemo12Student(Long id); | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * 获得学生分页 | |
| 51 | - * | |
| 52 | - * @param pageReqVO 分页查询 | |
| 53 | - * @return 学生分页 | |
| 54 | - */ | |
| 55 | - PageResult<InfraDemo12StudentDO> getDemo12StudentPage(InfraDemo12StudentPageReqVO pageReqVO); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 获得学生列表, 用于 Excel 导出 | |
| 59 | - * | |
| 60 | - * @param exportReqVO 查询条件 | |
| 61 | - * @return 学生列表 | |
| 62 | - */ | |
| 63 | - List<InfraDemo12StudentDO> getDemo12StudentList(InfraDemo12StudentExportReqVO exportReqVO); | |
| 64 | - | |
| 65 | - | |
| 66 | - // ==================== 子表(学生联系人) ==================== | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 获得学生联系人分页 | |
| 70 | - * | |
| 71 | - * @param pageReqVO 分页查询 | |
| 72 | - * @param studentId 学生编号 | |
| 73 | - * @return 学生联系人分页 | |
| 74 | - */ | |
| 75 | - PageResult<InfraDemo12StudentContactDO> getDemo12StudentContactPage(PageParam pageReqVO, Long studentId); | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * 创建学生联系人 | |
| 79 | - * | |
| 80 | - * @param demo12StudentContact 创建信息 | |
| 81 | - * @return 编号 | |
| 82 | - */ | |
| 83 | - Long createDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact); | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * 更新学生联系人 | |
| 87 | - * | |
| 88 | - * @param demo12StudentContact 更新信息 | |
| 89 | - */ | |
| 90 | - void updateDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact); | |
| 91 | - | |
| 92 | - /** | |
| 93 | - * 删除学生联系人 | |
| 94 | - * | |
| 95 | - * @param id 编号 | |
| 96 | - */ | |
| 97 | - void deleteDemo12StudentContact(Long id); | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * 获得学生联系人 | |
| 101 | - * | |
| 102 | - * @param id 编号 | |
| 103 | - * @return 学生联系人 | |
| 104 | - */ | |
| 105 | - InfraDemo12StudentContactDO getDemo12StudentContact(Long id); | |
| 106 | - | |
| 107 | - | |
| 108 | - // ==================== 子表(学生班主任) ==================== | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * 获得学生班主任分页 | |
| 112 | - * | |
| 113 | - * @param pageReqVO 分页查询 | |
| 114 | - * @param studentId 学生编号 | |
| 115 | - * @return 学生班主任分页 | |
| 116 | - */ | |
| 117 | - PageResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId); | |
| 118 | - | |
| 119 | - /** | |
| 120 | - * 创建学生班主任 | |
| 121 | - * | |
| 122 | - * @param demo12StudentTeacher 创建信息 | |
| 123 | - * @return 编号 | |
| 124 | - */ | |
| 125 | - Long createDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher); | |
| 126 | - | |
| 127 | - /** | |
| 128 | - * 更新学生班主任 | |
| 129 | - * | |
| 130 | - * @param demo12StudentTeacher 更新信息 | |
| 131 | - */ | |
| 132 | - void updateDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher); | |
| 133 | - | |
| 134 | - /** | |
| 135 | - * 删除学生班主任 | |
| 136 | - * | |
| 137 | - * @param id 编号 | |
| 138 | - */ | |
| 139 | - void deleteDemo12StudentTeacher(Long id); | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * 获得学生班主任 | |
| 143 | - * | |
| 144 | - * @param id 编号 | |
| 145 | - * @return 学生班主任 | |
| 146 | - */ | |
| 147 | - InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id); | |
| 148 | - | |
| 149 | -} | |
| 150 | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo12; | |
| 2 | - | |
| 3 | -import org.springframework.stereotype.Service; | |
| 4 | -import javax.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.transaction.annotation.Transactional; | |
| 7 | - | |
| 8 | -import java.util.*; | |
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; | |
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; | |
| 12 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; | |
| 13 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 14 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 15 | - | |
| 16 | -import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert; | |
| 17 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper; | |
| 18 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentContactMapper; | |
| 19 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentTeacherMapper; | |
| 20 | - | |
| 21 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 22 | -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | |
| 23 | - | |
| 24 | -/** | |
| 25 | - * 学生 Service 实现类 | |
| 26 | - * | |
| 27 | - * @author 芋道源码 | |
| 28 | - */ | |
| 29 | -@Service | |
| 30 | -@Validated | |
| 31 | -public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService { | |
| 32 | - | |
| 33 | - @Resource | |
| 34 | - private InfraDemo12StudentMapper demo12StudentMapper; | |
| 35 | - @Resource | |
| 36 | - private InfraDemo12StudentContactMapper demo12StudentContactMapper; | |
| 37 | - @Resource | |
| 38 | - private InfraDemo12StudentTeacherMapper demo12StudentTeacherMapper; | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - public Long createDemo12Student(InfraDemo12StudentCreateReqVO createReqVO) { | |
| 42 | - // 插入 | |
| 43 | - InfraDemo12StudentDO demo12Student = InfraDemo12StudentConvert.INSTANCE.convert(createReqVO); | |
| 44 | - demo12StudentMapper.insert(demo12Student); | |
| 45 | - // 返回 | |
| 46 | - return demo12Student.getId(); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @Override | |
| 50 | - public void updateDemo12Student(InfraDemo12StudentUpdateReqVO updateReqVO) { | |
| 51 | - // 校验存在 | |
| 52 | - validateDemo12StudentExists(updateReqVO.getId()); | |
| 53 | - // 更新 | |
| 54 | - InfraDemo12StudentDO updateObj = InfraDemo12StudentConvert.INSTANCE.convert(updateReqVO); | |
| 55 | - demo12StudentMapper.updateById(updateObj); | |
| 56 | - } | |
| 57 | - | |
| 58 | - @Override | |
| 59 | - @Transactional(rollbackFor = Exception.class) | |
| 60 | - public void deleteDemo12Student(Long id) { | |
| 61 | - // 校验存在 | |
| 62 | - validateDemo12StudentExists(id); | |
| 63 | - // 删除 | |
| 64 | - demo12StudentMapper.deleteById(id); | |
| 65 | - | |
| 66 | - // 删除子表 | |
| 67 | - deleteDemo12StudentContactByStudentId(id); | |
| 68 | - deleteDemo12StudentTeacherByStudentId(id); | |
| 69 | - } | |
| 70 | - | |
| 71 | - private void validateDemo12StudentExists(Long id) { | |
| 72 | - if (demo12StudentMapper.selectById(id) == null) { | |
| 73 | - throw exception(DEMO12_STUDENT_NOT_EXISTS); | |
| 74 | - } | |
| 75 | - } | |
| 76 | - | |
| 77 | - @Override | |
| 78 | - public InfraDemo12StudentDO getDemo12Student(Long id) { | |
| 79 | - return demo12StudentMapper.selectById(id); | |
| 80 | - } | |
| 81 | - | |
| 82 | - @Override | |
| 83 | - public PageResult<InfraDemo12StudentDO> getDemo12StudentPage(InfraDemo12StudentPageReqVO pageReqVO) { | |
| 84 | - return demo12StudentMapper.selectPage(pageReqVO); | |
| 85 | - } | |
| 86 | - | |
| 87 | - @Override | |
| 88 | - public List<InfraDemo12StudentDO> getDemo12StudentList(InfraDemo12StudentExportReqVO exportReqVO) { | |
| 89 | - return demo12StudentMapper.selectList(exportReqVO); | |
| 90 | - } | |
| 91 | - | |
| 92 | - // ==================== 子表(学生联系人) ==================== | |
| 93 | - | |
| 94 | - @Override | |
| 95 | - public PageResult<InfraDemo12StudentContactDO> getDemo12StudentContactPage(PageParam pageReqVO, Long studentId) { | |
| 96 | - return demo12StudentContactMapper.selectPage(pageReqVO, studentId); | |
| 97 | - } | |
| 98 | - | |
| 99 | - @Override | |
| 100 | - public Long createDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) { | |
| 101 | - demo12StudentContactMapper.insert(demo12StudentContact); | |
| 102 | - return demo12StudentContact.getId(); | |
| 103 | - } | |
| 104 | - | |
| 105 | - @Override | |
| 106 | - public void updateDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) { | |
| 107 | - demo12StudentContactMapper.updateById(demo12StudentContact); | |
| 108 | - } | |
| 109 | - | |
| 110 | - @Override | |
| 111 | - public void deleteDemo12StudentContact(Long id) { | |
| 112 | - demo12StudentContactMapper.deleteById(id); | |
| 113 | - } | |
| 114 | - | |
| 115 | - @Override | |
| 116 | - public InfraDemo12StudentContactDO getDemo12StudentContact(Long id) { | |
| 117 | - return demo12StudentContactMapper.selectById(id); | |
| 118 | - } | |
| 119 | - | |
| 120 | - private void deleteDemo12StudentContactByStudentId(Long studentId) { | |
| 121 | - demo12StudentContactMapper.deleteByStudentId(studentId); | |
| 122 | - } | |
| 123 | - | |
| 124 | - // ==================== 子表(学生班主任) ==================== | |
| 125 | - | |
| 126 | - @Override | |
| 127 | - public PageResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId) { | |
| 128 | - return demo12StudentTeacherMapper.selectPage(pageReqVO, studentId); | |
| 129 | - } | |
| 130 | - | |
| 131 | - @Override | |
| 132 | - public Long createDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) { | |
| 133 | - demo12StudentTeacherMapper.insert(demo12StudentTeacher); | |
| 134 | - return demo12StudentTeacher.getId(); | |
| 135 | - } | |
| 136 | - | |
| 137 | - @Override | |
| 138 | - public void updateDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) { | |
| 139 | - demo12StudentTeacherMapper.updateById(demo12StudentTeacher); | |
| 140 | - } | |
| 141 | - | |
| 142 | - @Override | |
| 143 | - public void deleteDemo12StudentTeacher(Long id) { | |
| 144 | - demo12StudentTeacherMapper.deleteById(id); | |
| 145 | - } | |
| 146 | - | |
| 147 | - @Override | |
| 148 | - public InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id) { | |
| 149 | - return demo12StudentTeacherMapper.selectById(id); | |
| 150 | - } | |
| 151 | - | |
| 152 | - private void deleteDemo12StudentTeacherByStudentId(Long studentId) { | |
| 153 | - demo12StudentTeacherMapper.deleteByStudentId(studentId); | |
| 154 | - } | |
| 155 | - | |
| 156 | -} | |
| 157 | 0 | \ No newline at end of file |
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 { |
| 85 | 85 | assertNotNull(${classNameVar}Id); |
| 86 | 86 | // 校验记录的属性是否正确 |
| 87 | 87 | ${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(${classNameVar}Id); |
| 88 | - assertPojoEquals(createReqVO, ${classNameVar}); | |
| 88 | + assertPojoEquals(createReqVO, ${classNameVar}, "id"); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | @Test | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImplTest.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.demo12; | |
| 2 | - | |
| 3 | -import org.junit.jupiter.api.Disabled; | |
| 4 | -import org.junit.jupiter.api.Test; | |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | |
| 6 | - | |
| 7 | -import javax.annotation.Resource; | |
| 8 | - | |
| 9 | -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 10 | - | |
| 11 | -import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; | |
| 12 | -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; | |
| 13 | -import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper; | |
| 14 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 15 | - | |
| 16 | -import javax.annotation.Resource; | |
| 17 | -import org.springframework.context.annotation.Import; | |
| 18 | -import java.util.*; | |
| 19 | -import java.time.LocalDateTime; | |
| 20 | - | |
| 21 | -import static cn.hutool.core.util.RandomUtil.*; | |
| 22 | -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | |
| 23 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; | |
| 24 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | |
| 25 | -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; | |
| 26 | -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; | |
| 27 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; | |
| 28 | -import static org.junit.jupiter.api.Assertions.*; | |
| 29 | -import static org.mockito.Mockito.*; | |
| 30 | - | |
| 31 | -/** | |
| 32 | - * {@link InfraDemo12StudentServiceImpl} 的单元测试类 | |
| 33 | - * | |
| 34 | - * @author 芋道源码 | |
| 35 | - */ | |
| 36 | -@Import(InfraDemo12StudentServiceImpl.class) | |
| 37 | -public class InfraDemo12StudentServiceImplTest extends BaseDbUnitTest { | |
| 38 | - | |
| 39 | - @Resource | |
| 40 | - private InfraDemo12StudentServiceImpl demo12StudentService; | |
| 41 | - | |
| 42 | - @Resource | |
| 43 | - private InfraDemo12StudentMapper demo12StudentMapper; | |
| 44 | - | |
| 45 | - @Test | |
| 46 | - public void testCreateDemo12Student_success() { | |
| 47 | - // 准备参数 | |
| 48 | - InfraDemo12StudentCreateReqVO reqVO = randomPojo(InfraDemo12StudentCreateReqVO.class); | |
| 49 | - | |
| 50 | - // 调用 | |
| 51 | - Long demo12StudentId = demo12StudentService.createDemo12Student(reqVO); | |
| 52 | - // 断言 | |
| 53 | - assertNotNull(demo12StudentId); | |
| 54 | - // 校验记录的属性是否正确 | |
| 55 | - InfraDemo12StudentDO demo12Student = demo12StudentMapper.selectById(demo12StudentId); | |
| 56 | - assertPojoEquals(reqVO, demo12Student); | |
| 57 | - } | |
| 58 | - | |
| 59 | - @Test | |
| 60 | - public void testUpdateDemo12Student_success() { | |
| 61 | - // mock 数据 | |
| 62 | - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class); | |
| 63 | - demo12StudentMapper.insert(dbDemo12Student);// @Sql: 先插入出一条存在的数据 | |
| 64 | - // 准备参数 | |
| 65 | - InfraDemo12StudentUpdateReqVO reqVO = randomPojo(InfraDemo12StudentUpdateReqVO.class, o -> { | |
| 66 | - o.setId(dbDemo12Student.getId()); // 设置更新的 ID | |
| 67 | - }); | |
| 68 | - | |
| 69 | - // 调用 | |
| 70 | - demo12StudentService.updateDemo12Student(reqVO); | |
| 71 | - // 校验是否更新正确 | |
| 72 | - InfraDemo12StudentDO demo12Student = demo12StudentMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 73 | - assertPojoEquals(reqVO, demo12Student); | |
| 74 | - } | |
| 75 | - | |
| 76 | - @Test | |
| 77 | - public void testUpdateDemo12Student_notExists() { | |
| 78 | - // 准备参数 | |
| 79 | - InfraDemo12StudentUpdateReqVO reqVO = randomPojo(InfraDemo12StudentUpdateReqVO.class); | |
| 80 | - | |
| 81 | - // 调用, 并断言异常 | |
| 82 | - assertServiceException(() -> demo12StudentService.updateDemo12Student(reqVO), DEMO12_STUDENT_NOT_EXISTS); | |
| 83 | - } | |
| 84 | - | |
| 85 | - @Test | |
| 86 | - public void testDeleteDemo12Student_success() { | |
| 87 | - // mock 数据 | |
| 88 | - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class); | |
| 89 | - demo12StudentMapper.insert(dbDemo12Student);// @Sql: 先插入出一条存在的数据 | |
| 90 | - // 准备参数 | |
| 91 | - Long id = dbDemo12Student.getId(); | |
| 92 | - | |
| 93 | - // 调用 | |
| 94 | - demo12StudentService.deleteDemo12Student(id); | |
| 95 | - // 校验数据不存在了 | |
| 96 | - assertNull(demo12StudentMapper.selectById(id)); | |
| 97 | - } | |
| 98 | - | |
| 99 | - @Test | |
| 100 | - public void testDeleteDemo12Student_notExists() { | |
| 101 | - // 准备参数 | |
| 102 | - Long id = randomLongId(); | |
| 103 | - | |
| 104 | - // 调用, 并断言异常 | |
| 105 | - assertServiceException(() -> demo12StudentService.deleteDemo12Student(id), DEMO12_STUDENT_NOT_EXISTS); | |
| 106 | - } | |
| 107 | - | |
| 108 | - @Test | |
| 109 | - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 110 | - public void testGetDemo12StudentPage() { | |
| 111 | - // mock 数据 | |
| 112 | - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class, o -> { // 等会查询到 | |
| 113 | - o.setName(null); | |
| 114 | - o.setBirthday(null); | |
| 115 | - o.setSex(null); | |
| 116 | - o.setEnabled(null); | |
| 117 | - o.setCreateTime(null); | |
| 118 | - }); | |
| 119 | - demo12StudentMapper.insert(dbDemo12Student); | |
| 120 | - // 测试 name 不匹配 | |
| 121 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setName(null))); | |
| 122 | - // 测试 birthday 不匹配 | |
| 123 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setBirthday(null))); | |
| 124 | - // 测试 sex 不匹配 | |
| 125 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setSex(null))); | |
| 126 | - // 测试 enabled 不匹配 | |
| 127 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setEnabled(null))); | |
| 128 | - // 测试 createTime 不匹配 | |
| 129 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setCreateTime(null))); | |
| 130 | - // 准备参数 | |
| 131 | - InfraDemo12StudentPageReqVO reqVO = new InfraDemo12StudentPageReqVO(); | |
| 132 | - reqVO.setName(null); | |
| 133 | - reqVO.setBirthday(null); | |
| 134 | - reqVO.setSex(null); | |
| 135 | - reqVO.setEnabled(null); | |
| 136 | - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | |
| 137 | - | |
| 138 | - // 调用 | |
| 139 | - PageResult<InfraDemo12StudentDO> pageResult = demo12StudentService.getDemo12StudentPage(reqVO); | |
| 140 | - // 断言 | |
| 141 | - assertEquals(1, pageResult.getTotal()); | |
| 142 | - assertEquals(1, pageResult.getList().size()); | |
| 143 | - assertPojoEquals(dbDemo12Student, pageResult.getList().get(0)); | |
| 144 | - } | |
| 145 | - | |
| 146 | - @Test | |
| 147 | - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 148 | - public void testGetDemo12StudentList() { | |
| 149 | - // mock 数据 | |
| 150 | - InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class, o -> { // 等会查询到 | |
| 151 | - o.setName(null); | |
| 152 | - o.setBirthday(null); | |
| 153 | - o.setSex(null); | |
| 154 | - o.setEnabled(null); | |
| 155 | - o.setCreateTime(null); | |
| 156 | - }); | |
| 157 | - demo12StudentMapper.insert(dbDemo12Student); | |
| 158 | - // 测试 name 不匹配 | |
| 159 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setName(null))); | |
| 160 | - // 测试 birthday 不匹配 | |
| 161 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setBirthday(null))); | |
| 162 | - // 测试 sex 不匹配 | |
| 163 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setSex(null))); | |
| 164 | - // 测试 enabled 不匹配 | |
| 165 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setEnabled(null))); | |
| 166 | - // 测试 createTime 不匹配 | |
| 167 | - demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setCreateTime(null))); | |
| 168 | - // 准备参数 | |
| 169 | - InfraDemo12StudentExportReqVO reqVO = new InfraDemo12StudentExportReqVO(); | |
| 170 | - reqVO.setName(null); | |
| 171 | - reqVO.setBirthday(null); | |
| 172 | - reqVO.setSex(null); | |
| 173 | - reqVO.setEnabled(null); | |
| 174 | - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | |
| 175 | - | |
| 176 | - // 调用 | |
| 177 | - List<InfraDemo12StudentDO> list = demo12StudentService.getDemo12StudentList(reqVO); | |
| 178 | - // 断言 | |
| 179 | - assertEquals(1, list.size()); | |
| 180 | - assertPojoEquals(dbDemo12Student, list.get(0)); | |
| 181 | - } | |
| 182 | - | |
| 183 | -} | |
| 184 | 0 | \ No newline at end of file |