Commit e01a48ff by fsn

整理

parent e4673207
package com.stylefeng.guns.common.annotion;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 统计系统调用次数的注解
*
* @author fengshuonan
* @date 2017年3月4日 下午11:53:28
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface CountStat {
String[] value() default {};
}
package com.stylefeng.guns.common.page;
/**
*
* 分页参数类(for BootStrap Table)
*
* @author fengshuonan
......@@ -9,58 +8,58 @@ package com.stylefeng.guns.common.page;
*/
public class PageBT {
private int limit; // 每页显示个数
private int limit; // 每页显示个数
private int offset; // 查询的偏移量(查询的页数 = offset/limit + 1)
private int offset; // 查询的偏移量(查询的页数 = offset/limit + 1)
private String order; // 排序方式
public PageBT() {
super();
}
private String order; // 排序方式
public PageBT(int limit, int offset) {
super();
this.limit = limit;
this.offset = offset;
}
public int getLimit() {
return limit;
}
public PageBT() {
super();
}
public void setLimit(int limit) {
this.limit = limit;
}
public PageBT(int limit, int offset) {
super();
this.limit = limit;
this.offset = offset;
}
public int getOffset() {
return offset;
}
public int getLimit() {
return limit;
}
public void setOffset(int offset) {
this.offset = offset;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getOrder() {
return order;
}
public int getOffset() {
return offset;
}
public void setOrder(String order) {
this.order = order;
}
public void setOffset(int offset) {
this.offset = offset;
}
public int getPageSize() {
return this.limit;
}
public String getOrder() {
return order;
}
public int getPageNumber() {
return this.offset / this.limit + 1;
}
public void setOrder(String order) {
this.order = order;
}
@Override
public String toString() {
return "PageBT [limit=" + limit + ", offset=" + offset + ", order=" + order + "]";
}
public int getPageSize() {
return this.limit;
}
public int getPageNumber() {
return this.offset / this.limit + 1;
}
@Override
public String toString() {
return "PageBT [limit=" + limit + ", offset=" + offset + ", order=" + order + "]";
}
}
......@@ -5,38 +5,37 @@ import com.baomidou.mybatisplus.plugins.Page;
import java.util.List;
/**
*
* 分页结果的封装(for Bootstrap Table)
*
*
* @author fengshuonan
* @Date 2017年1月22日 下午11:06:41
*/
public class PageInfoBT<T> {
// 结果集
private List<T> rows;
// 总数
private long total;
public PageInfoBT(Page<T> page) {
this.rows = page.getRecords();
this.total = page.getTotal();
}
public List<T> getRows() {
return rows;
}
public void setRows(List<T> rows) {
this.rows = rows;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
// 结果集
private List<T> rows;
// 总数
private long total;
public PageInfoBT(Page<T> page) {
this.rows = page.getRecords();
this.total = page.getTotal();
}
public List<T> getRows() {
return rows;
}
public void setRows(List<T> rows) {
this.rows = rows;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
}
package com.stylefeng.guns.core.aop;
import com.stylefeng.guns.common.controller.BaseController;
import com.stylefeng.guns.core.support.HttpKit;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
/**
* 本系统调用次数的统计
*/
@Aspect
@Component
public class CountAop extends BaseController {
private static Object sync = new Object();
@Pointcut(value = "@annotation(com.stylefeng.guns.common.annotion.CountStat)")
private void cutPermission() {
}
@Around("cutPermission()")
public Object around(ProceedingJoinPoint point) throws Throwable {
HttpServletRequest request = HttpKit.getRequest();
Object systemCount = request.getServletContext().getAttribute("systemCount");
synchronized (sync) {
if(systemCount == null){
request.getServletContext().setAttribute("systemCount", 1);
}else{
request.getServletContext().setAttribute("systemCount", (Integer)systemCount + 1);
}
}
return point.proceed();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment