| | |
| | | import com.xcong.farmer.cms.core.tag.data.PageChildData; |
| | | import com.xcong.farmer.cms.core.tag.data.PageData; |
| | | import com.xcong.farmer.cms.core.tag.model.Article; |
| | | import com.xcong.farmer.cms.core.tag.model.Column; |
| | | import com.xcong.farmer.cms.core.tag.model.Pagination; |
| | | import com.xcong.farmer.cms.modules.system.entity.ArticleEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.ColumnEntity; |
| | | import com.xcong.farmer.cms.modules.system.mapper.ArticleMapper; |
| | | import com.xcong.farmer.cms.modules.system.mapper.ColumnMapper; |
| | | import com.xcong.farmer.cms.utils.SpringContextHolder; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | public class PageDataParserHandler implements DataParserHandler { |
| | | |
| | | private ArticleMapper articleMapper = SpringContextHolder.getBean(ArticleMapper.class); |
| | | private ColumnMapper columnMapper = SpringContextHolder.getBean(ColumnMapper.class); |
| | | @Override |
| | | public void dataParser(AttrNode attrNode) { |
| | | log.info("分页解析"); |
| | | synchronized (this) { |
| | | Template.HAS_PAGING = true; |
| | | |
| | | String baseUrl = (String) attrNode.getSystemDataValue("baseUrl"); |
| | | |
| | | Long companyId = (Long) attrNode.getSystemDataValue("companyId"); |
| | | Pagination param = (Pagination) attrNode.getParam(); |
| | | |
| | | Object pageNum = attrNode.getSystemDataValue("page"); |
| | | if (pageNum != null) { |
| | | param.setPage(pageNum.toString()); |
| | | } |
| | | |
| | | Page<ArticleEntity> page = new Page<>(Integer.parseInt(param.getPage()), Integer.parseInt(param.getLimit())); |
| | | ArticleEntity article = new ArticleEntity(); |
| | |
| | | pageData.setTotalCnt((int) pageList.getSize()); |
| | | |
| | | if (CollUtil.isNotEmpty(pageList.getRecords())) { |
| | | String path = baseUrl + "/" + param.getCode(); |
| | | ColumnEntity parentColumn = columnMapper.selectParentColumnByCodeAndCompanyId(param.getCode(), companyId); |
| | | String path; |
| | | if (parentColumn == null) { |
| | | path = baseUrl + "/" + param.getCode(); |
| | | } else { |
| | | path = baseUrl + "/" + parentColumn.getColumnCode() + "/" + param.getCode(); |
| | | } |
| | | |
| | | String filename = "index_{}.html"; |
| | | |
| | | List<PageChildData> list = new ArrayList<>(); |