| | |
| | | |
| | | private ColumnMapper columnMapper = SpringContextHolder.getBean(ColumnMapper.class); |
| | | private ArticleMapper articleMapper = SpringContextHolder.getBean(ArticleMapper.class); |
| | | private CmsProperties cmsProperties = SpringContextHolder.getBean(CmsProperties.class); |
| | | |
| | | private String baseUrl = ""; |
| | | @Override |
| | | public void dataParser(AttrNode attrNode) { |
| | | log.info("栏目解析"); |
| | | // log.info("栏目解析"); |
| | | Long companyId = (Long) attrNode.getSystemDataValue("companyId"); |
| | | baseUrl = (String) attrNode.getSystemDataValue("baseUrl"); |
| | | |
| | | Column param = (Column) attrNode.getParam(); |
| | | |
| | |
| | | } |
| | | ColumnData columnData = columnToData(columnEntity); |
| | | if (columnEntity.getParentId() == 0L) { |
| | | List<ColumnEntity> child = columnMapper.selectColumnByParentId(columnEntity.getId(), companyId); |
| | | List<ColumnEntity> child = columnMapper.selectColumnByParentId(columnEntity.getId(), companyId, 1); |
| | | if (CollUtil.isNotEmpty(child)) { |
| | | List<ColumnData> list = new ArrayList<>(); |
| | | for (ColumnEntity entity : child) { |
| | |
| | | public ColumnData columnToData(ColumnEntity column) { |
| | | ColumnData columnData = ColumnConversion.INSTANCE.entityToData(column); |
| | | |
| | | columnData.setUrl(cmsProperties.getBaseUrl() + column.getPath()); |
| | | columnData.setUrl(baseUrl + column.getPath()); |
| | | if (column.getType() == 2) { |
| | | if (column.getTargetType() == 1) { |
| | | ArticleEntity article = this.articleMapper.selectArticleById(Long.parseLong(column.getTargetUrl())); |
| | | columnData.setUrl(cmsProperties.getBaseUrl() + article.getPath() + "/" + article.getId() + ".html"); |
| | | columnData.setUrl(baseUrl + article.getPath() + "/" + article.getId() + ".html"); |
| | | } else if (column.getTargetType() == 2) { |
| | | ColumnEntity columnEntity = this.columnMapper.selectByCodeAndCompanyId(column.getTargetUrl(), column.getCompanyId()); |
| | | columnData.setUrl(cmsProperties.getBaseUrl() + columnEntity.getPath()); |
| | | columnData.setUrl(baseUrl + columnEntity.getPath()); |
| | | } else { |
| | | columnData.setUrl(column.getTargetUrl()); |
| | | } |