mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-18 19:20:05 +08:00
清理一波 demo 示例代码,准备重新生成
This commit is contained in:
parent
413640f593
commit
d83e0413b8
@ -1,89 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.convert.demo01.InfraDemo01StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.service.demo01.InfraDemo01StudentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 学生")
|
||||
@RestController
|
||||
@RequestMapping("/infra/demo01-student")
|
||||
@Validated
|
||||
public class InfraDemo01StudentController {
|
||||
|
||||
@Resource
|
||||
private InfraDemo01StudentService demo01StudentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-student:create')")
|
||||
public CommonResult<Long> createDemo01Student(@Valid @RequestBody InfraDemo01StudentCreateReqVO createReqVO) {
|
||||
return success(demo01StudentService.createDemo01Student(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-student:update')")
|
||||
public CommonResult<Boolean> updateDemo01Student(@Valid @RequestBody InfraDemo01StudentUpdateReqVO updateReqVO) {
|
||||
demo01StudentService.updateDemo01Student(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除学生")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo01Student(@RequestParam("id") Long id) {
|
||||
demo01StudentService.deleteDemo01Student(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得学生")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-student:query')")
|
||||
public CommonResult<InfraDemo01StudentRespVO> getDemo01Student(@RequestParam("id") Long id) {
|
||||
InfraDemo01StudentDO demo01Student = demo01StudentService.getDemo01Student(id);
|
||||
return success(InfraDemo01StudentConvert.INSTANCE.convert(demo01Student));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得学生分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-student:query')")
|
||||
public CommonResult<PageResult<InfraDemo01StudentRespVO>> getDemo01StudentPage(@Valid InfraDemo01StudentPageReqVO pageVO) {
|
||||
PageResult<InfraDemo01StudentDO> pageResult = demo01StudentService.getDemo01StudentPage(pageVO);
|
||||
return success(InfraDemo01StudentConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出学生 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo01-student:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDemo01StudentExcel(@Valid InfraDemo01StudentExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfraDemo01StudentDO> list = demo01StudentService.getDemo01StudentList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfraDemo01StudentExcelVO> datas = InfraDemo01StudentConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "学生.xls", "数据", InfraDemo01StudentExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 学生 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemo01StudentBaseVO {
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头")
|
||||
@NotEmpty(message = "名字不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍")
|
||||
@NotEmpty(message = "简介不能为空")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "出生日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "是否有效不能为空")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
|
||||
@NotEmpty(message = "头像不能为空")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4")
|
||||
private String video;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String memo;
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 学生创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo01StudentCreateReqVO extends InfraDemo01StudentBaseVO {
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 学生 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemo01StudentExcelVO {
|
||||
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("简介")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@ExcelProperty(value = "性别", converter = DictConvert.class)
|
||||
@DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Integer sex;
|
||||
|
||||
@ExcelProperty(value = "是否有效", converter = DictConvert.class)
|
||||
@DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Boolean enabled;
|
||||
|
||||
@ExcelProperty(value = "支付方式", converter = DictConvert.class)
|
||||
@DictFormat("pay_channel_code") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private String payChannels;
|
||||
|
||||
@ExcelProperty("头像")
|
||||
private String avatar;
|
||||
|
||||
@ExcelProperty("附件")
|
||||
private String video;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo01StudentPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfraDemo01StudentExportReqVO {
|
||||
|
||||
@Schema(description = "名字", example = "芋头")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", example = "true")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 学生分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo01StudentPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名字", example = "芋头")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", example = "true")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo01StudentRespVO extends InfraDemo01StudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo01.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 学生更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo01StudentUpdateReqVO extends InfraDemo01StudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO;
|
||||
import cn.iocoder.yudao.module.infra.convert.demo02.InfraDemoStudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.service.demo02.InfraDemoStudentService;
|
||||
|
||||
@Tag(name = "管理后台 - 学生")
|
||||
@RestController
|
||||
@RequestMapping("/infra/demo-student")
|
||||
@Validated
|
||||
public class InfraDemoStudentController {
|
||||
|
||||
@Resource
|
||||
private InfraDemoStudentService demoStudentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:create')")
|
||||
public CommonResult<Long> createDemoStudent(@Valid @RequestBody InfraDemoStudentCreateReqVO createReqVO) {
|
||||
return success(demoStudentService.createDemoStudent(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:update')")
|
||||
public CommonResult<Boolean> updateDemoStudent(@Valid @RequestBody InfraDemoStudentUpdateReqVO updateReqVO) {
|
||||
demoStudentService.updateDemoStudent(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除学生")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemoStudent(@RequestParam("id") Long id) {
|
||||
demoStudentService.deleteDemoStudent(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得学生")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:query')")
|
||||
public CommonResult<InfraDemoStudentRespVO> getDemoStudent(@RequestParam("id") Long id) {
|
||||
InfraDemoStudentDO demoStudent = demoStudentService.getDemoStudent(id);
|
||||
return success(InfraDemoStudentConvert.INSTANCE.convert(demoStudent));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得学生分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:query')")
|
||||
public CommonResult<PageResult<InfraDemoStudentRespVO>> getDemoStudentPage(@Valid InfraDemoStudentPageReqVO pageVO) {
|
||||
PageResult<InfraDemoStudentDO> pageResult = demoStudentService.getDemoStudentPage(pageVO);
|
||||
return success(InfraDemoStudentConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出学生 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDemoStudentExcel(@Valid InfraDemoStudentExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfraDemoStudentDO> list = demoStudentService.getDemoStudentList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfraDemoStudentExcelVO> datas = InfraDemoStudentConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "学生.xls", "数据", InfraDemoStudentExcelVO.class, datas);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@GetMapping("/demo-student/list-by-student-id")
|
||||
@Operation(summary = "获得学生联系人列表")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:query')")
|
||||
public CommonResult<List<InfraDemoStudentContactDO>> getDemoStudentContactListByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demoStudentService.getDemoStudentContactListByStudentId(studentId));
|
||||
}
|
||||
|
||||
// ==================== 子表(学生地址) ====================
|
||||
|
||||
@GetMapping("/demo-student/get-by-student-id")
|
||||
@Operation(summary = "获得学生地址")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo-student:query')")
|
||||
public CommonResult<InfraDemoStudentAddressDO> getDemoStudentAddressByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demoStudentService.getDemoStudentAddressByStudentId(studentId));
|
||||
}
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02;
|
@ -1,21 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO;
|
||||
|
||||
/**
|
||||
* 学生 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemoStudentBaseVO {
|
||||
|
||||
private List<InfraDemoStudentContactDO> demoStudentContacts;
|
||||
|
||||
private InfraDemoStudentAddressDO demoStudentAddress;
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 学生创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemoStudentCreateReqVO extends InfraDemoStudentBaseVO {
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 学生 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemoStudentExcelVO {
|
||||
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemoStudentPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfraDemoStudentExportReqVO {
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 学生分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemoStudentPageReqVO extends PageParam {
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemoStudentRespVO extends InfraDemoStudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo02.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 学生更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemoStudentUpdateReqVO extends InfraDemoStudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO;
|
||||
import cn.iocoder.yudao.module.infra.convert.demo11.InfraDemo11StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.service.demo11.InfraDemo11StudentService;
|
||||
|
||||
@Tag(name = "管理后台 - 学生")
|
||||
@RestController
|
||||
@RequestMapping("/infra/demo11-student")
|
||||
@Validated
|
||||
public class InfraDemo11StudentController {
|
||||
|
||||
@Resource
|
||||
private InfraDemo11StudentService demo11StudentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:create')")
|
||||
public CommonResult<Long> createDemo11Student(@Valid @RequestBody InfraDemo11StudentCreateReqVO createReqVO) {
|
||||
return success(demo11StudentService.createDemo11Student(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:update')")
|
||||
public CommonResult<Boolean> updateDemo11Student(@Valid @RequestBody InfraDemo11StudentUpdateReqVO updateReqVO) {
|
||||
demo11StudentService.updateDemo11Student(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除学生")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo11Student(@RequestParam("id") Long id) {
|
||||
demo11StudentService.deleteDemo11Student(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得学生")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:query')")
|
||||
public CommonResult<InfraDemo11StudentRespVO> getDemo11Student(@RequestParam("id") Long id) {
|
||||
InfraDemo11StudentDO demo11Student = demo11StudentService.getDemo11Student(id);
|
||||
return success(InfraDemo11StudentConvert.INSTANCE.convert(demo11Student));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得学生分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:query')")
|
||||
public CommonResult<PageResult<InfraDemo11StudentRespVO>> getDemo11StudentPage(@Valid InfraDemo11StudentPageReqVO pageVO) {
|
||||
PageResult<InfraDemo11StudentDO> pageResult = demo11StudentService.getDemo11StudentPage(pageVO);
|
||||
return success(InfraDemo11StudentConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出学生 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDemo11StudentExcel(@Valid InfraDemo11StudentExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfraDemo11StudentDO> list = demo11StudentService.getDemo11StudentList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfraDemo11StudentExcelVO> datas = InfraDemo11StudentConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "学生.xls", "数据", InfraDemo11StudentExcelVO.class, datas);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@GetMapping("/demo11-student/list-by-student-id")
|
||||
@Operation(summary = "获得学生联系人列表")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:query')")
|
||||
public CommonResult<List<InfraDemo11StudentContactDO>> getDemo11StudentContactListByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demo11StudentService.getDemo11StudentContactListByStudentId(studentId));
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
@GetMapping("/demo11-student/get-by-student-id")
|
||||
@Operation(summary = "获得学生班主任")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo11-student:query')")
|
||||
public CommonResult<InfraDemo11StudentTeacherDO> getDemo11StudentTeacherByStudentId(@RequestParam("studentId") Long studentId) {
|
||||
return success(demo11StudentService.getDemo11StudentTeacherByStudentId(studentId));
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
/**
|
||||
* 代码生成示例:单表(增删改查)
|
||||
*
|
||||
* @see cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum#getType()
|
||||
*/
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11;
|
@ -1,57 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO;
|
||||
|
||||
/**
|
||||
* 学生 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemo11StudentBaseVO {
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头")
|
||||
@NotEmpty(message = "名字不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍")
|
||||
@NotEmpty(message = "简介不能为空")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "出生日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "是否有效不能为空")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
|
||||
@NotEmpty(message = "头像不能为空")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4")
|
||||
private String video;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String memo;
|
||||
|
||||
private List<InfraDemo11StudentContactDO> demo11StudentContacts;
|
||||
|
||||
private InfraDemo11StudentTeacherDO demo11StudentTeacher;
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 学生创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo11StudentCreateReqVO extends InfraDemo11StudentBaseVO {
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
|
||||
/**
|
||||
* 学生 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemo11StudentExcelVO {
|
||||
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("简介")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@ExcelProperty(value = "性别", converter = DictConvert.class)
|
||||
@DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Integer sex;
|
||||
|
||||
@ExcelProperty(value = "是否有效", converter = DictConvert.class)
|
||||
@DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Boolean enabled;
|
||||
|
||||
@ExcelProperty("头像")
|
||||
private String avatar;
|
||||
|
||||
@ExcelProperty("附件")
|
||||
private String video;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo11StudentPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfraDemo11StudentExportReqVO {
|
||||
|
||||
@Schema(description = "名字", example = "芋头")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", example = "true")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 学生分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo11StudentPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名字", example = "芋头")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", example = "true")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo11StudentRespVO extends InfraDemo11StudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo11.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 学生更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo11StudentUpdateReqVO extends InfraDemo11StudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,178 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import cn.iocoder.yudao.module.infra.service.demo12.InfraDemo12StudentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 学生")
|
||||
@RestController
|
||||
@RequestMapping("/infra/demo12-student")
|
||||
@Validated
|
||||
public class InfraDemo12StudentController {
|
||||
|
||||
@Resource
|
||||
private InfraDemo12StudentService demo12StudentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:create')")
|
||||
public CommonResult<Long> createDemo12Student(@Valid @RequestBody InfraDemo12StudentCreateReqVO createReqVO) {
|
||||
return success(demo12StudentService.createDemo12Student(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新学生")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:update')")
|
||||
public CommonResult<Boolean> updateDemo12Student(@Valid @RequestBody InfraDemo12StudentUpdateReqVO updateReqVO) {
|
||||
demo12StudentService.updateDemo12Student(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除学生")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo12Student(@RequestParam("id") Long id) {
|
||||
demo12StudentService.deleteDemo12Student(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得学生")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<InfraDemo12StudentRespVO> getDemo12Student(@RequestParam("id") Long id) {
|
||||
InfraDemo12StudentDO demo12Student = demo12StudentService.getDemo12Student(id);
|
||||
return success(InfraDemo12StudentConvert.INSTANCE.convert(demo12Student));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得学生分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<PageResult<InfraDemo12StudentRespVO>> getDemo12StudentPage(@Valid InfraDemo12StudentPageReqVO pageVO) {
|
||||
PageResult<InfraDemo12StudentDO> pageResult = demo12StudentService.getDemo12StudentPage(pageVO);
|
||||
return success(InfraDemo12StudentConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出学生 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDemo12StudentExcel(@Valid InfraDemo12StudentExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfraDemo12StudentDO> list = demo12StudentService.getDemo12StudentList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfraDemo12StudentExcelVO> datas = InfraDemo12StudentConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "学生.xls", "数据", InfraDemo12StudentExcelVO.class, datas);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@GetMapping("/demo12-student-contact/page")
|
||||
@Operation(summary = "获得学生联系人分页")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<PageResult<InfraDemo12StudentContactDO>> getDemo12StudentContactPage(PageParam pageReqVO,
|
||||
@RequestParam("studentId") Long studentId) {
|
||||
return success(demo12StudentService.getDemo12StudentContactPage(pageReqVO, studentId));
|
||||
}
|
||||
|
||||
@PostMapping("/demo12-student-contact/create")
|
||||
@Operation(summary = "创建学生联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:create')")
|
||||
public CommonResult<Long> createDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
return success(demo12StudentService.createDemo12StudentContact(demo12StudentContact));
|
||||
}
|
||||
|
||||
@PutMapping("/demo12-student-contact/update")
|
||||
@Operation(summary = "更新学生联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:update')")
|
||||
public CommonResult<Boolean> updateDemo12StudentContact(@Valid @RequestBody InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
demo12StudentService.updateDemo12StudentContact(demo12StudentContact);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/demo12-student-contact/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除学生联系人")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo12StudentContact(@RequestParam("id") Long id) {
|
||||
demo12StudentService.deleteDemo12StudentContact(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/demo12-student-contact/get")
|
||||
@Operation(summary = "获得学生联系人")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<InfraDemo12StudentContactDO> getDemo12StudentContact(@RequestParam("id") Long id) {
|
||||
return success(demo12StudentService.getDemo12StudentContact(id));
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
@GetMapping("/demo12-student-teacher/page")
|
||||
@Operation(summary = "获得学生班主任分页")
|
||||
@Parameter(name = "studentId", description = "学生编号")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<PageResult<InfraDemo12StudentTeacherDO>> getDemo12StudentTeacherPage(PageParam pageReqVO,
|
||||
@RequestParam("studentId") Long studentId) {
|
||||
return success(demo12StudentService.getDemo12StudentTeacherPage(pageReqVO, studentId));
|
||||
}
|
||||
|
||||
@PostMapping("/demo12-student-teacher/create")
|
||||
@Operation(summary = "创建学生班主任")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:create')")
|
||||
public CommonResult<Long> createDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
return success(demo12StudentService.createDemo12StudentTeacher(demo12StudentTeacher));
|
||||
}
|
||||
|
||||
@PutMapping("/demo12-student-teacher/update")
|
||||
@Operation(summary = "更新学生班主任")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:update')")
|
||||
public CommonResult<Boolean> updateDemo12StudentTeacher(@Valid @RequestBody InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
demo12StudentService.updateDemo12StudentTeacher(demo12StudentTeacher);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/demo12-student-teacher/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除学生班主任")
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:delete')")
|
||||
public CommonResult<Boolean> deleteDemo12StudentTeacher(@RequestParam("id") Long id) {
|
||||
demo12StudentService.deleteDemo12StudentTeacher(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/demo12-student-teacher/get")
|
||||
@Operation(summary = "获得学生班主任")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:demo12-student:query')")
|
||||
public CommonResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacher(@RequestParam("id") Long id) {
|
||||
return success(demo12StudentService.getDemo12StudentTeacher(id));
|
||||
}
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
|
||||
/**
|
||||
* 学生 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemo12StudentBaseVO {
|
||||
|
||||
@Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋头")
|
||||
@NotEmpty(message = "名字不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是介绍")
|
||||
@NotEmpty(message = "简介不能为空")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "出生日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "出生日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "是否有效不能为空")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
|
||||
@NotEmpty(message = "头像不能为空")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "附件", example = "https://www.iocoder.cn/1.mp4")
|
||||
private String video;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是备注")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String memo;
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 学生创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo12StudentCreateReqVO extends InfraDemo12StudentBaseVO {
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
|
||||
/**
|
||||
* 学生 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfraDemo12StudentExcelVO {
|
||||
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("简介")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@ExcelProperty(value = "性别", converter = DictConvert.class)
|
||||
@DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Integer sex;
|
||||
|
||||
@ExcelProperty(value = "是否有效", converter = DictConvert.class)
|
||||
@DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Boolean enabled;
|
||||
|
||||
@ExcelProperty("头像")
|
||||
private String avatar;
|
||||
|
||||
@ExcelProperty("附件")
|
||||
private String video;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Excel 导出 Request VO,参数和 InfraDemo12StudentPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfraDemo12StudentExportReqVO {
|
||||
|
||||
@Schema(description = "名字", example = "芋头")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", example = "true")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 学生分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo12StudentPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名字", example = "芋头")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "性别", example = "1")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "是否有效", example = "true")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 学生 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo12StudentRespVO extends InfraDemo12StudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.demo12.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 学生更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfraDemo12StudentUpdateReqVO extends InfraDemo12StudentBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.demo01;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO;
|
||||
|
||||
/**
|
||||
* 学生 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo01StudentConvert {
|
||||
|
||||
InfraDemo01StudentConvert INSTANCE = Mappers.getMapper(InfraDemo01StudentConvert.class);
|
||||
|
||||
InfraDemo01StudentDO convert(InfraDemo01StudentCreateReqVO bean);
|
||||
|
||||
InfraDemo01StudentDO convert(InfraDemo01StudentUpdateReqVO bean);
|
||||
|
||||
InfraDemo01StudentRespVO convert(InfraDemo01StudentDO bean);
|
||||
|
||||
List<InfraDemo01StudentRespVO> convertList(List<InfraDemo01StudentDO> list);
|
||||
|
||||
PageResult<InfraDemo01StudentRespVO> convertPage(PageResult<InfraDemo01StudentDO> page);
|
||||
|
||||
List<InfraDemo01StudentExcelVO> convertList02(List<InfraDemo01StudentDO> list);
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.demo02;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemoStudentConvert {
|
||||
|
||||
InfraDemoStudentConvert INSTANCE = Mappers.getMapper(InfraDemoStudentConvert.class);
|
||||
|
||||
InfraDemoStudentDO convert(InfraDemoStudentCreateReqVO bean);
|
||||
|
||||
InfraDemoStudentDO convert(InfraDemoStudentUpdateReqVO bean);
|
||||
|
||||
InfraDemoStudentRespVO convert(InfraDemoStudentDO bean);
|
||||
|
||||
List<InfraDemoStudentRespVO> convertList(List<InfraDemoStudentDO> list);
|
||||
|
||||
PageResult<InfraDemoStudentRespVO> convertPage(PageResult<InfraDemoStudentDO> page);
|
||||
|
||||
List<InfraDemoStudentExcelVO> convertList02(List<InfraDemoStudentDO> list);
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.demo11;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO;
|
||||
|
||||
/**
|
||||
* 学生 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo11StudentConvert {
|
||||
|
||||
InfraDemo11StudentConvert INSTANCE = Mappers.getMapper(InfraDemo11StudentConvert.class);
|
||||
|
||||
InfraDemo11StudentDO convert(InfraDemo11StudentCreateReqVO bean);
|
||||
|
||||
InfraDemo11StudentDO convert(InfraDemo11StudentUpdateReqVO bean);
|
||||
|
||||
InfraDemo11StudentRespVO convert(InfraDemo11StudentDO bean);
|
||||
|
||||
List<InfraDemo11StudentRespVO> convertList(List<InfraDemo11StudentDO> list);
|
||||
|
||||
PageResult<InfraDemo11StudentRespVO> convertPage(PageResult<InfraDemo11StudentDO> page);
|
||||
|
||||
List<InfraDemo11StudentExcelVO> convertList02(List<InfraDemo11StudentDO> list);
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.demo12;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
|
||||
/**
|
||||
* 学生 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo12StudentConvert {
|
||||
|
||||
InfraDemo12StudentConvert INSTANCE = Mappers.getMapper(InfraDemo12StudentConvert.class);
|
||||
|
||||
InfraDemo12StudentDO convert(InfraDemo12StudentCreateReqVO bean);
|
||||
|
||||
InfraDemo12StudentDO convert(InfraDemo12StudentUpdateReqVO bean);
|
||||
|
||||
InfraDemo12StudentRespVO convert(InfraDemo12StudentDO bean);
|
||||
|
||||
List<InfraDemo12StudentRespVO> convertList(List<InfraDemo12StudentDO> list);
|
||||
|
||||
PageResult<InfraDemo12StudentRespVO> convertPage(PageResult<InfraDemo12StudentDO> page);
|
||||
|
||||
List<InfraDemo12StudentExcelVO> convertList02(List<InfraDemo12StudentDO> list);
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo01;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*;
|
||||
|
||||
/**
|
||||
* 学生 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo01StudentMapper extends BaseMapperX<InfraDemo01StudentDO> {
|
||||
|
||||
default PageResult<InfraDemo01StudentDO> selectPage(InfraDemo01StudentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo01StudentDO>()
|
||||
.likeIfPresent(InfraDemo01StudentDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfraDemo01StudentDO::getBirthday, reqVO.getBirthday())
|
||||
.eqIfPresent(InfraDemo01StudentDO::getSex, reqVO.getSex())
|
||||
.eqIfPresent(InfraDemo01StudentDO::getEnabled, reqVO.getEnabled())
|
||||
.betweenIfPresent(InfraDemo01StudentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(InfraDemo01StudentDO::getId));
|
||||
}
|
||||
|
||||
default List<InfraDemo01StudentDO> selectList(InfraDemo01StudentExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<InfraDemo01StudentDO>()
|
||||
.likeIfPresent(InfraDemo01StudentDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfraDemo01StudentDO::getBirthday, reqVO.getBirthday())
|
||||
.eqIfPresent(InfraDemo01StudentDO::getSex, reqVO.getSex())
|
||||
.eqIfPresent(InfraDemo01StudentDO::getEnabled, reqVO.getEnabled())
|
||||
.betweenIfPresent(InfraDemo01StudentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(InfraDemo01StudentDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo02;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 学生地址 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemoStudentAddressMapper extends BaseMapperX<InfraDemoStudentAddressDO> {
|
||||
|
||||
default InfraDemoStudentAddressDO selectByStudentId(Long studentId) {
|
||||
return selectOne(InfraDemoStudentAddressDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
default List<InfraDemoStudentAddressDO> selectListByStudentId(List<Long> studentIds) {
|
||||
return selectList(InfraDemoStudentAddressDO::getStudentId, studentIds);
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(InfraDemoStudentAddressDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo02;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生联系人 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemoStudentContactMapper extends BaseMapperX<InfraDemoStudentContactDO> {
|
||||
|
||||
default List<InfraDemoStudentContactDO> selectListByStudentId(Long studentId) {
|
||||
return selectList(InfraDemoStudentContactDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
default List<InfraDemoStudentContactDO> selectListByStudentId(List<Long> studentIds) {
|
||||
return selectList(InfraDemoStudentContactDO::getStudentId, studentIds);
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(InfraDemoStudentContactDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo02;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.InfraDemoStudentPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemoStudentMapper extends BaseMapperX<InfraDemoStudentDO> {
|
||||
|
||||
default PageResult<InfraDemoStudentDO> selectPage(InfraDemoStudentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemoStudentDO>()
|
||||
.orderByDesc(InfraDemoStudentDO::getId));
|
||||
}
|
||||
|
||||
default List<InfraDemoStudentDO> selectList(InfraDemoStudentExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<InfraDemoStudentDO>()
|
||||
.orderByDesc(InfraDemoStudentDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo11;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 学生联系人 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo11StudentContactMapper extends BaseMapperX<InfraDemo11StudentContactDO> {
|
||||
|
||||
default List<InfraDemo11StudentContactDO> selectListByStudentId(Long studentId) {
|
||||
return selectList(InfraDemo11StudentContactDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(InfraDemo11StudentContactDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo11;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*;
|
||||
|
||||
/**
|
||||
* 学生 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo11StudentMapper extends BaseMapperX<InfraDemo11StudentDO> {
|
||||
|
||||
default PageResult<InfraDemo11StudentDO> selectPage(InfraDemo11StudentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo11StudentDO>()
|
||||
.likeIfPresent(InfraDemo11StudentDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfraDemo11StudentDO::getBirthday, reqVO.getBirthday())
|
||||
.eqIfPresent(InfraDemo11StudentDO::getSex, reqVO.getSex())
|
||||
.eqIfPresent(InfraDemo11StudentDO::getEnabled, reqVO.getEnabled())
|
||||
.betweenIfPresent(InfraDemo11StudentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(InfraDemo11StudentDO::getId));
|
||||
}
|
||||
|
||||
default List<InfraDemo11StudentDO> selectList(InfraDemo11StudentExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<InfraDemo11StudentDO>()
|
||||
.likeIfPresent(InfraDemo11StudentDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfraDemo11StudentDO::getBirthday, reqVO.getBirthday())
|
||||
.eqIfPresent(InfraDemo11StudentDO::getSex, reqVO.getSex())
|
||||
.eqIfPresent(InfraDemo11StudentDO::getEnabled, reqVO.getEnabled())
|
||||
.betweenIfPresent(InfraDemo11StudentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(InfraDemo11StudentDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo11;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 学生班主任 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo11StudentTeacherMapper extends BaseMapperX<InfraDemo11StudentTeacherDO> {
|
||||
|
||||
default InfraDemo11StudentTeacherDO selectByStudentId(Long studentId) {
|
||||
return selectOne(InfraDemo11StudentTeacherDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(InfraDemo11StudentTeacherDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo12;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 学生联系人 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo12StudentContactMapper extends BaseMapperX<InfraDemo12StudentContactDO> {
|
||||
|
||||
default PageResult<InfraDemo12StudentContactDO> selectPage(PageParam reqVO, Long studentId) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentContactDO>()
|
||||
.eq(InfraDemo12StudentContactDO::getStudentId, studentId)
|
||||
.orderByDesc(InfraDemo12StudentContactDO::getId));
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(InfraDemo12StudentContactDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo12;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*;
|
||||
|
||||
/**
|
||||
* 学生 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo12StudentMapper extends BaseMapperX<InfraDemo12StudentDO> {
|
||||
|
||||
default PageResult<InfraDemo12StudentDO> selectPage(InfraDemo12StudentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentDO>()
|
||||
.likeIfPresent(InfraDemo12StudentDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfraDemo12StudentDO::getBirthday, reqVO.getBirthday())
|
||||
.eqIfPresent(InfraDemo12StudentDO::getSex, reqVO.getSex())
|
||||
.eqIfPresent(InfraDemo12StudentDO::getEnabled, reqVO.getEnabled())
|
||||
.betweenIfPresent(InfraDemo12StudentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(InfraDemo12StudentDO::getId));
|
||||
}
|
||||
|
||||
default List<InfraDemo12StudentDO> selectList(InfraDemo12StudentExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<InfraDemo12StudentDO>()
|
||||
.likeIfPresent(InfraDemo12StudentDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfraDemo12StudentDO::getBirthday, reqVO.getBirthday())
|
||||
.eqIfPresent(InfraDemo12StudentDO::getSex, reqVO.getSex())
|
||||
.eqIfPresent(InfraDemo12StudentDO::getEnabled, reqVO.getEnabled())
|
||||
.betweenIfPresent(InfraDemo12StudentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(InfraDemo12StudentDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo12;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 学生班主任 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfraDemo12StudentTeacherMapper extends BaseMapperX<InfraDemo12StudentTeacherDO> {
|
||||
|
||||
default PageResult<InfraDemo12StudentTeacherDO> selectPage(PageParam reqVO, Long studentId) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfraDemo12StudentTeacherDO>()
|
||||
.eq(InfraDemo12StudentTeacherDO::getStudentId, studentId)
|
||||
.orderByDesc(InfraDemo12StudentTeacherDO::getId));
|
||||
}
|
||||
|
||||
default int deleteByStudentId(Long studentId) {
|
||||
return delete(InfraDemo12StudentTeacherDO::getStudentId, studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo01;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 学生 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfraDemo01StudentService {
|
||||
|
||||
/**
|
||||
* 创建学生
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo01Student(@Valid InfraDemo01StudentCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新学生
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemo01Student(@Valid InfraDemo01StudentUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo01Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生
|
||||
*/
|
||||
InfraDemo01StudentDO getDemo01Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 学生分页
|
||||
*/
|
||||
PageResult<InfraDemo01StudentDO> getDemo01StudentPage(InfraDemo01StudentPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得学生列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 学生列表
|
||||
*/
|
||||
List<InfraDemo01StudentDO> getDemo01StudentList(InfraDemo01StudentExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo01;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo01.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo01.InfraDemo01StudentDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.convert.demo01.InfraDemo01StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo01.InfraDemo01StudentMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
|
||||
/**
|
||||
* 学生 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class InfraDemo01StudentServiceImpl implements InfraDemo01StudentService {
|
||||
|
||||
@Resource
|
||||
private InfraDemo01StudentMapper demo01StudentMapper;
|
||||
|
||||
@Override
|
||||
public Long createDemo01Student(InfraDemo01StudentCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
InfraDemo01StudentDO demo01Student = InfraDemo01StudentConvert.INSTANCE.convert(createReqVO);
|
||||
demo01StudentMapper.insert(demo01Student);
|
||||
// 返回
|
||||
return demo01Student.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo01Student(InfraDemo01StudentUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemo01StudentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
InfraDemo01StudentDO updateObj = InfraDemo01StudentConvert.INSTANCE.convert(updateReqVO);
|
||||
demo01StudentMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo01Student(Long id) {
|
||||
// 校验存在
|
||||
validateDemo01StudentExists(id);
|
||||
// 删除
|
||||
demo01StudentMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateDemo01StudentExists(Long id) {
|
||||
if (demo01StudentMapper.selectById(id) == null) {
|
||||
throw exception(DEMO01_STUDENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemo01StudentDO getDemo01Student(Long id) {
|
||||
return demo01StudentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfraDemo01StudentDO> getDemo01StudentPage(InfraDemo01StudentPageReqVO pageReqVO) {
|
||||
return demo01StudentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfraDemo01StudentDO> getDemo01StudentList(InfraDemo01StudentExportReqVO exportReqVO) {
|
||||
return demo01StudentMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo02;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 学生 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfraDemoStudentService {
|
||||
|
||||
/**
|
||||
* 创建学生
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemoStudent(@Valid InfraDemoStudentCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新学生
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemoStudent(@Valid InfraDemoStudentUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemoStudent(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生
|
||||
*/
|
||||
InfraDemoStudentDO getDemoStudent(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 学生分页
|
||||
*/
|
||||
PageResult<InfraDemoStudentDO> getDemoStudentPage(InfraDemoStudentPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得学生列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 学生列表
|
||||
*/
|
||||
List<InfraDemoStudentDO> getDemoStudentList(InfraDemoStudentExportReqVO exportReqVO);
|
||||
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
/**
|
||||
* 获得学生联系人列表
|
||||
*
|
||||
* @param studentId 学生编号
|
||||
* @return 学生联系人列表
|
||||
*/
|
||||
List<InfraDemoStudentContactDO> getDemoStudentContactListByStudentId(Long studentId);
|
||||
|
||||
|
||||
// ==================== 子表(学生地址) ====================
|
||||
|
||||
/**
|
||||
* 获得学生地址
|
||||
*
|
||||
* @param studentId 学生编号
|
||||
* @return 学生地址
|
||||
*/
|
||||
InfraDemoStudentAddressDO getDemoStudentAddressByStudentId(Long studentId);
|
||||
|
||||
}
|
@ -1,146 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo02;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo02.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo02.InfraDemoStudentAddressDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.convert.demo02.InfraDemoStudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentContactMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo02.InfraDemoStudentAddressMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
|
||||
/**
|
||||
* 学生 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class InfraDemoStudentServiceImpl implements InfraDemoStudentService {
|
||||
|
||||
@Resource
|
||||
private InfraDemoStudentMapper demoStudentMapper;
|
||||
@Resource
|
||||
private InfraDemoStudentContactMapper demoStudentContactMapper;
|
||||
@Resource
|
||||
private InfraDemoStudentAddressMapper demoStudentAddressMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createDemoStudent(InfraDemoStudentCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
InfraDemoStudentDO demoStudent = InfraDemoStudentConvert.INSTANCE.convert(createReqVO);
|
||||
demoStudentMapper.insert(demoStudent);
|
||||
|
||||
// 插入子表($subTable.classComment)
|
||||
createDemoStudentContactList(demoStudent.getId(), createReqVO.getDemoStudentContacts());
|
||||
createDemoStudentAddress(demoStudent.getId(), createReqVO.getDemoStudentAddress());
|
||||
// 返回
|
||||
return demoStudent.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDemoStudent(InfraDemoStudentUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemoStudentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
InfraDemoStudentDO updateObj = InfraDemoStudentConvert.INSTANCE.convert(updateReqVO);
|
||||
demoStudentMapper.updateById(updateObj);
|
||||
|
||||
// 更新子表
|
||||
updateDemoStudentContactList(updateReqVO.getId(), updateReqVO.getDemoStudentContacts());
|
||||
updateDemoStudentAddress(updateReqVO.getId(), updateReqVO.getDemoStudentAddress());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDemoStudent(Long id) {
|
||||
// 校验存在
|
||||
validateDemoStudentExists(id);
|
||||
// 删除
|
||||
demoStudentMapper.deleteById(id);
|
||||
|
||||
// 删除子表
|
||||
deleteDemoStudentContactByStudentId(id);
|
||||
deleteDemoStudentAddressByStudentId(id);
|
||||
}
|
||||
|
||||
private void validateDemoStudentExists(Long id) {
|
||||
if (demoStudentMapper.selectById(id) == null) {
|
||||
throw exception(DEMO_STUDENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemoStudentDO getDemoStudent(Long id) {
|
||||
return demoStudentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfraDemoStudentDO> getDemoStudentPage(InfraDemoStudentPageReqVO pageReqVO) {
|
||||
return demoStudentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfraDemoStudentDO> getDemoStudentList(InfraDemoStudentExportReqVO exportReqVO) {
|
||||
return demoStudentMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@Override
|
||||
public List<InfraDemoStudentContactDO> getDemoStudentContactListByStudentId(Long studentId) {
|
||||
return demoStudentContactMapper.selectListByStudentId(studentId);
|
||||
}
|
||||
|
||||
private void createDemoStudentContactList(Long studentId, List<InfraDemoStudentContactDO> list) {
|
||||
list.forEach(o -> o.setStudentId(studentId));
|
||||
demoStudentContactMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
private void updateDemoStudentContactList(Long studentId, List<InfraDemoStudentContactDO> list) {
|
||||
deleteDemoStudentContactByStudentId(studentId);
|
||||
createDemoStudentContactList(studentId, list);
|
||||
}
|
||||
|
||||
private void deleteDemoStudentContactByStudentId(Long studentId) {
|
||||
demoStudentContactMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生地址) ====================
|
||||
|
||||
@Override
|
||||
public InfraDemoStudentAddressDO getDemoStudentAddressByStudentId(Long studentId) {
|
||||
return demoStudentAddressMapper.selectByStudentId(studentId);
|
||||
}
|
||||
|
||||
private void createDemoStudentAddress(Long studentId, InfraDemoStudentAddressDO demoStudentAddress) {
|
||||
demoStudentAddress.setStudentId(studentId);
|
||||
demoStudentAddressMapper.insert(demoStudentAddress);
|
||||
}
|
||||
|
||||
private void updateDemoStudentAddress(Long studentId, InfraDemoStudentAddressDO demoStudentAddress) {
|
||||
demoStudentAddress.setStudentId(studentId);
|
||||
demoStudentAddressMapper.updateById(demoStudentAddress);
|
||||
}
|
||||
|
||||
private void deleteDemoStudentAddressByStudentId(Long studentId) {
|
||||
demoStudentAddressMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo11;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 学生 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfraDemo11StudentService {
|
||||
|
||||
/**
|
||||
* 创建学生
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo11Student(@Valid InfraDemo11StudentCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新学生
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemo11Student(@Valid InfraDemo11StudentUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo11Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生
|
||||
*/
|
||||
InfraDemo11StudentDO getDemo11Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 学生分页
|
||||
*/
|
||||
PageResult<InfraDemo11StudentDO> getDemo11StudentPage(InfraDemo11StudentPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得学生列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 学生列表
|
||||
*/
|
||||
List<InfraDemo11StudentDO> getDemo11StudentList(InfraDemo11StudentExportReqVO exportReqVO);
|
||||
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
/**
|
||||
* 获得学生联系人列表
|
||||
*
|
||||
* @param studentId 学生编号
|
||||
* @return 学生联系人列表
|
||||
*/
|
||||
List<InfraDemo11StudentContactDO> getDemo11StudentContactListByStudentId(Long studentId);
|
||||
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
/**
|
||||
* 获得学生班主任
|
||||
*
|
||||
* @param studentId 学生编号
|
||||
* @return 学生班主任
|
||||
*/
|
||||
InfraDemo11StudentTeacherDO getDemo11StudentTeacherByStudentId(Long studentId);
|
||||
|
||||
}
|
@ -1,153 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo11;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo11.vo.InfraDemo11StudentUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.demo11.InfraDemo11StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo11.InfraDemo11StudentTeacherDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentContactMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo11.InfraDemo11StudentTeacherMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DEMO11_STUDENT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 学生 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class InfraDemo11StudentServiceImpl implements InfraDemo11StudentService {
|
||||
|
||||
@Resource
|
||||
private InfraDemo11StudentMapper demo11StudentMapper;
|
||||
@Resource
|
||||
private InfraDemo11StudentContactMapper demo11StudentContactMapper;
|
||||
@Resource
|
||||
private InfraDemo11StudentTeacherMapper demo11StudentTeacherMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createDemo11Student(InfraDemo11StudentCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
InfraDemo11StudentDO demo11Student = InfraDemo11StudentConvert.INSTANCE.convert(createReqVO);
|
||||
demo11StudentMapper.insert(demo11Student);
|
||||
|
||||
// 插入子表
|
||||
createDemo11StudentContactList(demo11Student.getId(), createReqVO.getDemo11StudentContacts());
|
||||
createDemo11StudentTeacher(demo11Student.getId(), createReqVO.getDemo11StudentTeacher());
|
||||
// 返回
|
||||
return demo11Student.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDemo11Student(InfraDemo11StudentUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemo11StudentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
InfraDemo11StudentDO updateObj = InfraDemo11StudentConvert.INSTANCE.convert(updateReqVO);
|
||||
demo11StudentMapper.updateById(updateObj);
|
||||
|
||||
// 更新子表
|
||||
updateDemo11StudentContactList(updateReqVO.getId(), updateReqVO.getDemo11StudentContacts());
|
||||
updateDemo11StudentTeacher(updateReqVO.getId(), updateReqVO.getDemo11StudentTeacher());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDemo11Student(Long id) {
|
||||
// 校验存在
|
||||
validateDemo11StudentExists(id);
|
||||
// 删除
|
||||
demo11StudentMapper.deleteById(id);
|
||||
|
||||
// 删除子表
|
||||
deleteDemo11StudentContactByStudentId(id);
|
||||
deleteDemo11StudentTeacherByStudentId(id);
|
||||
}
|
||||
|
||||
private void validateDemo11StudentExists(Long id) {
|
||||
if (demo11StudentMapper.selectById(id) == null) {
|
||||
throw exception(DEMO11_STUDENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemo11StudentDO getDemo11Student(Long id) {
|
||||
return demo11StudentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfraDemo11StudentDO> getDemo11StudentPage(InfraDemo11StudentPageReqVO pageReqVO) {
|
||||
return demo11StudentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfraDemo11StudentDO> getDemo11StudentList(InfraDemo11StudentExportReqVO exportReqVO) {
|
||||
return demo11StudentMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@Override
|
||||
public List<InfraDemo11StudentContactDO> getDemo11StudentContactListByStudentId(Long studentId) {
|
||||
return demo11StudentContactMapper.selectListByStudentId(studentId);
|
||||
}
|
||||
|
||||
private void createDemo11StudentContactList(Long studentId, List<InfraDemo11StudentContactDO> list) {
|
||||
list.forEach(o -> o.setStudentId(studentId));
|
||||
demo11StudentContactMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
private void updateDemo11StudentContactList(Long studentId, List<InfraDemo11StudentContactDO> list) {
|
||||
deleteDemo11StudentContactByStudentId(studentId);
|
||||
list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
|
||||
createDemo11StudentContactList(studentId, list);
|
||||
}
|
||||
|
||||
private void deleteDemo11StudentContactByStudentId(Long studentId) {
|
||||
demo11StudentContactMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
@Override
|
||||
public InfraDemo11StudentTeacherDO getDemo11StudentTeacherByStudentId(Long studentId) {
|
||||
return demo11StudentTeacherMapper.selectByStudentId(studentId);
|
||||
}
|
||||
|
||||
private void createDemo11StudentTeacher(Long studentId, InfraDemo11StudentTeacherDO demo11StudentTeacher) {
|
||||
if (demo11StudentTeacher == null) {
|
||||
return;
|
||||
}
|
||||
demo11StudentTeacher.setStudentId(studentId);
|
||||
demo11StudentTeacherMapper.insert(demo11StudentTeacher);
|
||||
}
|
||||
|
||||
private void updateDemo11StudentTeacher(Long studentId, InfraDemo11StudentTeacherDO demo11StudentTeacher) {
|
||||
if (demo11StudentTeacher == null) {
|
||||
return;
|
||||
}
|
||||
demo11StudentTeacher.setStudentId(studentId);
|
||||
demo11StudentTeacher.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
|
||||
demo11StudentTeacherMapper.insertOrUpdate(demo11StudentTeacher);
|
||||
}
|
||||
|
||||
private void deleteDemo11StudentTeacherByStudentId(Long studentId) {
|
||||
demo11StudentTeacherMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo12;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 学生 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfraDemo12StudentService {
|
||||
|
||||
/**
|
||||
* 创建学生
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo12Student(@Valid InfraDemo12StudentCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新学生
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemo12Student(@Valid InfraDemo12StudentUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo12Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生
|
||||
*/
|
||||
InfraDemo12StudentDO getDemo12Student(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 学生分页
|
||||
*/
|
||||
PageResult<InfraDemo12StudentDO> getDemo12StudentPage(InfraDemo12StudentPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得学生列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 学生列表
|
||||
*/
|
||||
List<InfraDemo12StudentDO> getDemo12StudentList(InfraDemo12StudentExportReqVO exportReqVO);
|
||||
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
/**
|
||||
* 获得学生联系人分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param studentId 学生编号
|
||||
* @return 学生联系人分页
|
||||
*/
|
||||
PageResult<InfraDemo12StudentContactDO> getDemo12StudentContactPage(PageParam pageReqVO, Long studentId);
|
||||
|
||||
/**
|
||||
* 创建学生联系人
|
||||
*
|
||||
* @param demo12StudentContact 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact);
|
||||
|
||||
/**
|
||||
* 更新学生联系人
|
||||
*
|
||||
* @param demo12StudentContact 更新信息
|
||||
*/
|
||||
void updateDemo12StudentContact(@Valid InfraDemo12StudentContactDO demo12StudentContact);
|
||||
|
||||
/**
|
||||
* 删除学生联系人
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo12StudentContact(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生联系人
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生联系人
|
||||
*/
|
||||
InfraDemo12StudentContactDO getDemo12StudentContact(Long id);
|
||||
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
/**
|
||||
* 获得学生班主任分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param studentId 学生编号
|
||||
* @return 学生班主任分页
|
||||
*/
|
||||
PageResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId);
|
||||
|
||||
/**
|
||||
* 创建学生班主任
|
||||
*
|
||||
* @param demo12StudentTeacher 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher);
|
||||
|
||||
/**
|
||||
* 更新学生班主任
|
||||
*
|
||||
* @param demo12StudentTeacher 更新信息
|
||||
*/
|
||||
void updateDemo12StudentTeacher(@Valid InfraDemo12StudentTeacherDO demo12StudentTeacher);
|
||||
|
||||
/**
|
||||
* 删除学生班主任
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemo12StudentTeacher(Long id);
|
||||
|
||||
/**
|
||||
* 获得学生班主任
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 学生班主任
|
||||
*/
|
||||
InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id);
|
||||
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo12;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentContactMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentTeacherMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 学生 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService {
|
||||
|
||||
@Resource
|
||||
private InfraDemo12StudentMapper demo12StudentMapper;
|
||||
@Resource
|
||||
private InfraDemo12StudentContactMapper demo12StudentContactMapper;
|
||||
@Resource
|
||||
private InfraDemo12StudentTeacherMapper demo12StudentTeacherMapper;
|
||||
|
||||
@Override
|
||||
public Long createDemo12Student(InfraDemo12StudentCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
InfraDemo12StudentDO demo12Student = InfraDemo12StudentConvert.INSTANCE.convert(createReqVO);
|
||||
demo12StudentMapper.insert(demo12Student);
|
||||
// 返回
|
||||
return demo12Student.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo12Student(InfraDemo12StudentUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDemo12StudentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
InfraDemo12StudentDO updateObj = InfraDemo12StudentConvert.INSTANCE.convert(updateReqVO);
|
||||
demo12StudentMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDemo12Student(Long id) {
|
||||
// 校验存在
|
||||
validateDemo12StudentExists(id);
|
||||
// 删除
|
||||
demo12StudentMapper.deleteById(id);
|
||||
|
||||
// 删除子表
|
||||
deleteDemo12StudentContactByStudentId(id);
|
||||
deleteDemo12StudentTeacherByStudentId(id);
|
||||
}
|
||||
|
||||
private void validateDemo12StudentExists(Long id) {
|
||||
if (demo12StudentMapper.selectById(id) == null) {
|
||||
throw exception(DEMO12_STUDENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemo12StudentDO getDemo12Student(Long id) {
|
||||
return demo12StudentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfraDemo12StudentDO> getDemo12StudentPage(InfraDemo12StudentPageReqVO pageReqVO) {
|
||||
return demo12StudentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfraDemo12StudentDO> getDemo12StudentList(InfraDemo12StudentExportReqVO exportReqVO) {
|
||||
return demo12StudentMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生联系人) ====================
|
||||
|
||||
@Override
|
||||
public PageResult<InfraDemo12StudentContactDO> getDemo12StudentContactPage(PageParam pageReqVO, Long studentId) {
|
||||
return demo12StudentContactMapper.selectPage(pageReqVO, studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
demo12StudentContactMapper.insert(demo12StudentContact);
|
||||
return demo12StudentContact.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) {
|
||||
demo12StudentContactMapper.updateById(demo12StudentContact);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo12StudentContact(Long id) {
|
||||
demo12StudentContactMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemo12StudentContactDO getDemo12StudentContact(Long id) {
|
||||
return demo12StudentContactMapper.selectById(id);
|
||||
}
|
||||
|
||||
private void deleteDemo12StudentContactByStudentId(Long studentId) {
|
||||
demo12StudentContactMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
// ==================== 子表(学生班主任) ====================
|
||||
|
||||
@Override
|
||||
public PageResult<InfraDemo12StudentTeacherDO> getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId) {
|
||||
return demo12StudentTeacherMapper.selectPage(pageReqVO, studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
demo12StudentTeacherMapper.insert(demo12StudentTeacher);
|
||||
return demo12StudentTeacher.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) {
|
||||
demo12StudentTeacherMapper.updateById(demo12StudentTeacher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDemo12StudentTeacher(Long id) {
|
||||
demo12StudentTeacherMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraDemo12StudentTeacherDO getDemo12StudentTeacher(Long id) {
|
||||
return demo12StudentTeacherMapper.selectById(id);
|
||||
}
|
||||
|
||||
private void deleteDemo12StudentTeacherByStudentId(Long studentId) {
|
||||
demo12StudentTeacherMapper.deleteByStudentId(studentId);
|
||||
}
|
||||
|
||||
}
|
@ -85,7 +85,7 @@ public class ${table.className}ServiceImplTest extends BaseDbUnitTest {
|
||||
assertNotNull(${classNameVar}Id);
|
||||
// 校验记录的属性是否正确
|
||||
${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(${classNameVar}Id);
|
||||
assertPojoEquals(createReqVO, ${classNameVar});
|
||||
assertPojoEquals(createReqVO, ${classNameVar}, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1,183 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo12;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.demo12.InfraDemo12StudentMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link InfraDemo12StudentServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(InfraDemo12StudentServiceImpl.class)
|
||||
public class InfraDemo12StudentServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private InfraDemo12StudentServiceImpl demo12StudentService;
|
||||
|
||||
@Resource
|
||||
private InfraDemo12StudentMapper demo12StudentMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateDemo12Student_success() {
|
||||
// 准备参数
|
||||
InfraDemo12StudentCreateReqVO reqVO = randomPojo(InfraDemo12StudentCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long demo12StudentId = demo12StudentService.createDemo12Student(reqVO);
|
||||
// 断言
|
||||
assertNotNull(demo12StudentId);
|
||||
// 校验记录的属性是否正确
|
||||
InfraDemo12StudentDO demo12Student = demo12StudentMapper.selectById(demo12StudentId);
|
||||
assertPojoEquals(reqVO, demo12Student);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDemo12Student_success() {
|
||||
// mock 数据
|
||||
InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class);
|
||||
demo12StudentMapper.insert(dbDemo12Student);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
InfraDemo12StudentUpdateReqVO reqVO = randomPojo(InfraDemo12StudentUpdateReqVO.class, o -> {
|
||||
o.setId(dbDemo12Student.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
demo12StudentService.updateDemo12Student(reqVO);
|
||||
// 校验是否更新正确
|
||||
InfraDemo12StudentDO demo12Student = demo12StudentMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, demo12Student);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDemo12Student_notExists() {
|
||||
// 准备参数
|
||||
InfraDemo12StudentUpdateReqVO reqVO = randomPojo(InfraDemo12StudentUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> demo12StudentService.updateDemo12Student(reqVO), DEMO12_STUDENT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteDemo12Student_success() {
|
||||
// mock 数据
|
||||
InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class);
|
||||
demo12StudentMapper.insert(dbDemo12Student);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbDemo12Student.getId();
|
||||
|
||||
// 调用
|
||||
demo12StudentService.deleteDemo12Student(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(demo12StudentMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteDemo12Student_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> demo12StudentService.deleteDemo12Student(id), DEMO12_STUDENT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetDemo12StudentPage() {
|
||||
// mock 数据
|
||||
InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class, o -> { // 等会查询到
|
||||
o.setName(null);
|
||||
o.setBirthday(null);
|
||||
o.setSex(null);
|
||||
o.setEnabled(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
demo12StudentMapper.insert(dbDemo12Student);
|
||||
// 测试 name 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setName(null)));
|
||||
// 测试 birthday 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setBirthday(null)));
|
||||
// 测试 sex 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setSex(null)));
|
||||
// 测试 enabled 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setEnabled(null)));
|
||||
// 测试 createTime 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
InfraDemo12StudentPageReqVO reqVO = new InfraDemo12StudentPageReqVO();
|
||||
reqVO.setName(null);
|
||||
reqVO.setBirthday(null);
|
||||
reqVO.setSex(null);
|
||||
reqVO.setEnabled(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<InfraDemo12StudentDO> pageResult = demo12StudentService.getDemo12StudentPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbDemo12Student, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetDemo12StudentList() {
|
||||
// mock 数据
|
||||
InfraDemo12StudentDO dbDemo12Student = randomPojo(InfraDemo12StudentDO.class, o -> { // 等会查询到
|
||||
o.setName(null);
|
||||
o.setBirthday(null);
|
||||
o.setSex(null);
|
||||
o.setEnabled(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
demo12StudentMapper.insert(dbDemo12Student);
|
||||
// 测试 name 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setName(null)));
|
||||
// 测试 birthday 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setBirthday(null)));
|
||||
// 测试 sex 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setSex(null)));
|
||||
// 测试 enabled 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setEnabled(null)));
|
||||
// 测试 createTime 不匹配
|
||||
demo12StudentMapper.insert(cloneIgnoreId(dbDemo12Student, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
InfraDemo12StudentExportReqVO reqVO = new InfraDemo12StudentExportReqVO();
|
||||
reqVO.setName(null);
|
||||
reqVO.setBirthday(null);
|
||||
reqVO.setSex(null);
|
||||
reqVO.setEnabled(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
List<InfraDemo12StudentDO> list = demo12StudentService.getDemo12StudentList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbDemo12Student, list.get(0));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user