src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -69,24 +69,19 @@ if(StrUtil.isNotEmpty(title)){ articleEntity.setTitle(title); } Integer contentType = adminArticleDto.getContentType() == null ? 0 : adminArticleDto.getContentType(); if(contentType != 0){ QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("content_type",contentType); List<ColumnEntity> columnEntities = columnMapper.selectList(objectQueryWrapper); if(CollUtil.isNotEmpty(columnEntities)){ List<Long> columIds = new ArrayList<>(); for(ColumnEntity columnEntity : columnEntities){ Long id = columnEntity.getId(); columIds.add(id); } articleEntity.setColumnIds(columIds); } } if(UserEntity.USER_BELONG_TOP != companyId){ articleEntity.setCompanyId(companyId); } IPage<AdminArticleVo> list = this.baseMapper.selectAdminArticleInPage(page,articleEntity); if (CollUtil.isNotEmpty(list.getRecords())) { for (AdminArticleVo record : list.getRecords()) { // 站内 if (record.getType() == 1) { record.setArticleUrl(record.getBaseUrl() + record.getPath() + "/" + record.getId() + ".html"); } } } return Result.ok(list); } src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminArticleVo.java
@@ -63,4 +63,10 @@ @ApiModelProperty(value = "外部链接地址") private String articleUrl; @ApiModelProperty(hidden = true) private String baseUrl; @ApiModelProperty(hidden = true) private String path; } src/main/resources/mapper/ArticleMapper.xml
@@ -5,10 +5,12 @@ <select id="selectAdminArticleInPage" resultType="com.xcong.farmer.cms.modules.system.vo.AdminArticleVo"> SELECT a.*, b.column_name columnName b.column_name columnName, c.web_address baseUrl FROM t_article a left join t_column b on a.column_id = b.id inner join t_company c on a.company_id=c.id <where> and a.del_status = 1 <if test="record != null" > @@ -73,7 +75,7 @@ inner join t_column b on a.column_id=b.id inner join t_column c on b.parent_id=c.id or c.id=b.id <where> a.company_id=#{record.companyId} a.company_id=#{record.companyId} and a.del_status = 1 <if test="record.columnCode != null and record.columnCode != ''"> and c.column_code=#{record.columnCode} </if>