提交 cf7ddc2b authored 作者: zgy's avatar zgy

修改session过期时间

上级 024d5074
......@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
......@@ -107,4 +108,16 @@ public class TbCfArticleController extends AbstractController {
return R.ok().put("list", list);
}
@RequestMapping("/changeStatus")
@ResponseBody
@RequiresPermissions("tbcfarticle:changeStatus")
public R changeStatus(@RequestParam("isShow") Integer isShow, @RequestBody String ids[]) {
int res = tbCfArticleService.changeStatus(isShow, ids);
if (res>0){
return R.ok();
}
return R.error("操作失败");
}
}
package com.platform.dao;
import com.platform.entity.TbCfArticleEntity;
import org.apache.ibatis.annotations.Param;
/**
* 文章表Dao
......@@ -10,4 +11,5 @@ import com.platform.entity.TbCfArticleEntity;
*/
public interface TbCfArticleDao extends BaseDao<TbCfArticleEntity> {
int changeStatus(@Param("isShow") Integer isShow, @Param("ids") String ids[]);
}
......@@ -8,11 +8,13 @@ import java.util.Date;
* 表名 tb_cf_article
*
* @author lipengjun
* @date 2020-03-25 15:15:05
* @date 2020-04-15 10:58:12
*/
public class TbCfArticleEntity implements Serializable {
private static final long serialVersionUID = 1L;
private String account;
/**
* 文章ID
*/
......@@ -46,9 +48,13 @@ public class TbCfArticleEntity implements Serializable {
*/
private Integer delFlag;
/**
* 是否置顶 是:Y 否:N
* 是否置顶 0:否 1:置顶
*/
private String top;
private Integer top;
/**
* 是否展示
*/
private Integer isShow;
/**
* 创建时间
*/
......@@ -58,16 +64,6 @@ public class TbCfArticleEntity implements Serializable {
*/
private Date updatetime;
private String account;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
/**
* 设置:文章ID
*/
......@@ -81,6 +77,7 @@ public class TbCfArticleEntity implements Serializable {
public String getId() {
return id;
}
/**
* 设置:文章标题
*/
......@@ -94,6 +91,7 @@ public class TbCfArticleEntity implements Serializable {
public String getTitle() {
return title;
}
/**
* 设置:文章内容
*/
......@@ -107,6 +105,7 @@ public class TbCfArticleEntity implements Serializable {
public String getContent() {
return content;
}
/**
* 设置:图片
*/
......@@ -120,6 +119,7 @@ public class TbCfArticleEntity implements Serializable {
public String getPicture() {
return picture;
}
/**
* 设置:系统用户:0 普通用户:1
*/
......@@ -133,6 +133,7 @@ public class TbCfArticleEntity implements Serializable {
public Integer getAuthorType() {
return authorType;
}
/**
* 设置:作者
*/
......@@ -146,6 +147,7 @@ public class TbCfArticleEntity implements Serializable {
public String getAuthor() {
return author;
}
/**
* 设置:点赞人数
*/
......@@ -159,6 +161,7 @@ public class TbCfArticleEntity implements Serializable {
public Long getLikeNum() {
return likeNum;
}
/**
* 设置:删除标志 0:已删除 1:正常
*/
......@@ -172,19 +175,29 @@ public class TbCfArticleEntity implements Serializable {
public Integer getDelFlag() {
return delFlag;
}
public Integer getTop() {
return top;
}
public void setTop(Integer top) {
this.top = top;
}
/**
* 设置:是否置顶 是:Y 否:N
* 设置:是否展示
*/
public void setTop(String top) {
this.top = top;
public void setIsShow(Integer isShow) {
this.isShow = isShow;
}
/**
* 获取:是否置顶 是:Y 否:N
* 获取:是否展示
*/
public String getTop() {
return top;
public Integer getIsShow() {
return isShow;
}
/**
* 设置:创建时间
*/
......@@ -198,6 +211,7 @@ public class TbCfArticleEntity implements Serializable {
public Date getCreatetime() {
return createtime;
}
/**
* 设置:更新时间
*/
......@@ -211,4 +225,12 @@ public class TbCfArticleEntity implements Serializable {
public Date getUpdatetime() {
return updatetime;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
}
package com.platform.service;
import com.platform.entity.TbCfArticleEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.UnsupportedEncodingException;
import java.util.List;
......@@ -69,4 +71,6 @@ public interface TbCfArticleService {
* @return 删除条数
*/
int deleteBatch(String[] ids);
int changeStatus(Integer isShow, String ids[]);
}
......@@ -80,4 +80,9 @@ public class TbCfArticleServiceImpl implements TbCfArticleService {
public int deleteBatch(String[] ids) {
return tbCfArticleDao.deleteBatch(ids);
}
@Override
public int changeStatus(Integer isShow, String[] ids) {
return tbCfArticleDao.changeStatus(isShow, ids);
}
}
......@@ -13,6 +13,7 @@
<result property="likeNum" column="like_num"/>
<result property="delFlag" column="del_flag"/>
<result property="top" column="top"/>
<result property="isShow" column="is_show"/>
<result property="createtime" column="createTime"/>
<result property="updatetime" column="updateTime"/>
</resultMap>
......@@ -28,6 +29,7 @@
`like_num`,
`del_flag`,
`top`,
`is_show`,
`createTime`,
`updateTime`
from tb_cf_article
......@@ -45,6 +47,7 @@
`like_num`,
`del_flag`,
`top`,
is_show,
`createTime`,
`updateTime`,
u.account account
......@@ -59,7 +62,7 @@
order by ${sidx} ${order}
</when>
<otherwise>
order by createTime desc
order by top desc,createTime desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
......@@ -86,6 +89,7 @@
`like_num`,
`del_flag`,
`top`,
`is_show`,
`createTime`,
`updateTime`)
values(
......@@ -98,6 +102,7 @@
#{likeNum},
#{delFlag},
#{top},
#{isShow},
#{createtime},
#{updatetime})
</insert>
......@@ -113,12 +118,18 @@
<if test="likeNum != null">`like_num` = #{likeNum},</if>
<if test="delFlag != null">`del_flag` = #{delFlag},</if>
<if test="top != null">`top` = #{top},</if>
<if test="isShow != null">`is_show` = #{isShow},</if>
<if test="createtime != null">`createTime` = #{createtime},</if>
<if test="updatetime != null">`updateTime` = #{updatetime}</if>
</set>
where id = #{id}
</update>
<update id="changeStatus">
update tb_cf_article set is_show=#{isShow} where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="delete">
delete from tb_cf_article where id = #{value}
</delete>
......
......@@ -25,6 +25,14 @@
#if($shiro.hasPermission("tbcfarticle:delete"))
<i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
#end
#if($shiro.hasPermission("tbcfarticle:changeStatus"))
<i-button type="success" @click="changeStatus(1)"><i class="fa fa-arrow-up"></i>&nbsp;显示
</i-button>
#end
#if($shiro.hasPermission("tbcfarticle:changeStatus"))
<i-button type="warning" @click="changeStatus(0)"><i class="fa fa-arrow-down"></i>&nbsp;隐藏
</i-button>
#end
</div>
</Row>
<table id="jqGrid"></table>
......@@ -56,6 +64,13 @@
<i-input v-model="tbCfArticle.author" placeholder="260977204970 or ctehillah@gmail.com"
@on-blur="queryAccount"/>
</Form-item>
<Form-item label="是否显示" prop="isShow">
<i-Switch size="large" v-model="isShow" true-color="#13ce66" false-color="#eeddff"
>
<span slot="open">显示</span>
<span slot="close">隐藏</span>
</i-Switch>
</Form-item>
<Form-item label="图片" prop="picture">
<!-- <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> -->
<upload
......
......@@ -6,6 +6,7 @@ $(function () {
{label: '文章标题', name: 'title', index: 'title', width: 80},
{label: '图片', name: 'picture', index: 'picture', width: 80, formatter: imageFormat},
{label: '作者', name: 'account', index: 'account', width: 80, formatter: accountFormat},
{label: '是否显示', name: 'isShow', index: 'isShow', width: 80, formatter: validFormat},
{label: '创建时间', name: 'createtime', index: 'createTime', width: 80}
]
});
......@@ -39,7 +40,9 @@ let vm = new Vue({
name: ''
},
disabled: false,
flag: true
flag: true,
isShow: false
},
methods: {
......@@ -74,6 +77,8 @@ let vm = new Vue({
vm.reload();
},
add: function () {
vm.account = true;
vm.isShow = false;
vm.disabled = false;
vm.showList = false;
vm.title = "新增";
......@@ -92,9 +97,34 @@ let vm = new Vue({
vm.getInfo(id);
},
changeStatus: function (status) {
let Ids = getSelectedRows("#jqGrid");
if (Ids == null) {
return;
}
Ajax.request({
url: "../tbcfarticle/changeStatus?isShow=" + status,
params: JSON.stringify(Ids),
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.reload();
});
}
});
},
saveOrUpdate: function (event) {
let flag = this.queryAccount();
let flag = vm.flag;
if (vm.tbCfArticle.authorType === 1 && vm.tbCfArticle.id == null) {
flag = this.queryAccount();
}
if (flag) {
if (!vm.isShow) {
vm.tbCfArticle.isShow = 0;
} else {
vm.tbCfArticle.isShow = 1;
}
let url = vm.tbCfArticle.id == null ? "../tbcfarticle/save" : "../tbcfarticle/update";
vm.tbCfArticle.picture = this.uploadList.map(res => res).join(',');
vm.tbCfArticle.content = encodeURI(UE.getEditor('content').getContent()); // 富文本取值
......@@ -142,6 +172,9 @@ let vm = new Vue({
successCallback: function (r) {
vm.account = true;
vm.tbCfArticle = r.tbCfArticle;
if (vm.tbCfArticle.isShow === 1) {
vm.isShow = true;
}
let content = vm.tbCfArticle.content;
vm.uploadList = vm.tbCfArticle.picture.split(',');
if (content != null) {
......
......@@ -10,7 +10,7 @@
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
<!-- 设置session过期时间为1小时(单位:毫秒),默认为30分钟 -->
<property name="globalSessionTimeout" value="86400000"></property>
<property name="globalSessionTimeout" value="2592000000"></property>
<property name="sessionValidationSchedulerEnabled" value="true"></property>
<property name="sessionIdUrlRewritingEnabled" value="false"></property>
</bean>
......@@ -55,8 +55,9 @@
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<!-- AOP式方法级权限检查 -->
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor">
<property name="proxyTargetClass" value="true" />
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
depends-on="lifecycleBeanPostProcessor">
<property name="proxyTargetClass" value="true"/>
</bean>
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
<property name="securityManager" ref="securityManager"/>
......
......@@ -14,8 +14,8 @@ import java.util.Map;
public class TokenService {
@Autowired
private ApiTokenMapper tokenDao;
//12小时后过期
private final static int EXPIRE = 3600 * 12;
//10天后过期
private final static int EXPIRE = 3600 * 240;
public TokenEntity queryByUserId(Long userId) {
return tokenDao.queryByUserId(userId);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论