浏览代码

首次提交

zh.sqy 9 年之前
父节点
当前提交
8fdc1300a9
共有 57 个文件被更改,包括 4266 次插入0 次删除
  1. 23 0
      hsweb-web-bean/pom.xml
  2. 38 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/param/PagerResult.java
  3. 134 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/param/QueryParam.java
  4. 81 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/GenericPo.java
  5. 126 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/config/Config.java
  6. 205 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/form/Form.java
  7. 249 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/logger/LoggerInfo.java
  8. 239 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/module/Module.java
  9. 185 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/resource/Resources.java
  10. 115 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/role/Role.java
  11. 139 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/role/RoleModule.java
  12. 93 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/role/UserRole.java
  13. 166 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/script/DynamicScript.java
  14. 323 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/user/User.java
  15. 86 0
      hsweb-web-bean/src/main/java/org/hsweb/web/bean/valid/ValidResults.java
  16. 57 0
      hsweb-web-controller/pom.xml
  17. 199 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/GenericController.java
  18. 155 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/config/ConfigController.java
  19. 193 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/file/FileController.java
  20. 32 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/form/FormController.java
  21. 33 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/module/ModuleController.java
  22. 85 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/resource/ResourcesController.java
  23. 39 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/role/RoleController.java
  24. 60 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/script/DynamicScriptController.java
  25. 62 0
      hsweb-web-controller/src/main/java/org/hsweb/web/controller/user/UserController.java
  26. 24 0
      hsweb-web-controller/src/test/java/org/hsweb/controller/test/HelloWorld.java
  27. 17 0
      hsweb-web-core/pom.xml
  28. 8 0
      hsweb-web-core/src/main/java/org/hsweb/web/authorize/annotation/AccessLogger.java
  29. 74 0
      hsweb-web-core/src/main/java/org/hsweb/web/authorize/annotation/Authorize.java
  30. 16 0
      hsweb-web-core/src/main/java/org/hsweb/web/exception/AuthorizeException.java
  31. 17 0
      hsweb-web-core/src/main/java/org/hsweb/web/exception/BusinessException.java
  32. 233 0
      hsweb-web-core/src/main/java/org/hsweb/web/message/ResponseMessage.java
  33. 16 0
      hsweb-web-dao-impl-mybatis/pom.xml
  34. 23 0
      hsweb-web-dao-interface/pom.xml
  35. 77 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/GenericMapper.java
  36. 13 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/config/ConfigMapper.java
  37. 12 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/form/FormMapper.java
  38. 12 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/module/ModuleMapper.java
  39. 12 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/resource/ResourcesMapper.java
  40. 12 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/role/RoleMapper.java
  41. 25 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/role/RoleModuleMapper.java
  42. 23 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/role/UserRoleMapper.java
  43. 12 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/script/DynamicScriptMapper.java
  44. 14 0
      hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/user/UserMapper.java
  45. 16 0
      hsweb-web-service-impl-common/pom.xml
  46. 22 0
      hsweb-web-service-interface/pom.xml
  47. 94 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/GenericService.java
  48. 82 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/config/ConfigService.java
  49. 13 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/form/FormService.java
  50. 22 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/module/ModuleService.java
  51. 23 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/resource/FileService.java
  52. 20 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/resource/ResourcesService.java
  53. 12 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/role/RoleService.java
  54. 26 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/script/DynamicScriptService.java
  55. 37 0
      hsweb-web-service-interface/src/main/java/org/hsweb/web/service/user/UserService.java
  56. 16 0
      hsweb-web-websocket/pom.xml
  57. 126 0
      pom.xml

