fix: 查询记录数1问题

This commit is contained in:
TsMask
2023-09-28 11:11:24 +08:00
parent 09bcf2dc25
commit 0dee0fecc0
12 changed files with 25 additions and 25 deletions

View File

@@ -42,7 +42,7 @@ export async function listNeBackup(query: Record<string, any>) {
result.data.data.forEach((item: any) => {
const itemData = item['ne_backup'];
if (Array.isArray(itemData)) {
if (itemData.length === 1 && itemData[0]['total']) {
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
data.total = itemData[0]['total'];
} else {
data.rows = itemData.map(v => parseObjLineToHump(v));

View File

@@ -42,7 +42,7 @@ export async function listNeInfo(query: Record<string, any>) {
result.data.data.forEach((item: any) => {
const itemData = item['ne_info'];
if (Array.isArray(itemData)) {
if (itemData.length === 1 && itemData[0]['total']) {
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
data.total = itemData[0]['total'];
} else {
data.rows = itemData.map(v => parseObjLineToHump(v));

View File

@@ -42,7 +42,7 @@ export async function listNeSoftware(query: Record<string, any>) {
result.data.data.forEach((item: any) => {
const itemData = item['ne_software'];
if (Array.isArray(itemData)) {
if (itemData.length === 1 && itemData[0]['total']) {
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
data.total = itemData[0]['total'];
} else {
data.rows = itemData.map(v => parseObjLineToHump(v));
@@ -141,7 +141,7 @@ export async function listNeVersion(query: Record<string, any>) {
result.data.data.forEach((item: any) => {
const itemData = item['ne_version'];
if (Array.isArray(itemData)) {
if (itemData.length === 1 && itemData[0]['total']) {
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
data.total = itemData[0]['total'];
} else {
data.rows = itemData.map(v => parseObjLineToHump(v));