瀏覽代碼

新增模板模块

zhouhao 7 年之前
父節點
當前提交
38d64fead0
共有 19 個文件被更改,包括 692 次插入1 次删除
  1. 32 0
      hsweb-system/hsweb-system-template/hsweb-system-template-controller/pom.xml
  2. 35 0
      hsweb-system/hsweb-system-template/hsweb-system-template-controller/src/main/java/org/hswebframework/web/controller/tempalte/TempalteController.java
  3. 27 0
      hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-api/pom.xml
  4. 11 0
      hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-api/src/main/java/org/hswebframework/web/dao/tempalte/TemplateDao.java
  5. 26 0
      hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-mybatis/pom.xml
  6. 50 0
      hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/tempalte/TempalteMapper.xml
  7. 18 0
      hsweb-system/hsweb-system-template/hsweb-system-template-dao/pom.xml
  8. 22 0
      hsweb-system/hsweb-system-template/hsweb-system-template-entity/pom.xml
  9. 100 0
      hsweb-system/hsweb-system-template/hsweb-system-template-entity/src/main/java/org/hswebframework/web/entity/tempalte/SimpleTemplateEntity.java
  10. 107 0
      hsweb-system/hsweb-system-template/hsweb-system-template-entity/src/main/java/org/hswebframework/web/entity/tempalte/TemplateEntity.java
  11. 26 0
      hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-api/pom.xml
  12. 11 0
      hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-api/src/main/java/org/hswebframework/web/service/tempalte/TemplateRender.java
  13. 13 0
      hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-api/src/main/java/org/hswebframework/web/service/tempalte/TemplateService.java
  14. 26 0
      hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-simple/pom.xml
  15. 39 0
      hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-simple/src/main/java/org/hswebframework/web/service/tempalte/simple/SimpleTemplateService.java
  16. 18 0
      hsweb-system/hsweb-system-template/hsweb-system-template-service/pom.xml
  17. 78 0
      hsweb-system/hsweb-system-template/hsweb-system-template-starter/pom.xml
  18. 45 0
      hsweb-system/hsweb-system-template/hsweb-system-template-starter/src/main/resources/hsweb-starter.js
  19. 8 1
      hsweb-system/hsweb-system-template/pom.xml

+ 32 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-controller/pom.xml

@@ -0,0 +1,32 @@
+<?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>hsweb-system-template</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-controller</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-service-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-controller</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 35 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-controller/src/main/java/org/hswebframework/web/controller/tempalte/TempalteController.java

@@ -0,0 +1,35 @@
+package org.hswebframework.web.controller.tempalte;
+
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.controller.SimpleGenericEntityController;
+import org.hswebframework.web.entity.tempalte.TemplateEntity;
+import org.hswebframework.web.logging.AccessLogger;
+import org.hswebframework.web.service.tempalte.TemplateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 模板
+ *
+ * @author hsweb-generator-online
+ */
+@RestController
+@RequestMapping("${hsweb.web.mappings.template:template}")
+@Authorize(permission = "template")
+@AccessLogger("模板")
+public class TempalteController implements SimpleGenericEntityController<TemplateEntity, String, QueryParamEntity> {
+
+    private TemplateService templateService;
+
+    @Autowired
+    public void setTemplateService(TemplateService templateService) {
+        this.templateService = templateService;
+    }
+
+    @Override
+    public TemplateService getService() {
+        return templateService;
+    }
+}

+ 27 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-api/pom.xml

@@ -0,0 +1,27 @@
+<?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>hsweb-system-template-dao</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-dao-api</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-entity</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-dao-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>

+ 11 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-api/src/main/java/org/hswebframework/web/dao/tempalte/TemplateDao.java

@@ -0,0 +1,11 @@
+package org.hswebframework.web.dao.tempalte;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.tempalte.TemplateEntity;
+
+/**
+*  模板 DAO接口
+*  @author hsweb-generator-online
+ */
+public interface TemplateDao extends CrudDao<TemplateEntity,String> {
+}

