|
|
|
@ -20,6 +20,7 @@ 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.CachePut; |
|
|
|
|
import org.springframework.cache.annotation.Cacheable; |
|
|
|
|
import org.springframework.data.redis.RedisConnectionFailureException; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
@ -101,8 +102,8 @@ public class SysColumnController { |
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails","redis_listWithTreeMenuVisible"}, |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar","redis_listWithTreeMenuVisible", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails", "redis_controlDisplayNavigationMenu"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
@ApiOperation(value = "新增", response = SysColumn.class) |
|
|
|
|
public R save(@RequestBody @Valid SysColumn sysColumn) { |
|
|
|
@ -114,10 +115,11 @@ public class SysColumnController { |
|
|
|
|
return addState ? R.success(sysColumn.getId()) : R.fail("新增失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails","redis_listWithTreeMenuVisible"}, |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar","redis_listWithTreeMenuVisible", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails", "redis_controlDisplayNavigationMenu"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
@ApiOperation(value = "修改", response = SysColumn.class) |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
public R update(@RequestBody SysColumn sysColumn) { |
|
|
|
|
boolean updateState = service.updateById(sysColumn); |
|
|
|
|
return updateState ? R.success() : R.fail("编辑失败"); |
|
|
|
@ -193,13 +195,20 @@ public class SysColumnController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/controlDisplayNavigationMenu") |
|
|
|
|
@ApiOperation(value = "控制显示导航菜单", response = SysColumn.class) |
|
|
|
|
public R controlDisplayNavigationMenu(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar","redis_listWithTreeMenuVisible", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails", "redis_controlDisplayNavigationMenu"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
@CachePut(value = "redis_controlDisplayNavigationMenu", key = "#id + ':' + #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不可见)
|
|
|
|
|
column.setMenuVisible(menuVisible); // 菜单是否可见(默认0可见 1不可见)
|
|
|
|
|
|
|
|
|
|
boolean updateState = service.updateById(column); |
|
|
|
|
return updateState ? R.success() : R.fail("编辑失败"); |
|
|
|
@ -220,8 +229,8 @@ public class SysColumnController { |
|
|
|
|
*/ |
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@PostMapping("/batchDeletion") |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails"}, |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar","redis_listWithTreeMenuVisible", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails", "redis_controlDisplayNavigationMenu"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
@ApiOperation(value = "批量删除栏目", response = SysColumn.class) |
|
|
|
|
public R batchDeletion(@ApiParam(name = "ids", value = "栏目ID列表", required = true) @RequestParam List<Integer> ids) { |
|
|
|
@ -271,6 +280,9 @@ public class SysColumnController { |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/sortByColumn") |
|
|
|
|
@ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class) |
|
|
|
|
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar","redis_listWithTreeMenuVisible", |
|
|
|
|
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails", "redis_controlDisplayNavigationMenu"}, |
|
|
|
|
allEntries = true) |
|
|
|
|
public R sortByColumn(@RequestBody List<SortColumnRespVO> sortColumnRespVOList) { |
|
|
|
|
for (SortColumnRespVO sortInfo : sortColumnRespVOList) { |
|
|
|
|
// 获取当前要排序的栏目信息
|
|
|
|
@ -399,7 +411,7 @@ public class SysColumnController { |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation("查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章,反之查询选中栏目下的文章)") |
|
|
|
|
@PostMapping("/queryArticlesByColumnType") |
|
|
|
|
@Cacheable(value = "redis_articlesByColumnType", key = "#ids + '-' + #id") |
|
|
|
|
@Cacheable(value = "redis_articlesByColumnType", key = "#columnId") |
|
|
|
|
public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) { |
|
|
|
|
String ids = this.getIds(columnId); |
|
|
|
|
if (StrUtil.isBlank(ids)) { |
|
|
|
|