fix
Helius
2022-08-08 a62596b736d8a6c53aefbf47e3938f0c835e7305
fix
3 files modified
19 ■■■■■ changed files
src/main/java/com/xcong/farmer/cms/core/handler/PageDataParserHandler.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/mapper/ColumnMapper.java 1 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/ColumnMapper.xml 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/core/handler/PageDataParserHandler.java
@@ -10,9 +10,12 @@
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;
@@ -27,6 +30,7 @@
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("分页解析");
@@ -49,7 +53,14 @@
            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<>();
src/main/java/com/xcong/farmer/cms/modules/system/mapper/ColumnMapper.java
@@ -17,6 +17,7 @@
    List<AdminColumnVo> selectColumnInListByParentId(@Param("parentId") Long parentidDefault, @Param("companyId") Long companyId);
    ColumnEntity selectByCodeAndCompanyId(@Param("code") String code, @Param("companyId") Long companyId);
    ColumnEntity selectParentColumnByCodeAndCompanyId(@Param("code") String code, @Param("companyId") Long companyId);
    List<ColumnEntity> selectColumnByParentId(@Param("parentId") Long parentId, @Param("companyId") Long companyId, @Param("isNav") Integer isNav);
src/main/resources/mapper/ColumnMapper.xml
@@ -34,6 +34,11 @@
        where column_code=#{code} and company_id=#{companyId}
    </select>
    <select id="selectParentColumnByCodeAndCompanyId" resultType="com.xcong.farmer.cms.modules.system.entity.ColumnEntity">
        select a.* from t_column a, t_column b
        where b.column_code=#{code} and b.company_id=#{companyId} and a.id=b.parent_id
    </select>
    <select id="selectColumnByParentId" resultType="com.xcong.farmer.cms.modules.system.entity.ColumnEntity">
        select * from t_column
        where parent_id=#{parentId} and company_id=#{companyId}