+ 26 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-mybatis/pom.xml

@@ -0,0 +1,26 @@
+<?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>hsweb-system-template-dao</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-dao-mybatis</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-dao-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-dao-mybatis</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 50 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-dao/hsweb-system-template-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/tempalte/TempalteMapper.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.hswebframework.web.dao.tempalte.TemplateDao">
+    <resultMap id="TemplateResultMap" type="org.hswebframework.web.entity.tempalte.TemplateEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+        <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
+        <result property="type" column="type" javaType="String" jdbcType="VARCHAR"/>
+        <result property="template" column="template" javaType="String" jdbcType="CLOB"/>
+        <result property="config" column="config" javaType="String" jdbcType="CLOB"/>
+        <result property="version" column="version" javaType="Long" jdbcType="DECIMAL"/>
+        <result property="classified" column="classified" javaType="String" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'TemplateResultMap'"/>
+        <bind name="tableName" value="'s_template'"/>
+    </sql>
+
+    <insert id="insert" parameterType="org.hswebframework.web.entity.tempalte.TemplateEntity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from s_template where u_id =#{id}
+    </delete>
+
+    <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildDeleteSql"/>
+    </delete>
+
+    <update id="update" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildUpdateSql"/>
+    </update>
+
+    <select id="query" parameterType="org.hswebframework.web.commons.entity.Entity" resultMap="TemplateResultMap">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildSelectSql"/>
+    </select>
+
+    <select id="count" parameterType="org.hswebframework.web.commons.entity.Entity" resultType="int">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildTotalSql"/>
+    </select>
+</mapper>

+ 18 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-dao/pom.xml

@@ -0,0 +1,18 @@
+<?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>hsweb-system-template</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-dao</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-system-template-dao-api</module>
+        <module>hsweb-system-template-dao-mybatis</module>
+    </modules>
+</project>

+ 22 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-entity/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>hsweb-system-template</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-entity</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-entity</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>

+ 100 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-entity/src/main/java/org/hswebframework/web/entity/tempalte/SimpleTemplateEntity.java

@@ -0,0 +1,100 @@
+package org.hswebframework.web.entity.tempalte;
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+
+/**
+* 模板
+* @author hsweb-generator-online
+*/
+public class SimpleTemplateEntity extends SimpleGenericEntity<String> implements TemplateEntity {
+  		//模板名称
+        private String name;
+  		//模板类型
+        private String type;
+  		//模板内容
+        private String template;
+  		//模板配置
+        private String config;
+  		//版本号
+        private Long version;
+  		//模板分类
+        private String classified;
+
+        /**
+        * @return  模板名称
+        */
+        public String getName(){
+			return this.name;
+        }
+
+        /**
+        * @param  name  模板名称
+        */
+        public void setName(String name){
+        	this.name=name;
+        }
+        /**
+        * @return  模板类型
+        */
+        public String getType(){
+			return this.type;
+        }
+
+        /**
+        * @param  type  模板类型
+        */
+        public void setType(String type){
+        	this.type=type;
+        }
+        /**
+        * @return  模板内容
+        */
+        public String getTemplate(){
+			return this.template;
+        }
+
+        /**
+        * @param  template  模板内容
+        */
+        public void setTemplate(String template){
+        	this.template=template;
+        }
+        /**
+        * @return  模板配置
+        */
+        public String getConfig(){
+			return this.config;
+        }
+
+        /**
+        * @param  config  模板配置
+        */
+        public void setConfig(String config){
+        	this.config=config;
+        }
+        /**
+        * @return  版本号
+        */
+        public Long getVersion(){
+			return this.version;
+        }
+
+        /**
+        * @param  version  版本号
+        */
+        public void setVersion(Long version){
+        	this.version=version;
+        }
+        /**
+        * @return  模板分类
+        */
+        public String getClassified(){
+			return this.classified;
+        }
+
+        /**
+        * @param  classified  模板分类
+        */
+        public void setClassified(String classified){
+        	this.classified=classified;
+        }
+}

