Commit 0c9485a6bfa88cf667f61779ac562ad5efb88833
1 parent
dffdd471
infra: 修正 查询实体列表方法,传入的ID集合为空时,会导致异常的问题
Showing
1 changed file
with
6 additions
and
0 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/serviceImpl.vm
| @@ -15,6 +15,9 @@ import ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName} | @@ -15,6 +15,9 @@ import ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName} | ||
| 15 | import static ${ServiceExceptionUtilClassName}.exception; | 15 | import static ${ServiceExceptionUtilClassName}.exception; |
| 16 | import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*; | 16 | import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*; |
| 17 | 17 | ||
| 18 | +import cn.hutool.core.collection.CollUtil; | ||
| 19 | +import cn.hutool.core.collection.ListUtil; | ||
| 20 | + | ||
| 18 | /** | 21 | /** |
| 19 | * ${table.classComment} Service 实现类 | 22 | * ${table.classComment} Service 实现类 |
| 20 | * | 23 | * |
| @@ -61,6 +64,9 @@ public class ${table.className}ServiceImpl implements ${table.className}Service | @@ -61,6 +64,9 @@ public class ${table.className}ServiceImpl implements ${table.className}Service | ||
| 61 | 64 | ||
| 62 | @Override | 65 | @Override |
| 63 | public ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id) { | 66 | public ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id) { |
| 67 | + if (CollUtil.isEmpty(ids)) { | ||
| 68 | + return ListUtil.empty(); | ||
| 69 | + } | ||
| 64 | return ${classNameVar}Mapper.selectById(id); | 70 | return ${classNameVar}Mapper.selectById(id); |
| 65 | } | 71 | } |
| 66 | 72 |