|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package com.huoran.iasf.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
import com.huoran.iasf.common.aop.annotation.NoRepeatSubmit; |
|
|
|
@ -18,6 +19,8 @@ import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.cache.annotation.CacheEvict; |
|
|
|
|
import org.springframework.cache.annotation.Cacheable; |
|
|
|
|
import org.springframework.data.redis.RedisConnectionFailureException; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
@ -63,12 +66,14 @@ public class SysColumnController { |
|
|
|
|
|
|
|
|
|
@PostMapping("/listWithTree") |
|
|
|
|
@ApiOperation(value = "栏目树结构", response = SysColumn.class) |
|
|
|
|
@Cacheable(value = "redis_listWithTree", key = "#sysColumn.toString()") |
|
|
|
|
public R listWithTree(@RequestBody @Valid PaginationColumnReqVO sysColumn) { |
|
|
|
|
return R.success(service.listWithTree(sysColumn)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/listWithTreeMenuVisible") |
|
|
|
|
@ApiOperation(value = "栏目树结构(前台可见,只展示试单可见的栏目)", response = SysColumn.class) |
|
|
|
|
@Cacheable(value = "redis_listWithTreeMenuVisible", key = "#sysColumn.toString()") |
|
|
|
|
public R listWithTreeMenuVisible(@RequestBody @Valid PaginationColumnReqVO sysColumn) { |
|
|
|
|
return R.success(service.listWithTreeMenuVisible(sysColumn)); |
|
|
|
|
} |
|
|
|
@ -76,6 +81,7 @@ public class SysColumnController { |
|
|
|
|
|
|
|
|
|
@PostMapping("/findById") |
|
|
|
|
@ApiOperation(value = "查询详情", response = SysColumn.class) |
|
|
|
|
@Cacheable(value = "redis_columnDetails", key = "#id") |
|
|
|
|
public R findById(@RequestParam("id") @ApiParam(value = "主键ID") Integer id) { |
|
|
|
|
SysColumn sysColumn = service.getById(id); |
|
|
|
|
if (sysColumn == null) { |
|
|
|
@ -95,6 +101,9 @@ public class SysColumnController { |
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails","redis_listWithTreeMenuVisible"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
@ApiOperation(value = "新增", response = SysColumn.class) |
|
|
|
|
public R save(@RequestBody @Valid SysColumn sysColumn) { |
|
|
|
|
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<SysColumn>(); |
|
|
|
@ -105,7 +114,9 @@ public class SysColumnController { |
|
|
|
|
return addState ? R.success(sysColumn.getId()) : R.fail("新增失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails","redis_listWithTreeMenuVisible"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
@ApiOperation(value = "修改", response = SysColumn.class) |
|
|
|
|
public R update(@RequestBody SysColumn sysColumn) { |
|
|
|
|
boolean updateState = service.updateById(sysColumn); |
|
|
|
@ -136,7 +147,6 @@ public class SysColumnController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据用户ID和站点ID获取缓存的字段列表。 |
|
|
|
|
* 该接口通过组合用户ID和站点ID作为键,从Redis缓存中获取字段列表。如果缓存中不存在相应的数据, |
|
|
|
@ -185,7 +195,8 @@ public class SysColumnController { |
|
|
|
|
|
|
|
|
|
@PostMapping("/controlDisplayNavigationMenu") |
|
|
|
|
@ApiOperation(value = "控制显示导航菜单", response = SysColumn.class) |
|
|
|
|
public R controlDisplayNavigationMenu(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, @ApiParam(name = "menuVisible", value = "菜单是否可见(默认0可见 1不可见)", required = true) @RequestParam Integer menuVisible) { |
|
|
|
|
public R controlDisplayNavigationMenu(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, |
|
|
|
|
@ApiParam(name = "menuVisible", value = "菜单是否可见(默认0可见 1不可见)", required = true) @RequestParam Integer menuVisible) { |
|
|
|
|
SysColumn column = new SysColumn(); |
|
|
|
|
column.setId(id); |
|
|
|
|
column.setMenuVisible(menuVisible);//菜单是否可见(默认0可见 1不可见)
|
|
|
|
@ -195,7 +206,6 @@ public class SysColumnController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 批量删除栏目及其关联的内容和长页信息。 |
|
|
|
|
* 接收一个包含栏目ID的列表,遍历这些ID以执行以下操作: |
|
|
|
@ -210,6 +220,9 @@ public class SysColumnController { |
|
|
|
|
*/ |
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@PostMapping("/batchDeletion") |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
@ApiOperation(value = "批量删除栏目", response = SysColumn.class) |
|
|
|
|
public R batchDeletion(@ApiParam(name = "ids", value = "栏目ID列表", required = true) @RequestParam List<Integer> ids) { |
|
|
|
|
for (Integer id : ids) { |
|
|
|
@ -242,7 +255,6 @@ public class SysColumnController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/sameLevelJudgment") |
|
|
|
|
@ApiOperation(value = "同级判重", response = ColumnWeightReqVO.class) |
|
|
|
|
public R sameLevelJudgment(@RequestBody @Valid ColumnWeightReqVO sysColumn) { |
|
|
|
@ -292,7 +304,8 @@ public class SysColumnController { |
|
|
|
|
|
|
|
|
|
@ApiOperation("获取一级下的子级栏目") |
|
|
|
|
@PostMapping("/getsTheSubColumn") |
|
|
|
|
public R getsTheSubColumn(@ApiParam(name = "id", value = "id", required = true) @RequestParam Integer id, @ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId) { |
|
|
|
|
public R getsTheSubColumn(@ApiParam(name = "id", value = "id", required = true) @RequestParam Integer id, |
|
|
|
|
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId) { |
|
|
|
|
String ids = this.getIds(id); |
|
|
|
|
return service.getsTheSubColumn(id, ids, siteId); |
|
|
|
|
|
|
|
|
@ -366,7 +379,10 @@ public class SysColumnController { |
|
|
|
|
|
|
|
|
|
@ApiOperation("某一级查全部") |
|
|
|
|
@PostMapping("/oneLevelChecksThemAll") |
|
|
|
|
public R oneLevelChecksThemAll(@ApiParam(name = "id", value = "栏目id", required = true) @RequestParam Integer id, @ApiParam(name = "isSort", value = "判断是否为排序接口调用(1为排序接口调用 0我栏目管理列表调用)", required = true) @RequestParam Integer isSort, @ApiParam(name = "ids", value = "主键", required = true) @RequestParam Integer siteId) { |
|
|
|
|
public R oneLevelChecksThemAll(@ApiParam(name = "id", value = "栏目id", required = true) @RequestParam Integer id, |
|
|
|
|
@ApiParam(name = "isSort", value = "判断是否为排序接口调用(1为排序接口调用 0我栏目管理列表调用)", required = |
|
|
|
|
true) @RequestParam Integer isSort, @ApiParam(name = "ids", value = "主键", |
|
|
|
|
required = true) @RequestParam Integer siteId) { |
|
|
|
|
|
|
|
|
|
Integer pid = service.oneLevelChecksThemAll(id); |
|
|
|
|
String ids = this.getIds(pid); |
|
|
|
@ -383,8 +399,12 @@ public class SysColumnController { |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation("查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章,反之查询选中栏目下的文章)") |
|
|
|
|
@PostMapping("/queryArticlesByColumnType") |
|
|
|
|
@Cacheable(value = "redis_articlesByColumnType", key = "#ids + '-' + #id") |
|
|
|
|
public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) { |
|
|
|
|
String ids = this.getIds(columnId); |
|
|
|
|
if (StrUtil.isBlank(ids)) { |
|
|
|
|
return R.fail("栏目类型ID字符串不能为空"); |
|
|
|
|
} |
|
|
|
|
return service.queryArticlesByColumnType(ids, columnId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|