+ 107 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-entity/src/main/java/org/hswebframework/web/entity/tempalte/TemplateEntity.java

@@ -0,0 +1,107 @@
+package org.hswebframework.web.entity.tempalte;
+
+import org.hibernate.validator.constraints.NotBlank;
+import org.hswebframework.web.commons.entity.GenericEntity;
+import org.hswebframework.web.validator.group.CreateGroup;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 模板 实体
+ *
+ * @author hsweb-generator-online
+ */
+public interface TemplateEntity extends GenericEntity<String> {
+ /*-------------------------------------------
+    |               属性名常量               |
+    ===========================================*/
+    /**
+     * 模板名称
+     */
+    String name       = "name";
+    /**
+     * 模板类型
+     */
+    String type       = "type";
+    /**
+     * 模板内容
+     */
+    String template   = "template";
+    /**
+     * 模板配置
+     */
+    String config     = "config";
+    /**
+     * 版本号
+     */
+    String version    = "version";
+    /**
+     * 模板分类
+     */
+    String classified = "classified";
+
+    /**
+     * @return 模板名称
+     */
+    @NotBlank(groups = CreateGroup.class)
+    String getName();
+
+    /**
+     * @param name 模板名称
+     */
+    void setName(String name);
+
+    /**
+     * @return 模板类型
+     */
+    @NotBlank(groups = CreateGroup.class)
+    String getType();
+
+    /**
+     * @param type 模板类型
+     */
+    void setType(String type);
+
+    /**
+     * @return 模板内容
+     */
+    @NotBlank(groups = CreateGroup.class)
+    String getTemplate();
+
+    /**
+     * @param template 模板内容
+     */
+    void setTemplate(String template);
+
+    /**
+     * @return 模板配置
+     */
+    String getConfig();
+
+    /**
+     * @param config 模板配置
+     */
+    void setConfig(String config);
+
+    /**
+     * @return 版本号
+     */
+    @NotNull(groups = CreateGroup.class)
+    Long getVersion();
+
+    /**
+     * @param version 版本号
+     */
+    void setVersion(Long version);
+
+    /**
+     * @return 模板分类
+     */
+    String getClassified();
+
+    /**
+     * @param classified 模板分类
+     */
+    void setClassified(String classified);
+
+}

+ 26 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-api/pom.xml

@@ -0,0 +1,26 @@
+<?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>hsweb-system-template-service</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-service-api</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-service-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-dao-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 11 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-api/src/main/java/org/hswebframework/web/service/tempalte/TemplateRender.java

@@ -0,0 +1,11 @@
+package org.hswebframework.web.service.tempalte;
+
+/**
+ * 模板渲染器
+ *
+ * @author zhouhao
+ * @since 3.0
+ */
+public interface TemplateRender {
+    String render(Object context);
+}

+ 13 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-api/src/main/java/org/hswebframework/web/service/tempalte/TemplateService.java

@@ -0,0 +1,13 @@
+package org.hswebframework.web.service.tempalte;
+
+import org.hswebframework.web.entity.tempalte.TemplateEntity;
+import org.hswebframework.web.service.CrudService;
+
+/**
+ * 模板 服务类
+ *
+ * @author hsweb-generator-online
+ */
+public interface TemplateService extends CrudService<TemplateEntity, String> {
+
+}

+ 26 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-simple/pom.xml

@@ -0,0 +1,26 @@
+<?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>hsweb-system-template-service</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-service-simple</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-service-simple</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-service-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 39 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-simple/src/main/java/org/hswebframework/web/service/tempalte/simple/SimpleTemplateService.java

