infra: 修正 查询实体列表方法,传入的ID集合为空时,会导致异常的问题

This commit is contained in:
owen 2023-09-19 17:14:42 +08:00
parent a3e161a9a3
commit f998d43e68

View File

@ -64,14 +64,14 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
@Override @Override
public ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id) { public ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id) {
if (CollUtil.isEmpty(ids)) {
return ListUtil.empty();
}
return ${classNameVar}Mapper.selectById(id); return ${classNameVar}Mapper.selectById(id);
} }
@Override @Override
public List<${table.className}DO> get${simpleClassName}List(Collection<${primaryColumn.javaType}> ids) { public List<${table.className}DO> get${simpleClassName}List(Collection<${primaryColumn.javaType}> ids) {
if (CollUtil.isEmpty(ids)) {
return ListUtil.empty();
}
return ${classNameVar}Mapper.selectBatchIds(ids); return ${classNameVar}Mapper.selectBatchIds(ids);
} }