diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/mapper_sub.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/mapper_sub.vm index e5589e99df..6ccaea79ea 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/mapper_sub.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/mapper_sub.vm @@ -29,6 +29,12 @@ public interface ${subTable.className}Mapper extends BaseMapperX<${subTable.clas .orderByDesc(${subTable.className}DO::getId));## 大多数情况下,id 倒序 } +## 主表与子表是一对一时 + #if (!$subTable.subJoinMany) + default ${subTable.className}DO selectBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return selectOne(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}); + } + #end ## 情况二:非 MASTER_ERP 时,需要列表查询子表 #else @@ -48,4 +54,4 @@ public interface ${subTable.className}Mapper extends BaseMapperX<${subTable.clas return delete(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}); } -} \ No newline at end of file +}