diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java index 7322f053c..b678bb92a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/InfraDemo12StudentController.java @@ -1,34 +1,31 @@ package cn.iocoder.yudao.module.infra.controller.admin.demo12; -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - +import cn.iocoder.yudao.framework.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 static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; - import cn.iocoder.yudao.module.infra.controller.admin.demo12.vo.*; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentContactDO; -import cn.iocoder.yudao.module.infra.dal.dataobject.demo12.InfraDemo12StudentTeacherDO; import cn.iocoder.yudao.module.infra.convert.demo12.InfraDemo12StudentConvert; +import cn.iocoder.yudao.module.infra.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 @@ -94,22 +91,88 @@ public class InfraDemo12StudentController { // ==================== 子表(学生联系人) ==================== - @GetMapping("/demo12-student/list-by-student-id") - @Operation(summary = "获得学生联系人列表") + @GetMapping("/demo12-student-contact/page") + @Operation(summary = "获得学生联系人分页") @Parameter(name = "studentId", description = "学生编号") @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult> getDemo12StudentContactListByStudentId(@RequestParam("studentId") Long studentId) { - return success(demo12StudentService.getDemo12StudentContactListByStudentId(studentId)); + public CommonResult> 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 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 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 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 getDemo12StudentContact(@RequestParam("id") Long id) { + return success(demo12StudentService.getDemo12StudentContact(id)); + } + // ==================== 子表(学生班主任) ==================== - @GetMapping("/demo12-student/get-by-student-id") - @Operation(summary = "获得学生班主任") + @GetMapping("/demo12-student-teacher/page") + @Operation(summary = "获得学生班主任分页") @Parameter(name = "studentId", description = "学生编号") @PreAuthorize("@ss.hasPermission('infra:demo12-student:query')") - public CommonResult getDemo12StudentTeacherByStudentId(@RequestParam("studentId") Long studentId) { - return success(demo12StudentService.getDemo12StudentTeacherByStudentId(studentId)); + public CommonResult> 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 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 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 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 getDemo12StudentTeacher(@RequestParam("id") Long id) { + return success(demo12StudentService.getDemo12StudentTeacher(id)); + } + } \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java index 4344edbb8..5544971cd 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/demo12/vo/InfraDemo12StudentBaseVO.java @@ -50,8 +50,4 @@ public class InfraDemo12StudentBaseVO { @NotEmpty(message = "备注不能为空") private String memo; - private List demo12StudentContacts; - - private InfraDemo12StudentTeacherDO demo12StudentTeacher; - } \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java index 1d28a06d5..e4206d98b 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentContactMapper.java @@ -17,8 +17,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface InfraDemo12StudentContactMapper extends BaseMapperX { - default List selectListByStudentId(Long studentId) { - return selectList(InfraDemo12StudentContactDO::getStudentId, studentId); + default PageResult selectPage(PageParam reqVO, Long studentId) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eq(InfraDemo12StudentContactDO::getStudentId, studentId) + .orderByDesc(InfraDemo12StudentContactDO::getId)); } default int deleteByStudentId(Long studentId) { diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java index 05f86f9ab..477207a98 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/demo12/InfraDemo12StudentTeacherMapper.java @@ -17,8 +17,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface InfraDemo12StudentTeacherMapper extends BaseMapperX { - default InfraDemo12StudentTeacherDO selectByStudentId(Long studentId) { - return selectOne(InfraDemo12StudentTeacherDO::getStudentId, studentId); + default PageResult selectPage(PageParam reqVO, Long studentId) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eq(InfraDemo12StudentTeacherDO::getStudentId, studentId) + .orderByDesc(InfraDemo12StudentTeacherDO::getId)); } default int deleteByStudentId(Long studentId) { diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java index 2b20779a9..a6b5a29fe 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentService.java @@ -7,6 +7,7 @@ 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 接口 @@ -65,22 +66,84 @@ public interface InfraDemo12StudentService { // ==================== 子表(学生联系人) ==================== /** - * 获得学生联系人列表 + * 获得学生联系人分页 * + * @param pageReqVO 分页查询 * @param studentId 学生编号 - * @return 学生联系人列表 + * @return 学生联系人分页 */ - List getDemo12StudentContactListByStudentId(Long studentId); + PageResult 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 学生班主任 + * @return 学生班主任分页 */ - InfraDemo12StudentTeacherDO getDemo12StudentTeacherByStudentId(Long studentId); + PageResult 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); } \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java index 07cef42d5..8a7149fac 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo12/InfraDemo12StudentServiceImpl.java @@ -11,6 +11,7 @@ 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; @@ -37,31 +38,21 @@ public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService private InfraDemo12StudentTeacherMapper demo12StudentTeacherMapper; @Override - @Transactional(rollbackFor = Exception.class) public Long createDemo12Student(InfraDemo12StudentCreateReqVO createReqVO) { // 插入 InfraDemo12StudentDO demo12Student = InfraDemo12StudentConvert.INSTANCE.convert(createReqVO); demo12StudentMapper.insert(demo12Student); - - // 插入子表 - createDemo12StudentContactList(demo12Student.getId(), createReqVO.getDemo12StudentContacts()); - createDemo12StudentTeacher(demo12Student.getId(), createReqVO.getDemo12StudentTeacher()); // 返回 return demo12Student.getId(); } @Override - @Transactional(rollbackFor = Exception.class) public void updateDemo12Student(InfraDemo12StudentUpdateReqVO updateReqVO) { // 校验存在 validateDemo12StudentExists(updateReqVO.getId()); // 更新 InfraDemo12StudentDO updateObj = InfraDemo12StudentConvert.INSTANCE.convert(updateReqVO); demo12StudentMapper.updateById(updateObj); - - // 更新子表 - updateDemo12StudentContactList(updateReqVO.getId(), updateReqVO.getDemo12StudentContacts()); - updateDemo12StudentTeacher(updateReqVO.getId(), updateReqVO.getDemo12StudentTeacher()); } @Override @@ -101,21 +92,31 @@ public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService // ==================== 子表(学生联系人) ==================== @Override - public List getDemo12StudentContactListByStudentId(Long studentId) { - return demo12StudentContactMapper.selectListByStudentId(studentId); + public PageResult getDemo12StudentContactPage(PageParam pageReqVO, Long studentId) { + return demo12StudentContactMapper.selectPage(pageReqVO, studentId); } - private void createDemo12StudentContactList(Long studentId, List list) { - list.forEach(o -> o.setStudentId(studentId)); - demo12StudentContactMapper.insertBatch(list); + @Override + public Long createDemo12StudentContact(InfraDemo12StudentContactDO demo12StudentContact) { + demo12StudentContactMapper.insert(demo12StudentContact); + return demo12StudentContact.getId(); } - private void updateDemo12StudentContactList(Long studentId, List list) { - deleteDemo12StudentContactByStudentId(studentId); - list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 - createDemo12StudentContactList(studentId, list); + @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); } @@ -123,27 +124,31 @@ public class InfraDemo12StudentServiceImpl implements InfraDemo12StudentService // ==================== 子表(学生班主任) ==================== @Override - public InfraDemo12StudentTeacherDO getDemo12StudentTeacherByStudentId(Long studentId) { - return demo12StudentTeacherMapper.selectByStudentId(studentId); + public PageResult getDemo12StudentTeacherPage(PageParam pageReqVO, Long studentId) { + return demo12StudentTeacherMapper.selectPage(pageReqVO, studentId); } - private void createDemo12StudentTeacher(Long studentId, InfraDemo12StudentTeacherDO demo12StudentTeacher) { - if (demo12StudentTeacher == null) { - return; - } - demo12StudentTeacher.setStudentId(studentId); + @Override + public Long createDemo12StudentTeacher(InfraDemo12StudentTeacherDO demo12StudentTeacher) { demo12StudentTeacherMapper.insert(demo12StudentTeacher); + return demo12StudentTeacher.getId(); } - private void updateDemo12StudentTeacher(Long studentId, InfraDemo12StudentTeacherDO demo12StudentTeacher) { - if (demo12StudentTeacher == null) { - return; - } - demo12StudentTeacher.setStudentId(studentId); - demo12StudentTeacher.setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新 - demo12StudentTeacherMapper.insertOrUpdate(demo12StudentTeacher); + @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); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/controller.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/controller.vm index eb89ffcf3..0ba78b8a0 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/controller.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/controller.vm @@ -192,6 +192,16 @@ public class ${sceneEnum.prefixClass}${table.className}Controller { return success(true); } + @GetMapping("/${subSimpleClassName_strikeCase}/get") + @Operation(summary = "获得${subTable.classComment}") + @Parameter(name = "id", description = "编号", required = true) +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult<${subTable.className}DO> get${subSimpleClassName}(@RequestParam("id") ${subPrimaryColumn.javaType} id) { + return success(${classNameVar}Service.get${subSimpleClassName}(id)); + } + #end #end } \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/service.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/service.vm index 0fd6f8514..9153b3ea2 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/service.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/service.vm @@ -132,6 +132,14 @@ public interface ${table.className}Service { */ void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id); + /** + * 获得${subTable.classComment} + * + * @param id 编号 + * @return ${subTable.classComment} + */ + ${subTable.className}DO get${subSimpleClassName}(${subPrimaryColumn.javaType} id); + #end #end } \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/serviceImpl.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/serviceImpl.vm index 2cb4d4792..7f3846bf5 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/serviceImpl.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/serviceImpl.vm @@ -198,6 +198,11 @@ public class ${table.className}ServiceImpl implements ${table.className}Service ${subClassNameVars.get($index)}Mapper.deleteById(id); } + @Override + public ${subTable.className}DO get${subSimpleClassName}(${subPrimaryColumn.javaType} id) { + return ${subClassNameVars.get($index)}Mapper.selectById(id); + } + ## 情况二:非 MASTER_ERP 时,支持批量的新增、修改操作 #else #if ( $subTable.subJoinMany) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm index 3d2f9cf3f..532a1d399 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm @@ -95,5 +95,10 @@ export const update${subSimpleClassName} = async (data) => { export const delete${subSimpleClassName} = async (id: number) => { return await request.delete({ url: `${baseURL}/${subSimpleClassName_strikeCase}/delete?id=` + id }) } + +// 获得${subTable.classComment} +export const get${subSimpleClassName} = async (id: number) => { + return await request.get({ url: `${baseURL}/${subSimpleClassName_strikeCase}/get?id=` + id }) +} #end #end \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/form_sub_erp.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/form_sub_erp.vue.vm index 36d800734..24ee0dea6 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/form_sub_erp.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/form_sub_erp.vue.vm @@ -30,7 +30,7 @@ #elseif($column.htmlType == "imageUpload")## 图片上传 - + #elseif($column.htmlType == "fileUpload")## 文件上传 @@ -149,7 +149,7 @@ const open = async (type: string, id?: number, ${subJoinColumn.javaField}: numbe dialogTitle.value = t('action.' + type) formType.value = type resetForm() - formData.${subJoinColumn.javaField} = ${subJoinColumn.javaField} + formData.value.${subJoinColumn.javaField} = ${subJoinColumn.javaField} // 修改时,设置数据 if (id) { formLoading.value = true diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm index b2d125adc..82ebaabd6 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/form.vue.vm @@ -27,7 +27,7 @@ #elseif($column.htmlType == "imageUpload")## 图片上传 - + #elseif($column.htmlType == "fileUpload")## 文件上传