提交代码

master
rong.liu 2 years ago
parent 657cfcae0e
commit 5e36ba9c37
  1. 16
      src/main/java/com/huoran/iasf/controller/SysColumnController.java
  2. 2
      src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java
  3. 3
      src/main/java/com/huoran/iasf/mapper/SysContentMapper.java
  4. 12
      src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml
  5. 20
      src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml
  6. 2
      src/main/java/com/huoran/iasf/service/SysColumnService.java
  7. 24
      src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java

@ -144,7 +144,7 @@ public class SysColumnController {
return R.success(); return R.success();
} }
@ApiOperation("获取一级下的子级栏目(包含自己)") @ApiOperation("获取一级下的子级栏目")
@PostMapping("/getsTheSubColumn") @PostMapping("/getsTheSubColumn")
public R getsTheSubColumn(Integer id) { public R getsTheSubColumn(Integer id) {
String ids = this.getIds(id); String ids = this.getIds(id);
@ -153,7 +153,7 @@ public class SysColumnController {
} }
@ApiOperation("获取某层级下的子级栏目(包含自己)") @ApiOperation("获取某层级下的子级栏目")
@PostMapping("/getsSublevelColumnsUnderALevel") @PostMapping("/getsSublevelColumnsUnderALevel")
public R getsSublevelColumnsUnderALevel(Integer id) { public R getsSublevelColumnsUnderALevel(Integer id) {
String ids = this.getIds(id); String ids = this.getIds(id);
@ -225,5 +225,17 @@ public class SysColumnController {
} }
/**
* 查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章反之查询选中栏目下的文章)
* @param columnId
* @return
*/
@ApiOperation("查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章,反之查询选中栏目下的文章)")
@PostMapping("/queryArticlesByColumnType")
public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) {
String ids = this.getIds(columnId);
return service.queryArticlesByColumnType(ids,columnId);
}
} }

@ -38,4 +38,6 @@ public interface SysColumnMapper extends BaseMapper<SysColumn> {
Integer oneLevelChecksThemAll(@Param("theChildId")Integer theChildId); Integer oneLevelChecksThemAll(@Param("theChildId")Integer theChildId);
List<SysColumn> queryByColumnType(@Param("ids")String ids);
} }

@ -28,4 +28,7 @@ public interface SysContentMapper extends BaseMapper<SysContent> {
List<SysContentClassification> useTheColumnToGetTagsForTheFullArticle(String ids); List<SysContentClassification> useTheColumnToGetTagsForTheFullArticle(String ids);
IPage<SysContent> siteSearchArticles(Page<SysContent> page, @Param("req") PageContentReqVO req); IPage<SysContent> siteSearchArticles(Page<SysContent> page, @Param("req") PageContentReqVO req);
List<PageContentRespVO> columnConditionsFilterArticles(@Param("columnId")String columnId);
} }

@ -185,6 +185,18 @@
ORDER BY ORDER BY
T1.lvl DESC limit 0,1 T1.lvl DESC limit 0,1
</select> </select>
<select id="queryByColumnType" resultType="com.huoran.iasf.entity.SysColumn">
SELECT
id,
father_id,
column_name,
list_style_id
FROM
sys_column s
WHERE
FIND_IN_SET( s.id, #{ids} )
GROUP BY list_style_id
</select>
</mapper> </mapper>

@ -137,6 +137,26 @@
CONCAT('%',#{req.title},'%') CONCAT('%',#{req.title},'%')
</if> </if>
</select> </select>
<select id="columnConditionsFilterArticles" resultType="com.huoran.iasf.vo.resp.PageContentRespVO">
SELECT
t.*,
( SELECT cl.list_style_id FROM sys_column cl WHERE cl.id = t.column_id ) AS listStyleId
FROM
(
SELECT
s.*,
( SELECT GROUP_CONCAT( label_name ) FROM sys_content_label l WHERE deleted = 1 AND FIND_IN_SET( l.id, s.lable_id ) ) AS labelName,
( SELECT c.classification_name FROM sys_content_classification c WHERE deleted = 1 AND s.classification_id = c.id ) AS classificationName
FROM
sys_content s
WHERE
s.deleted = 1
AND is_disable = 0
AND is_release = 1
) t
WHERE
FIND_IN_SET( t.column_id, #{columnId} )
</select>
</mapper> </mapper>

@ -40,5 +40,7 @@ public interface SysColumnService extends IService<SysColumn> {
R getSubColumn(Integer parentId,String ids); R getSubColumn(Integer parentId,String ids);
R queryArticlesByColumnType(String ids,Integer id);
} }

@ -8,6 +8,7 @@ import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.common.utils.TreeStructureUtils; import com.huoran.iasf.common.utils.TreeStructureUtils;
import com.huoran.iasf.entity.SysColumn; import com.huoran.iasf.entity.SysColumn;
import com.huoran.iasf.mapper.SysColumnMapper; import com.huoran.iasf.mapper.SysColumnMapper;
import com.huoran.iasf.mapper.SysContentMapper;
import com.huoran.iasf.service.SysColumnService; import com.huoran.iasf.service.SysColumnService;
import com.huoran.iasf.vo.FatherContentRespVO; import com.huoran.iasf.vo.FatherContentRespVO;
import com.huoran.iasf.vo.req.ColumnWeightReqVO; import com.huoran.iasf.vo.req.ColumnWeightReqVO;
@ -33,6 +34,9 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
@Autowired @Autowired
private SysColumnMapper mapper; private SysColumnMapper mapper;
@Autowired
private SysContentMapper contentMapper;
@Override @Override
public boolean sameLevelJudgment(ColumnWeightReqVO column) { public boolean sameLevelJudgment(ColumnWeightReqVO column) {
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<>();
@ -160,6 +164,26 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
return R.success(TreeStructureUtils.forMethod(getsTheSubColumn)); return R.success(TreeStructureUtils.forMethod(getsTheSubColumn));
} }
@Override
public R queryArticlesByColumnType(String ids, Integer id) {
Integer count = 0;
for (String columnId : ids.split(",")) {
++count;
}
List<SysColumn> queryByColumnType = baseMapper.queryByColumnType(ids);
//为1表示该层级下以及它本身列表样式模板一直则查询全部的
if (count > 1) {
if (queryByColumnType.size() == 1) {
return R.success(contentMapper.columnConditionsFilterArticles(ids));
}
}
//表示该层级下的全部层级不一致只查本身
return R.success(contentMapper.columnConditionsFilterArticles(id + ""));
}
} }

Loading…
Cancel
Save