This commit is contained in:
landaiqing 2023-12-25 02:45:03 +08:00
parent ee639e7f4a
commit 9161f7357e
3 changed files with 16 additions and 6 deletions

View File

@ -13,6 +13,7 @@ import com.lovenav.entity.UrlList;
import com.lovenav.service.UrlCateListService; import com.lovenav.service.UrlCateListService;
import com.lovenav.service.UrlListService; import com.lovenav.service.UrlListService;
import com.lovenav.vo.CateAndUrl; import com.lovenav.vo.CateAndUrl;
import io.swagger.models.auth.In;
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
@ -182,6 +183,7 @@ public class UrlAndCateController {
List<UrlList> urlLists = urlListService.selectUrListByNeedLogin(); List<UrlList> urlLists = urlListService.selectUrListByNeedLogin();
List<CateAndUrl> cateAndUrlList = new ArrayList<>(); List<CateAndUrl> cateAndUrlList = new ArrayList<>();
Set<String> parentSet = new HashSet<>(); Set<String> parentSet = new HashSet<>();
List<Integer> integers = new ArrayList<>();
for( int i = 0 ; i < urlLists.size() ; i++) for( int i = 0 ; i < urlLists.size() ; i++)
{ {
String parentString = urlCateListService.selectUrListCateByUrlCateId(urlLists.get(i).getCateId()); String parentString = urlCateListService.selectUrListCateByUrlCateId(urlLists.get(i).getCateId());
@ -194,8 +196,13 @@ public class UrlAndCateController {
parentSet.add(parent); parentSet.add(parent);
} }
} }
for(String str : parentSet)
for (String str : parentSet) { {
integers.add(Integer.valueOf(str));
}
Collections.sort(integers);
for (Integer str : integers) {
System.out.println(str);
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str)); UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str));
CateAndUrl cateAndUrl = new CateAndUrl(); CateAndUrl cateAndUrl = new CateAndUrl();
cateAndUrl.setFloder("true"); cateAndUrl.setFloder("true");
@ -463,7 +470,6 @@ public class UrlAndCateController {
String parentString = urlCateListService.selectUrListCateByUrlCateId(urlLists.get(i).getCateId()); String parentString = urlCateListService.selectUrListCateByUrlCateId(urlLists.get(i).getCateId());
if(parentString == null) continue; if(parentString == null) continue;
String [] parentList = parentString.split(","); String [] parentList = parentString.split(",");
System.out.println(parentString);
for(String parent : parentList) for(String parent : parentList)
{ {
if(parent.equals("0")){ if(parent.equals("0")){
@ -472,7 +478,10 @@ public class UrlAndCateController {
parentSet.add(parent); parentSet.add(parent);
} }
} }
for (String str : parentSet) { List<String> ls=Arrays.asList(parentSet.toArray(new String[0]));
Collections.sort(ls);
for (String str : ls) {
System.out.println(str);
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str)); UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str));
CateAndUrl cateAndUrl = new CateAndUrl(); CateAndUrl cateAndUrl = new CateAndUrl();
cateAndUrl.setFloder("true"); cateAndUrl.setFloder("true");
@ -506,7 +515,7 @@ public class UrlAndCateController {
cateAndUrl.setIsEncrypt(urlList.getIsEncrypt()); cateAndUrl.setIsEncrypt(urlList.getIsEncrypt());
int flag =0 ; int flag =0 ;
for(CateAndUrl cateAndUrl1 : cateAndUrlList){ for(CateAndUrl cateAndUrl1 : cateAndUrlList){
if(String.valueOf(cateAndUrl.getParentId()).equals(cateAndUrl1.getCateId()+"")) if(String.valueOf(urlList.getCateId()).equals(cateAndUrl1.getCateId()+""))
{ {
flag = 1; flag = 1;
cateAndUrl1.getChildUC().add(cateAndUrl); cateAndUrl1.getChildUC().add(cateAndUrl);

View File

@ -60,5 +60,6 @@ public class QRCServiceImpl implements QRCService{
String base64 = QRCodeUtil.ImageToBase64(url_wait); String base64 = QRCodeUtil.ImageToBase64(url_wait);
return JSON.toJSONString(base64); return JSON.toJSONString(base64);
} }
return null;
} }
} }

View File

@ -32,7 +32,7 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from ln_url_cate_list from ln_url_cate_list
where user_id = #{userId,jdbcType=INTEGER} where user_id = #{userId,jdbcType=INTEGER} order by id
</select> </select>
<select id="selectCateByNameAnduserId" resultMap="BaseResultMap"> <select id="selectCateByNameAnduserId" resultMap="BaseResultMap">