+ 23 - 0
hsweb-web-bean/pom.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-bean</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <dependencies>
+        <!-- hibernate-validator -->
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>${hibernate.validator.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 38 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/param/PagerResult.java

@@ -0,0 +1,38 @@
+package org.hsweb.web.bean.param;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by 浩 on 2016-01-16 0016.
+ */
+public class PagerResult<Po> implements Serializable {
+    private static final long serialVersionUID = -6171751136953308027L;
+    private int total;
+
+    private List<Po> data;
+
+    public PagerResult() {
+    }
+
+    public PagerResult(int total, List<Po> data) {
+        this.total = total;
+        this.data = data;
+    }
+
+    public int getTotal() {
+        return total;
+    }
+
+    public void setTotal(int total) {
+        this.total = total;
+    }
+
+    public List<Po> getData() {
+        return data;
+    }
+
+    public void setData(List<Po> data) {
+        this.data = data;
+    }
+}

+ 134 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/param/QueryParam.java

@@ -0,0 +1,134 @@
+package org.hsweb.web.bean.param;
+
+import java.util.*;
+
+/**
+ * Created by 浩 on 2016-01-16 0016.
+ */
+public class QueryParam extends HashMap<String, Object> {
+    private static final long serialVersionUID = 7941767360194797891L;
+
+    /**
+     * 是否进行分页,默认为true
+     */
+    private boolean paging = true;
+
+    /**
+     * 第几页 从0开始
+     */
+    private int pageIndex = 0;
+
+    /**
+     * 每页显示记录条数
+     */
+    private int pageSize = 25;
+
+    /**
+     * 排序字段
+     */
+    private String sortField;
+
+    /**
+     * 排序方式 DESC 反序 ASC 正序
+     */
+    private String sortOrder;
+
+    /**
+     * 指定要查询的字段
+     */
+    private Set<String> includes = new LinkedHashSet<>();
+
+    /**
+     * 指定不查询的字段
+     */
+    private Set<String> excludes = new LinkedHashSet<>();
+
+    /**
+     * 指定查询的字段列表,如传入 username,name,在sql里就只会执行 select username,name from table。
+     *
+     * @param fields 查询的字段列表
+     * @return this 引用
+     */
+    public QueryParam includes(String... fields) {
+        includes.addAll(Arrays.asList(fields));
+        return this;
+    }
+
+    /**
+     * 指定不需要查询的的字段列表
+     *
+     * @param fields 不需要查询的字段列表
+     * @return this 引用
+     */
+    public QueryParam excludes(String... fields) {
+        excludes.addAll(Arrays.asList(fields));
+        includes.removeAll(Arrays.asList(fields));
+        return this;
+    }
+
+    public QueryParam where(String key, Object value) {
+        this.put(key, value);
+        return this;
+    }
+
+    public QueryParam where(Map<String, Object> conditions) {
+        this.putAll(conditions);
+        return this;
+    }
+
+    public boolean isPaging() {
+        return paging;
+    }
+
+    public void setPaging(boolean paging) {
+        this.paging = paging;
+    }
+
+    public int getPageIndex() {
+        return pageIndex;
+    }
+
+    public void setPageIndex(int pageIndex) {
+        this.pageIndex = pageIndex;
+    }
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public String getSortField() {
+        return sortField;
+    }
+
+    public void setSortField(String sortField) {
+        this.sortField = sortField;
+    }
+
+    public String getSortOrder() {
+        return sortOrder;
+    }
+
+    public void setSortOrder(String sortOrder) {
+        this.sortOrder = sortOrder;
+    }
+
+    public Set<String> getIncludes() {
+        return includes;
+    }
+
+    public void setIncludes(Set<String> includes) {
+        this.includes = includes;
+    }
+
+    public Set<String> getExcludes() {
+        return excludes;
+    }
+
+    public void setExcludes(Set<String> excludes) {
+        this.excludes = excludes;
+    }
+}

+ 81 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/GenericPo.java

@@ -0,0 +1,81 @@
+package org.hsweb.web.bean.po;
+
+
+import org.hsweb.web.bean.valid.ValidResults;
+import org.webbuilder.utils.common.MD5;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * 通用的PO对象,实现基本的属性和方法。新建的PO都应继承该类
+ * Created by 浩 on 2015-07-20 0020.
+ */
+public class GenericPo<PK> implements Serializable {
+    private static final long serialVersionUID = 9197157871004374522L;
+    /**
+     * 主键
+     */
+    private PK u_id;
+
+    public PK getU_id() {
+        return u_id;
+    }
+
+    @Override
+    public int hashCode() {
+        if (getU_id() == null) return 0;
+        return getU_id().hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return this.hashCode() == obj.hashCode();
+    }
+
+    public void setU_id(PK u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 创建一个主键,根据当前时戳和随机数的一个MD5值
+     *
+     * @return
+     */
+    public static String createUID() {
+        return MD5.encode(String.valueOf(System.nanoTime()) + String.valueOf(Math.random()));
+    }
+
+    /**
+     * 使用hibernate验证器验证一个对象
+     *
+     * @param object 需要验证的对象
+     * @return 验证结果
+     */
+    public static final ValidResults valid(Object object) {
+        ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
+        Validator validator = factory.getValidator();
+        Set<ConstraintViolation<Object>> set = validator.validate(object);
+        ValidResults results = new ValidResults();
+        if (set.size() != 0) {
+            for (ConstraintViolation<Object> violation : set) {
+                results.addResult(violation.getPropertyPath().toString(), violation.getMessage());
+            }
+        }
+        return results;
+    }
+
+    /**
+     * 验证自生
+     *
+     * @return 验证结果
+     */
+    public ValidResults valid() {
+        return valid(this);
+    }
+
+}

+ 126 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/config/Config.java

@@ -0,0 +1,126 @@
+package org.hsweb.web.bean.po.config;
+
+import org.hsweb.web.bean.po.GenericPo;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Properties;
+
+/**
+ * 系统配置
+ * Created by generator
+ */
+public class Config extends GenericPo<String> {
+
+    private static final long serialVersionUID = 5328848488856425388L;
+    //主键
+    private String u_id;
+
+    //备注
+    private String remark;
+
+    //配置内容
+    private String content;
+
+    //创建日期
+    private java.util.Date create_date;
+
+    //最后一次修改日期
+    private java.util.Date update_date;
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return "";
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 备注
+     *
+     * @return String 备注
+     */
+    public String getRemark() {
+        if (this.remark == null)
+            return "";
+        return this.remark;
+    }
+
+    /**
+     * 设置 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    /**
+     * 获取 配置内容
+     *
+     * @return String 配置内容
+     */
+    public String getContent() {
+        if (this.content == null)
+            return "";
+        return this.content;
+    }
+
+    /**
+     * 设置 配置内容
+     */
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    /**
+     * 获取 创建日期
+     *
+     * @return java.util.Date 创建日期
+     */
+    public java.util.Date getCreate_date() {
+        return this.create_date;
+    }
+
+    /**
+     * 设置 创建日期
+     */
+    public void setCreate_date(java.util.Date create_date) {
+        this.create_date = create_date;
+    }
+
+    /**
+     * 获取 最后一次修改日期
+     *
+     * @return java.util.Date 最后一次修改日期
+     */
+    public java.util.Date getUpdate_date() {
+        return this.update_date;
+    }
+
+    /**
+     * 设置 最后一次修改日期
+     */
+    public void setUpdate_date(java.util.Date update_date) {
+        this.update_date = update_date;
+    }
+
+    public Properties toMap() {
+        Properties properties = new Properties();
+        try {
+            properties.load(new StringReader(getContent()));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return properties;
+    }
+}

+ 205 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/form/Form.java

@@ -0,0 +1,205 @@
+package org.hsweb.web.bean.po.form;
+
+import org.hsweb.web.bean.po.GenericPo;
+
+/**
+* 自定义表单
+* Created by generator 
+*/
+public class Form extends GenericPo<String> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    //主键
+    private String u_id;
+
+    //名称
+    private String name;
+
+    //定义内容
+    private String content;
+
+    //数据库表名
+    private String table_name;
+
+    //表关联信息
+    private String foreigns;
+
+    //备注
+    private String remark;
+
+    //自动维护
+    private boolean auto_alter;
+
+    //创建时间
+    private java.util.Date create_date;
+
+    //最后一次修改时间
+    private java.util.Date update_date;
+
+    //数据库名称
+    private String db_name;
+
+    /**
+    * 获取 主键
+    * @return String 主键
+    */
+    public String getU_id(){
+           if(this.u_id==null)
+              return "";
+        return this.u_id;
+    }
+
+    /**
+    * 设置 主键
+    */
+    public void setU_id(String u_id){
+        this.u_id=u_id;
+    }
+
+    /**
+    * 获取 名称
+    * @return String 名称
+    */
+    public String getName(){
+           if(this.name==null)
+              return "";
+        return this.name;
+    }
+
+    /**
+    * 设置 名称
+    */
+    public void setName(String name){
+        this.name=name;
+    }
+
+    /**
+    * 获取 定义内容
+    * @return String 定义内容
+    */
+    public String getContent(){
+           if(this.content==null)
+              return "";
+        return this.content;
+    }
+
+    /**
+    * 设置 定义内容
+    */
+    public void setContent(String content){
+        this.content=content;
+    }
+
+    /**
+    * 获取 数据库表名
+    * @return String 数据库表名
+    */
+    public String getTable_name(){
+           if(this.table_name==null)
+              return "";
+        return this.table_name;
+    }
+
+    /**
+    * 设置 数据库表名
+    */
+    public void setTable_name(String table_name){
+        this.table_name=table_name;
+    }
+
+    /**
+    * 获取 表关联信息
+    * @return String 表关联信息
+    */
+    public String getForeigns(){
+           if(this.foreigns==null)
+              return "";
+        return this.foreigns;
+    }
+
+    /**
+    * 设置 表关联信息
+    */
+    public void setForeigns(String foreigns){
+        this.foreigns=foreigns;
+    }
+
+    /**
+    * 获取 备注
+    * @return String 备注
+    */
+    public String getRemark(){
+           if(this.remark==null)
+              return "";
+        return this.remark;
+    }
+
+    /**
+    * 设置 备注
+    */
+    public void setRemark(String remark){
+        this.remark=remark;
+    }
+
+    /**
+    * 获取 自动维护
+    * @return boolean 自动维护
+    */
+    public boolean isAuto_alter(){
+        return this.auto_alter;
+    }
+
+    /**
+    * 设置 自动维护
+    */
+    public void setAuto_alter(boolean auto_alter){
+        this.auto_alter=auto_alter;
+    }
+
+    /**
+    * 获取 创建时间
+    * @return java.util.Date 创建时间
+    */
+    public java.util.Date getCreate_date(){
+        return this.create_date;
+    }
+
+    /**
+    * 设置 创建时间
+    */
+    public void setCreate_date(java.util.Date create_date){
+        this.create_date=create_date;
+    }
+
+    /**
+    * 获取 最后一次修改时间
+    * @return java.util.Date 最后一次修改时间
+    */
+    public java.util.Date getUpdate_date(){
+        return this.update_date;
+    }
+
+    /**
+    * 设置 最后一次修改时间
+    */
+    public void setUpdate_date(java.util.Date update_date){
+        this.update_date=update_date;
+    }
+
+    /**
+    * 获取 数据库名称
+    * @return String 数据库名称
+    */
+    public String getDb_name(){
+           if(this.db_name==null)
+              return "orcl";
+        return this.db_name;
+    }
+
+    /**
+    * 设置 数据库名称
+    */
+    public void setDb_name(String db_name){
+        this.db_name=db_name;
+    }
+
+}

+ 249 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/logger/LoggerInfo.java

@@ -0,0 +1,249 @@
+package org.hsweb.web.bean.po.logger;
+
+import org.hsweb.web.bean.po.GenericPo;
+
+/**
+ * Created by 浩 on 2015-09-11 0011.
+ */
+public class LoggerInfo extends GenericPo<String> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    /**
+     * 请求者ip
+     */
+    private String client_ip;
+
+    /**
+     * 请求路径
+     */
+    private String request_uri;
+
+    /**
+     * 完整路径
+     */
+    private String request_url;
+
+    /**
+     * 对应的方法,格式为 HTTP方法+java方法 如:GET.list()
+     */
+    private String request_method;
+
+    /**
+     * 响应结果
+     */
+    private String response_content;
+
+    /**
+     * 用户主键
+     */
+    private String user_id;
+
+    /**
+     * 请求时间
+     */
+    private long request_time;
+
+    /**
+     * 响应时间
+     */
+    private long response_time;
+
+    /**
+     * 请求耗时
+     */
+    private long use_time = -1;
+
+    /**
+     * referer信息
+     */
+    private String referer;
+
+    /**
+     * 客户端标识
+     */
+    private String user_agent;
+
+    /**
+     * 响应码
+     */
+    private String response_code;
+
+    /**
+     * 请求头信息
+     */
+    private String request_header;
+
+    /**
+     * 对应类名
+     */
+    private String class_name;
+
+    /**
+     * 功能摘要
+     */
+    private String module_desc;
+
+    /**
+     * 请求参数
+     */
+    private String request_param;
+
+    /**
+     * 响应异常
+     */
+    private String exception_info;
+
+    /**
+     * 命中缓存
+     */
+    private String cache_key;
+
+
+    public String getUser_id() {
+        if (user_id == null)
+            user_id = "-";
+        return user_id;
+    }
+
+    public void setUser_id(String user_id) {
+        this.user_id = user_id;
+    }
+
+    public long getRequest_time() {
+        return request_time;
+    }
+
+    public void setRequest_time(long request_time) {
+        this.request_time = request_time;
+    }
+
+    public long getResponse_time() {
+        return response_time;
+    }
+
+    public void setResponse_time(long response_time) {
+        this.response_time = response_time;
+    }
+
+    public long getUse_time() {
+        if (use_time == -1)
+            use_time = getResponse_time() - getRequest_time();
+        return use_time;
+    }
+
+    public void setUse_time(long use_time) {
+        this.use_time = use_time;
+    }
+
+    public String getReferer() {
+        return referer;
+    }
+
+    public void setReferer(String referer) {
+        this.referer = referer;
+    }
+
+    public String getUser_agent() {
+        return user_agent;
+    }
+
+    public void setUser_agent(String user_agent) {
+        this.user_agent = user_agent;
+    }
+
+
+    public String getClass_name() {
+        return class_name;
+    }
+
+    public void setClass_name(String class_name) {
+        this.class_name = class_name;
+    }
+
+    public String getClient_ip() {
+        return client_ip;
+    }
+
+    public void setClient_ip(String client_ip) {
+        this.client_ip = client_ip;
+    }
+
+    public String getRequest_uri() {
+        return request_uri;
+    }
+
+    public void setRequest_uri(String request_uri) {
+        this.request_uri = request_uri;
+    }
+
+    public String getRequest_url() {
+        return request_url;
+    }
+
+    public void setRequest_url(String request_url) {
+        this.request_url = request_url;
+    }
+
+    public String getRequest_method() {
+        return request_method;
+    }
+
+    public void setRequest_method(String request_method) {
+        this.request_method = request_method;
+    }
+
+    public String getResponse_content() {
+        return response_content;
+    }
+
+    public void setResponse_content(String response_content) {
+        this.response_content = response_content;
+    }
+
+    public String getResponse_code() {
+        return response_code;
+    }
+
+    public void setResponse_code(String response_code) {
+        this.response_code = response_code;
+    }
+
+    public String getRequest_header() {
+        return request_header;
+    }
+
+    public void setRequest_header(String request_header) {
+        this.request_header = request_header;
+    }
+
+    public String getModule_desc() {
+        return module_desc;
+    }
+
+    public void setModule_desc(String module_desc) {
+        this.module_desc = module_desc;
+    }
+
+    public String getRequest_param() {
+        return request_param;
+    }
+
+    public void setRequest_param(String request_param) {
+        this.request_param = request_param;
+    }
+
+    public String getException_info() {
+        return exception_info;
+    }
+
+    public void setException_info(String exception_info) {
+        this.exception_info = exception_info;
+    }
+
+    public String getCache_key() {
+        return cache_key;
+    }
+
+    public void setCache_key(String cache_key) {
+        this.cache_key = cache_key;
+    }
+}

+ 239 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/module/Module.java

@@ -0,0 +1,239 @@
+package org.hsweb.web.bean.po.module;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
+import org.hibernate.validator.constraints.NotEmpty;
+import org.hsweb.web.bean.po.GenericPo;
+
+import javax.validation.constraints.NotNull;
+import java.util.*;
+
+
+/**
+ * 系统模块
+ * Created by generator
+ */
+public class Module extends GenericPo<String> implements Comparable<Module> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    //主键
+    @NotNull
+    @NotEmpty(message = "id不能为空")
+    private String u_id;
+
+    //模块名称
+    @NotNull
+    @NotEmpty(message = "名称不能为空")
+    private String name;
+
+    //模块路径
+    private String uri;
+
+    //模块图标
+    private String icon;
+
+    //父级模块主键
+    private String p_id = "-1";
+
+    //备注
+    private String remark;
+
+    //状态
+    private int status = 1;
+
+    //模块操作选项
+    private String m_option;
+
+    //排序
+    private int sort_index;
+
+    private String old_id;
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return "";
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 模块名称
+     *
+     * @return String 模块名称
+     */
+    public String getName() {
+        if (this.name == null)
+            return "";
+        return this.name;
+    }
+
+    /**
+     * 设置 模块名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 获取 模块路径
+     *
+     * @return String 模块路径
+     */
+    public String getUri() {
+        if (this.uri == null)
+            return "";
+        return this.uri;
+    }
+
+    /**
+     * 设置 模块路径
+     */
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+    /**
+     * 获取 模块图标
+     *
+     * @return String 模块图标
+     */
+    public String getIcon() {
+        if (this.icon == null)
+            return "";
+        return this.icon;
+    }
+
+    /**
+     * 设置 模块图标
+     */
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    /**
+     * 获取 父级模块主键
+     *
+     * @return String 父级模块主键
+     */
+    public String getP_id() {
+        if (this.p_id == null)
+            return "-1";
+        return this.p_id;
+    }
+
+    /**
+     * 设置 父级模块主键
+     */
+    public void setP_id(String p_id) {
+        this.p_id = p_id;
+    }
+
+    /**
+     * 获取 备注
+     *
+     * @return String 备注
+     */
+    public String getRemark() {
+        if (this.remark == null)
+            return "";
+        return this.remark;
+    }
+
+    /**
+     * 设置 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    /**
+     * 获取 状态
+     *
+     * @return int 状态
+     */
+    public int getStatus() {
+        return this.status;
+    }
+
+    /**
+     * 设置 状态
+     */
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public int getSort_index() {
+        return sort_index;
+    }
+
+    public void setSort_index(int sort_index) {
+        this.sort_index = sort_index;
+    }
+
+    /**
+     * 获取 模块操作选项
+     *
+     * @return String 模块操作选项
+     */
+    public String getM_option() {
+        return this.m_option;
+    }
+
+    public Map<String, Object> getM_optionMap() {
+        try {
+            List<Map<String, Object>> opt = JSON.parseObject(getM_option(),new TypeReference<LinkedList<Map<String, Object>>>(){});
+            if (opt == null) return new HashMap<>();
+            Map<String, Object> all = new LinkedHashMap<>();
+            for (Map<String, Object> map : opt) {
+                all.put(String.valueOf(map.get("id")), map);
+            }
+            return all;
+        } catch (Exception e) {
+            return new HashMap<>();
+        }
+    }
+
+    /**
+     * 设置 模块操作选项
+     */
+    public void setM_option(String m_option) {
+        this.m_option = m_option;
+    }
+
+    @Override
+    public int hashCode() {
+        return getU_id().hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) return false;
+        return this.hashCode() == obj.hashCode();
+    }
+
+    @Override
+    public int compareTo(Module o) {
+        return getSort_index() > o.getSort_index() ? 1 : -1;
+    }
+
+    public String getOld_id() {
+        if (old_id == null)
+            old_id = getU_id();
+        return old_id;
+    }
+
+    public void setOld_id(String old_id) {
+        this.old_id = old_id;
+    }
+
+}

+ 185 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/resource/Resources.java

