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

修改session过期时间

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