长页栏目更改

master
rong.liu 2 years ago
parent 90d7f8fa7a
commit b9b813c33e
  1. 37
      src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java
  2. 16
      src/main/java/com/huoran/iasf/entity/SysColumnLongPage.java
  3. 4
      src/main/java/com/huoran/iasf/mapper/xml/SysColumnLongPageMapper.xml
  4. 31
      src/main/java/com/huoran/iasf/vo/req/SysColumnLongRedisVO.java

@ -1,10 +1,13 @@
package com.huoran.iasf.controller; package com.huoran.iasf.controller;
import com.alibaba.fastjson.JSONObject;
import com.huoran.iasf.vo.req.SysColumnLongRedisVO;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.iasf.common.utils.R; import com.huoran.iasf.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -18,6 +21,8 @@ import com.huoran.iasf.service.SysColumnLongPageService;
import com.huoran.iasf.entity.SysColumnLongPage; import com.huoran.iasf.entity.SysColumnLongPage;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
@ -33,6 +38,9 @@ public class SysColumnLongPageController {
@Autowired @Autowired
public SysColumnLongPageService service; public SysColumnLongPageService service;
@Autowired
private StringRedisTemplate redisTemplate;
@PostMapping("/findById") @PostMapping("/findById")
@ApiOperation(value = "查询详情", response = SysColumnLongPage.class) @ApiOperation(value = "查询详情", response = SysColumnLongPage.class)
@ -64,5 +72,34 @@ public class SysColumnLongPageController {
boolean delState = service.removeById(id); boolean delState = service.removeById(id);
return delState ? R.success() : R.fail("删除失败"); return delState ? R.success() : R.fail("删除失败");
} }
@PostMapping("/saveTheCache")
@ApiOperation(value = "预览至储存(整个页面存储)")
public R saveTheCache(@RequestBody @ApiParam(name = "预览至储存对象", required = true) SysColumnLongRedisVO vo) {
String key = "saveTheCache:columnId:" + vo.getColumnId();
//保存到缓存中
redisTemplate.opsForValue().set(key, vo.getJson());
return R.success();
}
@PostMapping("/getRedisCache")
@ApiOperation(value = "获取Redis缓存")
public R getRedisCache(@ApiParam(name = "columnId", value = "栏目id主键", required = true) @RequestParam Integer columnId) {
//保存的key名
String key = "saveTheCache:columnId:" + columnId;
//查看缓存是否有数据
String returnValue = redisTemplate.opsForValue().get(key);
//使用缓存返回数据
if (returnValue != null) {
return R.success(returnValue);
}
return R.success();
}
} }

@ -37,14 +37,12 @@ public class SysColumnLongPage implements Serializable {
@NotNull(message = "排序不能为空!") @NotNull(message = "排序不能为空!")
private Integer sort; private Integer sort;
@ApiModelProperty(value = "内容(json字符串)")
@NotNull(message = "内容不能为空!")
private String json;
@ApiModelProperty(value = "创建人id") @ApiModelProperty(value = "创建人id")
@NotNull(message = "创建人id不能为空!")
private Integer founderId; private Integer founderId;
@ApiModelProperty(value = "编辑人id") @ApiModelProperty(value = "编辑人id")
@NotNull(message = "编辑人id不能为空!")
private Integer editorId; private Integer editorId;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@ -56,10 +54,20 @@ public class SysColumnLongPage implements Serializable {
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "是否删除(1未删除;0已删除)") @ApiModelProperty(value = "是否删除(1未删除;0已删除)")
@TableLogic
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "内容(编辑前存储的json字符串)")
private String jsonBeforeEditing;
@ApiModelProperty(value = "内容(编辑后存储的json字符串)")
private String theEditedJson;
@ApiModelProperty(value = "发布状态(0:草稿 1已发布)")
private Integer state;
} }

@ -6,8 +6,10 @@
<resultMap id="BaseResultMap" type="com.huoran.iasf.entity.SysColumnLongPage"> <resultMap id="BaseResultMap" type="com.huoran.iasf.entity.SysColumnLongPage">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="column_id" property="columnId"/> <result column="column_id" property="columnId"/>
<result column="json_before_editing" property="jsonBeforeEditing"/>
<result column="the_edited_json" property="theEditedJson"/>
<result column="sort" property="sort"/> <result column="sort" property="sort"/>
<result column="json" property="json"/> <result column="state" property="state"/>
<result column="founder_id" property="founderId"/> <result column="founder_id" property="founderId"/>
<result column="editor_id" property="editorId"/> <result column="editor_id" property="editorId"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>

@ -0,0 +1,31 @@
package com.huoran.iasf.vo.req;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @描述长页栏目拓展表
* @作者: Rong
* @日期: 2022-08-09
*/
@Data
public class SysColumnLongRedisVO {
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "栏目id")
private Integer columnId;
@ApiModelProperty(value = "预览储存的整个页面的json")
private String json;
}
Loading…
Cancel
Save