@@ -0,0 +1,185 @@
+package org.hsweb.web.bean.po.resource;
+
+import org.hsweb.web.bean.po.GenericPo;
+import org.webbuilder.utils.file.FileUtils;
+import org.hibernate.validator.constraints.NotEmpty;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 资源
+ * Created by generator
+ */
+public class Resources extends GenericPo<String> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    //主键
+    @NotNull
+    @NotEmpty(message = "id不能为空")
+    private String u_id;
+
+    //资源名称
+    private String name;
+
+    //资源地址
+    private String path;
+
+    //创建时间
+    private java.util.Date create_date;
+
+    //创建人主键
+    private String creator_id;
+
+    //MD5校验值
+    private String md5;
+
+    //资源类型
+    private String type;
+
+    //状态
+    private int status;
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return "";
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 资源名称
+     *
+     * @return String 资源名称
+     */
+    public String getName() {
+        if (this.name == null)
+            return "";
+        return this.name;
+    }
+
+    /**
+     * 设置 资源名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 获取 资源地址
+     *
+     * @return String 资源地址
+     */
+    public String getPath() {
+        if (this.path == null)
+            return "";
+        return this.path;
+    }
+
+    /**
+     * 设置 资源地址
+     */
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    /**
+     * 获取 创建时间
+     *
+     * @return java.util.Date 创建时间
+     */
+    public java.util.Date getCreate_date() {
+        return this.create_date;
+    }
+
+    /**
+     * 设置 创建时间
+     */
+    public void setCreate_date(java.util.Date create_date) {
+        this.create_date = create_date;
+    }
+
+    /**
+     * 获取 创建人主键
+     *
+     * @return String 创建人主键
+     */
+    public String getCreator_id() {
+        if (this.creator_id == null)
+            return "";
+        return this.creator_id;
+    }
+
+    /**
+     * 设置 创建人主键
+     */
+    public void setCreator_id(String creator_id) {
+        this.creator_id = creator_id;
+    }
+
+    /**
+     * 获取 MD5校验值
+     *
+     * @return String MD5校验值
+     */
+    public String getMd5() {
+        if (this.md5 == null)
+            return "";
+        return this.md5;
+    }
+
+    /**
+     * 设置 MD5校验值
+     */
+    public void setMd5(String md5) {
+        this.md5 = md5;
+    }
+
+    /**
+     * 获取 资源类型
+     *
+     * @return String 资源类型
+     */
+    public String getType() {
+        if (this.type == null)
+            return "";
+        return this.type;
+    }
+
+    /**
+     * 设置 资源类型
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * 获取 状态
+     *
+     * @return int 状态
+     */
+    public int getStatus() {
+        return this.status;
+    }
+
+    /**
+     * 设置 状态
+     */
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public String getSuffix() {
+        return FileUtils.getSuffix(getName());
+    }
+
+}

+ 115 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/role/Role.java

@@ -0,0 +1,115 @@
+package org.hsweb.web.bean.po.role;
+
+import org.hsweb.web.bean.po.GenericPo;
+import org.hibernate.validator.constraints.NotEmpty;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * 后台管理角色
+ * Created by generator
+ */
+public class Role extends GenericPo<String> {
+
+    public static final String SYS_ROLE_ADMIN = "admin";
+    private static final long serialVersionUID = 9197157871004374522L;
+    //主键
+    @NotNull
+    @NotEmpty(message = "主键不能为空")
+    private String u_id;
+
+    //角色名称
+    @NotNull
+    @NotEmpty(message = "名称不能为空")
+    private String name;
+
+    //备注
+    private String remark;
+
+    //角色类型
+    private String type;
+
+    //角色持有的模块
+    private List<RoleModule> modules;
+
+    public List<RoleModule> getModules() {
+        return modules;
+    }
+
+    public void setModules(List<RoleModule> modules) {
+        this.modules = modules;
+    }
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return "";
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 角色名称
+     *
+     * @return String 角色名称
+     */
+    public String getName() {
+        if (this.name == null)
+            return "";
+        return this.name;
+    }
+
+    /**
+     * 设置 角色名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 获取 备注
+     *
+     * @return String 备注
+     */
+    public String getRemark() {
+        if (this.remark == null)
+            return "";
+        return this.remark;
+    }
+
+    /**
+     * 设置 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    /**
+     * 获取 角色类型
+     *
+     * @return String 角色类型
+     */
+    public String getType() {
+        if (this.type == null)
+            return "";
+        return this.type;
+    }
+
+    /**
+     * 设置 角色类型
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+}

+ 139 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/role/RoleModule.java

@@ -0,0 +1,139 @@
+package org.hsweb.web.bean.po.role;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
+import org.hibernate.validator.constraints.NotEmpty;
+import org.hsweb.web.bean.po.GenericPo;
+import org.hsweb.web.bean.po.module.Module;
+import org.webbuilder.utils.common.StringUtils;
+
+import javax.validation.constraints.NotNull;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 系统模块角色绑定
+ * Created by generator
+ */
+public class RoleModule extends GenericPo<String> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    //主键
+    @NotNull
+    @NotEmpty
+    private String u_id;
+
+    //模块主键
+    @NotNull
+    @NotEmpty
+    private String module_id;
+
+    //角色主键
+    @NotNull
+    @NotEmpty
+    private String role_id;
+
+    //权限级别
+    private String o_level;
+
+    private transient Module module;
+
+    private List<String> levels;
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return "";
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 模块主键
+     *
+     * @return String 模块主键
+     */
+    public String getModule_id() {
+        if (this.module_id == null)
+            return "";
+        return this.module_id;
+    }
+
+    /**
+     * 设置 模块主键
+     */
+    public void setModule_id(String module_id) {
+        this.module_id = module_id;
+    }
+
+    /**
+     * 获取 角色主键
+     *
+     * @return String 角色主键
+     */
+    public String getRole_id() {
+        if (this.role_id == null)
+            return "";
+        return this.role_id;
+    }
+
+    /**
+     * 设置 角色主键
+     */
+    public void setRole_id(String role_id) {
+        this.role_id = role_id;
+    }
+
+    /**
+     * 获取 权限级别
+     *
+     * @return String 权限级别
+     */
+    public String getO_level() {
+        if (this.o_level == null)
+            return "";
+        return this.o_level;
+    }
+
+    /**
+     * 设置 权限级别
+     */
+    public void setO_level(String o_level) {
+        this.o_level = o_level;
+    }
+
+    public Module getModule() {
+        return module;
+    }
+
+    public void setModule(Module module) {
+        this.module = module;
+    }
+
+    public List<String> getLevels() {
+        if (!StringUtils.isNullOrEmpty(getO_level())) {
+            try {
+                if (levels == null)
+                    levels = JSON.parseObject(getO_level(), new TypeReference<List<String>>(){});
+            } catch (Exception e) {
+                levels = new LinkedList<>();
+            }
+        } else {
+            levels = new LinkedList<>();
+        }
+        return levels;
+    }
+
+    public void setLevels(List<String> levels) {
+        this.levels = levels;
+    }
+}

+ 93 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/role/UserRole.java

@@ -0,0 +1,93 @@
+package org.hsweb.web.bean.po.role;
+
+import org.hibernate.validator.constraints.NotEmpty;
+import org.hsweb.web.bean.po.GenericPo;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 后台管理用户角色绑定
+ * Created by generator
+ */
+public class UserRole extends GenericPo<String> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    //主键
+    @NotNull
+    @NotEmpty
+    private String u_id;
+
+    //用户主键
+    @NotNull
+    @NotEmpty
+    private String user_id;
+
+    //角色主键
+    @NotNull
+    @NotEmpty
+    private String role_id;
+
+    //角色实例
+    private transient Role role;
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return "";
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 用户主键
+     *
+     * @return String 用户主键
+     */
+    public String getUser_id() {
+        if (this.user_id == null)
+            return "";
+        return this.user_id;
+    }
+
+    /**
+     * 设置 用户主键
+     */
+    public void setUser_id(String user_id) {
+        this.user_id = user_id;
+    }
+
+    /**
+     * 获取 角色主键
+     *
+     * @return String 角色主键
+     */
+    public String getRole_id() {
+        if (this.role_id == null)
+            return "";
+        return this.role_id;
+    }
+
+    /**
+     * 设置 角色主键
+     */
+    public void setRole_id(String role_id) {
+        this.role_id = role_id;
+    }
+
+    public Role getRole() {
+        return role;
+    }
+
+    public void setRole(Role role) {
+        this.role = role;
+    }
+}

+ 166 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/script/DynamicScript.java

@@ -0,0 +1,166 @@
+package org.hsweb.web.bean.po.script;
+
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.NotEmpty;
+import org.hsweb.web.bean.po.GenericPo;
+import org.webbuilder.utils.common.StringUtils;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+
+/**
+ * 动态脚本
+ * Created by generator
+ */
+public class DynamicScript extends GenericPo<String> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    //主键
+    @NotNull
+    @NotEmpty(message = "id不能为空")
+    private String u_id;
+
+    //名称
+    @Length(min = 4, message = "名称长度不能少于4")
+    @NotNull
+    @Pattern(regexp = "[a-zA-Z]+", message = "名称只能为大小写字母组成")
+    private String name;
+
+    //类型
+    @Pattern(regexp = "(js)|(groovy)|(spel)|(ognl)", message = "类型仅支持js,groovy,spel,ognl")
+    private String type;
+
+    //内容
+    private String content;
+
+    //备注
+    private String remark;
+
+    //路径
+    private String path;
+
+    //状态
+    private int status;
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return this.u_id = StringUtils.concat(getPath(), ".", getName(), ".", getType());
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 名称
+     *
+     * @return String 名称
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * 设置 名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 获取 类型
+     *
+     * @return String 类型
+     */
+    public String getType() {
+        if (this.type == null)
+            return "js";
+        return this.type;
+    }
+
+    /**
+     * 设置 类型
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * 获取 内容
+     *
+     * @return String 内容
+     */
+    public String getContent() {
+        if (this.content == null)
+            return "";
+        return this.content;
+    }
+
+    /**
+     * 设置 内容
+     */
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    /**
+     * 获取 备注
+     *
+     * @return String 备注
+     */
+    public String getRemark() {
+        if (this.remark == null)
+            return "";
+        return this.remark;
+    }
+
+    /**
+     * 设置 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    /**
+     * 获取 路径
+     *
+     * @return String 路径
+     */
+    public String getPath() {
+        if (this.path == null)
+            return "root";
+        return this.path;
+    }
+
+    /**
+     * 设置 路径
+     */
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    /**
+     * 获取 状态
+     *
+     * @return int 状态
+     */
+    public int getStatus() {
+        return this.status;
+    }
+
+    /**
+     * 设置 状态
+     */
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+}

+ 323 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/user/User.java

