From 6d2f6b16a2bbcf0dd5343526d0323ce9482bbc0e Mon Sep 17 00:00:00 2001 From: User_cyk <1020691186@qq.com> Date: Tue, 11 Jul 2023 12:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9onefile=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/service/oneFileService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/com/hellogithub/service/oneFileService.java b/src/com/hellogithub/service/oneFileService.java index 35aff92..a98f8a6 100644 --- a/src/com/hellogithub/service/oneFileService.java +++ b/src/com/hellogithub/service/oneFileService.java @@ -1,12 +1,11 @@ package com.hellogithub.service; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hellogithub.dao.fileDao; import com.hellogithub.entity.fileEntity; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class oneFileService { private fileDao fileDao = new fileDao(); @@ -14,7 +13,7 @@ public class oneFileService { List fileEntityList =fileDao.selectFileEntity(); Map dataMap; - Map> daMap2= new HashMap<>(); + List> daMap2= new LinkedList<>(); for(int i=0;i(); @@ -25,9 +24,10 @@ public class oneFileService { dataMap.put("name",name); dataMap.put("language",language); dataMap.put("description",description); - daMap2.put(""+i,dataMap); + daMap2.add(i,dataMap); } - return JSONObject.toJSONString(daMap2); + return JSONArray.toJSONString(daMap2); + } public fileEntity selectFileEntityById(int id ){return fileDao.selectFileEntityById(id); } }