diff --git a/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/assert.json b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/assert.json new file mode 100644 index 0000000..42c0e49 --- /dev/null +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/assert.json @@ -0,0 +1,73 @@ +[ { + "contentPath" : "java/InfraStudentPageReqVO", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/vo/InfraStudentPageReqVO.java" +}, { + "contentPath" : "java/InfraStudentRespVO", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/vo/InfraStudentRespVO.java" +}, { + "contentPath" : "java/InfraStudentSaveReqVO", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/vo/InfraStudentSaveReqVO.java" +}, { + "contentPath" : "java/InfraStudentController", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo/InfraStudentController.java" +}, { + "contentPath" : "java/InfraStudentDO", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/InfraStudentDO.java" +}, { + "contentPath" : "java/InfraStudentContactDO", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/InfraStudentContactDO.java" +}, { + "contentPath" : "java/InfraStudentTeacherDO", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/demo/InfraStudentTeacherDO.java" +}, { + "contentPath" : "java/InfraStudentMapper", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/InfraStudentMapper.java" +}, { + "contentPath" : "java/InfraStudentContactMapper", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/InfraStudentContactMapper.java" +}, { + "contentPath" : "java/InfraStudentTeacherMapper", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo/InfraStudentTeacherMapper.java" +}, { + "contentPath" : "xml/InfraStudentMapper", + "filePath" : "yudao-module-infra/src/main/resources/mapper/demo/InfraStudentMapper.xml" +}, { + "contentPath" : "java/InfraStudentServiceImpl", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/InfraStudentServiceImpl.java" +}, { + "contentPath" : "java/InfraStudentService", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/service/demo/InfraStudentService.java" +}, { + "contentPath" : "java/InfraStudentServiceImplTest", + "filePath" : "yudao-module-infra/src/test/java/cn/iocoder/yudao/module/infra/service/demo/InfraStudentServiceImplTest.java" +}, { + "contentPath" : "java/ErrorCodeConstants_手动操作", + "filePath" : "yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants_手动操作.java" +}, { + "contentPath" : "sql/sql", + "filePath" : "sql/sql.sql" +}, { + "contentPath" : "sql/h2", + "filePath" : "sql/h2.sql" +}, { + "contentPath" : "vue/index", + "filePath" : "yudao-ui-admin-vben/src/views/infra/demo/index.vue" +}, { + "contentPath" : "vue/form", + "filePath" : "yudao-ui-admin-vben/src/views/infra/demo/modules/form.vue" +}, { + "contentPath" : "ts/index", + "filePath" : "yudao-ui-admin-vben/src/api/infra/demo/index.ts" +}, { + "contentPath" : "vue/student-contact-form", + "filePath" : "yudao-ui-admin-vben/src/views/infra/demo/modules/student-contact-form.vue" +}, { + "contentPath" : "vue/student-teacher-form", + "filePath" : "yudao-ui-admin-vben/src/views/infra/demo/modules/student-teacher-form.vue" +}, { + "contentPath" : "vue/student-contact-list", + "filePath" : "yudao-ui-admin-vben/src/views/infra/demo/modules/student-contact-list.vue" +}, { + "contentPath" : "vue/student-teacher-list", + "filePath" : "yudao-ui-admin-vben/src/views/infra/demo/modules/student-teacher-list.vue" +} ] \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/ErrorCodeConstants_手动操作 b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/ErrorCodeConstants_手动操作 index d3201de..7373c5e 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/ErrorCodeConstants_手动操作 +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/ErrorCodeConstants_手动操作 @@ -1,6 +1,6 @@ -// TODO 待办:请将下面的错误码复制到 yudao-module-infra-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!! -// ========== 学生 TODO 补充编号 ========== -ErrorCode STUDENT_NOT_EXISTS = new ErrorCode(TODO 补充编号, "学生不存在"); -ErrorCode STUDENT_CONTACT_NOT_EXISTS = new ErrorCode(TODO 补充编号, "学生联系人不存在"); -ErrorCode STUDENT_TEACHER_NOT_EXISTS = new ErrorCode(TODO 补充编号, "学生班主任不存在"); -ErrorCode STUDENT_TEACHER_EXISTS = new ErrorCode(TODO 补充编号, "学生班主任已存在"); \ No newline at end of file +// TODO 待办:请将下面的错误码复制到 yudao-module-infra 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!! +// ========== 学生 TODO 补充编号 ========== +ErrorCode STUDENT_NOT_EXISTS = new ErrorCode(TODO 补充编号, "学生不存在"); +ErrorCode STUDENT_CONTACT_NOT_EXISTS = new ErrorCode(TODO 补充编号, "学生联系人不存在"); +ErrorCode STUDENT_TEACHER_NOT_EXISTS = new ErrorCode(TODO 补充编号, "学生班主任不存在"); +ErrorCode STUDENT_TEACHER_EXISTS = new ErrorCode(TODO 补充编号, "学生班主任已存在"); \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentContactDO b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentContactDO index 17c668e..17c668e 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentContactDO +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentContactDO diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentContactMapper b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentContactMapper index ca662d1..f3d2d53 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentContactMapper +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentContactMapper @@ -27,4 +27,8 @@ public interface InfraStudentContactMapper extends BaseMapperX studentIds) { + return deleteBatch(InfraStudentContactDO::getStudentId, studentIds); + } + } \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentController b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentController index d6f2018..02bd597 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentController +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentController @@ -1,16 +1,16 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo; import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; +import jakarta.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 jakarta.validation.constraints.*; +import jakarta.validation.*; +import jakarta.servlet.http.*; import java.util.*; import java.io.IOException; @@ -22,8 +22,8 @@ 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.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; import cn.iocoder.yudao.module.infra.controller.admin.demo.vo.*; import cn.iocoder.yudao.module.infra.dal.dataobject.demo.InfraStudentDO; @@ -64,6 +64,15 @@ public class InfraStudentController { return success(true); } + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除学生") + @PreAuthorize("@ss.hasPermission('infra:student:delete')") + public CommonResult deleteStudentList(@RequestParam("ids") List ids) { + studentService.deleteStudentListByIds(ids); + return success(true); + } + @GetMapping("/get") @Operation(summary = "获得学生") @Parameter(name = "id", description = "编号", required = true, example = "1024") @@ -84,7 +93,7 @@ public class InfraStudentController { @GetMapping("/export-excel") @Operation(summary = "导出学生 Excel") @PreAuthorize("@ss.hasPermission('infra:student:export')") - @OperateLog(type = EXPORT) + @ApiAccessLog(operateType = EXPORT) public void exportStudentExcel(@Valid InfraStudentPageReqVO pageReqVO, HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); @@ -129,6 +138,15 @@ public class InfraStudentController { return success(true); } + @DeleteMapping("/student-contact/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除学生联系人") + @PreAuthorize("@ss.hasPermission('infra:student:delete')") + public CommonResult deleteStudentContactList(@RequestParam("ids") List ids) { + studentService.deleteStudentContactListByIds(ids); + return success(true); + } + @GetMapping("/student-contact/get") @Operation(summary = "获得学生联系人") @Parameter(name = "id", description = "编号", required = true) @@ -172,6 +190,15 @@ public class InfraStudentController { return success(true); } + @DeleteMapping("/student-teacher/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除学生班主任") + @PreAuthorize("@ss.hasPermission('infra:student:delete')") + public CommonResult deleteStudentTeacherList(@RequestParam("ids") List ids) { + studentService.deleteStudentTeacherListByIds(ids); + return success(true); + } + @GetMapping("/student-teacher/get") @Operation(summary = "获得学生班主任") @Parameter(name = "id", description = "编号", required = true) diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentDO b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentDO index b0d4bd2..f39fef2 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentDO +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentDO @@ -64,4 +64,5 @@ public class InfraStudentDO extends BaseDO { */ private String memo; + } \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentMapper b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentMapper index 34e70a0..34e70a0 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentMapper +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentMapper diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentPageReqVO b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentPageReqVO index 41a3730..52d7a23 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentPageReqVO +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentPageReqVO @@ -11,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Schema(description = "管理后台 - 学生分页 Request VO") @Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) public class InfraStudentPageReqVO extends PageParam { @Schema(description = "名字", example = "芋头") diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentRespVO b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentRespVO index f86f679..12166f4 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentRespVO +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentRespVO @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.vo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; -import java.util.*; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; import cn.idev.excel.annotation.*; @@ -57,4 +56,4 @@ public class InfraStudentRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; -} +} \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentSaveReqVO b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentSaveReqVO index eaadf74..2378872 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentSaveReqVO +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentSaveReqVO @@ -3,8 +3,7 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo.vo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; -import javax.validation.constraints.*; -import java.util.*; +import jakarta.validation.constraints.*; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; import cn.iocoder.yudao.module.infra.dal.dataobject.demo.InfraStudentContactDO; diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentService b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentService index 7df090d..fea24fa 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentService +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentService @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.infra.service.demo; import java.util.*; -import javax.validation.*; +import jakarta.validation.*; import cn.iocoder.yudao.module.infra.controller.admin.demo.vo.*; import cn.iocoder.yudao.module.infra.dal.dataobject.demo.InfraStudentDO; import cn.iocoder.yudao.module.infra.dal.dataobject.demo.InfraStudentContactDO; @@ -39,6 +39,13 @@ public interface InfraStudentService { void deleteStudent(Long id); /** + * 批量删除学生 + * + * @param ids 编号 + */ + void deleteStudentListByIds(List ids); + + /** * 获得学生 * * @param id 编号 @@ -87,6 +94,13 @@ public interface InfraStudentService { */ void deleteStudentContact(Long id); + /** + * 批量删除学生联系人 + * + * @param ids 编号 + */ + void deleteStudentContactListByIds(List ids); + /** * 获得学生联系人 * @@ -128,6 +142,13 @@ public interface InfraStudentService { */ void deleteStudentTeacher(Long id); + /** + * 批量删除学生班主任 + * + * @param ids 编号 + */ + void deleteStudentTeacherListByIds(List ids); + /** * 获得学生班主任 * diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentServiceImpl b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentServiceImpl index 793b2dd..6c86267 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentServiceImpl +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentServiceImpl @@ -1,7 +1,8 @@ package cn.iocoder.yudao.module.infra.service.demo; +import cn.hutool.core.collection.CollUtil; import org.springframework.stereotype.Service; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; @@ -19,6 +20,8 @@ import cn.iocoder.yudao.module.infra.dal.mysql.demo.InfraStudentContactMapper; import cn.iocoder.yudao.module.infra.dal.mysql.demo.InfraStudentTeacherMapper; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; /** @@ -42,6 +45,7 @@ public class InfraStudentServiceImpl implements InfraStudentService { // 插入 InfraStudentDO student = BeanUtils.toBean(createReqVO, InfraStudentDO.class); studentMapper.insert(student); + // 返回 return student.getId(); } @@ -68,6 +72,18 @@ public class InfraStudentServiceImpl implements InfraStudentService { deleteStudentTeacherByStudentId(id); } + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteStudentListByIds(List ids) { + // 删除 + studentMapper.deleteByIds(ids); + + // 删除子表 + deleteStudentContactByStudentIds(ids); + deleteStudentTeacherByStudentIds(ids); + } + + private void validateStudentExists(Long id) { if (studentMapper.selectById(id) == null) { throw exception(STUDENT_NOT_EXISTS); @@ -93,6 +109,7 @@ public class InfraStudentServiceImpl implements InfraStudentService { @Override public Long createStudentContact(InfraStudentContactDO studentContact) { + studentContact.clean(); // 清理掉创建、更新时间等相关属性值 studentContactMapper.insert(studentContact); return studentContact.getId(); } @@ -102,17 +119,22 @@ public class InfraStudentServiceImpl implements InfraStudentService { // 校验存在 validateStudentContactExists(studentContact.getId()); // 更新 + studentContact.clean(); // 解决更新情况下:updateTime 不更新 studentContactMapper.updateById(studentContact); } @Override public void deleteStudentContact(Long id) { - // 校验存在 - validateStudentContactExists(id); // 删除 studentContactMapper.deleteById(id); } + @Override + public void deleteStudentContactListByIds(List ids) { + // 删除 + studentContactMapper.deleteByIds(ids); + } + @Override public InfraStudentContactDO getStudentContact(Long id) { return studentContactMapper.selectById(id); @@ -128,6 +150,10 @@ public class InfraStudentServiceImpl implements InfraStudentService { studentContactMapper.deleteByStudentId(studentId); } + private void deleteStudentContactByStudentIds(List studentIds) { + studentContactMapper.deleteByStudentIds(studentIds); + } + // ==================== 子表(学生班主任) ==================== @Override @@ -142,6 +168,7 @@ public class InfraStudentServiceImpl implements InfraStudentService { throw exception(STUDENT_TEACHER_EXISTS); } // 插入 + studentTeacher.clean(); // 清理掉创建、更新时间等相关属性值 studentTeacherMapper.insert(studentTeacher); return studentTeacher.getId(); } @@ -151,17 +178,22 @@ public class InfraStudentServiceImpl implements InfraStudentService { // 校验存在 validateStudentTeacherExists(studentTeacher.getId()); // 更新 + studentTeacher.clean(); // 解决更新情况下:updateTime 不更新 studentTeacherMapper.updateById(studentTeacher); } @Override public void deleteStudentTeacher(Long id) { - // 校验存在 - validateStudentTeacherExists(id); // 删除 studentTeacherMapper.deleteById(id); } + @Override + public void deleteStudentTeacherListByIds(List ids) { + // 删除 + studentTeacherMapper.deleteByIds(ids); + } + @Override public InfraStudentTeacherDO getStudentTeacher(Long id) { return studentTeacherMapper.selectById(id); @@ -177,4 +209,8 @@ public class InfraStudentServiceImpl implements InfraStudentService { studentTeacherMapper.deleteByStudentId(studentId); } + private void deleteStudentTeacherByStudentIds(List studentIds) { + studentTeacherMapper.deleteByStudentIds(studentIds); + } + } \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentServiceImplTest b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentServiceImplTest index fa32593..f1d3bb9 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentServiceImplTest +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentServiceImplTest @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.infra.service.demo; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; @@ -12,7 +12,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.demo.InfraStudentDO; import cn.iocoder.yudao.module.infra.dal.mysql.demo.InfraStudentMapper; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import org.springframework.context.annotation.Import; import java.util.*; import java.time.LocalDateTime; diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentTeacherDO b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentTeacherDO index c19cf9f..c19cf9f 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentTeacherDO +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentTeacherDO diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentTeacherMapper b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentTeacherMapper index 994212d..0e84a58 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/java/InfraStudentTeacherMapper +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/java/InfraStudentTeacherMapper @@ -22,9 +22,16 @@ public interface InfraStudentTeacherMapper extends BaseMapperX studentIds) { + return deleteBatch(InfraStudentTeacherDO::getStudentId, studentIds); + } + } \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/sql/h2 b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/sql/h2 index 6c1875f..6c1875f 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/sql/h2 +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/sql/h2 diff --git a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/sql/sql b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/sql/sql index 83df279..c0e5f74 100644 --- a/yudao-module-infra/src/test/resources/codegen/windows10/vue2_master_erp/sql/sql +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/sql/sql @@ -1,55 +1,54 @@ --- 菜单 SQL -INSERT INTO system_menu( - name, permission, type, sort, parent_id, - path, icon, component, status, component_name -) -VALUES ( - '学生管理', '', 2, 0, 888, - 'student', '', 'infra/demo/index', 0, 'InfraStudent' -); - --- 按钮父菜单ID --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -INSERT INTO system_menu( - name, permission, type, sort, parent_id, - path, icon, component, status -) -VALUES ( - '学生查询', 'infra:student:query', 3, 1, @parentId, - '', '', '', 0 -); -INSERT INTO system_menu( - name, permission, type, sort, parent_id, - path, icon, component, status -) -VALUES ( - '学生创建', 'infra:student:create', 3, 2, @parentId, - '', '', '', 0 -); -INSERT INTO system_menu( - name, permission, type, sort, parent_id, - path, icon, component, status -) -VALUES ( - '学生更新', 'infra:student:update', 3, 3, @parentId, - '', '', '', 0 -); -INSERT INTO system_menu( - name, permission, type, sort, parent_id, - path, icon, component, status -) -VALUES ( - '学生删除', 'infra:student:delete', 3, 4, @parentId, - '', '', '', 0 -); -INSERT INTO system_menu( - name, permission, type, sort, parent_id, - path, icon, component, status -) -VALUES ( - '学生导出', 'infra:student:export', 3, 5, @parentId, - '', '', '', 0 -); \ No newline at end of file +-- 菜单 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status, component_name +) +VALUES ( + '学生管理', '', 2, 0, 888, + 'student', '', 'infra/demo/index', 0, 'InfraStudent' +); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '学生查询', 'infra:student:query', 3, 1, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '学生创建', 'infra:student:create', 3, 2, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '学生更新', 'infra:student:update', 3, 3, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '学生删除', 'infra:student:delete', 3, 4, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '学生导出', 'infra:student:export', 3, 5, @parentId, + '', '', '', 0 +); \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/ts/index b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/ts/index new file mode 100644 index 0000000..4e16274 --- /dev/null +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/ts/index @@ -0,0 +1,145 @@ +import type { PageParam, PageResult } from '@vben/request'; +import type { Dayjs } from 'dayjs'; + +import { requestClient } from '#/api/request'; + +export namespace StudentApi { + /** 学生联系人信息 */ + export interface StudentContact { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + description?: string; // 简介 + birthday?: string | Dayjs; // 出生日期 + sex?: number; // 性别 + enabled?: boolean; // 是否有效 + avatar?: string; // 头像 + video: string; // 附件 + memo?: string; // 备注 + } + + /** 学生班主任信息 */ + export interface StudentTeacher { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + description?: string; // 简介 + birthday?: string | Dayjs; // 出生日期 + sex?: number; // 性别 + enabled?: boolean; // 是否有效 + avatar?: string; // 头像 + video: string; // 附件 + memo?: string; // 备注 + } + + /** 学生信息 */ + export interface Student { + id: number; // 编号 + name?: string; // 名字 + description?: string; // 简介 + birthday?: string | Dayjs; // 出生日期 + sex?: number; // 性别 + enabled?: boolean; // 是否有效 + avatar?: string; // 头像 + video?: string; // 附件 + memo?: string; // 备注 + } +} + +/** 查询学生分页 */ +export function getStudentPage(params: PageParam) { + return requestClient.get>('/infra/student/page', { params }); +} + +/** 查询学生详情 */ +export function getStudent(id: number) { + return requestClient.get(`/infra/student/get?id=${id}`); +} + +/** 新增学生 */ +export function createStudent(data: StudentApi.Student) { + return requestClient.post('/infra/student/create', data); +} + +/** 修改学生 */ +export function updateStudent(data: StudentApi.Student) { + return requestClient.put('/infra/student/update', data); +} + +/** 删除学生 */ +export function deleteStudent(id: number) { + return requestClient.delete(`/infra/student/delete?id=${id}`); +} + +/** 批量删除学生 */ +export function deleteStudentList(ids: number[]) { + return requestClient.delete(`/infra/student/delete-list?ids=${ids.join(',')}`) +} + +/** 导出学生 */ +export function exportStudent(params: any) { + return requestClient.download('/infra/student/export-excel', { params }); +} + + +// ==================== 子表(学生联系人) ==================== + +/** 获得学生联系人分页 */ +export function getStudentContactPage(params: PageParam) { + return requestClient.get>(`/infra/student/student-contact/page`, { params }); +} + /** 新增学生联系人 */ +export function createStudentContact(data: StudentApi.StudentContact) { + return requestClient.post(`/infra/student/student-contact/create`, data); +} + +/** 修改学生联系人 */ +export function updateStudentContact(data: StudentApi.StudentContact) { + return requestClient.put(`/infra/student/student-contact/update`, data); +} + +/** 删除学生联系人 */ +export function deleteStudentContact(id: number) { + return requestClient.delete(`/infra/student/student-contact/delete?id=${id}`); +} + +/** 批量删除学生联系人 */ +export function deleteStudentContactList(ids: number[]) { + return requestClient.delete(`/infra/student/student-contact/delete-list?ids=${ids.join(',')}`) +} + +/** 获得学生联系人 */ +export function getStudentContact(id: number) { + return requestClient.get(`/infra/student/student-contact/get?id=${id}`); +} + +// ==================== 子表(学生班主任) ==================== + +/** 获得学生班主任分页 */ +export function getStudentTeacherPage(params: PageParam) { + return requestClient.get>(`/infra/student/student-teacher/page`, { params }); +} + /** 新增学生班主任 */ +export function createStudentTeacher(data: StudentApi.StudentTeacher) { + return requestClient.post(`/infra/student/student-teacher/create`, data); +} + +/** 修改学生班主任 */ +export function updateStudentTeacher(data: StudentApi.StudentTeacher) { + return requestClient.put(`/infra/student/student-teacher/update`, data); +} + +/** 删除学生班主任 */ +export function deleteStudentTeacher(id: number) { + return requestClient.delete(`/infra/student/student-teacher/delete?id=${id}`); +} + +/** 批量删除学生班主任 */ +export function deleteStudentTeacherList(ids: number[]) { + return requestClient.delete(`/infra/student/student-teacher/delete-list?ids=${ids.join(',')}`) +} + +/** 获得学生班主任 */ +export function getStudentTeacher(id: number) { + return requestClient.get(`/infra/student/student-teacher/get?id=${id}`); +} \ No newline at end of file diff --git a/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/vue/form b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/vue/form new file mode 100644 index 0000000..7062027 --- /dev/null +++ b/yudao-module-infra/src/test/resources/codegen/vben5_antd_general_master_erp/vue/form @@ -0,0 +1,161 @@ + + +