@@ -0,0 +1,323 @@
+package org.hsweb.web.bean.po.user;
+
+import org.hibernate.validator.constraints.NotEmpty;
+import org.hsweb.web.bean.po.GenericPo;
+import org.hsweb.web.bean.po.role.Role;
+import org.hsweb.web.bean.po.module.Module;
+import org.hsweb.web.bean.po.role.RoleModule;
+import org.hsweb.web.bean.po.role.UserRole;
+import org.webbuilder.utils.common.MapUtils;
+
+import javax.validation.constraints.NotNull;
+import java.util.*;
+
+/**
+ * 后台管理用户
+ * Created by generator
+ */
+public class User extends GenericPo<String> {
+    private static final long serialVersionUID = 8910856253780046561L;
+    //主键
+    @NotNull
+    @NotEmpty
+    private String u_id;
+
+    //用户名
+    @NotNull
+    @NotEmpty(message = "用户名不能为空")
+    private String username;
+
+    //密码
+    @NotNull
+    @NotEmpty(message = "密码不能为空")
+    private String password;
+
+    //姓名
+    private String name;
+
+    //邮箱
+    private String email;
+
+    //联系电话
+    private String phone;
+
+    //状态
+    private int status;
+
+    //创建日期
+    private java.util.Date create_date;
+
+    //修改日期
+    private java.util.Date update_date;
+
+    //用户角色绑定
+    private List<UserRole> userRoles;
+
+    private Map<Module, Set<String>> roleInfo;
+
+    /**
+     * 判断此用户是否拥有对指定模块的访问权限
+     *
+     * @param mId    模块id
+     * @param levels 访问级别
+     * @return 是否能够访问
+     */
+    public boolean hasAccessModuleLevel(String mId, String... levels) {
+        if (!hasAccessModule(mId)) return false;
+        if (levels == null || levels.length == 0) return hasAccessModule(mId);
+        Set<String> lv = roleInfo.get(getModule(mId));
+        if (lv != null)
+            for (String level : levels) {
+                if (lv.contains(level)) return true;
+            }
+        return false;
+    }
+
+    public Module getModule(String mId) {
+        for (Module module : getModules()) {
+            if (module.getU_id().equals(mId)) return module;
+        }
+        return null;
+    }
+
+    public Set<Module> getModules() {
+        if (roleInfo == null) initRoleInfo();
+        return roleInfo.keySet();
+    }
+
+    public Set<Module> getModulesByPid(String pid) {
+        Set<Module> modules = new LinkedHashSet<>();
+        for (Module module : getModules()) {
+            if (pid.equals(module.getP_id())) {
+                modules.add(module);
+            }
+        }
+        return modules;
+    }
+
+    public Set<Module> getModulesByPid(String pid, String level) {
+        Set<Module> modules = new LinkedHashSet<>();
+        for (Module module : getModules()) {
+            if (module.getP_id().equals(pid) && hasAccessModuleLevel(module.getU_id(), level)) {
+                modules.add(module);
+            }
+        }
+        return modules;
+    }
+
+    public boolean hasAccessRole(String rId) {
+        if (getUserRoles() != null)
+            for (UserRole userRole : getUserRoles()) {
+                if (rId.equals(userRole.getRole_id())) return true;
+            }
+        return false;
+    }
+
+    public boolean hasAccessModule(String mId) {
+        if (roleInfo == null) initRoleInfo();
+        for (Module module : roleInfo.keySet()) {
+            if (module.getU_id().equals(mId)) return true;
+        }
+        return false;
+    }
+
+    /**
+     * 初始化用户的权限角色信息
+     */
+    public void initRoleInfo() {
+        Map<Module, Set<String>> roleInfo_tmp = new LinkedHashMap<>();
+        for (UserRole userRole : getUserRoles()) {
+            Role role = userRole.getRole();
+            if (role == null) continue;
+            //角色可访问的路径
+            List<RoleModule> roleModules = role.getModules();
+            for (RoleModule roleModule : roleModules) {
+                Module module = roleModule.getModule();
+                if (module == null || module.getStatus() != 1) continue;
+                Set<String> levels = roleInfo_tmp.get(module);
+                if (levels == null)
+                    roleInfo_tmp.put(module, new HashSet<>(roleModule.getLevels()));
+                else {
+                    levels.addAll(roleModule.getLevels());
+                }
+            }
+        }
+        //排序
+        roleInfo = MapUtils.sortMapByKey(roleInfo_tmp);
+    }
+
+
+    /**
+     * 获取 主键
+     *
+     * @return String 主键
+     */
+    public String getU_id() {
+        if (this.u_id == null)
+            return "";
+        return this.u_id;
+    }
+
+    /**
+     * 设置 主键
+     */
+    public void setU_id(String u_id) {
+        this.u_id = u_id;
+    }
+
+    /**
+     * 获取 用户名
+     *
+     * @return String 用户名
+     */
+    public String getUsername() {
+        if (this.username == null)
+            return "";
+        return this.username;
+    }
+
+    /**
+     * 设置 用户名
+     */
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    /**
+     * 获取 密码
+     *
+     * @return String 密码
+     */
+    public String getPassword() {
+        if (this.password == null)
+            return "";
+        return this.password;
+    }
+
+    /**
+     * 设置 密码
+     */
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    /**
+     * 获取 姓名
+     *
+     * @return String 姓名
+     */
+    public String getName() {
+        if (this.name == null)
+            return "";
+        return this.name;
+    }
+
+    /**
+     * 设置 姓名
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 获取 邮箱
+     *
+     * @return String 邮箱
+     */
+    public String getEmail() {
+        if (this.email == null)
+            return "";
+        return this.email;
+    }
+
+    /**
+     * 设置 邮箱
+     */
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    /**
+     * 获取 联系电话
+     *
+     * @return String 联系电话
+     */
+    public String getPhone() {
+        if (this.phone == null)
+            return "";
+        return this.phone;
+    }
+
+    /**
+     * 设置 联系电话
+     */
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    /**
+     * 获取 状态
+     *
+     * @return boolean 状态
+     */
+    public int getStatus() {
+        return this.status;
+    }
+
+    /**
+     * 设置 状态
+     */
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    /**
+     * 获取 创建日期
+     *
+     * @return java.util.Date 创建日期
+     */
+    public java.util.Date getCreate_date() {
+        return this.create_date;
+    }
+
+    /**
+     * 设置 创建日期
+     */
+    public void setCreate_date(java.util.Date create_date) {
+        this.create_date = create_date;
+    }
+
+    /**
+     * 获取 修改日期
+     *
+     * @return java.util.Date 修改日期
+     */
+    public java.util.Date getUpdate_date() {
+        return this.update_date;
+    }
+
+    /**
+     * 设置 修改日期
+     */
+    public void setUpdate_date(java.util.Date update_date) {
+        this.update_date = update_date;
+    }
+
+    public List<UserRole> getUserRoles() {
+        if (userRoles == null)
+            userRoles = new ArrayList<>();
+        return userRoles;
+    }
+
+    public void setUserRoles(List<UserRole> userRoles) {
+        this.userRoles = userRoles;
+    }
+
+    public Map<Module, Set<String>> getRoleInfo() {
+        return roleInfo;
+    }
+
+    public void setRoleInfo(Map<Module, Set<String>> roleInfo) {
+        this.roleInfo = roleInfo;
+    }
+}

+ 86 - 0
hsweb-web-bean/src/main/java/org/hsweb/web/bean/valid/ValidResults.java

