├── .gitignore ├── README.md ├── biz ├── biz.iml ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── pocketdigi │ │ └── demo │ │ └── biz │ │ └── user │ │ ├── UserBiz.java │ │ ├── bo │ │ ├── BaseBO.java │ │ └── UserBO.java │ │ └── impl │ │ └── UserBizImpl.java │ └── resources │ ├── config │ └── dubbo.properties │ └── spring │ ├── biz-bean.xml │ ├── dubbo-consumer.xml │ └── dubbo.xml ├── client ├── client.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── pocketdigi │ └── demo │ ├── dto │ ├── BaseDTO.java │ └── ResultDTO.java │ └── user │ ├── UserService.java │ └── dto │ └── UserDTO.java ├── common ├── common.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── pocketdigi │ └── demo │ └── common │ ├── converter │ ├── BeanConverter.java │ └── JsonConverter.java │ └── util │ └── FileUtil.java ├── dal ├── dal.iml ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── pocketdigi │ │ └── demo │ │ └── dal │ │ ├── mapper │ │ ├── BaseMapper.java │ │ └── UserMapper.java │ │ └── po │ │ ├── BasePO.java │ │ └── UserPO.java │ └── resources │ ├── config │ ├── database.properties │ └── mybatis_config.xml │ ├── mapper │ ├── BaseMapper.xml │ └── UserMap.xml │ └── spring │ └── mybatis.xml ├── dubbo-server ├── dubbo-server.iml ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── pocketdigi │ │ └── demo │ │ └── user │ │ └── UserServiceImpl.java │ └── resources │ ├── config │ └── dubbo-provider.properties │ └── spring │ └── dubbo-provider.xml ├── pom.xml └── web ├── pom.xml ├── src ├── main │ ├── angular │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── README.md │ │ ├── angular-cli.json │ │ ├── e2e │ │ │ ├── app.e2e-spec.ts │ │ │ ├── app.po.ts │ │ │ └── tsconfig.json │ │ ├── karma.conf.js │ │ ├── package.json │ │ ├── protractor.conf.js │ │ ├── src │ │ │ ├── app │ │ │ │ ├── app-routing.module.ts │ │ │ │ ├── app.component.css │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.module.ts │ │ │ │ ├── common │ │ │ │ │ ├── api.service.spec.ts │ │ │ │ │ ├── api.service.ts │ │ │ │ │ ├── log.service.spec.ts │ │ │ │ │ ├── log.service.ts │ │ │ │ │ ├── result.ts │ │ │ │ │ └── validator │ │ │ │ │ │ ├── number-between-validator.directive.spec.ts │ │ │ │ │ │ └── number-between-validator.directive.ts │ │ │ │ ├── home │ │ │ │ │ ├── home-routing.module.ts │ │ │ │ │ ├── home.module.ts │ │ │ │ │ └── home │ │ │ │ │ │ ├── home.component.css │ │ │ │ │ │ ├── home.component.html │ │ │ │ │ │ ├── home.component.spec.ts │ │ │ │ │ │ └── home.component.ts │ │ │ │ ├── rxjs │ │ │ │ │ ├── rxjs.component.css │ │ │ │ │ ├── rxjs.component.html │ │ │ │ │ ├── rxjs.component.spec.ts │ │ │ │ │ └── rxjs.component.ts │ │ │ │ └── user │ │ │ │ │ ├── user-detail │ │ │ │ │ ├── user-detail.component.css │ │ │ │ │ ├── user-detail.component.html │ │ │ │ │ ├── user-detail.component.spec.ts │ │ │ │ │ └── user-detail.component.ts │ │ │ │ │ ├── user-edit │ │ │ │ │ ├── user-edit.component.css │ │ │ │ │ ├── user-edit.component.html │ │ │ │ │ ├── user-edit.component.spec.ts │ │ │ │ │ └── user-edit.component.ts │ │ │ │ │ ├── user-list │ │ │ │ │ ├── user-list.component.css │ │ │ │ │ ├── user-list.component.html │ │ │ │ │ ├── user-list.component.spec.ts │ │ │ │ │ └── user-list.component.ts │ │ │ │ │ ├── user.service.spec.ts │ │ │ │ │ ├── user.service.ts │ │ │ │ │ └── user.ts │ │ │ ├── assets │ │ │ │ └── .gitkeep │ │ │ ├── environments │ │ │ │ ├── environment.prod.ts │ │ │ │ └── environment.ts │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ ├── polyfills.ts │ │ │ ├── styles.css │ │ │ ├── test.ts │ │ │ └── tsconfig.json │ │ └── tslint.json │ ├── java │ │ └── com │ │ │ └── pocketdigi │ │ │ └── demo │ │ │ ├── controller │ │ │ ├── FileUploaderController.java │ │ │ ├── IndexController.java │ │ │ └── UserController.java │ │ │ ├── exception │ │ │ └── CommonExceptionResolver.java │ │ │ └── interceptor │ │ │ └── RequestInterceptor.java │ ├── resources │ │ ├── applicationContext.xml │ │ ├── config │ │ │ └── upload.properties │ │ ├── log4j2.xml │ │ └── spring │ │ │ ├── exception_resolver.xml │ │ │ ├── freemarker.xml │ │ │ ├── multipart_resolver.xml │ │ │ └── properties_config.xml │ └── webapp │ │ ├── WEB-INF │ │ ├── ftl │ │ │ └── index.ftl │ │ ├── mvc-dispatcher-servlet.xml │ │ └── web.xml │ │ └── static │ │ └── html │ │ ├── tt.html │ │ └── user.html └── test │ ├── java │ └── WebServer.java │ └── resources │ ├── log4j2-test.xml │ └── webdefault.xml └── web.iml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | */target/ 3 | logs/ 4 | /web/src/main/webapp/dist/ 5 | /web/src/main/webapp/upload/ 6 | **/*.iml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### SpringMVC+MyBatis+FreeMarker+Angular2 Demo 2 | ##### 模块化分离代码 3 | 4 | - biz:Service 业务逻辑层 5 | - client:对外的接口定义 6 | - dal:数据持久化层 7 | - web:控制器层 8 | - common:一些公共类 9 | 10 | 11 | #### 用到的框架: 12 | 13 | 1. SpringMVC 14 | 2. Mybatis 15 | 3. FreeMarker 16 | 4. log4j+slf4j 17 | 5. Gson 18 | 6. Angular2 19 | 20 | #### 使用方法 21 | 1. 全局搜索 `${project.groupId}`,`${project.artifactId}`,`${project.version}`替换项目的groupId,artifactId,version。 22 | 如果直接使用表达式,打包会有警告,但也不会报错。 23 | 2. 更改包名。在web/src/main/java/com.pocketdigi.demo上按shift+F6(快捷键可能不一样,右键-Refactor-rename也是可以的),选择`Rename Package` 24 | 3. git remote remove origin 25 | 4. git remote add origin xxxxx 26 | 27 | 28 | Angular目录在web/src/main/angular,生成的dist目录在web/src/main/webapp/dist 29 | 30 | Angular监听文件变化自动构建:`npm run develop`,建议在idea添加运行配置 31 | 32 | 发布:`mvn package` 33 | 34 | 配置步骤参考[SpringMVC Angular2 Intellij Idea 开发环境搭建](https://www.pocketdigi.com/20170214/1567.html) -------------------------------------------------------------------------------- /biz/biz.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /biz/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ${project.artifactId} 7 | ${project.groupId} 8 | ${project.version} 9 | 10 | 4.0.0 11 | 12 | biz 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | ${project.groupId} 18 | common 19 | 20 | 21 | 22 | dal 23 | ${project.groupId} 24 | 25 | 26 | client 27 | ${project.groupId} 28 | 29 | 30 | org.projectlombok 31 | lombok 32 | 33 | 34 | 35 | 36 | org.springframework.data 37 | spring-data-commons 38 | 39 | 40 | org.slf4j 41 | jcl-over-slf4j 42 | 43 | 44 | org.slf4j 45 | slf4j-api 46 | 47 | 48 | ${spring-data.version} 49 | 50 | 51 | 52 | org.springframework 53 | spring-web 54 | 55 | 56 | org.springframework 57 | spring-context 58 | 59 | 60 | org.springframework 61 | spring-beans 62 | 63 | 64 | org.springframework 65 | spring-aop 66 | 67 | 68 | org.springframework 69 | spring-core 70 | 71 | 72 | org.springframework 73 | spring-expression 74 | 75 | 76 | 77 | 78 | org.springframework 79 | spring-context 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /biz/src/main/java/com/pocketdigi/demo/biz/user/UserBiz.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.biz.user; 2 | 3 | import com.pocketdigi.demo.biz.user.bo.UserBO; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by fhp on 16/10/30. 9 | */ 10 | public interface UserBiz { 11 | UserBO addUser(UserBO userBO); 12 | boolean deleteUser(Integer id); 13 | List listAll(); 14 | UserBO getUser(Integer id); 15 | UserBO updateUser(UserBO userBO); 16 | List listAllUseDubbo(); 17 | } 18 | -------------------------------------------------------------------------------- /biz/src/main/java/com/pocketdigi/demo/biz/user/bo/BaseBO.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.biz.user.bo; 2 | 3 | 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | 9 | /** 10 | * 数据库基础字段 11 | * Created by fhp on 16/10/13. 12 | */ 13 | @Data 14 | public class BaseBO implements Serializable{ 15 | private Integer id; 16 | private Date gmtCreate; 17 | private Date gmtModified; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /biz/src/main/java/com/pocketdigi/demo/biz/user/bo/UserBO.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.biz.user.bo; 2 | import lombok.Data; 3 | 4 | @Data 5 | public class UserBO extends BaseBO { 6 | private String userName; 7 | private int userAge; 8 | private String avatar; 9 | } 10 | -------------------------------------------------------------------------------- /biz/src/main/java/com/pocketdigi/demo/biz/user/impl/UserBizImpl.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.biz.user.impl; 2 | 3 | import com.pocketdigi.demo.biz.user.UserBiz; 4 | import com.pocketdigi.demo.biz.user.bo.UserBO; 5 | import com.pocketdigi.demo.common.converter.BeanConverter; 6 | import com.pocketdigi.demo.dal.mapper.UserMapper; 7 | import com.pocketdigi.demo.dal.po.UserPO; 8 | import com.pocketdigi.demo.user.UserService; 9 | import com.pocketdigi.demo.user.dto.UserDTO; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * Created by fhp on 16/10/30. 17 | */ 18 | @Service 19 | public class UserBizImpl implements UserBiz{ 20 | @Autowired 21 | UserMapper userMapper; 22 | @Autowired 23 | UserService userService; 24 | 25 | public UserBO addUser(UserBO userBO) { 26 | UserPO userPO = BeanConverter.convertObj(userBO, UserPO.class); 27 | int insert = userMapper.insert(userPO); 28 | userBO.setId(userPO.getId()); 29 | if(insert==1) { 30 | return userBO; 31 | }else{ 32 | return null; 33 | } 34 | } 35 | 36 | public boolean deleteUser(Integer id) { 37 | return userMapper.deleteById(id)==1; 38 | } 39 | 40 | public List listAll() { 41 | List userPOs = userMapper.selectAll(); 42 | return BeanConverter.convertArrayList(userPOs, UserBO.class); 43 | } 44 | 45 | public UserBO getUser(Integer id) { 46 | UserPO userPO = userMapper.selectById(id); 47 | return BeanConverter.convertObj(userPO,UserBO.class); 48 | 49 | } 50 | 51 | public UserBO updateUser(UserBO userBO) { 52 | userMapper.updateById(BeanConverter.convertObj(userBO, UserPO.class)); 53 | return getUser(userBO.getId()); 54 | } 55 | 56 | public List listAllUseDubbo() { 57 | List data = userService.listAll().getData(); 58 | return BeanConverter.convertArrayList(data,UserBO.class); 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /biz/src/main/resources/config/dubbo.properties: -------------------------------------------------------------------------------- 1 | #dubbo config 2 | zookeeper.address=172.16.134.23:2181 3 | dubbo.application.name=SpringMVCWithAngular2demo 4 | # consumer 5 | dubbo.consumer.demo.version = 1.0.0.local -------------------------------------------------------------------------------- /biz/src/main/resources/spring/biz-bean.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /biz/src/main/resources/spring/dubbo-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 13 | -------------------------------------------------------------------------------- /biz/src/main/resources/spring/dubbo.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /client/client.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ${project.artifactId} 7 | ${project.groupId} 8 | ${project.version} 9 | 10 | 4.0.0 11 | client 12 | 1.0-SNAPSHOT 13 | 14 | 15 | org.projectlombok 16 | lombok 17 | provided 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /client/src/main/java/com/pocketdigi/demo/dto/BaseDTO.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.util.Date; 7 | 8 | /** 9 | * 数据库基础字段 10 | * Created by fhp on 16/10/13. 11 | */ 12 | @Data 13 | public class BaseDTO implements Serializable{ 14 | Integer id; 15 | Date gmtCreate; 16 | Date gmtModified; 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /client/src/main/java/com/pocketdigi/demo/dto/ResultDTO.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * Created by fhp on 16/10/30. 7 | */ 8 | @Data 9 | public class ResultDTO implements java.io.Serializable{ 10 | String msg; 11 | int code; 12 | T data; 13 | public static ResultDTO wrapSuccess(T data) { 14 | ResultDTO result = new ResultDTO(); 15 | result.data = data; 16 | result.code=0; 17 | result.msg="成功"; 18 | return result; 19 | } 20 | 21 | public static ResultDTO wrapError(int code,String msg) { 22 | ResultDTO result = new ResultDTO(); 23 | result.code=code; 24 | result.msg=msg; 25 | return result; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /client/src/main/java/com/pocketdigi/demo/user/UserService.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.user; 2 | 3 | import com.pocketdigi.demo.dto.ResultDTO; 4 | import com.pocketdigi.demo.user.dto.UserDTO; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by fhp on 16/10/30. 10 | */ 11 | public interface UserService { 12 | ResultDTO addUser(UserDTO user); 13 | ResultDTO deleteUser(Integer id); 14 | ResultDTO> listAll(); 15 | } 16 | -------------------------------------------------------------------------------- /client/src/main/java/com/pocketdigi/demo/user/dto/UserDTO.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.user.dto; 2 | 3 | import com.pocketdigi.demo.dto.BaseDTO; 4 | import lombok.Data; 5 | 6 | /** 7 | * Created by fhp on 16/10/30. 8 | */ 9 | @Data 10 | public class UserDTO extends BaseDTO { 11 | String userName; 12 | int userAge; 13 | String avatar; 14 | } 15 | -------------------------------------------------------------------------------- /common/common.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ${project.artifactId} 7 | ${project.groupId} 8 | ${project.version} 9 | 10 | 4.0.0 11 | 12 | common 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | 18 | 19 | org.apache.logging.log4j 20 | log4j-api 21 | 22 | 23 | org.apache.logging.log4j 24 | log4j-core 25 | 26 | 27 | org.apache.logging.log4j 28 | log4j-slf4j-impl 29 | 30 | 31 | org.apache.logging.log4j 32 | log4j-jcl 33 | 34 | 35 | org.apache.logging.log4j 36 | log4j-web 37 | runtime 38 | 39 | 40 | org.slf4j 41 | slf4j-api 42 | 43 | 44 | org.slf4j 45 | slf4j-log4j12 46 | 47 | 48 | 49 | 50 | org.projectlombok 51 | lombok 52 | 53 | 54 | 55 | org.apache.commons 56 | commons-lang3 57 | 58 | 59 | 60 | org.springframework 61 | spring-beans 62 | 63 | 64 | 65 | 66 | com.google.code.gson 67 | gson 68 | 69 | 70 | 71 | io.reactivex.rxjava2 72 | rxjava 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /common/src/main/java/com/pocketdigi/demo/common/converter/BeanConverter.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.common.converter; 2 | 3 | import org.springframework.beans.BeanUtils; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Bean转换器 10 | * Created by fhp on 16/11/2. 11 | */ 12 | public class BeanConverter { 13 | /** 14 | * 转换对象 15 | * @param source 16 | * @param targetClass 17 | * @param 18 | * @return 19 | */ 20 | public static T convertObj(Object source, Class targetClass) { 21 | try { 22 | T target = targetClass.newInstance(); 23 | BeanUtils.copyProperties(source,target); 24 | return target; 25 | } catch (InstantiationException e) { 26 | e.printStackTrace(); 27 | } catch (IllegalAccessException e) { 28 | e.printStackTrace(); 29 | } 30 | return null; 31 | } 32 | 33 | /** 34 | * 转换ArrayList 35 | * @param sourceList 36 | * @param targetClass 37 | * @param 38 | * @return 39 | */ 40 | public static List convertArrayList(List sourceList, Class targetClass) { 41 | ArrayList targetList=new ArrayList(); 42 | for(Object obj:sourceList) { 43 | targetList.add(convertObj(obj,targetClass)); 44 | } 45 | return targetList; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/src/main/java/com/pocketdigi/demo/common/converter/JsonConverter.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.common.converter; 2 | 3 | 4 | import com.google.gson.Gson; 5 | 6 | /** 7 | * 对象转成json 8 | * Created by fhp on 16/8/11. 9 | */ 10 | public class JsonConverter { 11 | public static String convertObj(Object obj) { 12 | Gson gson=new Gson(); 13 | return gson.toJson(obj); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/src/main/java/com/pocketdigi/demo/common/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.common.util; 2 | 3 | 4 | import io.reactivex.Flowable; 5 | import io.reactivex.Observable; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.Random; 10 | import java.util.Set; 11 | 12 | /** 13 | * Created by fhp on 2017/2/17. 14 | */ 15 | public class FileUtil { 16 | 17 | private static HashMap CONTENT_TYPE_EXT_MAP = new HashMap<>(100); 18 | 19 | static { 20 | CONTENT_TYPE_EXT_MAP.put("application/pdf", ".pdf"); 21 | CONTENT_TYPE_EXT_MAP.put("application/x-png", ".png"); 22 | CONTENT_TYPE_EXT_MAP.put("image/png", ".png"); 23 | CONTENT_TYPE_EXT_MAP.put("application/x-jpg", ".jpg"); 24 | CONTENT_TYPE_EXT_MAP.put("image/jpeg", ".jpg"); 25 | CONTENT_TYPE_EXT_MAP.put("video/mpeg4", ".mp4"); 26 | CONTENT_TYPE_EXT_MAP.put("audio/mp3", ".mp3"); 27 | CONTENT_TYPE_EXT_MAP.put("video/mpg", ".mpeg"); 28 | CONTENT_TYPE_EXT_MAP.put("application/vnd.ms-excel", ".xls"); 29 | CONTENT_TYPE_EXT_MAP.put("application/x-bmp", ".bmp"); 30 | CONTENT_TYPE_EXT_MAP.put("text/html", ".html"); 31 | CONTENT_TYPE_EXT_MAP.put("application/msword", ".doc"); 32 | } 33 | 34 | /** 35 | * ContentType转扩展名 36 | * 37 | * @param contentType 如application/x-png png 38 | * @return 扩展名 带. 39 | */ 40 | public static String contentType2Ext(String contentType) { 41 | return CONTENT_TYPE_EXT_MAP.get(contentType); 42 | } 43 | 44 | /** 45 | * 通过扩展名获取contentType 46 | * @param ext 带. 47 | * @return 48 | */ 49 | public static String ext2ContentType(String ext) { 50 | Set> entries = CONTENT_TYPE_EXT_MAP.entrySet(); 51 | for (Map.Entry entry : entries) { 52 | if(entry.getValue().equals(ext)) 53 | return entry.getKey(); 54 | } 55 | return null; 56 | } 57 | 58 | public static String generateFileName(String ext) { 59 | int nextInt = new Random().nextInt(10000); 60 | return System.currentTimeMillis()+""+nextInt+ext; 61 | 62 | } 63 | 64 | public static void main(String[] args) { 65 | 66 | System.out.println(contentType2Ext("video/mpg")); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /dal/dal.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /dal/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ${project.artifactId} 7 | ${project.groupId} 8 | ${project.version} 9 | 10 | 4.0.0 11 | 12 | dal 13 | 1.0-SNAPSHOT 14 | 15 | 16 | ${project.groupId} 17 | common 18 | 19 | 20 | 21 | 22 | org.springframework.data 23 | spring-data-jpa 24 | 25 | 26 | org.springframework 27 | spring-core 28 | 29 | 30 | org.springframework 31 | spring-beans 32 | 33 | 34 | org.springframework 35 | spring-context 36 | 37 | 38 | org.springframework 39 | spring-aop 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | mysql 48 | mysql-connector-java 49 | 50 | 51 | org.mybatis 52 | mybatis 53 | 54 | 55 | org.mybatis 56 | mybatis-spring 57 | 58 | 59 | org.apache.commons 60 | commons-dbcp2 61 | 62 | 63 | org.projectlombok 64 | lombok 65 | 66 | 67 | org.springframework 68 | spring-context 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /dal/src/main/java/com/pocketdigi/demo/dal/mapper/BaseMapper.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.dal.mapper; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | /** 7 | * Created by fhp on 16/10/13. 8 | */ 9 | public interface BaseMapper { 10 | /** 11 | * 查询总数 12 | * 13 | * @param param 14 | * @return 15 | */ 16 | Integer selectCount(Map param); 17 | 18 | /** 19 | * 查询 20 | * 21 | * @param parameters 22 | * @return 23 | */ 24 | List select(Map parameters); 25 | 26 | List selectAll(); 27 | 28 | /** 29 | * 根据ID查询 30 | * 31 | * @param id 32 | * @return 33 | */ 34 | T selectById(int id); 35 | 36 | /** 37 | * 根据IDS查询 38 | * @param ids 39 | * @return 40 | */ 41 | List selectByIds(int[] ids); 42 | 43 | /** 44 | * 根据ID删除 45 | * 46 | * @param id 47 | * @return 48 | */ 49 | int deleteById(int id); 50 | 51 | /** 52 | * 根据IDS批量删除 53 | * 54 | * @param list 55 | * @return 56 | */ 57 | int deleteByIds(Object[] list); 58 | 59 | /** 60 | * 删除 61 | * 62 | * @param parameters 63 | * @return 64 | */ 65 | int delete(Map parameters); 66 | 67 | /** 68 | * 添加 69 | * 70 | * @param t 71 | * @return 72 | */ 73 | int insert(T t); 74 | 75 | /** 76 | * 通过ID更新 77 | * 78 | * @param t 79 | * @return 80 | */ 81 | int updateById(T t); 82 | 83 | 84 | /** 85 | * 批量插入 86 | * @param t 87 | * @return 88 | */ 89 | Integer batchInsert(List t); 90 | } 91 | -------------------------------------------------------------------------------- /dal/src/main/java/com/pocketdigi/demo/dal/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.dal.mapper; 2 | 3 | 4 | import com.pocketdigi.demo.dal.po.UserPO; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by fhp on 16/10/13. 11 | */ 12 | @Component 13 | public interface UserMapper extends BaseMapper{ 14 | List selectByName(String userName); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /dal/src/main/java/com/pocketdigi/demo/dal/po/BasePO.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.dal.po; 2 | 3 | 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | 9 | /** 10 | * 数据库基础字段 11 | * Created by fhp on 16/10/13. 12 | */ 13 | @Data 14 | public class BasePO implements Serializable{ 15 | private Integer id; 16 | private Date gmtCreate; 17 | private Date gmtModified; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /dal/src/main/java/com/pocketdigi/demo/dal/po/UserPO.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.dal.po; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class UserPO extends BasePO { 7 | private String userName; 8 | private int userAge; 9 | private String avatar; 10 | } 11 | -------------------------------------------------------------------------------- /dal/src/main/resources/config/database.properties: -------------------------------------------------------------------------------- 1 | #mysql config 2 | db.url = jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=utf8 3 | db.username = root 4 | db.password = -------------------------------------------------------------------------------- /dal/src/main/resources/config/mybatis_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /dal/src/main/resources/mapper/BaseMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | id as id, 12 | gmt_create as gmtCreate, 13 | gmt_modified as gmtModified, 14 | 15 | 16 | and id= #{id} 17 | and gmt_create= #{gmtCreate} 18 | and gmt_modified= #{gmtModified} 19 | 20 | 21 | 22 | gmt_create=#{gmtCreate}, 23 | 24 | 25 | gmt_modified=#{gmtModified}, 26 | 27 | 28 | 29 | 30 | gmt_create, 31 | gmt_modified, 32 | 33 | 34 | 35 | 36 | order by 37 | 38 | ${tag} 39 | 40 | 41 | 42 | 43 | 44 | 45 | limit ${offset}, ${limit} 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /dal/src/main/resources/mapper/UserMap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | user_name, 15 | user_age, 16 | avatar, 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | and user_name = #{userName} 26 | 27 | 28 | and user_age = #{userAge} 29 | 30 | 31 | and avatar = #{avatar} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | user_name = #{userName}, 43 | 44 | 45 | user_age = #{userAge}, 46 | 47 | 48 | avatar = #{avatar} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 60 | 61 | 69 | 70 | 76 | 77 | 83 | 84 | 89 | 90 | 91 | 102 | 103 | 104 | DELETE 105 | FROM users 106 | where id in 107 | ( 108 | 109 | #{tag} 110 | 111 | ) 112 | 113 | 114 | 115 | DELETE 116 | FROM users 117 | where id = #{id}; 118 | 119 | 120 | 121 | DELETE 122 | FROM users 123 | 124 | 125 | 126 | 127 | INSERT INTO users ( 128 | 129 | user_name, 130 | 131 | 132 | user_age, 133 | 134 | 135 | avatar 136 | 137 | ) 138 | VALUES ( 139 | 140 | #{userName}, 141 | 142 | 143 | #{userAge}, 144 | 145 | 146 | #{avatar} 147 | 148 | ) 149 | 150 | 151 | 152 | UPDATE users 153 | SET user_name = #{userName},user_age = #{userAge},avatar = #{avatar} 154 | WHERE id = ${id}; 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /dal/src/main/resources/spring/mybatis.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /dubbo-server/dubbo-server.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /dubbo-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ${project.artifactId} 7 | ${project.groupId} 8 | ${project.version} 9 | 10 | 4.0.0 11 | 1.0-SNAPSHOT 12 | dubbo-server 13 | 14 | 15 | org.projectlombok 16 | lombok 17 | provided 18 | 19 | 20 | 21 | com.alibaba 22 | dubbo 23 | 24 | 25 | 26 | com.101tec 27 | zkclient 28 | 29 | 30 | 31 | common 32 | ${project.groupId} 33 | 34 | 35 | 36 | client 37 | ${project.groupId} 38 | 39 | 40 | 41 | biz 42 | ${project.groupId} 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /dubbo-server/src/main/java/com/pocketdigi/demo/user/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.user; 2 | 3 | import com.pocketdigi.demo.biz.user.UserBiz; 4 | import com.pocketdigi.demo.biz.user.bo.UserBO; 5 | import com.pocketdigi.demo.common.converter.BeanConverter; 6 | import com.pocketdigi.demo.dto.ResultDTO; 7 | import com.pocketdigi.demo.user.dto.UserDTO; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Exception on 2017/3/17. 15 | */ 16 | @Service("UserService") 17 | public class UserServiceImpl implements UserService { 18 | @Autowired 19 | private UserBiz userBiz; 20 | 21 | public ResultDTO addUser(UserDTO user) { 22 | UserBO userBO = userBiz.addUser(BeanConverter.convertObj(user, UserBO.class)); 23 | return ResultDTO.wrapSuccess(BeanConverter.convertObj(userBO,UserDTO.class)); 24 | } 25 | 26 | public ResultDTO deleteUser(Integer id) { 27 | return ResultDTO.wrapSuccess(userBiz.deleteUser(id)); 28 | } 29 | 30 | public ResultDTO> listAll() { 31 | List userBOS = userBiz.listAll(); 32 | List userDTOS = BeanConverter.convertArrayList(userBOS, UserDTO.class); 33 | return ResultDTO.wrapSuccess(userDTOS); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dubbo-server/src/main/resources/config/dubbo-provider.properties: -------------------------------------------------------------------------------- 1 | #dubbo config 2 | dubbo.service.version=1.0.0.local 3 | dubbo.port=20880 -------------------------------------------------------------------------------- /dubbo-server/src/main/resources/spring/dubbo-provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | ${project.groupId} 8 | ${project.artifactId} 9 | pom 10 | ${project.version} 11 | 12 | common 13 | web 14 | client 15 | biz 16 | dal 17 | dubbo-server 18 | 19 | 20 | 21 | com.pocketdigi.demo 22 | demo 23 | 1.0-SNAPSHOT 24 | 1.0-SNAPSHOT 25 | 26 | 27 | 3.1.0 28 | 29 | 4.1.0.RELEASE 30 | 1.10.1.RELEASE 31 | 5.1.35 32 | 3.4.0 33 | 34 | 1.7.21 35 | 1.7.7 36 | 2.7 37 | 38 | 2.6.2 39 | 3.4 40 | 2.3.22 41 | 1.3.2 42 | 2.0.6 43 | 44 | 45 | 8.2.0.v20160908 46 | 47 | 9.3.13.v20161014 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | common 57 | ${project.groupId} 58 | 1.0-SNAPSHOT 59 | 60 | 61 | client 62 | ${project.groupId} 63 | ${client.version} 64 | 65 | 66 | dubbo-server 67 | ${project.groupId} 68 | 1.0-SNAPSHOT 69 | 70 | 71 | dal 72 | 1.0-SNAPSHOT 73 | ${project.groupId} 74 | 75 | 76 | biz 77 | 1.0-SNAPSHOT 78 | ${project.groupId} 79 | 80 | 81 | web 82 | ${project.groupId} 83 | 1.0-SNAPSHOT 84 | 85 | 86 | 87 | 88 | junit 89 | junit 90 | 4.11 91 | test 92 | 93 | 94 | jstl 95 | jstl 96 | 1.2 97 | 98 | 99 | 100 | javax.servlet.jsp 101 | jsp-api 102 | 2.1 103 | provided 104 | 105 | 106 | 107 | javax.servlet 108 | javax.servlet-api 109 | ${servlet-api.version} 110 | provided 111 | 112 | 113 | 114 | 115 | 116 | org.springframework 117 | spring-core 118 | ${spring.version} 119 | 120 | 121 | 122 | org.springframework 123 | spring-web 124 | ${spring.version} 125 | 126 | 127 | 128 | org.springframework 129 | spring-webmvc 130 | ${spring.version} 131 | 132 | 133 | org.springframework 134 | spring-test 135 | ${spring.version} 136 | test 137 | 138 | 139 | 140 | org.springframework 141 | spring-context 142 | ${spring.version} 143 | 144 | 145 | 146 | org.springframework 147 | spring-context-support 148 | ${spring.version} 149 | 150 | 151 | 152 | 153 | 154 | org.springframework.data 155 | spring-data-jpa 156 | ${spring-data.version} 157 | 158 | 159 | org.springframework 160 | spring-core 161 | 162 | 163 | org.springframework 164 | spring-beans 165 | 166 | 167 | org.springframework 168 | spring-context 169 | 170 | 171 | org.springframework 172 | spring-aop 173 | 174 | 175 | 176 | 177 | org.springframework 178 | spring-beans 179 | ${spring.version} 180 | 181 | 182 | 183 | 184 | mysql 185 | mysql-connector-java 186 | ${mysql-connector.version} 187 | 188 | 189 | org.mybatis 190 | mybatis 191 | ${mybatis.version} 192 | 193 | 194 | org.mybatis 195 | mybatis-spring 196 | 1.3.0 197 | 198 | 199 | org.apache.commons 200 | commons-dbcp2 201 | 2.1.1 202 | 203 | 204 | 205 | 206 | 207 | org.apache.logging.log4j 208 | log4j-api 209 | ${log4j.version} 210 | 211 | 212 | org.apache.logging.log4j 213 | log4j-core 214 | ${log4j.version} 215 | 216 | 217 | org.apache.logging.log4j 218 | log4j-slf4j-impl 219 | ${log4j.version} 220 | 221 | 222 | org.apache.logging.log4j 223 | log4j-jcl 224 | ${log4j.version} 225 | 226 | 227 | org.apache.logging.log4j 228 | log4j-web 229 | ${log4j.version} 230 | runtime 231 | 232 | 233 | org.slf4j 234 | slf4j-api 235 | ${slf4j.version} 236 | 237 | 238 | org.slf4j 239 | slf4j-log4j12 240 | ${slf4j.version} 241 | 242 | 243 | 244 | 245 | org.projectlombok 246 | lombok 247 | 1.16.8 248 | provided 249 | 250 | 251 | 252 | org.apache.commons 253 | commons-lang3 254 | ${commons-lang3.version} 255 | 256 | 257 | 258 | 259 | com.google.code.gson 260 | gson 261 | ${gson.version} 262 | 263 | 264 | 265 | org.freemarker 266 | freemarker 267 | ${freemarker.version} 268 | 269 | 270 | 271 | 272 | commons-fileupload 273 | commons-fileupload 274 | ${commons-fileupload.version} 275 | 276 | 277 | 278 | io.reactivex.rxjava2 279 | rxjava 280 | ${rxjava.version} 281 | 282 | 283 | 284 | com.alibaba 285 | dubbo 286 | 2.5.3 287 | 288 | 289 | org.springframework 290 | spring 291 | 292 | 293 | 294 | 295 | 296 | com.101tec 297 | zkclient 298 | 0.5 299 | 300 | 301 | org.slf4j 302 | slf4j-api 303 | 304 | 305 | org.slf4j 306 | slf4j-log4j12 307 | 308 | 309 | log4j 310 | log4j 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | org.eclipse.jetty.aggregate 319 | jetty-all 320 | ${jetty-all.version} 321 | 322 | 323 | 324 | org.eclipse.jetty 325 | jetty-webapp 326 | ${jetty-webapp.version} 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | org.apache.maven.plugins 336 | maven-compiler-plugin 337 | 338 | 1.8 339 | 1.8 340 | 341 | 342 | 343 | 344 | 345 | -------------------------------------------------------------------------------- /web/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | ${project.artifactId} 5 | ${project.groupId} 6 | ${project.version} 7 | 8 | 4.0.0 9 | web 10 | 1.0-SNAPSHOT 11 | war 12 | web 13 | http://maven.apache.org 14 | 15 | 16 | 17 | common 18 | ${project.groupId} 19 | 20 | 21 | 22 | client 23 | ${project.groupId} 24 | 25 | 26 | 27 | biz 28 | ${project.groupId} 29 | 30 | 31 | dubbo-server 32 | ${project.groupId} 33 | 34 | 35 | 36 | javax.servlet.jsp 37 | jsp-api 38 | 39 | 40 | 41 | javax.servlet 42 | javax.servlet-api 43 | 44 | 45 | jstl 46 | jstl 47 | 48 | 49 | 50 | 51 | org.springframework 52 | spring-core 53 | 54 | 55 | 56 | org.springframework 57 | spring-web 58 | 59 | 60 | 61 | org.springframework 62 | spring-webmvc 63 | 64 | 65 | org.springframework 66 | spring-test 67 | test 68 | 69 | 70 | 71 | org.springframework 72 | spring-context 73 | 74 | 75 | 76 | org.springframework 77 | spring-context-support 78 | 79 | 80 | org.projectlombok 81 | lombok 82 | 83 | 84 | org.freemarker 85 | freemarker 86 | 87 | 88 | 89 | commons-fileupload 90 | commons-fileupload 91 | 92 | 93 | 94 | 95 | org.eclipse.jetty.aggregate 96 | jetty-all 97 | test 98 | 99 | 100 | 101 | org.eclipse.jetty 102 | jetty-webapp 103 | test 104 | 105 | 106 | 107 | 108 | web 109 | 110 | 111 | org.codehaus.mojo 112 | exec-maven-plugin 113 | 1.5.0 114 | 115 | 116 | generate-sources 117 | 118 | exec 119 | 120 | 121 | 122 | 123 | cnpm 124 | ${basedir}/src/main/angular 125 | 126 | 127 | run 128 | release 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /web/src/main/angular/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /web/src/main/angular/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | 10 | # IDEs and editors 11 | /.idea 12 | .project 13 | .classpath 14 | .c9/ 15 | *.launch 16 | .settings/ 17 | 18 | # IDE - VSCode 19 | .vscode/* 20 | !.vscode/settings.json 21 | !.vscode/tasks.json 22 | !.vscode/launch.json 23 | !.vscode/extensions.json 24 | 25 | # misc 26 | /.sass-cache 27 | /connect.lock 28 | /coverage/* 29 | /libpeerconnection.log 30 | npm-debug.log 31 | testem.log 32 | /typings 33 | 34 | # e2e 35 | /e2e/*.js 36 | /e2e/*.map 37 | 38 | #System Files 39 | .DS_Store 40 | Thumbs.db 41 | -------------------------------------------------------------------------------- /web/src/main/angular/README.md: -------------------------------------------------------------------------------- 1 | # Angular 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0-beta.31. 4 | 5 | ## Development server 6 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 7 | 8 | ## Code scaffolding 9 | 10 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`. 11 | 12 | ## Build 13 | 14 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 15 | 16 | ## Running unit tests 17 | 18 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 19 | 20 | ## Running end-to-end tests 21 | 22 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 23 | Before running the tests make sure you are serving the app via `ng serve`. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /web/src/main/angular/angular-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "project": { 4 | "version": "1.0.0-beta.31", 5 | "name": "angular" 6 | }, 7 | "apps": [ 8 | { 9 | "root": "src", 10 | "outDir": "dist", 11 | "assets": [ 12 | "assets", 13 | "favicon.ico" 14 | ], 15 | "index": "index.html", 16 | "main": "main.ts", 17 | "polyfills": "polyfills.ts", 18 | "test": "test.ts", 19 | "tsconfig": "tsconfig.json", 20 | "prefix": "app", 21 | "styles": [ 22 | "styles.css" 23 | ], 24 | "scripts": [], 25 | "environments": { 26 | "source": "environments/environment.ts", 27 | "dev": "environments/environment.ts", 28 | "prod": "environments/environment.prod.ts" 29 | } 30 | } 31 | ], 32 | "e2e": { 33 | "protractor": { 34 | "config": "./protractor.conf.js" 35 | } 36 | }, 37 | "lint": [ 38 | { 39 | "files": "src/**/*.ts", 40 | "project": "src/tsconfig.json" 41 | }, 42 | { 43 | "files": "e2e/**/*.ts", 44 | "project": "e2e/tsconfig.json" 45 | } 46 | ], 47 | "test": { 48 | "karma": { 49 | "config": "./karma.conf.js" 50 | } 51 | }, 52 | "defaults": { 53 | "styleExt": "css", 54 | "prefixInterfaces": false, 55 | "inline": { 56 | "style": false, 57 | "template": false 58 | }, 59 | "spec": { 60 | "class": false, 61 | "component": true, 62 | "directive": true, 63 | "module": false, 64 | "pipe": true, 65 | "service": true 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /web/src/main/angular/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AngularPage } from './app.po'; 2 | 3 | describe('angular App', function() { 4 | let page: AngularPage; 5 | 6 | beforeEach(() => { 7 | page = new AngularPage(); 8 | }); 9 | 10 | it('should display message saying app works', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('app works!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /web/src/main/angular/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, element, by } from 'protractor'; 2 | 3 | export class AngularPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /web/src/main/angular/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "es2016" 9 | ], 10 | "module": "commonjs", 11 | "moduleResolution": "node", 12 | "outDir": "../dist/out-tsc-e2e", 13 | "sourceMap": true, 14 | "target": "es6", 15 | "typeRoots": [ 16 | "../node_modules/@types" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /web/src/main/angular/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/0.13/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-coverage-istanbul-reporter'), 12 | require('@angular/cli/plugins/karma') 13 | ], 14 | files: [ 15 | { pattern: './src/test.ts', watched: false } 16 | ], 17 | preprocessors: { 18 | './src/test.ts': ['@angular/cli'] 19 | }, 20 | mime: { 21 | 'text/x-typescript': ['ts','tsx'] 22 | }, 23 | coverageIstanbulReporter: { 24 | reports: [ 'html', 'lcovonly' ], 25 | fixWebpackSourcePaths: true 26 | }, 27 | angularCli: { 28 | config: './angular-cli.json', 29 | environment: 'dev' 30 | }, 31 | reporters: config.angularCli && config.angularCli.codeCoverage 32 | ? ['progress', 'coverage-istanbul'] 33 | : ['progress'], 34 | port: 9876, 35 | colors: true, 36 | logLevel: config.LOG_INFO, 37 | autoWatch: true, 38 | browsers: ['Chrome'], 39 | singleRun: false 40 | }); 41 | }; 42 | -------------------------------------------------------------------------------- /web/src/main/angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "angular-cli": {}, 6 | "scripts": { 7 | "ng": "ng", 8 | "start": "ng serve", 9 | "test": "ng test", 10 | "lint": "ng lint", 11 | "e2e": "ng e2e", 12 | "develop": "ng build -op ../webapp/dist -bh /dist/ -w", 13 | "release": "ng build -op ../webapp/dist -bh /dist/ -prod -aot --env=prod" 14 | }, 15 | "private": true, 16 | "dependencies": { 17 | "@angular/common": "^2.4.0", 18 | "@angular/compiler": "^2.4.0", 19 | "@angular/core": "^2.4.0", 20 | "@angular/flex-layout": "^2.0.0-beta.5", 21 | "@angular/forms": "^2.4.0", 22 | "@angular/http": "^2.4.0", 23 | "@angular/material": "^2.0.0-beta.2", 24 | "@angular/platform-browser": "^2.4.0", 25 | "@angular/platform-browser-dynamic": "^2.4.0", 26 | "@angular/router": "^3.4.0", 27 | "core-js": "^2.4.1", 28 | "hammerjs": "^2.0.8", 29 | "ng2-file-upload": "^1.2.0", 30 | "rxjs": "^5.0.1", 31 | "ts-helpers": "^1.1.1", 32 | "zone.js": "^0.7.2" 33 | }, 34 | "devDependencies": { 35 | "@angular/cli": "1.0.0-beta.31", 36 | "@angular/compiler-cli": "^2.4.0", 37 | "@types/hammerjs": "^2.0.34", 38 | "@types/jasmine": "2.5.38", 39 | "@types/node": "^6.0.42", 40 | "codelyzer": "~2.0.0-beta.1", 41 | "jasmine-core": "2.5.2", 42 | "jasmine-spec-reporter": "2.5.0", 43 | "karma": "1.2.0", 44 | "karma-chrome-launcher": "^2.0.0", 45 | "karma-cli": "^1.0.1", 46 | "karma-coverage-istanbul-reporter": "^0.2.0", 47 | "karma-jasmine": "^1.0.2", 48 | "protractor": "~5.1.0", 49 | "ts-node": "1.2.1", 50 | "tslint": "^4.3.0", 51 | "typescript": "~2.0.0" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /web/src/main/angular/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | /*global jasmine */ 5 | var SpecReporter = require('jasmine-spec-reporter'); 6 | 7 | exports.config = { 8 | allScriptsTimeout: 11000, 9 | specs: [ 10 | './e2e/**/*.e2e-spec.ts' 11 | ], 12 | capabilities: { 13 | 'browserName': 'chrome' 14 | }, 15 | directConnect: true, 16 | baseUrl: 'http://localhost:4200/', 17 | framework: 'jasmine', 18 | jasmineNodeOpts: { 19 | showColors: true, 20 | defaultTimeoutInterval: 30000, 21 | print: function() {} 22 | }, 23 | useAllAngular2AppRoots: true, 24 | beforeLaunch: function() { 25 | require('ts-node').register({ 26 | project: 'e2e' 27 | }); 28 | }, 29 | onPrepare: function() { 30 | jasmine.getEnv().addReporter(new SpecReporter()); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from "@angular/core"; 2 | import {Routes, RouterModule} from "@angular/router"; 3 | import {UserListComponent} from "./user/user-list/user-list.component"; 4 | import {UserDetailComponent} from "./user/user-detail/user-detail.component"; 5 | import {RxjsComponent} from "./rxjs/rxjs.component"; 6 | import {UserEditComponent} from "./user/user-edit/user-edit.component"; 7 | import {environment} from "../environments/environment"; 8 | 9 | const routes: Routes = [ 10 | { 11 | path: 'user/list', 12 | component:UserListComponent, 13 | children: [] 14 | }, 15 | { 16 | path:'user/add', 17 | component:UserEditComponent, 18 | }, 19 | { 20 | path:'user/edit/:id', 21 | component:UserEditComponent, 22 | }, 23 | { 24 | path:'user/:id', 25 | component:UserDetailComponent, 26 | }, 27 | { 28 | path:'rxjs', 29 | component:RxjsComponent 30 | }, 31 | { 32 | path:'home', 33 | loadChildren:'app/home/home.module#HomeModule' 34 | } 35 | 36 | ]; 37 | 38 | @NgModule({ 39 | imports: [RouterModule.forRoot(routes,{ useHash: environment.useHash })], 40 | exports: [RouterModule], 41 | providers: [] 42 | }) 43 | export class AppRoutingModule { } 44 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/app/app.component.css -------------------------------------------------------------------------------- /web/src/main/angular/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |

2 | {{title}} 3 |

4 | 用户列表 5 | 添加用户 6 | 7 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async } from '@angular/core/testing'; 4 | import { RouterTestingModule } from '@angular/router/testing'; 5 | import { AppComponent } from './app.component'; 6 | 7 | describe('AppComponent', () => { 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({ 10 | imports: [ 11 | RouterTestingModule 12 | ], 13 | declarations: [ 14 | AppComponent 15 | ], 16 | }); 17 | TestBed.compileComponents(); 18 | }); 19 | 20 | it('should create the app', async(() => { 21 | const fixture = TestBed.createComponent(AppComponent); 22 | const app = fixture.debugElement.componentInstance; 23 | expect(app).toBeTruthy(); 24 | })); 25 | 26 | it(`should have as title 'app works!'`, async(() => { 27 | const fixture = TestBed.createComponent(AppComponent); 28 | const app = fixture.debugElement.componentInstance; 29 | expect(app.title).toEqual('app works!'); 30 | })); 31 | 32 | it('should render title in a h1 tag', async(() => { 33 | const fixture = TestBed.createComponent(AppComponent); 34 | fixture.detectChanges(); 35 | const compiled = fixture.debugElement.nativeElement; 36 | expect(compiled.querySelector('h1').textContent).toContain('app works!'); 37 | })); 38 | }); 39 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'hello spring!!!!'; 10 | } 11 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import {BrowserModule} from '@angular/platform-browser'; 2 | import {NgModule} from '@angular/core'; 3 | import {FormsModule, ReactiveFormsModule} from '@angular/forms'; 4 | import {HttpModule} from '@angular/http'; 5 | import {AppRoutingModule} from './app-routing.module'; 6 | 7 | import {AppComponent} from './app.component'; 8 | import {UserListComponent} from './user/user-list/user-list.component'; 9 | import {UserDetailComponent} from './user/user-detail/user-detail.component'; 10 | import {UserService} from "./user/user.service"; 11 | import {ApiService} from "./common/api.service"; 12 | import {RxjsComponent} from './rxjs/rxjs.component'; 13 | import {UserEditComponent} from './user/user-edit/user-edit.component'; 14 | import {NumberBetweenValidatorDirective} from './common/validator/number-between-validator.directive'; 15 | import {MaterialModule} from "@angular/material"; 16 | import {FlexLayoutModule} from "@angular/flex-layout"; 17 | import {FileUploadModule} from "ng2-file-upload"; 18 | import {LogService} from "./common/log.service"; 19 | 20 | 21 | @NgModule({ 22 | declarations: [ 23 | AppComponent, 24 | UserListComponent, 25 | UserDetailComponent, 26 | RxjsComponent, 27 | UserEditComponent, 28 | NumberBetweenValidatorDirective, 29 | ], 30 | imports: [ 31 | BrowserModule, 32 | FormsModule, 33 | HttpModule, 34 | ReactiveFormsModule, 35 | AppRoutingModule, 36 | MaterialModule, 37 | FlexLayoutModule, 38 | FileUploadModule, 39 | ], 40 | providers: [LogService, ApiService, UserService], 41 | bootstrap: [AppComponent] 42 | }) 43 | export class AppModule { 44 | } 45 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/common/api.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async, inject } from '@angular/core/testing'; 4 | import { ApiService } from './api.service'; 5 | 6 | describe('ApiService', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | providers: [ApiService] 10 | }); 11 | }); 12 | 13 | it('should ...', inject([ApiService], (service: ApiService) => { 14 | expect(service).toBeTruthy(); 15 | })); 16 | }); 17 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/common/api.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {Observable} from "rxjs"; 3 | import {Headers, RequestOptions, Http, Response, Request, RequestMethod} from "@angular/http"; 4 | import {Result} from "./result"; 5 | import {User} from "../user/user"; 6 | import {LogService} from "./log.service"; 7 | 8 | @Injectable() 9 | export class ApiService { 10 | 11 | constructor(private _http:Http,private log:LogService) { } 12 | 13 | /** 14 | * get方法 15 | * @param url 16 | */ 17 | get(url:string):Observable> { 18 | let options=new RequestOptions({method:RequestMethod.Get}); 19 | return this.sendRequest(url,options); 20 | } 21 | 22 | /** 23 | * post 24 | * @param url 25 | * @param body 如果不是RESTFul新增,body可为空 26 | * @returns {Observable} 27 | */ 28 | post(url:string,body:any):Observable> { 29 | let options:RequestOptions; 30 | if(body!=null) { 31 | let postBody=JSON.stringify(body); 32 | let headers=new Headers({'Content-type':'application/json'}); 33 | options=new RequestOptions({headers:headers,body:postBody,method:RequestMethod.Post}); 34 | }else{ 35 | let headers=new Headers({'Content-type':'application/x-www-form-urlencoded'}); 36 | options=new RequestOptions({headers:headers,method:RequestMethod.Post}); 37 | } 38 | return this.sendRequest(url,options); 39 | } 40 | 41 | delete(url:string):Observable> { 42 | let options=new RequestOptions({method:RequestMethod.Delete}); 43 | return this.sendRequest(url,options); 44 | } 45 | 46 | put(url:string,body:any) { 47 | let postBody=JSON.stringify(body); 48 | let headers=new Headers({'Content-type':'application/json'}); 49 | let options=new RequestOptions({headers:headers,body:postBody,method:RequestMethod.Put}); 50 | return this.sendRequest(url,options); 51 | } 52 | 53 | private sendRequest(url:string,options:RequestOptions):Observable>{ 54 | return this._http.request(url,options).map(this.extractData.bind(this)).catch(this.handleError.bind(this)); 55 | } 56 | 57 | private extractData(res:Response):Result { 58 | let body = res.json(); 59 | this.log.debug(JSON.stringify(body)); 60 | return body as Result || null; 61 | } 62 | 63 | private handleError(error:any) { 64 | this.log.error(JSON.stringify(error)); 65 | return Observable.throw(error.message); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/common/log.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async, inject } from '@angular/core/testing'; 4 | import { LogService } from './log.service'; 5 | 6 | describe('LogService', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | providers: [LogService] 10 | }); 11 | }); 12 | 13 | it('should ...', inject([LogService], (service: LogService) => { 14 | expect(service).toBeTruthy(); 15 | })); 16 | }); 17 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/common/log.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {environment} from "../../environments/environment"; 3 | 4 | @Injectable() 5 | export class LogService { 6 | 7 | constructor() { } 8 | 9 | debug(msg:string){ 10 | if(!environment.production) { 11 | console.log(msg); 12 | } 13 | } 14 | error(msg:string) { 15 | if(!environment.production) { 16 | console.error(msg); 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/common/result.ts: -------------------------------------------------------------------------------- 1 | export class Result { 2 | data:T; 3 | msg:string; 4 | code:number; 5 | } 6 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/common/validator/number-between-validator.directive.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async } from '@angular/core/testing'; 4 | import { NumberBetweenValidatorDirective } from './number-between-validator.directive'; 5 | 6 | describe('NumberBetweenValidatorDirective', () => { 7 | it('should create an instance', () => { 8 | const directive = new NumberBetweenValidatorDirective(); 9 | expect(directive).toBeTruthy(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/common/validator/number-between-validator.directive.ts: -------------------------------------------------------------------------------- 1 | import {Directive, Input, SimpleChanges, OnChanges} from '@angular/core'; 2 | import {AbstractControl, ValidatorFn, NG_VALIDATORS, Validator} from "@angular/forms"; 3 | /** 4 | * 校验数字是否在指定范围内 5 | * 使用方法: 6 | * input标签添加numberBetween="1,100" 7 | * 上限或下限可留空,如numberBetween="1,"表示限制必须大于等于1 8 | * 条件不符合,错误类型为 numberBetween 9 | */ 10 | @Directive({ 11 | selector: '[numberBetween]', 12 | providers: [{provide: NG_VALIDATORS, useExisting: NumberBetweenValidatorDirective, multi: true}] 13 | }) 14 | export class NumberBetweenValidatorDirective implements Validator,OnChanges{ 15 | 16 | @Input('numberBetween') numberBetween:number; 17 | min:number; 18 | max:number; 19 | validate(c: AbstractControl): {[p: string]: any} { 20 | return between(c,this.min,this.max); 21 | } 22 | 23 | ngOnChanges(changes: SimpleChanges): void { 24 | let numbers=changes['numberBetween'].currentValue.split(','); 25 | if(numbers[0]!=''&&!isNaN(numbers[0])) { 26 | this.min=parseInt(numbers[0]); 27 | }else{ 28 | this.min=null; 29 | } 30 | if(numbers[1]!=''&&!isNaN(numbers[1])) { 31 | this.max=parseInt(numbers[1]); 32 | }else{ 33 | this.max=null; 34 | } 35 | } 36 | constructor() { } 37 | } 38 | 39 | /** 40 | * 响应式表单使用 41 | * @param min 42 | * @param max 43 | * @returns {(currentControl:AbstractControl)=>{[p: string]: any}} 44 | */ 45 | export function numberBetween(min:number,max:number):ValidatorFn { 46 | return (currentControl: AbstractControl): {[key: string]: any} => { 47 | return between(currentControl,min,max); 48 | }; 49 | } 50 | /** 51 | * 数字是否在指定范围 52 | * @param currentControl 53 | * @param min 54 | * @param max 55 | */ 56 | function between(currentControl: AbstractControl,min:number,max:number) { 57 | if(currentControl.value==''||isNaN(currentControl.value)) { 58 | return {numberBetween:{'errMsg':'数字输入不合法'}} 59 | } 60 | let integerValue=parseInt(currentControl.value); 61 | if((!currentControl.untouched||currentControl.dirty)) { 62 | if((min!=null&&integerValuemax)) { 63 | return {numberBetween:{'errMsg':'数字输入不合法'}} 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/home/home-routing.module.ts: -------------------------------------------------------------------------------- 1 | import {Routes, RouterModule} from "@angular/router"; 2 | import {HomeComponent} from "./home/home.component"; 3 | import {NgModule} from "@angular/core"; 4 | 5 | const routes: Routes=[ 6 | { 7 | path:'', 8 | component:HomeComponent 9 | } 10 | ] 11 | 12 | @NgModule({ 13 | imports:[RouterModule.forChild(routes)], 14 | exports:[RouterModule], 15 | providers:[] 16 | 17 | }) 18 | export class HomeRoutingModule{} 19 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { HomeComponent } from './home/home.component'; 4 | import {HomeRoutingModule} from "./home-routing.module"; 5 | 6 | @NgModule({ 7 | imports: [ 8 | CommonModule, 9 | HomeRoutingModule 10 | ], 11 | declarations: [HomeComponent] 12 | }) 13 | export class HomeModule { } 14 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/home/home/home.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/app/home/home/home.component.css -------------------------------------------------------------------------------- /web/src/main/angular/src/app/home/home/home.component.html: -------------------------------------------------------------------------------- 1 |

2 | home works! 3 |

4 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/home/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { HomeComponent } from './home.component'; 7 | 8 | describe('HomeComponent', () => { 9 | let component: HomeComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ HomeComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(HomeComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/home/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | templateUrl: './home.component.html', 6 | styleUrls: ['./home.component.css'] 7 | }) 8 | export class HomeComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/rxjs/rxjs.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/app/rxjs/rxjs.component.css -------------------------------------------------------------------------------- /web/src/main/angular/src/app/rxjs/rxjs.component.html: -------------------------------------------------------------------------------- 1 |

2 | rxjs works! 3 | 4 |

5 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/rxjs/rxjs.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { RxjsComponent } from './rxjs.component'; 7 | 8 | describe('RxjsComponent', () => { 9 | let component: RxjsComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ RxjsComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(RxjsComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/rxjs/rxjs.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit, AfterViewInit} from '@angular/core'; 2 | import {Observable} from "rxjs"; 3 | import 'rxjs/add/operator/map'; 4 | 5 | @Component({ 6 | selector: 'app-rxjs', 7 | templateUrl: './rxjs.component.html', 8 | styleUrls: ['./rxjs.component.css'] 9 | }) 10 | export class RxjsComponent implements OnInit,AfterViewInit { 11 | ngAfterViewInit(): void { 12 | 13 | // const input=document.querySelector('input'); 14 | // 15 | // Observable.fromEvent(input,'input') 16 | // .map(e => e.target.value ) 17 | 18 | } 19 | 20 | constructor() { } 21 | 22 | ngOnInit() { 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-detail/user-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/app/user/user-detail/user-detail.component.css -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-detail/user-detail.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | {{user.userName}} 6 | 年龄:{{user.userAge}} 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-detail/user-detail.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { UserDetailComponent } from './user-detail.component'; 7 | 8 | describe('UserDetailComponent', () => { 9 | let component: UserDetailComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ UserDetailComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(UserDetailComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-detail/user-detail.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit, AfterViewInit} from "@angular/core"; 2 | import {UserService} from "../user.service"; 3 | import {ActivatedRoute, Params, Router} from "@angular/router"; 4 | import {User} from "../user"; 5 | 6 | @Component({ 7 | selector: 'app-user-detail', 8 | templateUrl: './user-detail.component.html', 9 | styleUrls: ['./user-detail.component.css'] 10 | }) 11 | export class UserDetailComponent implements OnInit,AfterViewInit { 12 | 13 | user:User; 14 | constructor(private userService:UserService, private route: ActivatedRoute,private router:Router) { } 15 | 16 | ngOnInit() { 17 | 18 | } 19 | 20 | 21 | ngAfterViewInit(): void { 22 | this.route.params.switchMap((params:Params)=> this.userService.getUser(params['id'])) 23 | .subscribe(result=>this.user=result.data); 24 | } 25 | 26 | edit() { 27 | this.router.navigate(['user','edit',this.user.id]); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-edit/user-edit.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/app/user/user-edit/user-edit.component.css -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-edit/user-edit.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | {{ formErrors['userName'] }} 5 | 6 |
7 | 8 | {{ formErrors['userAge'] }} 9 |
10 |
11 | 12 | 13 | 14 | 15 |
16 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-edit/user-edit.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { UserEditComponent } from './user-edit.component'; 7 | 8 | describe('UserEditComponent', () => { 9 | let component: UserEditComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ UserEditComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(UserEditComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-edit/user-edit.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit, AfterViewInit, ViewChild, ElementRef} from "@angular/core"; 2 | import {ActivatedRoute, Router, Params} from "@angular/router"; 3 | import {UserService} from "../user.service"; 4 | import {FormBuilder, NgForm} from "@angular/forms"; 5 | import {User} from "../user"; 6 | import {Result} from "../../common/result"; 7 | import {isUndefined} from "util"; 8 | import {FileUploader, FileItem, ParsedResponseHeaders} from "ng2-file-upload"; 9 | 10 | const URL = "/upload"; 11 | @Component({ 12 | selector: 'app-user-edit', 13 | templateUrl: './user-edit.component.html', 14 | styleUrls: ['./user-edit.component.css'] 15 | }) 16 | export class UserEditComponent implements OnInit,AfterViewInit { 17 | 18 | //找到表单 19 | @ViewChild('userForm') userForm: NgForm; 20 | @ViewChild('uploadInput') uploadInput:ElementRef; 21 | public uploader: FileUploader = new FileUploader({url: URL, itemAlias: 'file', method: "POST",allowedMimeType:["image/png","image/jpeg"]}); 22 | 23 | constructor(private route: ActivatedRoute, private userService: UserService, private fb: FormBuilder, private router: Router) { 24 | } 25 | 26 | user: User; 27 | ngOnInit() { 28 | this.user = new User(); 29 | this.uploader.onSuccessItem = this.onSuccessItem.bind(this); 30 | this.uploader.onErrorItem = this.onErrorItem.bind(this); 31 | this.uploader.onWhenAddingFileFailed=this.onWhenAddingFileFailed.bind(this); 32 | } 33 | 34 | ngAfterViewInit(): void { 35 | this.userForm.valueChanges.subscribe(data => this.onValueChanged(data)); 36 | 37 | this.route.params.filter((params: Params) => !isUndefined(params['id'])).switchMap((params: Params) => this.userService.getUser(params['id'])) 38 | .subscribe((result: Result) => this.bindData(result.data)); 39 | } 40 | 41 | //添加用户 42 | addUser() { 43 | this.userService.addUser(this.user).subscribe(result => this.router.navigate(['/user', 'list'])); 44 | } 45 | 46 | //保存用户 47 | editUser() { 48 | this.userService.editUser(this.user).subscribe(result => this.router.navigate(['/user', 'list'])); 49 | } 50 | 51 | bindData(user: User) { 52 | this.user = user; 53 | } 54 | 55 | onValueChanged(data) { 56 | for (const field in this.formErrors) { 57 | this.formErrors[field] = ''; 58 | //取到表单字段 59 | const control = this.userForm.form.get(field); 60 | //表单字段已修改或无效 61 | if (control && control.dirty && !control.valid) { 62 | //取出对应字段可能的错误信息 63 | const messages = this.validationMessages[field]; 64 | //从errors里取出错误类型,再拼上该错误对应的信息 65 | for (const key in control.errors) { 66 | this.formErrors[field] += messages[key] + ''; 67 | } 68 | } 69 | 70 | } 71 | } 72 | 73 | //存储错误信息 74 | formErrors = { 75 | 'userName': '', 76 | 'userAge': '', 77 | }; 78 | //错误对应的提示 79 | validationMessages = { 80 | 'userName': { 81 | 'required': '用户名必填.', 82 | 'minlength': '用户名太短', 83 | }, 84 | 'userAge': { 85 | 'required': '请输入年龄', 86 | 'numberBetween': '年龄范围不正确', 87 | }, 88 | 'passwordGroup.password2': { 89 | 'required': '请重复输入密码', 90 | 'minlength': '密码太短', 91 | 'passwordNEQ': '两次输入密码不同', 92 | 'password1InValid': '' 93 | }, 94 | 'sex': { 95 | 'required': '性别必填' 96 | } 97 | 98 | }; 99 | 100 | 101 | public hasBaseDropZoneOver: boolean = false; 102 | public hasAnotherDropZoneOver: boolean = false; 103 | 104 | public fileOverBase(e: any): void { 105 | this.hasBaseDropZoneOver = e; 106 | } 107 | 108 | public fileOverAnother(e: any): void { 109 | this.hasAnotherDropZoneOver = e; 110 | } 111 | 112 | upload() { 113 | 114 | this.uploader.queue.forEach((fileItem: FileItem) => fileItem.alias = "file"); 115 | this.uploader.uploadAll(); 116 | } 117 | 118 | onSuccessItem(item: FileItem, response: string, status: number, headers: ParsedResponseHeaders): any { 119 | let result=JSON.parse(response) as Result; 120 | this.user.avatar=result.data; 121 | } 122 | 123 | onErrorItem(item: FileItem, response: string, status: number, headers: ParsedResponseHeaders): any { 124 | let result=JSON.parse(response) as Result; 125 | alert(result.msg); 126 | } 127 | onWhenAddingFileFailed(item: Object, filter: any, options: any): any { 128 | alert(item['name']+"无法上传,请重新选择"); 129 | this.uploadInput.nativeElement.value="" 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-list/user-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/app/user/user-list/user-list.component.css -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-list/user-list.component.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-list/user-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { UserListComponent } from './user-list.component'; 7 | 8 | describe('UserListComponent', () => { 9 | let component: UserListComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ UserListComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(UserListComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user-list/user-list.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit, AfterViewInit} from '@angular/core'; 2 | import {UserService} from "../user.service"; 3 | import {User} from "../user"; 4 | import {Router} from "@angular/router"; 5 | 6 | @Component({ 7 | selector: 'app-user-list', 8 | templateUrl: './user-list.component.html', 9 | styleUrls: ['./user-list.component.css'], 10 | providers:[UserService] 11 | }) 12 | export class UserListComponent implements OnInit,AfterViewInit { 13 | userList:User[]; 14 | ngAfterViewInit(): void { 15 | this.userService.getUserList().subscribe(result=> 16 | (result.code==0?this.loadData(result.data):this.showError(result.msg))); 17 | } 18 | 19 | constructor(private userService:UserService) { } 20 | 21 | ngOnInit() { 22 | this.userList=[]; 23 | } 24 | 25 | loadData(data:User[]) { 26 | data.forEach(user=>this.userList.push(user)); 27 | } 28 | 29 | _trackByFn(index:number,user:User) { 30 | return user.id; 31 | } 32 | 33 | delete(id:string) { 34 | this.userService.deleteUser(id).subscribe(result=>(location.reload())); 35 | } 36 | showError(msg:string) { 37 | alert(msg); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async, inject } from '@angular/core/testing'; 4 | import { UserService } from './user.service'; 5 | 6 | describe('UserService', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | providers: [UserService] 10 | }); 11 | }); 12 | 13 | it('should ...', inject([UserService], (service: UserService) => { 14 | expect(service).toBeTruthy(); 15 | })); 16 | }); 17 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {ApiService} from "../common/api.service"; 3 | import {Observable} from "rxjs"; 4 | import {User} from "./user"; 5 | import {Result} from "../common/result"; 6 | 7 | @Injectable() 8 | export class UserService { 9 | 10 | constructor(private apiService:ApiService) { } 11 | 12 | /** 13 | * 获取用户列表 14 | * @returns {Observable} 15 | */ 16 | getUserList():Observable> { 17 | return this.apiService.get('/user/list'); 18 | } 19 | 20 | getUser(id:string):Observable> { 21 | return this.apiService.get('/user/'+id); 22 | } 23 | 24 | addUser(user:User):Observable> { 25 | return this.apiService.post('/user',user); 26 | } 27 | 28 | deleteUser(id:string):Observable> { 29 | return this.apiService.delete('/user/'+id); 30 | } 31 | 32 | editUser(user:User):Observable> { 33 | return this.apiService.put('/user/'+user.id,user); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /web/src/main/angular/src/app/user/user.ts: -------------------------------------------------------------------------------- 1 | export class User { 2 | userName:string; 3 | userAge:number; 4 | id:number; 5 | avatar:string; 6 | gmtCreate:string; 7 | gmtModified:string; 8 | } 9 | -------------------------------------------------------------------------------- /web/src/main/angular/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/assets/.gitkeep -------------------------------------------------------------------------------- /web/src/main/angular/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | //正式上线不使用#分割url 4 | useHash:false 5 | }; 6 | -------------------------------------------------------------------------------- /web/src/main/angular/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false, 8 | useHash:true 9 | }; 10 | -------------------------------------------------------------------------------- /web/src/main/angular/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pocketdigi/SpringMVCWithAngular2/0e9d0b03abe67891c3500cc66fa5b9612de9deaf/web/src/main/angular/src/favicon.ico -------------------------------------------------------------------------------- /web/src/main/angular/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular 6 | 7 | 8 | 9 | 10 | 11 | 12 | Loading... 13 | 14 | 15 | -------------------------------------------------------------------------------- /web/src/main/angular/src/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | import { enableProdMode } from '@angular/core'; 3 | import { environment } from './environments/environment'; 4 | import { AppModule } from './app/app.module'; 5 | 6 | if (environment.production) { 7 | enableProdMode(); 8 | } 9 | 10 | platformBrowserDynamic().bootstrapModule(AppModule); 11 | -------------------------------------------------------------------------------- /web/src/main/angular/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/set'; 35 | 36 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 37 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 38 | 39 | /** IE10 and IE11 requires the following to support `@angular/animation`. */ 40 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 41 | 42 | 43 | /** Evergreen browsers require these. **/ 44 | import 'core-js/es6/reflect'; 45 | import 'core-js/es7/reflect'; 46 | 47 | 48 | /** ALL Firefox browsers require the following to support `@angular/animation`. **/ 49 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 50 | 51 | 52 | 53 | /*************************************************************************************************** 54 | * Zone JS is required by Angular itself. 55 | */ 56 | import 'zone.js/dist/zone'; // Included with Angular-CLI. 57 | 58 | 59 | 60 | /*************************************************************************************************** 61 | * APPLICATION IMPORTS 62 | */ 63 | 64 | /** 65 | * Date, currency, decimal and percent pipes. 66 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 67 | */ 68 | // import 'intl'; // Run `npm install --save intl`. 69 | -------------------------------------------------------------------------------- /web/src/main/angular/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import '~@angular/material/core/theming/prebuilt/deeppurple-amber.css'; 3 | 4 | body { 5 | background-color: #fafafa; 6 | } 7 | -------------------------------------------------------------------------------- /web/src/main/angular/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare var __karma__: any; 17 | declare var require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /web/src/main/angular/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "", 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "es2016", 9 | "dom" 10 | ], 11 | "mapRoot": "./", 12 | "module": "es2015", 13 | "moduleResolution": "node", 14 | "outDir": "../dist/out-tsc", 15 | "sourceMap": true, 16 | "target": "es5", 17 | "typeRoots": [ 18 | "../node_modules/@types" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /web/src/main/angular/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "callable-types": true, 7 | "class-name": true, 8 | "comment-format": [ 9 | true, 10 | "check-space" 11 | ], 12 | "curly": true, 13 | "eofline": true, 14 | "forin": true, 15 | "import-blacklist": [true, "rxjs"], 16 | "import-spacing": true, 17 | "indent": [ 18 | true, 19 | "spaces" 20 | ], 21 | "interface-over-type-literal": true, 22 | "label-position": true, 23 | "max-line-length": [ 24 | true, 25 | 140 26 | ], 27 | "member-access": false, 28 | "member-ordering": [ 29 | true, 30 | "static-before-instance", 31 | "variables-before-functions" 32 | ], 33 | "no-arg": true, 34 | "no-bitwise": true, 35 | "no-console": [ 36 | true, 37 | "debug", 38 | "info", 39 | "time", 40 | "timeEnd", 41 | "trace" 42 | ], 43 | "no-construct": true, 44 | "no-debugger": true, 45 | "no-duplicate-variable": true, 46 | "no-empty": false, 47 | "no-empty-interface": true, 48 | "no-eval": true, 49 | "no-inferrable-types": true, 50 | "no-shadowed-variable": true, 51 | "no-string-literal": false, 52 | "no-string-throw": true, 53 | "no-switch-case-fall-through": true, 54 | "no-trailing-whitespace": true, 55 | "no-unused-expression": true, 56 | "no-use-before-declare": true, 57 | "no-var-keyword": true, 58 | "object-literal-sort-keys": false, 59 | "one-line": [ 60 | true, 61 | "check-open-brace", 62 | "check-catch", 63 | "check-else", 64 | "check-whitespace" 65 | ], 66 | "prefer-const": true, 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "radix": true, 72 | "semicolon": [ 73 | "always" 74 | ], 75 | "triple-equals": [ 76 | true, 77 | "allow-null-check" 78 | ], 79 | "typedef-whitespace": [ 80 | true, 81 | { 82 | "call-signature": "nospace", 83 | "index-signature": "nospace", 84 | "parameter": "nospace", 85 | "property-declaration": "nospace", 86 | "variable-declaration": "nospace" 87 | } 88 | ], 89 | "typeof-compare": true, 90 | "unified-signatures": true, 91 | "variable-name": false, 92 | "whitespace": [ 93 | true, 94 | "check-branch", 95 | "check-decl", 96 | "check-operator", 97 | "check-separator", 98 | "check-type" 99 | ], 100 | 101 | "directive-selector": [true, "attribute", "app", "camelCase"], 102 | "component-selector": [true, "element", "app", "kebab-case"], 103 | "use-input-property-decorator": true, 104 | "use-output-property-decorator": true, 105 | "use-host-property-decorator": true, 106 | "no-input-rename": true, 107 | "no-output-rename": true, 108 | "use-life-cycle-interface": true, 109 | "use-pipe-transform-interface": true, 110 | "component-class-suffix": true, 111 | "directive-class-suffix": true, 112 | "no-access-missing-member": true, 113 | "templates-use-public": true, 114 | "invoke-injectable": true 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /web/src/main/java/com/pocketdigi/demo/controller/FileUploaderController.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.controller; 2 | 3 | import com.pocketdigi.demo.common.util.FileUtil; 4 | import com.pocketdigi.demo.dto.ResultDTO; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.http.HttpStatus; 8 | import org.springframework.http.ResponseEntity; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | import org.springframework.web.bind.annotation.ResponseBody; 14 | import org.springframework.web.multipart.commons.CommonsMultipartFile; 15 | 16 | import javax.servlet.http.HttpServletRequest; 17 | import java.io.File; 18 | import java.io.IOException; 19 | 20 | /** 21 | * Created by fhp on 2017/2/17. 22 | */ 23 | @Controller 24 | @Slf4j 25 | public class FileUploaderController { 26 | @Value("${upload.path}") 27 | private String uploadPath; 28 | @RequestMapping(value = "/upload",method = RequestMethod.POST) 29 | @ResponseBody 30 | public ResponseEntity index(@RequestParam("file") CommonsMultipartFile file, HttpServletRequest request) { 31 | String contentType = file.getContentType(); 32 | String ext = FileUtil.contentType2Ext(contentType); 33 | if(ext==null) { 34 | return new ResponseEntity(ResultDTO.wrapError(-1,"不允许上传的文件类型"+contentType), HttpStatus.FORBIDDEN); 35 | } 36 | String fileName = FileUtil.generateFileName(ext); 37 | String filePath=uploadPath+fileName; 38 | File newFile=new File(filePath); 39 | try { 40 | file.transferTo(newFile); 41 | String url = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+"/upload/"+fileName; 42 | return new ResponseEntity(ResultDTO.wrapSuccess(url), HttpStatus.OK); 43 | } catch (IOException e) { 44 | e.printStackTrace(); 45 | 46 | return new ResponseEntity(ResultDTO.wrapError(-1,"上传失败"), HttpStatus.FORBIDDEN); 47 | } 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /web/src/main/java/com/pocketdigi/demo/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.controller; 2 | 3 | import com.pocketdigi.demo.biz.user.UserBiz; 4 | import com.pocketdigi.demo.dto.ResultDTO; 5 | import com.pocketdigi.demo.user.dto.UserDTO; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.apache.commons.lang3.*; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.ui.Model; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.ResponseBody; 14 | 15 | /** 16 | * Created by fhp on 16/10/30. 17 | */ 18 | @Controller 19 | @Slf4j 20 | public class IndexController { 21 | @Autowired 22 | UserBiz userBiz; 23 | @RequestMapping(value = "/test",method = RequestMethod.GET) 24 | @ResponseBody 25 | public ResultDTO index(Model model) { 26 | 27 | log.error("common-lang3能否正常用{}", StringUtils.isBlank(" ")); 28 | model.addAttribute("describe","TEST"); 29 | UserDTO userDTO=new UserDTO(); 30 | userDTO.setUserName("23fas"); 31 | return ResultDTO.wrapSuccess(userDTO); 32 | } 33 | 34 | @RequestMapping(value = "") 35 | public String freemarker(Model model) { 36 | model.addAttribute("describe","adsfasfasdf"); 37 | return "index"; 38 | } 39 | @RequestMapping(value = "dubbo") 40 | @ResponseBody 41 | public ResultDTO dubboTest() { 42 | return ResultDTO.wrapSuccess(userBiz.listAllUseDubbo()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /web/src/main/java/com/pocketdigi/demo/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.controller; 2 | 3 | import com.pocketdigi.demo.biz.user.UserBiz; 4 | import com.pocketdigi.demo.biz.user.bo.UserBO; 5 | import com.pocketdigi.demo.common.converter.BeanConverter; 6 | import com.pocketdigi.demo.dto.ResultDTO; 7 | import com.pocketdigi.demo.user.dto.UserDTO; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * Created by fhp on 16/10/30. 17 | */ 18 | @Controller 19 | @Slf4j 20 | @RequestMapping(value = "user") 21 | public class UserController{ 22 | @Autowired 23 | private UserBiz userBiz; 24 | 25 | @RequestMapping(value = "",method = RequestMethod.POST) 26 | @ResponseBody 27 | public ResultDTO addUser(@RequestBody UserDTO user) { 28 | UserBO userBO = BeanConverter.convertObj(user,UserBO.class); 29 | 30 | userBiz.addUser(userBO); 31 | UserDTO userDTO=BeanConverter.convertObj(userBO,UserDTO.class); 32 | return ResultDTO.wrapSuccess(userDTO); 33 | } 34 | 35 | @RequestMapping(value = "list",method = RequestMethod.GET) 36 | @ResponseBody 37 | public ResultDTO> list() { 38 | List userBOs = userBiz.listAll(); 39 | return ResultDTO.wrapSuccess(BeanConverter.convertArrayList(userBOs,UserDTO.class)); 40 | } 41 | 42 | @RequestMapping(value = "{id}",method = RequestMethod.DELETE) 43 | @ResponseBody 44 | public ResultDTO delete(@PathVariable Integer id) { 45 | return ResultDTO.wrapSuccess(userBiz.deleteUser(id)); 46 | 47 | } 48 | 49 | @RequestMapping(value = "{id}",method = RequestMethod.GET) 50 | @ResponseBody 51 | public ResultDTO detail(@PathVariable Integer id) { 52 | UserBO user = userBiz.getUser(id); 53 | UserDTO userDTO=BeanConverter.convertObj(user,UserDTO.class); 54 | return ResultDTO.wrapSuccess(userDTO); 55 | } 56 | @RequestMapping(value = "{id}",method = RequestMethod.PUT) 57 | @ResponseBody 58 | public ResultDTO update(@PathVariable Integer id, @RequestBody UserDTO user) { 59 | UserBO user1 = userBiz.updateUser(BeanConverter.convertObj(user,UserBO.class)); 60 | UserDTO userDTO=BeanConverter.convertObj(user1,UserDTO.class); 61 | return ResultDTO.wrapSuccess(userDTO); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /web/src/main/java/com/pocketdigi/demo/exception/CommonExceptionResolver.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.exception; 2 | 3 | import com.google.gson.Gson; 4 | import com.pocketdigi.demo.dto.ResultDTO; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.web.servlet.HandlerExceptionResolver; 7 | import org.springframework.web.servlet.ModelAndView; 8 | 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | 14 | /** 15 | * Created by fhp on 2017/2/17. 16 | */ 17 | @Slf4j 18 | public class CommonExceptionResolver implements HandlerExceptionResolver{ 19 | public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse response, Object o, Exception e) { 20 | try { 21 | PrintWriter writer = response.getWriter(); 22 | response.setCharacterEncoding("UTF-8"); 23 | response.setContentType("application/json;charset=UTF-8"); 24 | response.setStatus(HttpServletResponse.SC_OK); 25 | ResultDTO result = ResultDTO.wrapError(-1, "未知错误"); 26 | Gson gson=new Gson(); 27 | writer.write(gson.toJson(result)); 28 | writer.flush(); 29 | } catch (IOException e1) { 30 | e1.printStackTrace(); 31 | log.error("error reponse write failure!", e); 32 | }finally { 33 | e.printStackTrace(); 34 | } 35 | return null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /web/src/main/java/com/pocketdigi/demo/interceptor/RequestInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.pocketdigi.demo.interceptor; 2 | 3 | /** 4 | * Created by fhp on 16/10/30. 5 | */ 6 | public class RequestInterceptor { 7 | } 8 | -------------------------------------------------------------------------------- /web/src/main/resources/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /web/src/main/resources/config/upload.properties: -------------------------------------------------------------------------------- 1 | upload.path = /Users/fhp/Documents/work/java/SpringMVCModuleDemo/web/src/main/webapp/upload/ 2 | upload.tmp.path=/tmp/ -------------------------------------------------------------------------------- /web/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logs 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /web/src/main/resources/spring/exception_resolver.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /web/src/main/resources/spring/freemarker.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 10 15 | zh_CN 16 | yyyy-MM-dd HH:mm:ss 17 | yyyy-MM-dd 18 | #.## 19 | 20 | 21 | 22 | 23 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /web/src/main/resources/spring/multipart_resolver.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /web/src/main/resources/spring/properties_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | classpath*:/config/*.properties 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web/src/main/webapp/WEB-INF/ftl/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 描述:${describe} 9 | 10 | -------------------------------------------------------------------------------- /web/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /web/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 5 | SpringMVC Demo 6 | 7 | 8 | org.springframework.web.context.ContextLoaderListener 9 | 10 | 11 | 12 | contextConfigLocation 13 | classpath:applicationContext.xml 14 | 15 | 16 | 17 | mvc-dispatcher 18 | org.springframework.web.servlet.DispatcherServlet 19 | 1 20 | 21 | 22 | 23 | 24 | 25 | default 26 | *.html 27 | 28 | 29 | default 30 | *.htm 31 | 32 | 33 | default 34 | *.json 35 | 36 | 37 | default 38 | *.png 39 | 40 | 41 | default 42 | *.jpg 43 | 44 | 45 | default 46 | *.gif 47 | 48 | 49 | default 50 | *.js 51 | 52 | 53 | default 54 | *.css 55 | 56 | 57 | 58 | 59 | mvc-dispatcher 60 | / 61 | 62 | 63 | encodingFilter 64 | org.springframework.web.filter.CharacterEncodingFilter 65 | 66 | encoding 67 | UTF-8 68 | 69 | 70 | forceEncoding 71 | true 72 | 73 | 74 | 75 | encodingFilter 76 | /* 77 | 78 | 79 | -------------------------------------------------------------------------------- /web/src/main/webapp/static/html/tt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 静态文件 6 | 7 | 8 | 静态文件 9 | 10 | -------------------------------------------------------------------------------- /web/src/main/webapp/static/html/user.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 用户管理 6 | 7 | 8 | 15 | 16 |
17 |
增加用户
18 |
19 |
20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
姓名年龄操作
34 | 35 | 36 | 37 | 38 | 92 | -------------------------------------------------------------------------------- /web/src/test/java/WebServer.java: -------------------------------------------------------------------------------- 1 | 2 | import org.eclipse.jetty.server.Server; 3 | import org.eclipse.jetty.webapp.WebAppContext; 4 | 5 | /** 6 | * Jetty服务器 7 | */ 8 | public class WebServer { 9 | public static void main(String[] args) { 10 | Server server = new Server(8080); 11 | WebAppContext context = new WebAppContext(); 12 | context.setContextPath("/"); 13 | context.setDescriptor("./web/src/main/webapp/WEB-INF/web.xml"); 14 | context.setResourceBase("./web/src/main/webapp"); 15 | //解决静态资源缓存后再ide里面不能修改问题 16 | context.setDefaultsDescriptor("./web/src/test/resources/webdefault.xml"); 17 | context.setParentLoaderPriority(true); 18 | server.setHandler(context); 19 | try { 20 | server.start(); 21 | server.join(); 22 | } catch (Exception e) { 23 | e.printStackTrace(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /web/src/test/resources/log4j2-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logs 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /web/src/test/resources/webdefault.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | Default web.xml file. 30 | This file is applied to a Web application before it's own WEB_INF/web.xml file 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | org.eclipse.jetty.servlet.listener.ELContextCleaner 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | org.eclipse.jetty.servlet.listener.IntrospectorCleaner 47 | 48 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 114 | 115 | 116 | 117 | 118 | default 119 | org.eclipse.jetty.servlet.DefaultServlet 120 | 121 | aliases 122 | false 123 | 124 | 125 | acceptRanges 126 | true 127 | 128 | 129 | dirAllowed 130 | true 131 | 132 | 133 | welcomeServlets 134 | false 135 | 136 | 137 | redirectWelcome 138 | false 139 | 140 | 141 | maxCacheSize 142 | 256000000 143 | 144 | 145 | maxCachedFileSize 146 | 200000000 147 | 148 | 149 | maxCachedFiles 150 | 2048 151 | 152 | 153 | gzip 154 | true 155 | 156 | 157 | useFileMappedBuffer 158 | false 159 | 160 | 166 | 172 | 0 173 | 174 | 175 | 176 | default 177 | / 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 269 | jsp 270 | org.apache.jasper.servlet.JspServlet 271 | 272 | logVerbosityLevel 273 | DEBUG 274 | 275 | 276 | fork 277 | false 278 | 279 | 280 | xpoweredBy 281 | false 282 | 283 | 289 | 0 290 | 291 | 292 | 293 | jsp 294 | *.jsp 295 | *.jspf 296 | *.jspx 297 | *.xsp 298 | *.JSP 299 | *.JSPF 300 | *.JSPX 301 | *.XSP 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 329 | 330 | 331 | 332 | 333 | 334 | 30 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 349 | 350 | 351 | 352 | index.html 353 | index.htm 354 | index.jsp 355 | 356 | 357 | 358 | 359 | 360 | ar 361 | ISO-8859-6 362 | 363 | 364 | be 365 | ISO-8859-5 366 | 367 | 368 | bg 369 | ISO-8859-5 370 | 371 | 372 | ca 373 | ISO-8859-1 374 | 375 | 376 | cs 377 | ISO-8859-2 378 | 379 | 380 | da 381 | ISO-8859-1 382 | 383 | 384 | de 385 | ISO-8859-1 386 | 387 | 388 | el 389 | ISO-8859-7 390 | 391 | 392 | en 393 | ISO-8859-1 394 | 395 | 396 | es 397 | ISO-8859-1 398 | 399 | 400 | et 401 | ISO-8859-1 402 | 403 | 404 | fi 405 | ISO-8859-1 406 | 407 | 408 | fr 409 | ISO-8859-1 410 | 411 | 412 | hr 413 | ISO-8859-2 414 | 415 | 416 | hu 417 | ISO-8859-2 418 | 419 | 420 | is 421 | ISO-8859-1 422 | 423 | 424 | it 425 | ISO-8859-1 426 | 427 | 428 | iw 429 | ISO-8859-8 430 | 431 | 432 | ja 433 | Shift_JIS 434 | 435 | 436 | ko 437 | EUC-KR 438 | 439 | 440 | lt 441 | ISO-8859-2 442 | 443 | 444 | lv 445 | ISO-8859-2 446 | 447 | 448 | mk 449 | ISO-8859-5 450 | 451 | 452 | nl 453 | ISO-8859-1 454 | 455 | 456 | no 457 | ISO-8859-1 458 | 459 | 460 | pl 461 | ISO-8859-2 462 | 463 | 464 | pt 465 | ISO-8859-1 466 | 467 | 468 | ro 469 | ISO-8859-2 470 | 471 | 472 | ru 473 | ISO-8859-5 474 | 475 | 476 | sh 477 | ISO-8859-5 478 | 479 | 480 | sk 481 | ISO-8859-2 482 | 483 | 484 | sl 485 | ISO-8859-2 486 | 487 | 488 | sq 489 | ISO-8859-2 490 | 491 | 492 | sr 493 | ISO-8859-5 494 | 495 | 496 | sv 497 | ISO-8859-1 498 | 499 | 500 | tr 501 | ISO-8859-9 502 | 503 | 504 | uk 505 | ISO-8859-5 506 | 507 | 508 | zh 509 | GB2312 510 | 511 | 512 | zh_TW 513 | Big5 514 | 515 | 516 | 517 | 518 | 519 | Disable TRACE 520 | / 521 | TRACE 522 | 523 | 524 | 525 | 526 | 527 | 528 | -------------------------------------------------------------------------------- /web/web.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | --------------------------------------------------------------------------------