prescript
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -31,7 +30,19 @@ public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEn
|
||||
Page<PrescriptEntity> prescriptEntityPage = getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
for (PrescriptEntity p : prescriptEntityPage.getRecords()){
|
||||
p.setImageList(JSON.parseArray(p.getImages(),String.class));
|
||||
p.setPrescriptCategoryEntity(getTree(p.getPrescriptCategoryId()));
|
||||
}
|
||||
return prescriptEntityPage;
|
||||
}
|
||||
|
||||
|
||||
private PrescriptCategoryEntity getTree(int categoryId){
|
||||
PrescriptCategoryEntity prescriptCategoryEntity = prescriptCategoryDao.selectOne(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPrescriptCategoryId,categoryId));
|
||||
if(prescriptCategoryEntity.getPid()==0){
|
||||
return prescriptCategoryEntity;
|
||||
}
|
||||
PrescriptCategoryEntity tree = getTree(prescriptCategoryEntity.getPid());
|
||||
tree.setChild(prescriptCategoryEntity);
|
||||
return tree;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user