@@ -0,0 +1,86 @@
+package org.hsweb.web.bean.valid;
+
+import com.alibaba.fastjson.JSON;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * 对象验证结果集合
+ * Created by 浩 on 2015-10-10 0010.
+ */
+public class ValidResults extends ArrayList<ValidResults.ValidResult> implements Serializable {
+    private static final long serialVersionUID = 8910856253780046561L;
+    /**
+     * 是否验证通过
+     */
+    private boolean success = true;
+
+    @Override
+    public boolean addAll(Collection<? extends ValidResult> c) {
+        success = false;
+        return super.addAll(c);
+    }
+
+    @Override
+    public boolean add(ValidResult result) {
+        success = false;
+        return super.add(result);
+    }
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public void addResult(String field, String message) {
+        this.add(new ValidResult(field, message));
+    }
+
+    /**
+     * 单个属性验证结果
+     */
+    public class ValidResult {
+        public ValidResult() {
+        }
+        /**
+         * 带参数构造方法,用于初始化验证的字段和验证的结果
+         *
+         * @param field   验证的字段
+         * @param message 验证结果
+         */
+        public ValidResult(String field, String message) {
+            this.field = field;
+            this.message = message;
+        }
+
+        private String field;
+        private String message;
+
+        public String getField() {
+            return field;
+        }
+
+        public void setField(String field) {
+            this.field = field;
+        }
+
+        public String getMessage() {
+            return message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+
+        @Override
+        public String toString() {
+            return String.format("{\"%s\":\"%s\"}", getField(), getMessage());
+        }
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+}

+ 57 - 0
hsweb-web-controller/pom.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-controller</artifactId>
+    <version>${parent.version}</version>
+
+    <properties>
+        <commons.fileupload.version>1.3.1</commons.fileupload.version>
+        <commons.codec.version>1.9</commons.codec.version>
+        <commons.net.version>3.3</commons.net.version>
+        <commons.logging.version>1.1.3</commons.logging.version>
+        <commons.collections.version>3.2.1</commons.collections.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.hsweb</groupId>
+            <artifactId>service-impl-common</artifactId>
+            <version>${parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hsweb</groupId>
+            <artifactId>hsweb-web-core</artifactId>
+            <version>${parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hsweb</groupId>
+            <artifactId>hsweb-web-service-interface</artifactId>
+            <version>${parent.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <version>${spring.boot.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-logging</artifactId>
+            <version>${spring.boot.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>${commons.fileupload.version}</version>
+        </dependency>
+
+    </dependencies>
+</project>

+ 199 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/GenericController.java

@@ -0,0 +1,199 @@
+package org.hsweb.web.controller;
+
+import com.alibaba.fastjson.JSON;
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.param.QueryParam;
+import org.hsweb.web.message.ResponseMessage;
+import org.hsweb.web.service.GenericService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+import org.webbuilder.utils.common.ClassUtils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 通用Controller,使用RESTful和json进行数据提交及访问。
+ * 如果要进行权限控制,可以在方法上注解{@link Authorize}
+ * <br/>所有Controller应继承改类,并手动注解@Controller 以及@RequestMapping
+ * <br/>json解析使用fastJson
+ * Created by 浩 on 2015-07-28 0028.
+ */
+public abstract class GenericController<PO, PK> {
+
+    protected Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    /**
+     * 获取此Controller 需要的服务类
+     *
+     * @return
+     */
+    protected abstract GenericService<PO, PK> getService();
+
+    /**
+     * 获取PO的类型
+     *
+     * @return PO类型
+     */
+    protected final Class<PO> getPOType() {
+        return (Class<PO>) ClassUtils.getGenericType(this.getClass(), 0);
+    }
+
+    /**
+     * 获取PK(主键)的类型
+     *
+     * @return PK(主键)类型
+     */
+    protected final Class<PK> getPKType() {
+        return (Class<PK>) ClassUtils.getGenericType(this.getClass(), 1);
+    }
+
+    /**
+     * 查询列表,并返回查询结果
+     *
+     * @param param 查询参数
+     * @return 返回请求结果
+     */
+    @RequestMapping(method = RequestMethod.GET)
+    @AccessLogger("查询列表")
+    @Authorize(level = "R")
+    public ResponseMessage list(QueryParam param) {
+        // 获取条件查询
+        try {
+            Object data;
+            if (!param.isPaging())//不分页
+                data = getService().select(param);
+            else
+                data = getService().selectPager(param);
+            return new ResponseMessage(true, data).onlyData();
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+    /**
+     * 根据id(主键)查询数据
+     *
+     * @param id 主键
+     * @return 请求结果
+     */
+    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+    @AccessLogger("查询明细")
+    @Authorize(level = "R")
+    public ResponseMessage info(@PathVariable("id") PK id) {
+        try {
+            PO po = getService().selectByPk(id);
+            if (po == null)
+                return new ResponseMessage(false, "data is not found!", "404");
+            return new ResponseMessage(true, po);
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+
+    /**
+     * 根据查询条件,查询数据数量
+     *
+     * @param param 查询条件
+     * @return 请求结果
+     */
+    @RequestMapping(value = "/total", method = RequestMethod.GET)
+    @AccessLogger("查询总数")
+    @Authorize(level = "R")
+    public ResponseMessage total(QueryParam param) {
+        try {
+            // 获取条件查询
+            return new ResponseMessage(true, getService().total(param));
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+    /**
+     * 请求添加数据,请求必须以POST方式,必要参数为:json
+     *
+     * @param object 前端请求的对象
+     * @return 请求结果
+     */
+    @RequestMapping(method = RequestMethod.POST)
+    @AccessLogger("新增")
+    @Authorize(level = "C")
+    public ResponseMessage add(@RequestBody PO object) {
+        try {
+            PK pk = getService().insert(object);
+            return new ResponseMessage(true, pk);
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+    /**
+     * 请求删除指定id的数据,请求方式为DELETE,使用rest风格,如请求 /delete/1 ,将删除id为1的数据
+     *
+     * @param id 要删除的id标识
+     * @return 请求结果
+     */
+    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+    @AccessLogger("删除")
+    @Authorize(level = "D")
+    public ResponseMessage delete(@PathVariable("id") PK id) {
+        try {
+            int number = getService().delete(id);
+            return new ResponseMessage(true, number);
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+    /**
+     * 请求更新数据,请求必须以PUT方式
+     *
+     * @param object 前端请求的对象
+     * @return 请求结果
+     */
+    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
+    @AccessLogger("修改")
+    @Authorize(level = "U")
+    public ResponseMessage update(@PathVariable("id") PK id, @RequestBody(required = true) PO object) {
+        try {
+            int number = getService().update(id, object);
+            return new ResponseMessage(true, number);
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+    /**
+     * 请求更新数据,请求必须以PUT方式,必要参数为:json
+     *
+     * @param json 前端请求的对象
+     * @return 请求结果
+     */
+    @RequestMapping(method = RequestMethod.PUT)
+    @AccessLogger("批量修改")
+    @Authorize(level = "U")
+    public ResponseMessage update(@RequestBody(required = true) String json) {
+        try {
+            int number;
+            if (json.startsWith("[")) {
+                List<PO> datas = JSON.parseArray(json, getPOType());
+                number = getService().update(datas);
+            } else if (json.startsWith("{")) {
+                PO data = JSON.parseObject(json, getPOType());
+                List<PO> datas = new ArrayList<>();
+                datas.add(data);
+                number = getService().update(datas);
+            } else {
+                return new ResponseMessage(false, "数据错误");
+            }
+            return new ResponseMessage(true, number);
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+}

+ 155 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/config/ConfigController.java

@@ -0,0 +1,155 @@
+package org.hsweb.web.controller.config;
+
+import com.alibaba.fastjson.JSON;
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.po.config.Config;
+import org.hsweb.web.controller.GenericController;
+import org.hsweb.web.message.ResponseMessage;
+import org.hsweb.web.service.config.ConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 系统配置控制器,继承自GenericController,使用rest+json。
+ * 此功能将传配置文件放到数据库和缓存中,可动态修改配置。
+ * Created by generator 2015-8-17 11:16:45
+ */
+@RestController
+@RequestMapping(value = "/config")
+@AccessLogger("配置管理")
+@Authorize
+public class ConfigController extends GenericController<Config, String> {
+    private static final String CACHE_KEY = "config";
+
+    //默认服务类
+    @Autowired
+    private ConfigService configService;
+
+    @Override
+    public ConfigService getService() {
+        return this.configService;
+    }
+
+    /**
+     * 批量获取缓存,如传入["core.system.version","upload.path"] 将获取core中的system.version属性和upload中的path属性
+     * <br/>并返回结果如: {"core":{"system.version":"1.0"},"upload":{"path":"/files"}}
+     *
+     * @param resources 请求获取的配置列表
+     * @return 配置内容
+     */
+    @RequestMapping(value = "/info", method = RequestMethod.GET)
+    @Cacheable(value = CACHE_KEY, key = "'info_list'+#resources.hashCode()")
+    @AccessLogger("批量获取配置")
+    public Object batch(@RequestParam(value = "resources", defaultValue = "[]") String resources) {
+        List<String> requestData = JSON.parseArray(resources, String.class);
+        //获取缓存里的配置
+        Map<String, Object> config = new LinkedHashMap<>();
+        //临时缓存,用于当进行如: cfg.name,cfg.data,cfg.other。等获取时,cfg只获取一次,提升效率
+        Map<String, Map<String, String>> temp = new LinkedHashMap<>();
+        for (String request : requestData) {
+            //如果包含[.],则代表是获取当个配置属性。如: core.system.version,将获取core配置中的system.version属性
+            if (request.contains(".")) {
+                String[] res = request.split("[.]");
+                if (res.length > 2) {
+                    for (int i = 2; i < res.length; i++) {
+                        res[1] = res[1].concat(".").concat(res[i]);
+                    }
+                }
+                String name = res[0]; //如: core
+                String key = res[1]; //如: system.version
+                Map cache;
+                //获取临时缓存中的配置
+                if ((cache = temp.get(name)) == null) {
+                    try {
+                        Config conf = configService.selectByPk(name);
+                        cache = conf.toMap();
+                    } catch (Exception e) {
+                    }
+                    if (cache == null) {
+                        config.put(request, new LinkedHashMap<>());
+                        continue;
+                    }
+                    temp.put(name, cache);
+                }
+                Map<String, Object> tmp = (Map) config.get(name);
+                if (tmp != null) {
+                    tmp.put(key, cache.get(key));
+                } else {
+                    tmp = new LinkedHashMap<>();
+                    tmp.put(key, cache.get(key));
+                    config.put(name, tmp);
+                }
+            } else {
+                //获取完整配置
+                Config conf = null;
+                try {
+                    conf = configService.selectByPk(request);
+                } catch (Exception e) {
+                }
+                if (conf != null) {
+                    config.put(request, conf.toMap());
+                }
+            }
+        }
+        temp.clear();
+        return config;
+    }
+
+    /**
+     * 获取一个配置的完整内容
+     *
+     * @param name 配置名称
+     * @return 配置内容
+     */
+    @RequestMapping(value = "/info/{name:.+}", method = RequestMethod.GET)
+    @AccessLogger("根据配置名获取配置")
+    public Object configInfo(@PathVariable("name") String name) {
+        try {
+            return configService.get(name);
+        } catch (Exception e) {
+            return "";
+        }
+    }
+
+
+    /**
+     * 获取一个配置中的某个属性
+     *
+     * @param name 配置名称
+     * @param key  配置属性,支持.,如 system.version
+     * @return 配置内容
+     */
+    @RequestMapping(value = {"/info/{name:.+}/{key:.+}"}, method = RequestMethod.GET)
+    @AccessLogger("根据配置名和键获取配置")
+    public Object configInfo(@PathVariable("name") String name, @PathVariable("key") String key) {
+        try {
+            return configService.get(name, key);
+        } catch (Exception e) {
+            return "";
+        }
+    }
+
+    @Override
+    @RequestMapping(value = "/{id:.+}", method = RequestMethod.GET)
+    public ResponseMessage info(@PathVariable("id") String id) {
+        return super.info(id);
+    }
+
+    @Override
+    @Authorize(module = "config", level = "C")
+    public ResponseMessage add(@RequestBody Config object) {
+        return super.add(object);
+    }
+
+    @Override
+    @Authorize(module = "config", level = "U")
+    public ResponseMessage update(@PathVariable("id") String id, @RequestBody Config object) {
+        return super.update(id, object);
+    }
+}

+ 193 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/file/FileController.java

@@ -0,0 +1,193 @@
+package org.hsweb.web.controller.file;
+
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.po.resource.Resources;
+import org.hsweb.web.message.ResponseMessage;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+import org.webbuilder.utils.common.StringUtils;
+import org.hsweb.web.service.config.ConfigService;
+import org.hsweb.web.service.resource.FileService;
+import org.hsweb.web.service.resource.ResourcesService;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.regex.Pattern;
+
+/**
+ * 文件管理控制器,用于上传和下载资源文件,使用restful。
+ * Created by 浩 on 2015-08-28 0028.
+ */
+@RestController
+@RequestMapping(value = "/file")
+@AccessLogger("文件管理")
+@Authorize
+public class FileController {
+
+    private org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    /**
+     * 配置服务类,用于获取文件存放路径等配置信息
+     */
+    @Resource
+    private ConfigService configService;
+
+    /**
+     * 资源服务类,每一个上传的文件都对应一个资源。通过存放到数据库的资源信息,可以实现文件秒传。
+     * 通过资源id进行下载,使系统更安全
+     */
+    @Resource
+    private ResourcesService resourcesService;
+
+    /**
+     * 文件服务类,用于进行文件保存等操作
+     */
+    @Resource
+    private FileService fileService;
+
+    //文件名中不允许出现的字符 \ / : | ? < > "
+    private static final Pattern fileNameKeyWordPattern = Pattern.compile("(\\\\)|(/)|(:)(|)|(\\?)|(>)|(<)|(\")");
+
+    private static final Map<String, String> mediaTypeMapper = new HashMap<>();
+
+    static {
+        mediaTypeMapper.put(".png", MediaType.IMAGE_PNG_VALUE);
+        mediaTypeMapper.put(".jpg", MediaType.IMAGE_JPEG_VALUE);
+        mediaTypeMapper.put(".jpeg", MediaType.IMAGE_JPEG_VALUE);
+        mediaTypeMapper.put(".gif", MediaType.IMAGE_GIF_VALUE);
+        mediaTypeMapper.put(".bmp", MediaType.IMAGE_JPEG_VALUE);
+        mediaTypeMapper.put(".json", MediaType.APPLICATION_JSON_VALUE);
+        mediaTypeMapper.put(".txt", MediaType.TEXT_PLAIN_VALUE);
+        mediaTypeMapper.put(".css", MediaType.TEXT_PLAIN_VALUE);
+        mediaTypeMapper.put(".js", "application/javascript");
+        mediaTypeMapper.put(".html", MediaType.TEXT_HTML_VALUE);
+        mediaTypeMapper.put(".xml", MediaType.TEXT_XML_VALUE);
+    }
+
+    /**
+     * restful风格的文件下载
+     */
+    @RequestMapping(value = "/download/{id}/{name:.+}", method = RequestMethod.GET)
+    @AccessLogger("下载文件")
+    public ResponseMessage restDownLoad(@PathVariable("id") String id,
+                                        @PathVariable("name") String name,
+                                        HttpServletResponse response, HttpServletRequest request) {
+        return downLoad(id, name, response, request);
+    }
+
+    /**
+     * 下载文件,支持断点下载
+     *
+     * @param id   要下载资源文件的id
+     * @param name 自定义文件名,该文件名不能存在非法字符
+     * @return 失败时,会返回失败原因信息{@link ResponseMessage}
+     */
+    @RequestMapping(value = "/download/{id}", method = RequestMethod.GET)
+    @AccessLogger("下载文件")
+    public ResponseMessage downLoad(@PathVariable("id") String id,
+                                    @RequestParam(value = "name", required = false) String name,
+                                    HttpServletResponse response, HttpServletRequest request) {
+        try {
+            Resources resources = resourcesService.selectByPk(id);
+            if (resources == null || resources.getStatus() != 1) {
+                response.setStatus(404);
+                return new ResponseMessage(false, "资源不存在!", "404");
+            } else {
+                if (!"file".equals(resources.getType()))
+                    return new ResponseMessage(false, "该资源不是文件!", "400");
+                String fileBasePath = configService.get("upload", "basePath", "/upload/").trim();
+                File file = new File(fileBasePath.concat(resources.getPath().concat("/".concat(resources.getMd5()))));
+                if (!file.canRead()) {
+                    response.setStatus(404);
+                    return new ResponseMessage(false, "资源不存在!", "404");
+                }
+                //获取contentType,默认application/octet-stream
+                String contentType = mediaTypeMapper.get(resources.getSuffix().toLowerCase());
+                if (contentType == null)
+                    contentType = "application/octet-stream";
+                if (StringUtils.isNullOrEmpty(name))//未自定义文件名,则使用上传时的文件名
+                    name = resources.getName();
+                if (!name.contains("."))//如果未指定文件拓展名,则追加默认的文件拓展名
+                    name = name.concat(".").concat(resources.getSuffix());
+                //关键字剔除
+                name = fileNameKeyWordPattern.matcher(name).replaceAll("");
+                int skip = 0;
+                long fSize = file.length();
+                //尝试判断是否为断点下载
+                try {
+                    //获取要继续下载的位置
+                    String Range = request.getHeader("Range").replaceAll("bytes=", "").replaceAll("-", "");
+                    skip = StringUtils.toInt(Range);
+                } catch (Exception e) {
+                }
+
+                response.setContentLength((int) fSize);//文件大小
+                response.setContentType(contentType);
+                response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(name, "utf-8"));
+                //try with resource
+                try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file));
+                     BufferedOutputStream stream = new BufferedOutputStream(response.getOutputStream())) {
+                    //断点下载
+                    if (skip > 0) {
+                        inputStream.skip(skip);
+                        response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
+                        String contentRange = new StringBuffer("bytes ").append(skip).append("-").append(fSize - 1).append("/").append(fSize).toString();
+                        response.setHeader("Content-Range", contentRange);
+                    }
+                    byte b[] = new byte[2048 * 10];
+                    while ((inputStream.read(b)) != -1) {
+                        stream.write(b);
+                    }
+                    stream.flush();
+                } catch (Exception e) {
+                    logger.debug(String.format("download file error%s", e.getMessage()));
+                    throw e;
+                }
+                return null;
+            }
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+
+    }
+
+    /**
+     * 上传文件,进行md5一致性校验,不保存重复文件。成功后返回文件信息{uid,md5,name}
+     *
+     * @param files 文件列表
+     * @return 上传结果
+     */
+    @RequestMapping(value = "/upload", method = RequestMethod.POST)
+    @AccessLogger("上传文件")
+    public Object upload(@RequestParam("file") CommonsMultipartFile[] files) {
+        if (logger.isInfoEnabled())
+            logger.info(String.format("start upload , file number:%s", files.length));
+        List<Resources> resourcesList = new LinkedList<>();
+        for (int i = 0; i < files.length; i++) {
+            CommonsMultipartFile file = files[i];
+            if (!file.isEmpty()) {
+                if (logger.isInfoEnabled())
+                    logger.info(String.format("start write file:%s", file.getOriginalFilename()));
+                try {
+                    String fileName = files[i].getOriginalFilename();
+                    Resources resources = fileService.saveFile(files[i].getFileItem().getInputStream(), fileName);
+                    resourcesList.add(resources);
+                } catch (Exception e) {
+                    return new ResponseMessage(false, e);
+                }
+            }
+        }//响应上传成功的资源信息
+        return new ResponseMessage(true, resourcesList)
+                .include(Resources.class, "u_id", "name", "md5");
+    }
+}

+ 32 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/form/FormController.java

@@ -0,0 +1,32 @@
+package org.hsweb.web.controller.form;
+
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.po.form.Form;
+import org.hsweb.web.controller.GenericController;
+import org.hsweb.web.service.form.FormService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 自定义表单控制器,继承自GenericController,使用rest+json
+ * Created by generator(by 周浩) 2015-8-1 16:31:30
+ */
+@RestController
+@RequestMapping(value = "/form")
+@AccessLogger("表单管理")
+@Authorize(role = "form")
+public class FormController extends GenericController<Form, String> {
+
+    //默认服务类
+    @Resource
+    private FormService formService;
+
+    @Override
+    public FormService getService() {
+        return this.formService;
+    }
+
+}

+ 33 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/module/ModuleController.java

@@ -0,0 +1,33 @@
+package org.hsweb.web.controller.module;
+
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.po.module.Module;
+import org.hsweb.web.controller.GenericController;
+import org.hsweb.web.service.module.ModuleService;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import javax.annotation.Resource;
+
+/**
+ * 系统模块控制器,继承自GenericController,使用rest+json
+ * Created by generator 2015-8-26 11:22:11
+ */
+@Controller
+@RequestMapping(value = "/module")
+@AccessLogger("系统模块管理")
+@Authorize(module = "module")
+public class ModuleController extends GenericController<Module, String> {
+
+    //默认服务类
+    @Resource
+    private ModuleService moduleService;
+
+    @Override
+    public ModuleService getService() {
+        return this.moduleService;
+    }
+
+
+}

+ 85 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/resource/ResourcesController.java

@@ -0,0 +1,85 @@
+package org.hsweb.web.controller.resource;
+
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.po.resource.Resources;
+import org.hsweb.web.bean.po.role.Role;
+import org.hsweb.web.controller.GenericController;
+import org.hsweb.web.message.ResponseMessage;
+import org.hsweb.web.service.resource.ResourcesService;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+
+/**
+ * 资源控制器,继承自GenericController,使用rest+json
+ * Created by generator 2015-8-28 13:01:29
+ *
+ * @author 浩
+ * @version 1.0
+ * @UpdateRemark 2015年8月31日,重写{@link ResourcesController#delete(String)}方法,删除资源时需要授权认证
+ */
+@Controller
+@RequestMapping(value = "/resources")
+@AccessLogger("资源管理")
+public class ResourcesController extends GenericController<Resources, String> {
+
+    //默认服务类
+    @Resource
+    private ResourcesService resourcesService;
+
+    @Override
+    public ResourcesService getService() {
+        return this.resourcesService;
+    }
+
+    /**
+     * 重写 {@link GenericController#delete(Object)} 新增注解: @Authorize(role = Role.SYS_ROLE_ADMIN),只有拥有系统管理员权限的用户才能执行此操作
+     *
+     * @param id 要删除的id标识
+     * @return
+     */
+    @Override
+    @Authorize(role = Role.SYS_ROLE_ADMIN)
+    public ResponseMessage delete(@PathVariable("id") String id) {
+        return super.delete(id);
+    }
+
+    /**
+     * 判断资源文件是否存在并检测其健康状况
+     *
+     * @param id 资源文件id
+     * @return 查询结果
+     */
+    @RequestMapping(value = "/{id:^[0-9a-zA-Z]*$}", method = RequestMethod.GET)
+    @ResponseBody
+    @AccessLogger("获取资源信息")
+    public ResponseMessage info(@PathVariable("id") String id) {
+        try {
+            Resources resources;
+            //如果id长度为32,则尝试通过md5获取
+            if (id.length() == 32) {
+                resources = getService().selectByMd5(id);
+                if (resources == null)
+                    resources = getService().selectByPk(id);
+            } else
+                resources = resourcesService.selectByPk(id);
+            if (resources == null) {
+                return new ResponseMessage(false, "资源不存在!", "404");
+            } else {
+                if (resources.getStatus() != 1)
+                    return new ResponseMessage(false, "拒绝访问!", "502");
+                return new ResponseMessage(true, resources);
+            }
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+
+}

+ 39 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/role/RoleController.java

@@ -0,0 +1,39 @@
+package org.hsweb.web.controller.role;
+
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.param.QueryParam;
+import org.hsweb.web.bean.po.role.Role;
+import org.hsweb.web.controller.GenericController;
+import org.hsweb.web.message.ResponseMessage;
+import org.springframework.web.bind.annotation.RestController;
+import org.hsweb.web.service.role.RoleService;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import javax.annotation.Resource;
+
+/**
+ * 后台管理角色控制器,继承自GenericController,使用rest+json
+ * Created by generator 2015-8-26 10:57:38
+ */
+@RestController
+@RequestMapping(value = "/role")
+@AccessLogger("角色管理")
+@Authorize(module = "role")
+public class RoleController extends GenericController<Role, String> {
+
+    //默认服务类
+    @Resource
+    private RoleService roleService;
+
+    @Override
+    public RoleService getService() {
+        return this.roleService;
+    }
+
+    @Override
+    public ResponseMessage list(QueryParam param) {
+        return super.list(param).exclude(Role.class, "modules");
+    }
+}

+ 60 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/script/DynamicScriptController.java

@@ -0,0 +1,60 @@
+package org.hsweb.web.controller.script;
+
+import com.alibaba.fastjson.JSON;
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.po.role.Role;
+import org.hsweb.web.bean.po.script.DynamicScript;
+import org.hsweb.web.controller.GenericController;
+import org.hsweb.web.message.ResponseMessage;
+import org.springframework.web.bind.annotation.*;
+import org.webbuilder.utils.script.engine.ExecuteResult;
+import org.hsweb.web.service.script.DynamicScriptService;
+
+import javax.annotation.Resource;
+
+/**
+ * 动态脚本控制器,继承自GenericController,使用rest+json
+ * Created by generator 2015-10-27 14:42:34
+ */
+@RestController
+@RequestMapping(value = "/script")
+@AccessLogger("动态脚本")
+@Authorize(role = Role.SYS_ROLE_ADMIN)
+public class DynamicScriptController extends GenericController<DynamicScript, String> {
+
+    //默认服务类
+    @Resource
+    private DynamicScriptService dynamicScriptService;
+
+    @Override
+    public DynamicScriptService getService() {
+        return this.dynamicScriptService;
+    }
+
+
+    @RequestMapping(value = "/compile", method = {RequestMethod.GET})
+    public ResponseMessage compileAll() {
+        ResponseMessage message;
+        try {
+            dynamicScriptService.compileAll();
+            message = new ResponseMessage(true, "success");
+        } catch (Exception e) {
+            message = new ResponseMessage(false, e);
+        }
+        return message;
+    }
+
+    @RequestMapping(value = "/compile/{id:.+}", method = {RequestMethod.GET})
+    public ResponseMessage compile(@PathVariable("id") String id) {
+        ResponseMessage message;
+        try {
+            dynamicScriptService.compile(id);
+
+            message = new ResponseMessage(true, "success");
+        } catch (Exception e) {
+            message = new ResponseMessage(false, e);
+        }
+        return message;
+    }
+}

+ 62 - 0
hsweb-web-controller/src/main/java/org/hsweb/web/controller/user/UserController.java

@@ -0,0 +1,62 @@
+package org.hsweb.web.controller.user;
+
+import org.hsweb.web.authorize.annotation.AccessLogger;
+import org.hsweb.web.authorize.annotation.Authorize;
+import org.hsweb.web.bean.param.QueryParam;
+import org.hsweb.web.bean.po.user.User;
+import org.hsweb.web.controller.GenericController;
+import org.hsweb.web.message.ResponseMessage;
+import org.hsweb.web.service.user.UserService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * 后台管理用户控制器,继承自GenericController,使用rest+json
+ * Created by generator 2015-8-26 10:35:57
+ */
+@RestController
+@RequestMapping(value = "/user")
+@AccessLogger("用户管理")
+@Authorize(module = "user")
+public class UserController extends GenericController<User, String> {
+
+    //默认服务类
+    @Resource
+    private UserService userService;
+
+    @Override
+    public UserService getService() {
+        return this.userService;
+    }
+
+    @Override
+    @AccessLogger("获取列表")
+    public ResponseMessage list(QueryParam param) {
+        param.excludes("password");
+        return super.list(param)
+                .exclude(User.class, "password", "modules", "userRoles")
+                .onlyData();
+    }
+
+    @Override
+    @AccessLogger("获取用户详情")
+    public ResponseMessage info(@PathVariable("id") String id) {
+        return super.info(id).exclude(User.class, "password", "modules");
+    }
+
+    @Override
+    @AccessLogger("删除")
+    public ResponseMessage delete(@PathVariable("id") String id) {
+        try {
+            User user = getService().selectByPk(id);
+            if (user == null) return new ResponseMessage(false, "该用户不存在!", "404");
+            user.setStatus(-1);
+            getService().update(id, user);
+            return new ResponseMessage(true, "删除成功");
+        } catch (Exception e) {
+            return new ResponseMessage(false, e);
+        }
+    }
+
+}

+ 24 - 0
hsweb-web-controller/src/test/java/org/hsweb/controller/test/HelloWorld.java

@@ -0,0 +1,24 @@
+package org.hsweb.controller.test;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by 浩 on 2016-01-16 0016.
+ */
+@RestController
+@RequestMapping(value = "/test")
+@EnableAutoConfiguration
+public class HelloWorld {
+
+    @RequestMapping
+    public String test() {
+        return "hello-world";
+    }
+
+    public static void main(String[] args) {
+        SpringApplication.run(HelloWorld.class);
+    }
+}

+ 17 - 0
hsweb-web-core/pom.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-core</artifactId>
+    <packaging>pom</packaging>
+    <version>${parent.version}</version>
+
+
+</project>

+ 8 - 0
hsweb-web-core/src/main/java/org/hsweb/web/authorize/annotation/AccessLogger.java

@@ -0,0 +1,8 @@
+package org.hsweb.web.authorize.annotation;
+
+/**
+ * Created by 浩 on 2016-01-16 0016.
+ */
+public @interface AccessLogger {
+    String value();
+}

+ 74 - 0
hsweb-web-core/src/main/java/org/hsweb/web/authorize/annotation/Authorize.java

@@ -0,0 +1,74 @@
+package org.hsweb.web.authorize.annotation;
+
+
+import java.lang.annotation.*;
+
+/**
+ * 权限注解
+ * Created by 浩 on 2015-08-25 0025.
+ */
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Authorize {
+
+    /**
+     * 对角色授权,当使用按角色授权时,对模块以及操作级别授权方式失效
+     *
+     * @return 进行授权的角色数组
+     */
+    String[] role() default {};
+
+    /**
+     * 对模块授权
+     *
+     * @return 进行授权的模块
+     */
+    String[] module() default {};
+
+    /**
+     * 操作级别,如增删改查等
+     *
+     * @return
+     */
+    String[] level() default {};
+
+    /**
+     * 表达式验证如
+     *
+     * @return
+     */
+    String expression() default "";
+
+    /**
+     * 表达式语言,默认spring表达式
+     *
+     * @return 表达式语言
+     */
+    String expressionLanguage() default "spel";
+
+    /**
+     * 是否为api接口,为true时,不使用用户登录策略。
+     *
+     * @return
+     */
+    boolean api() default false;
+
+    /**
+     * 验证模式,在使用多个验证条件时有效,当设置为INTERSECTION时,用户只需要通过其中一个验证即可
+     *
+     * @return
+     */
+    MOD mod() default MOD.AND;
+
+    enum MOD {
+        /**
+         * 并集,需要满足所有验证条件
+         */
+        AND,
+        /**
+         * 交集,满足其中一个验证条件
+         */
+        OR
+    }
+}

+ 16 - 0
hsweb-web-core/src/main/java/org/hsweb/web/exception/AuthorizeException.java

@@ -0,0 +1,16 @@
+package org.hsweb.web.exception;
+
+/**
+ * Created by 浩 on 2015-12-23 0023.
+ */
+public class AuthorizeException extends BusinessException {
+    private static final long serialVersionUID = 2422918455013900645L;
+
+    public AuthorizeException(String message) {
+        super(message);
+    }
+
+    public AuthorizeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

+ 17 - 0
hsweb-web-core/src/main/java/org/hsweb/web/exception/BusinessException.java

@@ -0,0 +1,17 @@
+package org.hsweb.web.exception;
+
+/**
+ * 业务异常,用于抛出给前端提示错误信息
+ * Created by 浩 on 2015-08-01 0001.
+ */
+public class BusinessException extends RuntimeException {
+    private static final long serialVersionUID = -695542791928644578L;
+
+    public BusinessException(String message) {
+        super(message);
+    }
+
+    public BusinessException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

+ 233 - 0
hsweb-web-core/src/main/java/org/hsweb/web/message/ResponseMessage.java

@@ -0,0 +1,233 @@
+package org.hsweb.web.message;
+
+import com.alibaba.fastjson.JSON;
+import org.hsweb.web.exception.AuthorizeException;
+import org.hsweb.web.exception.BusinessException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.webbuilder.utils.common.DateTimeUtils;
+
+import java.io.Serializable;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 响应消息。controller中处理后,返回此对象,响应请求结果给客户端。
+ */
+public class ResponseMessage implements Serializable {
+    private static final long serialVersionUID = 8992436576262574064L;
+
+    /**
+     * message处理类,可以自定义message处理方案
+     */
+    private transient static final Map<Class, MessageHandler> handlers = new HashMap<>();
+
+    /**
+     * 注册一个消息处理器
+     *
+     * @param dataType 消息类型
+     * @param handler  处理器实例
+     * @return 已注册的消息处理器
+     */
+    public static final <T> MessageHandler<T> registerMessageHandler(Class<T> dataType, MessageHandler<T> handler) {
+        return handlers.put(dataType, handler);
+    }
+
+    /**
+     * 注销一个消息处理器
+     *
+     * @param dataType 消息类型
+     * @return 已注册的消息处理器
+     */
+    public static final <T> MessageHandler<T> cancelMessageHandler(Class<T> dataType) {
+        return handlers.remove(dataType);
+    }
+
+    /**
+     * 注册默认的消息处理
+     */
+    static {
+        registerMessageHandler(Object.class, new MessageHandler<Object>() {
+            @Override
+            public Object handle(ResponseMessage message, Object msg) {
+                return msg;
+            }
+        });
+        //默认异常信息处理
+        registerMessageHandler(Throwable.class, new MessageHandler<Throwable>() {
+            @Override
+            public Object handle(ResponseMessage message, Throwable e) {
+                LOGGER.error(e.getMessage(), e);
+                return e.getMessage();
+            }
+        });
+        //默认业务异常信息处理
+        registerMessageHandler(BusinessException.class, new MessageHandler<BusinessException>() {
+            @Override
+            public Object handle(ResponseMessage message, BusinessException e) {
+                LOGGER.error(e.getMessage());
+                return e.getMessage();
+            }
+        });
+        //权限验证异常
+        registerMessageHandler(AuthorizeException.class, new MessageHandler<AuthorizeException>() {
+            @Override
+            public Object handle(ResponseMessage message, AuthorizeException e) {
+                message.setCode("502");
+                return e.getMessage();
+            }
+        });
+    }
+
+    private static final <T> MessageHandler<T> getMessageHandler(Class<T> type) {
+        return handlers.get(type);
+    }
+
+    private transient static final Logger LOGGER = LoggerFactory.getLogger(ResponseMessage.class);
+
+    /**
+     * 是否成功
+     */
+    private boolean success;
+
+    /**
+     * 反馈数据
+     */
+    private Object data;
+
+    /**
+     * 响应码
+     */
+    private String code;
+
+    /**
+     * 进行响应的元数据,不会被序列化,只是提供aop和拦截器访问
+     */
+    private transient Object sourceData;
+
+    /**
+     * 过滤字段:指定需要序列化的字段
+     */
+    private Map<Class<?>, Set<String>> includes;
+
+    /**
+     * 过滤字段:指定不需要序列化的字段
+     */
+    private Map<Class<?>, Set<String>> excludes;
+
+    private transient boolean onlyData;
+
+    public ResponseMessage(boolean success, Object data) {
+        this.code = success ? "200" : "500";
+        if (data == null)
+            data = "null";
+        sourceData = data;
+        //获取消息处理器
+        MessageHandler messageHandler = getMessageHandler(data.getClass());
+        if (messageHandler == null) {
+            if (data instanceof Throwable) {
+                //未获取到指定的异常信息处理器,使用通用异常处理器
+                messageHandler = getMessageHandler(Throwable.class);
+            } else {
+                messageHandler = getMessageHandler(Object.class);
+            }
+        }
+        this.success = success;
+        if (messageHandler == null)
+            this.data = data;
+        else
+            this.data = messageHandler.handle(this, data);
+
+    }
+
+    public ResponseMessage(boolean success, Object data, String code) {
+        this(success, data);
+        this.code = code;
+    }
+
+
+    public ResponseMessage include(Class<?> type, String... fileds) {
+        if (includes == null)
+            includes = new HashMap<>();
+        getStringListFormMap(includes, type).addAll(Arrays.asList(fileds));
+        return this;
+    }
+
+    public ResponseMessage exclude(Class type, String... fileds) {
+        if (excludes == null)
+            excludes = new HashMap<>();
+        getStringListFormMap(excludes, type).addAll(Arrays.asList(fileds));
+        return this;
+    }
+
+    protected Set<String> getStringListFormMap(Map<Class<?>, Set<String>> map, Class type) {
+        Set<String> list = map.get(type);
+        if (list == null) {
+            list = new HashSet<>();
+            map.put(type, list);
+        }
+        return list;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    @Override
+    public String toString() {
+        return JSON.toJSONStringWithDateFormat(this, DateTimeUtils.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public interface MessageHandler<T> {
+        Object handle(ResponseMessage message, T msg);
+    }
+
+    public Object getSourceData() {
+        return sourceData;
+    }
+
+    public static ResponseMessage fromJson(String json) {
+        return JSON.parseObject(json, ResponseMessage.class);
+    }
+
+    public Map<Class<?>, Set<String>> getExcludes() {
+        return excludes;
+    }
+
+    public Map<Class<?>, Set<String>> getIncludes() {
+        return includes;
+    }
+
+    public ResponseMessage onlyData() {
+        setOnlyData(true);
+        return this;
+    }
+
+    public void setOnlyData(boolean onlyData) {
+        this.onlyData = onlyData;
+    }
+
+    public boolean isOnlyData() {
+        return onlyData;
+    }
+}

+ 16 - 0
hsweb-web-dao-impl-mybatis/pom.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-dao-impl-mybatis</artifactId>
+    <version>${parent.version}</version>
+
+
+</project>

+ 23 - 0
hsweb-web-dao-interface/pom.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-dao-interface</artifactId>
+    <version>${parent.version}</version>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hsweb</groupId>
+            <artifactId>hsweb-web-bean</artifactId>
+            <version>${parent.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 77 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/GenericMapper.java

@@ -0,0 +1,77 @@
+package org.hsweb.web.dao;
+
+import org.hsweb.web.bean.param.QueryParam;
+
+import java.util.List;
+
+/**
+ * 通用dao,定义常用的增删改查操作。其他daoMapper接口继承此接口,则无需再定义这些方法
+ * <p/>
+ * Created by zh.sqy@qq.com on 2015-07-20 0020.
+ */
+public interface GenericMapper<Po, Pk> {
+    /**
+     * 添加一条数据
+     *
+     * @param data 要添加的数据
+     * @return 添加后生成的主键
+     * @throws Exception 异常信息
+     */
+    Pk insert(Po data) throws Exception;
+
+    /**
+     * 根据主键删除记录
+     *
+     * @param pk 主键
+     * @return 影响记录数
+     * @throws Exception 异常信息
+     */
+    int delete(Pk pk) throws Exception;
+
+    /**
+     * 修改记录信息
+     *
+     * @param data 要修改的对象
+     * @return 影响记录数
+     * @throws Exception 异常信息
+     */
+    int update(Po data) throws Exception;
+
+    /**
+     * 根据条件集合查询记录,支持分页,排序。
+     * <br/>查询条件支持 类似$LIKE,$IN 表达式查询,如传入 name$LIKE 则进行name字段模糊查询
+     * <br/>$LIKE -->模糊查询 (只支持字符)
+     * <br/>$START -->以?开始 (只支持字符 和数字)
+     * <br/>$END -->以?结尾 (只支持字符 和数字)
+     * <br/>$IN -->in查询,参数必须为List实现,传入类似 1,2,3 是非法的
+     * <br/>$GT -->大于 (只支持 数字和日期)
+     * <br/>$LT -->小于 (只支持 数字和日期)
+     * <br/>$NOT -->不等于
+     * <br/>$NOTNULL -->值不为空
+     * <br/>$ISNULL -->值为空
+     * <br/>所有操作支持取反
+     *
+     * @param param 查询参数
+     * @return 查询结果
+     * @throws Exception 异常信息
+     */
+    List<Po> select(QueryParam param) throws Exception;
+
+    /**
+     * 查询记录总数,用于分页等操作。查询条件同 {@link GenericMapper#select}
+     *
+     * @param param 查询参数
+     * @return 查询结果,实现mapper中的sql应指定默认值,否则可能抛出异常
+     * @throws Exception 异常信息
+     */
+    int total(QueryParam param) throws Exception;
+
+    /**
+     * 根据主键查询记录
+     *
+     * @param pk 主键
+     * @return 查询结果
+     * @throws Exception 异常信息
+     */
+    Po selectByPk(Pk pk) throws Exception;
+}

+ 13 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/config/ConfigMapper.java

@@ -0,0 +1,13 @@
+package org.hsweb.web.dao.config;
+
+
+import org.hsweb.web.bean.po.config.Config;
+import org.hsweb.web.dao.GenericMapper;
+
+/**
+* 系统配置数据映射接口
+* Created by generator 
+*/
+public interface ConfigMapper extends GenericMapper<Config,String> {
+
+}

+ 12 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/form/FormMapper.java

@@ -0,0 +1,12 @@
+package org.hsweb.web.dao.form;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.form.Form;
+
+/**
+* 自定义表单数据映射接口
+* Created by generator 
+*/
+public interface FormMapper extends GenericMapper<Form,String> {
+
+}

+ 12 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/module/ModuleMapper.java

@@ -0,0 +1,12 @@
+package org.hsweb.web.dao.module;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.module.Module;
+
+/**
+* 系统模块数据映射接口
+* Created by generator 
+*/
+public interface ModuleMapper extends GenericMapper<Module,String> {
+
+}

+ 12 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/resource/ResourcesMapper.java

@@ -0,0 +1,12 @@
+package org.hsweb.web.dao.resource;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.resource.Resources;
+
+/**
+* 资源数据映射接口
+* Created by generator 
+*/
+public interface ResourcesMapper extends GenericMapper<Resources,String> {
+
+}

+ 12 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/role/RoleMapper.java

@@ -0,0 +1,12 @@
+package org.hsweb.web.dao.role;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.role.Role;
+
+/**
+* 后台管理角色数据映射接口
+* Created by generator 
+*/
+public interface RoleMapper extends GenericMapper<Role,String> {
+
+}

+ 25 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/role/RoleModuleMapper.java

@@ -0,0 +1,25 @@
+package org.hsweb.web.dao.role;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.role.RoleModule;
+
+import java.util.List;
+
+/**
+ * 系统模块角色绑定数据映射接口
+ * Created by generator
+ */
+public interface RoleModuleMapper extends GenericMapper<RoleModule, String> {
+    /**
+     * 根据角色id查询
+     *
+     * @param roleId 角色id
+     * @return
+     * @throws Exception
+     */
+    List<RoleModule> selectByRoleId(String roleId) throws Exception;
+
+    int deleteByRoleId(String roleId) throws Exception;
+
+    int deleteByModuleId(String moduleId) throws Exception;
+}

+ 23 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/role/UserRoleMapper.java

@@ -0,0 +1,23 @@
+package org.hsweb.web.dao.role;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.role.UserRole;
+
+import java.util.List;
+
+/**
+ * 后台管理用户角色绑定数据映射接口
+ * Created by generator
+ */
+public interface UserRoleMapper extends GenericMapper<UserRole, String> {
+    /**
+     * 根据用户id查询用户的角色列表
+     *
+     * @param userId 用户id
+     * @return 角色列表
+     * @throws Exception 异常信息
+     */
+    List<UserRole> selectByUserId(String userId) throws Exception;
+
+    int deleteByUserId(String userId) throws Exception;
+}

+ 12 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/script/DynamicScriptMapper.java

@@ -0,0 +1,12 @@
+package org.hsweb.web.dao.script;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.script.DynamicScript;
+
+/**
+* 动态脚本数据映射接口
+* Created by generator 
+*/
+public interface DynamicScriptMapper extends GenericMapper<DynamicScript,String> {
+
+}

+ 14 - 0
hsweb-web-dao-interface/src/main/java/org/hsweb/web/dao/user/UserMapper.java

@@ -0,0 +1,14 @@
+package org.hsweb.web.dao.user;
+
+import org.hsweb.web.dao.GenericMapper;
+import org.hsweb.web.bean.po.user.User;
+
+/**
+ * 后台管理用户数据映射接口
+ * Created by generator
+ */
+public interface UserMapper extends GenericMapper<User, String> {
+    User selectByUserName(String userName) throws Exception;
+
+    void updatePassword(User user);
+}

+ 16 - 0
hsweb-web-service-impl-common/pom.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-service-impl-common</artifactId>
+    <version>${parent.version}</version>
+
+
+</project>

+ 22 - 0
hsweb-web-service-interface/pom.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-service-interface</artifactId>
+    <version>${parent.version}</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hsweb</groupId>
+            <artifactId>hsweb-web-dao-interface</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>

+ 94 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/GenericService.java

@@ -0,0 +1,94 @@
+package org.hsweb.web.service;
+
+import org.hsweb.web.bean.param.PagerResult;
+import org.hsweb.web.bean.param.QueryParam;
+import org.hsweb.web.dao.GenericMapper;
+
+import java.util.List;
+
+
+/**
+ * 通用Service。继承了通用mapper的常用增删改查方法
+ * <p/>
+ * Created by zh.sqy@qq.com on 2015-07-20 0020.
+ */
+public interface GenericService<Po, Pk> {
+
+    PagerResult<Po> selectPager(QueryParam param) throws Exception;
+
+    /**
+     * 添加一条数据
+     *
+     * @param data 要添加的数据
+     * @return 添加后生成的主键
+     * @throws Exception 异常信息
+     */
+    Pk insert(Po data) throws Exception;
+
+    /**
+     * 根据主键删除记录
+     *
+     * @param pk 主键
+     * @return 影响记录数
+     * @throws Exception 异常信息
+     */
+    int delete(Pk pk) throws Exception;
+
+    /**
+     * 修改记录信息
+     *
+     * @param pk   要修改对象的主键
+     * @param data 要修改的对象
+     * @return 影响记录数
+     * @throws Exception 异常信息
+     */
+    int update(Pk pk, Po data) throws Exception;
+
+    /**
+     * 批量修改记录
+     *
+     * @param data 要修改的记录集合
+     * @return 影响记录数
+     * @throws Exception 异常信息
+     */
+    int update(List<Po> data) throws Exception;
+
+    /**
+     * 根据条件集合查询记录,支持分页,排序。
+     * <br/>查询条件支持 类似$LIKE,$IN 表达式查询,如传入 name$LIKE 则进行name字段模糊查询
+     * <br/>$LIKE -->模糊查询 (只支持字符)
+     * <br/>$START -->以?开始 (只支持字符 和数字)
+     * <br/>$END -->以?结尾 (只支持字符 和数字)
+     * <br/>$IN -->in查询,参数必须为List实现,传入类似 1,2,3 是非法的
+     * <br/>$GT -->大于 (只支持 数字和日期)
+     * <br/>$LT -->小于 (只支持 数字和日期)
+     * <br/>$NOT -->不等于
+     * <br/>$NOTNULL -->值不为空
+     * <br/>$ISNULL -->值为空
+     * <br/>所有操作支持取反
+     *
+     * @param param 查询参数
+     * @return 查询结果
+     * @throws Exception 异常信息
+     */
+    List<Po> select(QueryParam param) throws Exception;
+
+    /**
+     * 查询记录总数,用于分页等操作。查询条件同 {@link GenericMapper#select}
+     *
+     * @param param 查询参数
+     * @return 查询结果,实现mapper中的sql应指定默认值,否则可能抛出异常
+     * @throws Exception 异常信息
+     */
+    int total(QueryParam param) throws Exception;
+
+    /**
+     * 根据主键查询记录
+     *
+     * @param pk 主键
+     * @return 查询结果
+     * @throws Exception 异常信息
+     */
+    Po selectByPk(Pk pk) throws Exception;
+
+}

+ 82 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/config/ConfigService.java

@@ -0,0 +1,82 @@
+package org.hsweb.web.service.config;
+
+import org.hsweb.web.bean.po.config.Config;
+import org.hsweb.web.service.GenericService;
+
+import java.util.Properties;
+
+/**
+ * 系统配置服务类
+ * Created by generator
+ */
+public interface ConfigService extends GenericService<Config, String> {
+    /**
+     * 根据配置名称,获取配置内容
+     *
+     * @param name 配置名称
+     * @return 配置内容
+     * @throws Exception 异常信息
+     */
+    String getContent(String name);
+
+    /**
+     * 根据配置名称,获取配置内容,并解析为Properties格式
+     *
+     * @param name 配置名称
+     * @return 配置内容
+     * @throws Exception 异常信息
+     */
+    Properties get(String name);
+
+    /**
+     * 获取配置中指定key的值
+     *
+     * @param name 配置名称
+     * @param key  key 异常信息
+     * @return 指定的key对应的value
+     * @throws Exception
+     */
+    String get(String name, String key);
+
+    /**
+     * 获取配置中指定key的值,并指定一个默认值,如果对应的key未获取到,则返回默认值
+     *
+     * @param name         配置名称
+     * @param key          key 异常信息
+     * @param defaultValue 默认值
+     * @return 对应key的值,若为null,则返回默认值
+     */
+    String get(String name, String key, String defaultValue);
+
+
+    /**
+     * 参照 {@link ConfigService#get(String, String)},将值转为int类型
+     */
+    int getInt(String name, String key) throws Exception;
+
+    /**
+     * 参照 {@link ConfigService#get(String, String)},将值转为double类型
+     */
+    double getDouble(String name, String key) throws Exception;
+
+    /**
+     * 参照 {@link ConfigService#get(String, String)},将值转为long类型
+     */
+    long getLong(String name, String key) throws Exception;
+
+    /**
+     * 参照 {@link ConfigService#get(String, String, String)},将值转为int类型
+     */
+    int getInt(String name, String key, int defaultValue);
+
+    /**
+     * 参照 {@link ConfigService#get(String, String, String)},将值转为double类型
+     */
+    double getDouble(String name, String key, double defaultValue);
+
+    /**
+     * 参照 {@link ConfigService#get(String, String, String)},将值转为long类型
+     */
+    long getLong(String name, String key, long defaultValue);
+
+}

+ 13 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/form/FormService.java

@@ -0,0 +1,13 @@
+package org.hsweb.web.service.form;
+
+import org.hsweb.web.bean.po.form.Form;
+import org.hsweb.web.service.GenericService;
+
+/**
+ * 自定义表单服务类
+ * Created by generator
+ *
+ */
+public interface FormService extends GenericService<Form, String> {
+
+}

+ 22 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/module/ModuleService.java

@@ -0,0 +1,22 @@
+package org.hsweb.web.service.module;
+
+import org.hsweb.web.bean.po.module.Module;
+import org.hsweb.web.service.GenericService;
+
+import java.util.List;
+
+
+/**
+ * 系统模块服务类
+ * Created by generator
+ */
+public interface ModuleService extends GenericService<Module, String> {
+    /**
+     * 根据父级ID查询所有子级的模块
+     *
+     * @param pid 父级ID
+     * @return 子级的模块集合
+     * @throws Exception 查询异常
+     */
+    List<Module> selectByPid(String pid) throws Exception;
+}

+ 23 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/resource/FileService.java

@@ -0,0 +1,23 @@
+package org.hsweb.web.service.resource;
+
+import org.hsweb.web.bean.po.resource.Resources;
+
+import java.io.InputStream;
+
+/**
+ * 文件服务接口,用于对服务器文件进行操作
+ * Created by 浩 on 2015-11-26 0026.
+ */
+public interface FileService {
+    /**
+     * 保存一个文件流,并返回保存后生成的资源对象
+     *
+     * @param is       文件输入流
+     * @param fileName 文件原始名称
+     * @return 生成的资源对象
+     * @throws Exception 保存失败的异常信息
+     */
+    Resources saveFile(InputStream is, String fileName) throws Exception;
+
+
+}

+ 20 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/resource/ResourcesService.java

@@ -0,0 +1,20 @@
+package org.hsweb.web.service.resource;
+
+import org.hsweb.web.bean.po.resource.Resources;
+import org.hsweb.web.service.GenericService;
+
+/**
+ * 资源服务类
+ * Created by generator
+ */
+public interface ResourcesService extends GenericService<Resources, String> {
+    /**
+     * 根据资源md5 查询资源信息,如果没有资源则返回null
+     *
+     * @param md5 md5值
+     * @return 资源对象
+     * @throws Exception
+     */
+    Resources selectByMd5(String md5) throws Exception;
+
+}

+ 12 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/role/RoleService.java

@@ -0,0 +1,12 @@
+package org.hsweb.web.service.role;
+
+import org.hsweb.web.bean.po.role.Role;
+import org.hsweb.web.service.GenericService;
+
+/**
+ * 后台管理角色服务类
+ * Created by generator
+ */
+public interface RoleService extends GenericService<Role, String> {
+
+}

+ 26 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/script/DynamicScriptService.java

@@ -0,0 +1,26 @@
+package org.hsweb.web.service.script;
+
+import org.hsweb.web.bean.po.script.DynamicScript;
+import org.hsweb.web.service.GenericService;
+
+/**
+ * 动态脚本服务类
+ * Created by generator
+ */
+public interface DynamicScriptService extends GenericService<DynamicScript, String> {
+    /**
+     * 编译一个脚本
+     *
+     * @param id 要编译脚本的ID
+     * @throws Exception 编译异常
+     */
+    void compile(String id) throws Exception;
+
+    /**
+     * 编译所有脚本
+     *
+     * @throws Exception 编译异常
+     */
+    void compileAll() throws Exception;
+
+}

+ 37 - 0
hsweb-web-service-interface/src/main/java/org/hsweb/web/service/user/UserService.java

@@ -0,0 +1,37 @@
+package org.hsweb.web.service.user;
+
+import org.hsweb.web.bean.po.user.User;
+import org.hsweb.web.service.GenericService;
+
+/**
+ * 后台管理用户服务类
+ * Created by generator
+ */
+public interface UserService extends GenericService<User, String> {
+
+    /**
+     * 根据用户名查询用户
+     *
+     * @param username 用户名
+     * @return 用户名对应的用户,如果不存在返回null
+     * @throws Exception
+     */
+    User selectByUserName(String username) throws Exception;
+
+    /**
+     * 将一个user初始化为超级管理员
+     *
+     * @param user 要初始化的user对象
+     * @throws Exception 初始化失败异常
+     */
+    void initAdminUser(User user) throws Exception;
+
+    /**
+     * 将一个user初始化为游客
+     *
+     * @param user 要初始化的user对象
+     * @throws Exception 初始化失败异常
+     */
+    void initGuestUser(User user) throws Exception;
+
+}

+ 16 - 0
hsweb-web-websocket/pom.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>framework</artifactId>
+        <groupId>org.hsweb</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-web-websocket</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+
+</project>

+ 126 - 0
pom.xml

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.hsweb</groupId>
+    <artifactId>framework</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <modules>
+        <module>hsweb-web-dao-interface</module>
+        <module>hsweb-web-dao-impl-mybatis</module>
+        <module>hsweb-web-service-interface</module>
+        <module>hsweb-web-service-impl-common</module>
+        <module>hsweb-web-controller</module>
+        <module>hsweb-web-bean</module>
+        <module>hsweb-web-core</module>
+        <module>hsweb-web-websocket</module>
+    </modules>
+
+    <properties>
+        <!-- base setting -->
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.build.locales>zh_CN</project.build.locales>
+        <project.build.jdk>1.7</project.build.jdk>
+
+        <junit.version>4.11</junit.version>
+        <spring.boot.version>1.3.1.RELEASE</spring.boot.version>
+        <fastjson.version>1.2.6</fastjson.version>
+
+        <hibernate.validator.version>5.1.1.Final</hibernate.validator.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <!-- 要将源码放上去,需要加入这个插件 -->
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>2.4</version>
+                <configuration>
+                    <attach>true</attach>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <source>${project.build.jdk}</source>
+                    <target>${project.build.jdk}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.4</version>
+                <configuration>
+                    <excludes>
+                        <exclude>config</exclude>
+                        <exclude>config/**/*</exclude>
+                        <exclude>*.xml</exclude>
+                        <exclude>*.properties</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring.boot.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <!-- test-junit -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.webbuilder</groupId>
+            <artifactId>utils</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
+        <!--json-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>${fastjson.version}</version>
+        </dependency>
+    </dependencies>
+    <distributionManagement>
+        <repository>
+            <id>releases</id>
+            <name>Nexus Release Repository</name>
+            <url>http://121.199.3.43:8889/nexus/content/repositories/releases/</url>
+        </repository>
+        <snapshotRepository>
+            <id>snapshots</id>
+            <name>Nexus Snapshot Repository</name>
+            <url>http://121.199.3.43:8889/nexus/content/repositories/snapshots/</url>
+        </snapshotRepository>
+    </distributionManagement>
+</project>