@@ -0,0 +1,39 @@
+package org.hswebframework.web.service.tempalte.simple;
+
+import org.hswebframework.web.dao.tempalte.TemplateDao;
+import org.hswebframework.web.entity.tempalte.TemplateEntity;
+import org.hswebframework.web.service.GenericEntityService;
+import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.service.tempalte.TemplateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 默认的服务实现
+ *
+ * @author hsweb-generator-online
+ */
+@Service("templateService")
+public class SimpleTemplateService extends GenericEntityService<TemplateEntity, String>
+        implements TemplateService {
+    @Autowired
+    private TemplateDao templateDao;
+
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+
+    @Override
+    public TemplateDao getDao() {
+        return templateDao;
+    }
+
+    @Override
+    public int updateByPk(String id, TemplateEntity entity) {
+        TemplateEntity old = selectByPk(id);
+        assertNotNull(old);
+        entity.setVersion(old.getVersion() + 1);
+        return super.updateByPk(id, entity);
+    }
+}

+ 18 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-service/pom.xml

@@ -0,0 +1,18 @@
+<?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>hsweb-system-template</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-service</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-system-template-service-api</module>
+        <module>hsweb-system-template-service-simple</module>
+    </modules>
+</project>

+ 78 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-starter/pom.xml

@@ -0,0 +1,78 @@
+<?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>hsweb-system-template</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-template-starter</artifactId>
+
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-service-simple</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+      
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-dao-mybatis</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+      
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-template-controller</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+      
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.0.26</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-spring-boot-starter</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-tests</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>test</scope>
+        </dependency>
+      
+    </dependencies>
+</project>

+ 45 - 0
hsweb-system/hsweb-system-template/hsweb-system-template-starter/src/main/resources/hsweb-starter.js

@@ -0,0 +1,45 @@
+//组件信息
+var info = {
+    groupId: "${project.groupId}",
+    artifactId: "${project.artifactId}",
+    version: "${project.version}",
+    website: "https://github.com/hs-web/hsweb-framework",
+    author: "admin@hsweb.me",
+    comment: "模板"
+};
+
+//版本更新信息
+var versions = [
+    // {
+    //     version: "3.0.2",
+    //     upgrade: function (context) {
+    //         java.lang.System.out.println("更新到3.0.2了");
+    //     }
+    // }
+];
+var JDBCType = java.sql.JDBCType;
+function install(context) {
+    var database = context.database;
+    database.createOrAlter("s_template")
+        .addColumn().name("u_id").alias("id").comment("ID").jdbcType(java.sql.JDBCType.VARCHAR).length(32).primaryKey().commit()
+        .addColumn().name("name").alias("name").comment("模板名称").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("type").alias("type").comment("模板类型").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("template").alias("template").comment("模板内容").jdbcType(java.sql.JDBCType.CLOB).commit()
+        .addColumn().name("config").alias("config").comment("模板配置").jdbcType(java.sql.JDBCType.CLOB).commit()
+        .addColumn().name("version").alias("version").comment("版本号").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .addColumn().name("classified").alias("classified").comment("模板分类").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .comment("模板").commit();
+}
+//设置依赖
+dependency.setup(info)
+    .onInstall(install)
+    .onUpgrade(function (context) { //更新时执行
+        var upgrader = context.upgrader;
+        upgrader.filter(versions)
+            .upgrade(function (newVer) {
+                newVer.upgrade(context);
+            });
+    })
+    .onUninstall(function (context) { //卸载时执行
+
+    });

+ 8 - 1
hsweb-system/hsweb-system-template/pom.xml

@@ -10,6 +10,13 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>hsweb-system-template</artifactId>
+    <packaging>pom</packaging>
 
-
+    <modules>
+        <module>hsweb-system-template-controller</module>
+        <module>hsweb-system-template-dao</module>
+        <module>hsweb-system-template-entity</module>
+        <module>hsweb-system-template-service</module>
+        <module>hsweb-system-template-starter</module>
+    </modules>
 </project>