权限开发,页面交互开发,增加阅读数
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.zyplayer.doc.data.aspect;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.HttpConst;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
@@ -14,9 +15,11 @@ import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
@@ -32,13 +35,16 @@ public class AuthAspect {
|
||||
RestController restController = BeanUtil.getAnnotation(pjp, RestController.class);
|
||||
boolean isResponseBody = (restController != null || responseBody != null);
|
||||
|
||||
Class<?> returnType = ((MethodSignature) pjp.getSignature()).getMethod().getReturnType();
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (currentUser == null) {
|
||||
String reason = "你访问的内容需要登录,请登录后再试";
|
||||
if (isResponseBody) {
|
||||
return DocResponseJson.failure(HttpConst.TOKEN_TIMEOUT, reason);
|
||||
} else {
|
||||
return authMan.authUrl();
|
||||
} else if (returnType.isAssignableFrom(ModelAndView.class)) {
|
||||
return new ModelAndView("redirect:/static/manage/login.html");
|
||||
} else if (returnType.isAssignableFrom(Map.class)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
}
|
||||
// 判断权限是否足够
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -11,7 +12,7 @@ import java.io.Serializable;
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-09
|
||||
* @since 2019-06-05
|
||||
*/
|
||||
public class WikiPage implements Serializable {
|
||||
|
||||
@@ -88,6 +89,11 @@ public class WikiPage implements Serializable {
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 阅读数
|
||||
*/
|
||||
private Integer viewNum;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -186,6 +192,13 @@ public class WikiPage implements Serializable {
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
public Integer getViewNum() {
|
||||
return viewNum;
|
||||
}
|
||||
|
||||
public void setViewNum(Integer viewNum) {
|
||||
this.viewNum = viewNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -204,6 +217,7 @@ public class WikiPage implements Serializable {
|
||||
", updateUserName=" + updateUserName +
|
||||
", updateTime=" + updateTime +
|
||||
", delFlag=" + delFlag +
|
||||
", viewNum=" + viewNum +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class CodeGenerator {
|
||||
final String moduleName = "manage";
|
||||
// final String[] tableName = { "zyplayer_storage", "auth_info", "user_auth", "user_info" };
|
||||
// final String[] tableName = { "wiki_space", "wiki_page", "wiki_page_content", "wiki_page_file", "wiki_page_comment", "wiki_page_zan" };
|
||||
final String[] tableName = { "user_auth" };
|
||||
final String[] tableName = { "wiki_page" };
|
||||
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-09
|
||||
* @since 2019-06-05
|
||||
*/
|
||||
@Service
|
||||
public class WikiPageServiceImpl extends ServiceImpl<WikiPageMapper, WikiPage> implements WikiPageService {
|
||||
|
||||
Reference in New Issue
Block a user