Commit 0d49691aa0ef78146addd1de334cf1ca85373905
1 parent
d83e0413
代码生成:增加 crud 单表示例
Showing
22 changed files
with
381 additions
and
592 deletions
yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java
| @@ -58,13 +58,7 @@ public interface ErrorCodeConstants { | @@ -58,13 +58,7 @@ public interface ErrorCodeConstants { | ||
| 58 | // ========== 数据源配置 1-001-107-000 ========== | 58 | // ========== 数据源配置 1-001-107-000 ========== |
| 59 | ErrorCode DEMO_STUDENT_NOT_EXISTS = new ErrorCode(1_001_107_000, "学生不存在"); | 59 | ErrorCode DEMO_STUDENT_NOT_EXISTS = new ErrorCode(1_001_107_000, "学生不存在"); |
| 60 | 60 | ||
| 61 | - // ========== 学生(CodegenTemplateTypeEnum.ONE 示例) 1-001-201-000 ========== | ||
| 62 | - ErrorCode DEMO01_STUDENT_NOT_EXISTS = new ErrorCode(1_001_200_000, "学生不存在"); | ||
| 63 | - | ||
| 64 | - // ========== 学生(CodegenTemplateTypeEnum.MASTER_NORMAL 示例) 1-001-211-000 ========== | ||
| 65 | - ErrorCode DEMO11_STUDENT_NOT_EXISTS = new ErrorCode(1_001_211_000, "学生不存在"); | ||
| 66 | - | ||
| 67 | - // ========== 学生(CodegenTemplateTypeEnum.MASTER_INNER 示例) 1-001-213-000 ========== | ||
| 68 | - ErrorCode DEMO12_STUDENT_NOT_EXISTS = new ErrorCode(1_001_213_000, "学生不存在"); | 61 | + // ========== 学生 1-001-201-000 ========== |
| 62 | + ErrorCode DEMO01_CONTACT_NOT_EXISTS = new ErrorCode(1_001_201_000, "示例联系人不存在"); | ||
| 69 | 63 | ||
| 70 | } | 64 | } |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/Demo01ContactController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01; | ||
| 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.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 8 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO; | ||
| 13 | +import cn.iocoder.yudao.module.infra.service.demo.demo01.Demo01ContactService; | ||
| 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/demo01-contact") | ||
| 33 | +@Validated | ||
| 34 | +public class Demo01ContactController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private Demo01ContactService demo01ContactService; | ||
| 38 | + | ||
| 39 | + @PostMapping("/create") | ||
| 40 | + @Operation(summary = "创建示例联系人") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('infra:demo01-contact:create')") | ||
| 42 | + public CommonResult<Long> createDemo01Contact(@Valid @RequestBody Demo01ContactSaveReqVO createReqVO) { | ||
| 43 | + return success(demo01ContactService.createDemo01Contact(createReqVO)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @PutMapping("/update") | ||
| 47 | + @Operation(summary = "更新示例联系人") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('infra:demo01-contact:update')") | ||
| 49 | + public CommonResult<Boolean> updateDemo01Contact(@Valid @RequestBody Demo01ContactSaveReqVO updateReqVO) { | ||
| 50 | + demo01ContactService.updateDemo01Contact(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:demo01-contact:delete')") | ||
| 58 | + public CommonResult<Boolean> deleteDemo01Contact(@RequestParam("id") Long id) { | ||
| 59 | + demo01ContactService.deleteDemo01Contact(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:demo01-contact:query')") | ||
| 67 | + public CommonResult<Demo01ContactRespVO> getDemo01Contact(@RequestParam("id") Long id) { | ||
| 68 | + Demo01ContactDO demo01Contact = demo01ContactService.getDemo01Contact(id); | ||
| 69 | + return success(BeanUtils.toBean(demo01Contact, Demo01ContactRespVO.class)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/page") | ||
| 73 | + @Operation(summary = "获得示例联系人分页") | ||
| 74 | + @PreAuthorize("@ss.hasPermission('infra:demo01-contact:query')") | ||
| 75 | + public CommonResult<PageResult<Demo01ContactRespVO>> getDemo01ContactPage(@Valid Demo01ContactPageReqVO pageReqVO) { | ||
| 76 | + PageResult<Demo01ContactDO> pageResult = demo01ContactService.getDemo01ContactPage(pageReqVO); | ||
| 77 | + return success(BeanUtils.toBean(pageResult, Demo01ContactRespVO.class)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @GetMapping("/export-excel") | ||
| 81 | + @Operation(summary = "导出示例联系人 Excel") | ||
| 82 | + @PreAuthorize("@ss.hasPermission('infra:demo01-contact:export')") | ||
| 83 | + @OperateLog(type = EXPORT) | ||
| 84 | + public void exportDemo01ContactExcel(@Valid Demo01ContactPageReqVO pageReqVO, | ||
| 85 | + HttpServletResponse response) throws IOException { | ||
| 86 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 87 | + List<Demo01ContactDO> list = demo01ContactService.getDemo01ContactPage(pageReqVO).getList(); | ||
| 88 | + // 导出 Excel | ||
| 89 | + ExcelUtils.write(response, "示例联系人.xls", "数据", Demo01ContactRespVO.class, | ||
| 90 | + BeanUtils.toBean(list, Demo01ContactRespVO.class)); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | +} | ||
| 0 | \ No newline at end of file | 94 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.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 Demo01ContactPageReqVO extends PageParam { | ||
| 17 | + | ||
| 18 | + @Schema(description = "名字", example = "张三") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "性别", example = "1") | ||
| 22 | + private Integer sex; | ||
| 23 | + | ||
| 24 | + @Schema(description = "创建时间") | ||
| 25 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 26 | + private LocalDateTime[] createTime; | ||
| 27 | + | ||
| 28 | +} | ||
| 0 | \ No newline at end of file | 29 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import java.util.*; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import com.alibaba.excel.annotation.*; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 11 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - 示例联系人 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class Demo01ContactRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21555") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 23 | + @ExcelProperty("名字") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 27 | + @ExcelProperty(value = "性别", converter = DictConvert.class) | ||
| 28 | + @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 | ||
| 29 | + private Integer sex; | ||
| 30 | + | ||
| 31 | + @Schema(description = "出生年", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 32 | + @ExcelProperty("出生年") | ||
| 33 | + private LocalDateTime birthday; | ||
| 34 | + | ||
| 35 | + @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | ||
| 36 | + @ExcelProperty("简介") | ||
| 37 | + private String description; | ||
| 38 | + | ||
| 39 | + @Schema(description = "头像") | ||
| 40 | + @ExcelProperty("头像") | ||
| 41 | + private String avatar; | ||
| 42 | + | ||
| 43 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 44 | + @ExcelProperty("创建时间") | ||
| 45 | + private LocalDateTime createTime; | ||
| 46 | + | ||
| 47 | +} | ||
| 0 | \ No newline at end of file | 48 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/demo01/vo/Demo01ContactSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.validation.constraints.NotEmpty; | ||
| 7 | +import javax.validation.constraints.NotNull; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - 示例联系人新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class Demo01ContactSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21555") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 18 | + @NotEmpty(message = "名字不能为空") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 22 | + @NotNull(message = "性别不能为空") | ||
| 23 | + private Integer sex; | ||
| 24 | + | ||
| 25 | + @Schema(description = "出生年", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 26 | + @NotNull(message = "出生年不能为空") | ||
| 27 | + private LocalDateTime birthday; | ||
| 28 | + | ||
| 29 | + @Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | ||
| 30 | + @NotEmpty(message = "简介不能为空") | ||
| 31 | + private String description; | ||
| 32 | + | ||
| 33 | + @Schema(description = "头像") | ||
| 34 | + private String avatar; | ||
| 35 | + | ||
| 36 | +} | ||
| 0 | \ No newline at end of file | 37 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/package-info.java
0 → 100644
| 1 | +/** | ||
| 2 | + * 代码生成示例 | ||
| 3 | + * | ||
| 4 | + * 1. demo01:单表(增删改查) | ||
| 5 | + * 2. demo02:单表(树形结构) | ||
| 6 | + * 3.1 demo03/normal:主子表(标准模式) | ||
| 7 | + * 3.2 demo03/erp:主子表(ERP 模式) | ||
| 8 | + * 3.3 demo03/inner:主子表(内嵌模式) | ||
| 9 | + */ | ||
| 10 | +package cn.iocoder.yudao.module.infra.controller.admin.demo; | ||
| 0 | \ No newline at end of file | 11 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo11/InfraDemo11StudentDO.java renamed to yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/demo01/Demo01ContactDO.java
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo11; | 1 | +package cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01; |
| 2 | 2 | ||
| 3 | import lombok.*; | 3 | import lombok.*; |
| 4 | import java.util.*; | 4 | import java.util.*; |
| 5 | import java.time.LocalDateTime; | 5 | import java.time.LocalDateTime; |
| 6 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 7 | +import java.time.LocalDateTime; | ||
| 7 | import com.baomidou.mybatisplus.annotation.*; | 8 | import com.baomidou.mybatisplus.annotation.*; |
| 8 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 9 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| 11 | - * 学生 DO | 12 | + * 示例联系人 DO |
| 12 | * | 13 | * |
| 13 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 14 | */ | 15 | */ |
| 15 | -@TableName("infra_demo11_student") | ||
| 16 | -@KeySequence("infra_demo11_student_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | 16 | +@TableName("infra_demo01_contact") |
| 17 | +@KeySequence("infra_demo01_contact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 17 | @Data | 18 | @Data |
| 18 | @EqualsAndHashCode(callSuper = true) | 19 | @EqualsAndHashCode(callSuper = true) |
| 19 | @ToString(callSuper = true) | 20 | @ToString(callSuper = true) |
| 20 | @Builder | 21 | @Builder |
| 21 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 22 | @AllArgsConstructor | 23 | @AllArgsConstructor |
| 23 | -public class InfraDemo11StudentDO extends BaseDO { | 24 | +public class Demo01ContactDO extends BaseDO { |
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| 26 | * 编号 | 27 | * 编号 |
| @@ -32,36 +33,22 @@ public class InfraDemo11StudentDO extends BaseDO { | @@ -32,36 +33,22 @@ public class InfraDemo11StudentDO extends BaseDO { | ||
| 32 | */ | 33 | */ |
| 33 | private String name; | 34 | private String name; |
| 34 | /** | 35 | /** |
| 35 | - * 简介 | ||
| 36 | - */ | ||
| 37 | - private String description; | ||
| 38 | - /** | ||
| 39 | - * 出生日期 | ||
| 40 | - */ | ||
| 41 | - private LocalDateTime birthday; | ||
| 42 | - /** | ||
| 43 | * 性别 | 36 | * 性别 |
| 44 | * | 37 | * |
| 45 | * 枚举 {@link TODO system_user_sex 对应的类} | 38 | * 枚举 {@link TODO system_user_sex 对应的类} |
| 46 | */ | 39 | */ |
| 47 | private Integer sex; | 40 | private Integer sex; |
| 48 | /** | 41 | /** |
| 49 | - * 是否有效 | ||
| 50 | - * | ||
| 51 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | ||
| 52 | - */ | ||
| 53 | - private Boolean enabled; | ||
| 54 | - /** | ||
| 55 | - * 头像 | 42 | + * 出生年 |
| 56 | */ | 43 | */ |
| 57 | - private String avatar; | 44 | + private LocalDateTime birthday; |
| 58 | /** | 45 | /** |
| 59 | - * 附件 | 46 | + * 简介 |
| 60 | */ | 47 | */ |
| 61 | - private String video; | 48 | + private String description; |
| 62 | /** | 49 | /** |
| 63 | - * 备注 | 50 | + * 头像 |
| 64 | */ | 51 | */ |
| 65 | - private String memo; | 52 | + private String avatar; |
| 66 | 53 | ||
| 67 | } | 54 | } |
| 68 | \ No newline at end of file | 55 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo01/InfraDemo01StudentDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo01; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | -import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 5 | -import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | -import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | -import lombok.*; | ||
| 8 | - | ||
| 9 | -import java.time.LocalDateTime; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 学生 DO | ||
| 13 | - * | ||
| 14 | - * @author 芋道源码 | ||
| 15 | - */ | ||
| 16 | -@TableName("infra_demo01_student") | ||
| 17 | -@KeySequence("infra_demo01_student_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 18 | -@Data | ||
| 19 | -@EqualsAndHashCode(callSuper = true) | ||
| 20 | -@ToString(callSuper = true) | ||
| 21 | -@Builder | ||
| 22 | -@NoArgsConstructor | ||
| 23 | -@AllArgsConstructor | ||
| 24 | -public class InfraDemo01StudentDO extends BaseDO { | ||
| 25 | - | ||
| 26 | - /** | ||
| 27 | - * 编号 | ||
| 28 | - */ | ||
| 29 | - @TableId | ||
| 30 | - private Long id; | ||
| 31 | - /** | ||
| 32 | - * 名字 | ||
| 33 | - */ | ||
| 34 | - private String name; | ||
| 35 | - /** | ||
| 36 | - * 简介 | ||
| 37 | - */ | ||
| 38 | - private String description; | ||
| 39 | - /** | ||
| 40 | - * 出生日期 | ||
| 41 | - */ | ||
| 42 | - private LocalDateTime birthday; | ||
| 43 | - /** | ||
| 44 | - * 性别 | ||
| 45 | - * | ||
| 46 | - * 枚举 {@link TODO system_user_sex 对应的类} | ||
| 47 | - */ | ||
| 48 | - private Integer sex; | ||
| 49 | - /** | ||
| 50 | - * 是否有效 | ||
| 51 | - * | ||
| 52 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | ||
| 53 | - */ | ||
| 54 | - private Boolean enabled; | ||
| 55 | - /** | ||
| 56 | - * 头像 | ||
| 57 | - */ | ||
| 58 | - private String avatar; | ||
| 59 | - /** | ||
| 60 | - * 附件 | ||
| 61 | - */ | ||
| 62 | - private String video; | ||
| 63 | - /** | ||
| 64 | - * 备注 | ||
| 65 | - */ | ||
| 66 | - private String memo; | ||
| 67 | - | ||
| 68 | -} | ||
| 69 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo02/InfraDemoStudentAddressDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo02; | ||
| 2 | - | ||
| 3 | -import lombok.*; | ||
| 4 | -import java.util.*; | ||
| 5 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 学生地址 DO | ||
| 10 | - * | ||
| 11 | - * @author 芋道源码 | ||
| 12 | - */ | ||
| 13 | -@TableName("infra_demo_student_address") | ||
| 14 | -@KeySequence("infra_demo_student_address_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 15 | -@Data | ||
| 16 | -@EqualsAndHashCode(callSuper = true) | ||
| 17 | -@ToString(callSuper = true) | ||
| 18 | -@Builder | ||
| 19 | -@NoArgsConstructor | ||
| 20 | -@AllArgsConstructor | ||
| 21 | -public class InfraDemoStudentAddressDO extends BaseDO { | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 编号 | ||
| 25 | - */ | ||
| 26 | - @TableId | ||
| 27 | - private Long id; | ||
| 28 | - /** | ||
| 29 | - * 学生编号 | ||
| 30 | - */ | ||
| 31 | - private Long studentId; | ||
| 32 | - /** | ||
| 33 | - * 明细 | ||
| 34 | - */ | ||
| 35 | - private String detail; | ||
| 36 | - | ||
| 37 | -} | ||
| 38 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo02/InfraDemoStudentContactDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo02; | ||
| 2 | - | ||
| 3 | -import lombok.*; | ||
| 4 | -import java.util.*; | ||
| 5 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 学生联系人 DO | ||
| 10 | - * | ||
| 11 | - * @author 芋道源码 | ||
| 12 | - */ | ||
| 13 | -@TableName("infra_demo_student_contact") | ||
| 14 | -@KeySequence("infra_demo_student_contact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 15 | -@Data | ||
| 16 | -@EqualsAndHashCode(callSuper = true) | ||
| 17 | -@ToString(callSuper = true) | ||
| 18 | -@Builder | ||
| 19 | -@NoArgsConstructor | ||
| 20 | -@AllArgsConstructor | ||
| 21 | -public class InfraDemoStudentContactDO extends BaseDO { | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 编号 | ||
| 25 | - */ | ||
| 26 | - @TableId | ||
| 27 | - private Long id; | ||
| 28 | - /** | ||
| 29 | - * 学生编号 | ||
| 30 | - */ | ||
| 31 | - private Long studentId; | ||
| 32 | - /** | ||
| 33 | - * 名字 | ||
| 34 | - */ | ||
| 35 | - private String name; | ||
| 36 | - | ||
| 37 | -} | ||
| 38 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo02/InfraDemoStudentDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo02; | ||
| 2 | - | ||
| 3 | -import lombok.*; | ||
| 4 | -import java.util.*; | ||
| 5 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 学生 DO | ||
| 10 | - * | ||
| 11 | - * @author 芋道源码 | ||
| 12 | - */ | ||
| 13 | -@TableName("infra_demo_student") | ||
| 14 | -@KeySequence("infra_demo_student_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 15 | -@Data | ||
| 16 | -@EqualsAndHashCode(callSuper = true) | ||
| 17 | -@ToString(callSuper = true) | ||
| 18 | -@Builder | ||
| 19 | -@NoArgsConstructor | ||
| 20 | -@AllArgsConstructor | ||
| 21 | -public class InfraDemoStudentDO extends BaseDO { | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 编号 | ||
| 25 | - */ | ||
| 26 | - @TableId | ||
| 27 | - private Long id; | ||
| 28 | - | ||
| 29 | -} | ||
| 30 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo11/InfraDemo11StudentContactDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo11; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | -import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 5 | -import com.baomidou.mybatisplus.annotation.TableId; | ||
| 6 | -import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | -import lombok.*; | ||
| 8 | - | ||
| 9 | -import java.time.LocalDateTime; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 学生联系人 DO | ||
| 13 | - * | ||
| 14 | - * @author 芋道源码 | ||
| 15 | - */ | ||
| 16 | -@TableName("infra_demo11_student_contact") | ||
| 17 | -@KeySequence("infra_demo11_student_contact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 18 | -@Data | ||
| 19 | -@EqualsAndHashCode(callSuper = true) | ||
| 20 | -@ToString(callSuper = true) | ||
| 21 | -@Builder | ||
| 22 | -@NoArgsConstructor | ||
| 23 | -@AllArgsConstructor | ||
| 24 | -public class InfraDemo11StudentContactDO extends BaseDO { | ||
| 25 | - | ||
| 26 | - /** | ||
| 27 | - * 编号 | ||
| 28 | - */ | ||
| 29 | - @TableId | ||
| 30 | - private Long id; | ||
| 31 | - /** | ||
| 32 | - * 学生编号 | ||
| 33 | - */ | ||
| 34 | - private Long studentId; | ||
| 35 | - /** | ||
| 36 | - * 名字 | ||
| 37 | - */ | ||
| 38 | - private String name; | ||
| 39 | - /** | ||
| 40 | - * 简介 | ||
| 41 | - */ | ||
| 42 | - private String description; | ||
| 43 | - /** | ||
| 44 | - * 出生日期 | ||
| 45 | - */ | ||
| 46 | - private LocalDateTime birthday; | ||
| 47 | - /** | ||
| 48 | - * 性别 | ||
| 49 | - * | ||
| 50 | - * 枚举 {@link TODO system_user_sex 对应的类} | ||
| 51 | - */ | ||
| 52 | - private Integer sex; | ||
| 53 | - /** | ||
| 54 | - * 是否有效 | ||
| 55 | - * | ||
| 56 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | ||
| 57 | - */ | ||
| 58 | - private Boolean enabled; | ||
| 59 | - /** | ||
| 60 | - * 头像 | ||
| 61 | - */ | ||
| 62 | - private String avatar; | ||
| 63 | - /** | ||
| 64 | - * 附件 | ||
| 65 | - */ | ||
| 66 | - private String video; | ||
| 67 | - /** | ||
| 68 | - * 备注 | ||
| 69 | - */ | ||
| 70 | - private String memo; | ||
| 71 | - | ||
| 72 | -} | ||
| 73 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo11/InfraDemo11StudentTeacherDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo11; | ||
| 2 | - | ||
| 3 | -import lombok.*; | ||
| 4 | -import java.util.*; | ||
| 5 | -import java.time.LocalDateTime; | ||
| 6 | -import java.time.LocalDateTime; | ||
| 7 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 学生班主任 DO | ||
| 12 | - * | ||
| 13 | - * @author 芋道源码 | ||
| 14 | - */ | ||
| 15 | -@TableName("infra_demo11_student_teacher") | ||
| 16 | -@KeySequence("infra_demo11_student_teacher_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 17 | -@Data | ||
| 18 | -@EqualsAndHashCode(callSuper = true) | ||
| 19 | -@ToString(callSuper = true) | ||
| 20 | -@Builder | ||
| 21 | -@NoArgsConstructor | ||
| 22 | -@AllArgsConstructor | ||
| 23 | -public class InfraDemo11StudentTeacherDO extends BaseDO { | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 编号 | ||
| 27 | - */ | ||
| 28 | - @TableId | ||
| 29 | - private Long id; | ||
| 30 | - /** | ||
| 31 | - * 学生编号 | ||
| 32 | - */ | ||
| 33 | - private Long studentId; | ||
| 34 | - /** | ||
| 35 | - * 名字 | ||
| 36 | - */ | ||
| 37 | - private String name; | ||
| 38 | - /** | ||
| 39 | - * 简介 | ||
| 40 | - */ | ||
| 41 | - private String description; | ||
| 42 | - /** | ||
| 43 | - * 出生日期 | ||
| 44 | - */ | ||
| 45 | - private LocalDateTime birthday; | ||
| 46 | - /** | ||
| 47 | - * 性别 | ||
| 48 | - * | ||
| 49 | - * 枚举 {@link TODO system_user_sex 对应的类} | ||
| 50 | - */ | ||
| 51 | - private Integer sex; | ||
| 52 | - /** | ||
| 53 | - * 是否有效 | ||
| 54 | - * | ||
| 55 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | ||
| 56 | - */ | ||
| 57 | - private Boolean enabled; | ||
| 58 | - /** | ||
| 59 | - * 头像 | ||
| 60 | - */ | ||
| 61 | - private String avatar; | ||
| 62 | - /** | ||
| 63 | - * 附件 | ||
| 64 | - */ | ||
| 65 | - private String video; | ||
| 66 | - /** | ||
| 67 | - * 备注 | ||
| 68 | - */ | ||
| 69 | - private String memo; | ||
| 70 | - | ||
| 71 | -} | ||
| 72 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentContactDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo12; | ||
| 2 | - | ||
| 3 | -import lombok.*; | ||
| 4 | -import java.util.*; | ||
| 5 | -import java.time.LocalDateTime; | ||
| 6 | -import java.time.LocalDateTime; | ||
| 7 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 学生联系人 DO | ||
| 12 | - * | ||
| 13 | - * @author 芋道源码 | ||
| 14 | - */ | ||
| 15 | -@TableName("infra_demo12_student_contact") | ||
| 16 | -@KeySequence("infra_demo12_student_contact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 17 | -@Data | ||
| 18 | -@EqualsAndHashCode(callSuper = true) | ||
| 19 | -@ToString(callSuper = true) | ||
| 20 | -@Builder | ||
| 21 | -@NoArgsConstructor | ||
| 22 | -@AllArgsConstructor | ||
| 23 | -public class InfraDemo12StudentContactDO extends BaseDO { | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 编号 | ||
| 27 | - */ | ||
| 28 | - @TableId | ||
| 29 | - private Long id; | ||
| 30 | - /** | ||
| 31 | - * 学生编号 | ||
| 32 | - */ | ||
| 33 | - private Long studentId; | ||
| 34 | - /** | ||
| 35 | - * 名字 | ||
| 36 | - */ | ||
| 37 | - private String name; | ||
| 38 | - /** | ||
| 39 | - * 简介 | ||
| 40 | - */ | ||
| 41 | - private String description; | ||
| 42 | - /** | ||
| 43 | - * 出生日期 | ||
| 44 | - */ | ||
| 45 | - private LocalDateTime birthday; | ||
| 46 | - /** | ||
| 47 | - * 性别 | ||
| 48 | - * | ||
| 49 | - * 枚举 {@link TODO system_user_sex 对应的类} | ||
| 50 | - */ | ||
| 51 | - private Integer sex; | ||
| 52 | - /** | ||
| 53 | - * 是否有效 | ||
| 54 | - * | ||
| 55 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | ||
| 56 | - */ | ||
| 57 | - private Boolean enabled; | ||
| 58 | - /** | ||
| 59 | - * 头像 | ||
| 60 | - */ | ||
| 61 | - private String avatar; | ||
| 62 | - /** | ||
| 63 | - * 附件 | ||
| 64 | - */ | ||
| 65 | - private String video; | ||
| 66 | - /** | ||
| 67 | - * 备注 | ||
| 68 | - */ | ||
| 69 | - private String memo; | ||
| 70 | - | ||
| 71 | -} | ||
| 72 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo12; | ||
| 2 | - | ||
| 3 | -import lombok.*; | ||
| 4 | -import java.util.*; | ||
| 5 | -import java.time.LocalDateTime; | ||
| 6 | -import java.time.LocalDateTime; | ||
| 7 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 学生 DO | ||
| 12 | - * | ||
| 13 | - * @author 芋道源码 | ||
| 14 | - */ | ||
| 15 | -@TableName("infra_demo12_student") | ||
| 16 | -@KeySequence("infra_demo12_student_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 17 | -@Data | ||
| 18 | -@EqualsAndHashCode(callSuper = true) | ||
| 19 | -@ToString(callSuper = true) | ||
| 20 | -@Builder | ||
| 21 | -@NoArgsConstructor | ||
| 22 | -@AllArgsConstructor | ||
| 23 | -public class InfraDemo12StudentDO extends BaseDO { | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 编号 | ||
| 27 | - */ | ||
| 28 | - @TableId | ||
| 29 | - private Long id; | ||
| 30 | - /** | ||
| 31 | - * 名字 | ||
| 32 | - */ | ||
| 33 | - private String name; | ||
| 34 | - /** | ||
| 35 | - * 简介 | ||
| 36 | - */ | ||
| 37 | - private String description; | ||
| 38 | - /** | ||
| 39 | - * 出生日期 | ||
| 40 | - */ | ||
| 41 | - private LocalDateTime birthday; | ||
| 42 | - /** | ||
| 43 | - * 性别 | ||
| 44 | - * | ||
| 45 | - * 枚举 {@link TODO system_user_sex 对应的类} | ||
| 46 | - */ | ||
| 47 | - private Integer sex; | ||
| 48 | - /** | ||
| 49 | - * 是否有效 | ||
| 50 | - * | ||
| 51 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | ||
| 52 | - */ | ||
| 53 | - private Boolean enabled; | ||
| 54 | - /** | ||
| 55 | - * 头像 | ||
| 56 | - */ | ||
| 57 | - private String avatar; | ||
| 58 | - /** | ||
| 59 | - * 附件 | ||
| 60 | - */ | ||
| 61 | - private String video; | ||
| 62 | - /** | ||
| 63 | - * 备注 | ||
| 64 | - */ | ||
| 65 | - private String memo; | ||
| 66 | - | ||
| 67 | -} | ||
| 68 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo12/InfraDemo12StudentTeacherDO.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.dataobject.demo12; | ||
| 2 | - | ||
| 3 | -import lombok.*; | ||
| 4 | -import java.util.*; | ||
| 5 | -import java.time.LocalDateTime; | ||
| 6 | -import java.time.LocalDateTime; | ||
| 7 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 学生班主任 DO | ||
| 12 | - * | ||
| 13 | - * @author 芋道源码 | ||
| 14 | - */ | ||
| 15 | -@TableName("infra_demo12_student_teacher") | ||
| 16 | -@KeySequence("infra_demo12_student_teacher_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 17 | -@Data | ||
| 18 | -@EqualsAndHashCode(callSuper = true) | ||
| 19 | -@ToString(callSuper = true) | ||
| 20 | -@Builder | ||
| 21 | -@NoArgsConstructor | ||
| 22 | -@AllArgsConstructor | ||
| 23 | -public class InfraDemo12StudentTeacherDO extends BaseDO { | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 编号 | ||
| 27 | - */ | ||
| 28 | - @TableId | ||
| 29 | - private Long id; | ||
| 30 | - /** | ||
| 31 | - * 学生编号 | ||
| 32 | - */ | ||
| 33 | - private Long studentId; | ||
| 34 | - /** | ||
| 35 | - * 名字 | ||
| 36 | - */ | ||
| 37 | - private String name; | ||
| 38 | - /** | ||
| 39 | - * 简介 | ||
| 40 | - */ | ||
| 41 | - private String description; | ||
| 42 | - /** | ||
| 43 | - * 出生日期 | ||
| 44 | - */ | ||
| 45 | - private LocalDateTime birthday; | ||
| 46 | - /** | ||
| 47 | - * 性别 | ||
| 48 | - * | ||
| 49 | - * 枚举 {@link TODO system_user_sex 对应的类} | ||
| 50 | - */ | ||
| 51 | - private Integer sex; | ||
| 52 | - /** | ||
| 53 | - * 是否有效 | ||
| 54 | - * | ||
| 55 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | ||
| 56 | - */ | ||
| 57 | - private Boolean enabled; | ||
| 58 | - /** | ||
| 59 | - * 头像 | ||
| 60 | - */ | ||
| 61 | - private String avatar; | ||
| 62 | - /** | ||
| 63 | - * 附件 | ||
| 64 | - */ | ||
| 65 | - private String video; | ||
| 66 | - /** | ||
| 67 | - * 备注 | ||
| 68 | - */ | ||
| 69 | - private String memo; | ||
| 70 | - | ||
| 71 | -} | ||
| 72 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/demo01/Demo01ContactMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo01; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 示例联系人 Mapper | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface Demo01ContactMapper extends BaseMapperX<Demo01ContactDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<Demo01ContactDO> selectPage(Demo01ContactPageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<Demo01ContactDO>() | ||
| 20 | + .likeIfPresent(Demo01ContactDO::getName, reqVO.getName()) | ||
| 21 | + .eqIfPresent(Demo01ContactDO::getSex, reqVO.getSex()) | ||
| 22 | + .betweenIfPresent(Demo01ContactDO::getCreateTime, reqVO.getCreateTime()) | ||
| 23 | + .orderByDesc(Demo01ContactDO::getId)); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | +} | ||
| 0 | \ No newline at end of file | 27 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.service.demo.demo01; | ||
| 2 | + | ||
| 3 | +import javax.validation.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO; | ||
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 示例联系人 Service 接口 | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +public interface Demo01ContactService { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 创建示例联系人 | ||
| 19 | + * | ||
| 20 | + * @param createReqVO 创建信息 | ||
| 21 | + * @return 编号 | ||
| 22 | + */ | ||
| 23 | + Long createDemo01Contact(@Valid Demo01ContactSaveReqVO createReqVO); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 更新示例联系人 | ||
| 27 | + * | ||
| 28 | + * @param updateReqVO 更新信息 | ||
| 29 | + */ | ||
| 30 | + void updateDemo01Contact(@Valid Demo01ContactSaveReqVO updateReqVO); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 删除示例联系人 | ||
| 34 | + * | ||
| 35 | + * @param id 编号 | ||
| 36 | + */ | ||
| 37 | + void deleteDemo01Contact(Long id); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 获得示例联系人 | ||
| 41 | + * | ||
| 42 | + * @param id 编号 | ||
| 43 | + * @return 示例联系人 | ||
| 44 | + */ | ||
| 45 | + Demo01ContactDO getDemo01Contact(Long id); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 获得示例联系人分页 | ||
| 49 | + * | ||
| 50 | + * @param pageReqVO 分页查询 | ||
| 51 | + * @return 示例联系人分页 | ||
| 52 | + */ | ||
| 53 | + PageResult<Demo01ContactDO> getDemo01ContactPage(Demo01ContactPageReqVO pageReqVO); | ||
| 54 | + | ||
| 55 | +} | ||
| 0 | \ No newline at end of file | 56 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo01/Demo01ContactServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.service.demo.demo01; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO; | ||
| 5 | +import org.springframework.stereotype.Service; | ||
| 6 | +import javax.annotation.Resource; | ||
| 7 | +import org.springframework.validation.annotation.Validated; | ||
| 8 | + | ||
| 9 | +import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO; | ||
| 10 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 11 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 12 | + | ||
| 13 | +import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo01.Demo01ContactMapper; | ||
| 14 | + | ||
| 15 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 16 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 示例联系人 Service 实现类 | ||
| 20 | + * | ||
| 21 | + * @author 芋道源码 | ||
| 22 | + */ | ||
| 23 | +@Service | ||
| 24 | +@Validated | ||
| 25 | +public class Demo01ContactServiceImpl implements Demo01ContactService { | ||
| 26 | + | ||
| 27 | + @Resource | ||
| 28 | + private Demo01ContactMapper demo01ContactMapper; | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public Long createDemo01Contact(Demo01ContactSaveReqVO createReqVO) { | ||
| 32 | + // 插入 | ||
| 33 | + Demo01ContactDO demo01Contact = BeanUtils.toBean(createReqVO, Demo01ContactDO.class); | ||
| 34 | + demo01ContactMapper.insert(demo01Contact); | ||
| 35 | + // 返回 | ||
| 36 | + return demo01Contact.getId(); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public void updateDemo01Contact(Demo01ContactSaveReqVO updateReqVO) { | ||
| 41 | + // 校验存在 | ||
| 42 | + validateDemo01ContactExists(updateReqVO.getId()); | ||
| 43 | + // 更新 | ||
| 44 | + Demo01ContactDO updateObj = BeanUtils.toBean(updateReqVO, Demo01ContactDO.class); | ||
| 45 | + demo01ContactMapper.updateById(updateObj); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public void deleteDemo01Contact(Long id) { | ||
| 50 | + // 校验存在 | ||
| 51 | + validateDemo01ContactExists(id); | ||
| 52 | + // 删除 | ||
| 53 | + demo01ContactMapper.deleteById(id); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + private void validateDemo01ContactExists(Long id) { | ||
| 57 | + if (demo01ContactMapper.selectById(id) == null) { | ||
| 58 | + throw exception(DEMO01_CONTACT_NOT_EXISTS); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public Demo01ContactDO getDemo01Contact(Long id) { | ||
| 64 | + return demo01ContactMapper.selectById(id); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public PageResult<Demo01ContactDO> getDemo01ContactPage(Demo01ContactPageReqVO pageReqVO) { | ||
| 69 | + return demo01ContactMapper.selectPage(pageReqVO); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | +} | ||
| 0 | \ No newline at end of file | 73 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/mapper/demo01/InfraDemo01StudentMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | -<mapper namespace="cn.iocoder.yudao.module.infra.dal.mysql.demo01.InfraDemo01StudentMapper"> | ||
| 4 | - | ||
| 5 | - <!-- | ||
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | ||
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | ||
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | ||
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | ||
| 10 | - --> | ||
| 11 | - | ||
| 12 | -</mapper> | ||
| 13 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/mapper/demo11/InfraDemo11StudentMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | -<mapper namespace="cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentMapper"> | ||
| 4 | - | ||
| 5 | - <!-- | ||
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | ||
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | ||
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | ||
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | ||
| 10 | - --> | ||
| 11 | - | ||
| 12 | -</mapper> | ||
| 13 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/mapper/demo12/InfraDemo12StudentMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | -<mapper namespace="cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper"> | ||
| 4 | - | ||
| 5 | - <!-- | ||
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | ||
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | ||
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | ||
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | ||
| 10 | - --> | ||
| 11 | - | ||
| 12 | -</mapper> | ||
| 13 | \ No newline at end of file | 0 | \ No newline at end of file |