├── .gitignore
├── config
└── application.yml
├── pom.xml
├── viboot-apilog
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── apilog
│ │ ├── ViBootApiLogApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── User.java
│ │ ├── mapper
│ │ ├── UserMapper.java
│ │ └── xml
│ │ │ └── UserMapper.xml
│ │ └── service
│ │ ├── UserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mapper
│ └── user
│ └── UserMapper.xml
├── viboot-common
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ ├── aop
│ │ └── ResponseAop.java
│ │ ├── exception
│ │ └── NullResponseException.java
│ │ ├── handler
│ │ ├── GlobalExceptionHandler.java
│ │ └── RequestExceptionHandler.java
│ │ └── util
│ │ ├── CORSFilter.java
│ │ ├── CommonUrl.java
│ │ ├── JSONUtil.java
│ │ ├── MailConstants.java
│ │ ├── ReadPropertiesUtil.java
│ │ ├── ReturnCode.java
│ │ ├── ReturnVO.java
│ │ └── Slf4JTest.java
│ └── resources
│ ├── banner.txt
│ └── response.properties
├── viboot-email
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── mail
│ │ ├── ViBootMailApplication.java
│ │ ├── controller
│ │ └── MailController.java
│ │ ├── entity
│ │ └── Mail.java
│ │ └── util
│ │ └── MailUtil.java
│ └── resources
│ ├── application.properties
│ └── templates
│ └── mailTemplate.html
├── viboot-es
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── es
│ │ ├── ViBootESApplication.java
│ │ ├── controller
│ │ └── ESController.java
│ │ ├── dao
│ │ └── ESDao.java
│ │ ├── entity
│ │ └── Article.java
│ │ └── service
│ │ ├── ESService.java
│ │ └── impl
│ │ └── ESServiceImpl.java
│ └── resources
│ └── application.yml
├── viboot-exception-annotation
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── exception
│ │ └── annotation
│ │ ├── ViBootExceptionAnnotationApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── dao
│ │ └── UserMapper.java
│ │ ├── entity
│ │ └── UserDO.java
│ │ ├── exception
│ │ ├── GlobalExceptionHandler.java
│ │ └── RequestExceptionHandler.java
│ │ └── service
│ │ ├── IUserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ └── application.yml
├── viboot-mybatis-grace
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── mybatis
│ │ ├── ViBootMybatisGraceApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── dao
│ │ ├── BaseDao.java
│ │ └── impl
│ │ │ └── BaseDaoImpl.java
│ │ ├── entity
│ │ └── UserDO.java
│ │ └── service
│ │ ├── IUserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mybatis
│ ├── mapper
│ └── UserMapper.xml
│ └── mybatis-config.xml
├── viboot-mybatis-plus
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── mybatis
│ │ ├── ViBootMybatisPlusApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── User.java
│ │ ├── mapper
│ │ ├── UserMapper.java
│ │ └── xml
│ │ │ └── UserMapper.xml
│ │ └── service
│ │ ├── UserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mapper
│ └── user
│ └── UserMapper.xml
├── viboot-mybatis-sqlsession
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── mybatis
│ │ ├── ViBootMybatisSqlSessionApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── UserDO.java
│ │ ├── mapper
│ │ └── UserMapper.java
│ │ └── service
│ │ ├── IUserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mybatis
│ ├── mapper
│ └── UserMapper.xml
│ └── mybatis-config.xml
├── viboot-mybatis-xml
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── mybatis
│ │ ├── ViBootMybatisXmlApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── UserDO.java
│ │ ├── mapper
│ │ └── UserMapper.java
│ │ └── service
│ │ ├── IUserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mybatis
│ ├── mapper
│ └── UserMapper.xml
│ └── mybatis-config.xml
├── viboot-mybatis
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── mybatis
│ │ ├── ViBootMybatisApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── UserDO.java
│ │ ├── mapper
│ │ └── UserMapper.java
│ │ └── service
│ │ ├── IUserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ └── application.yml
├── viboot-pagehelper
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── pagehelper
│ │ ├── VibootPagehelperApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── UserDO.java
│ │ ├── mapper
│ │ └── UserMapper.java
│ │ └── service
│ │ ├── IUserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ └── application.yml
├── viboot-rds
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── redis
│ │ ├── VibootRedisApplication.java
│ │ ├── base
│ │ ├── RedisDao.java
│ │ └── impl
│ │ │ ├── AbstractBaseRedisDao.java
│ │ │ └── RedisDaoImpl.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── UserDO.java
│ │ ├── mapper
│ │ └── UserMapper.java
│ │ └── service
│ │ ├── IUserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mybatis
│ ├── mapper
│ └── UserMapper.xml
│ └── mybatis-config.xml
├── viboot-restful
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── restful
│ │ ├── VibootRestfulApplication.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── User.java
│ │ ├── mapper
│ │ ├── UserMapper.java
│ │ └── xml
│ │ │ └── UserMapper.xml
│ │ └── service
│ │ ├── UserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mapper
│ └── user
│ └── UserMapper.xml
├── viboot-shiro
└── pom.xml
├── viboot-swagger2
├── .classpath
├── .factorypath
├── .project
├── .settings
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.jdt.apt.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── indi
│ │ └── viyoung
│ │ └── viboot
│ │ └── swagger2
│ │ ├── ViBootSwaggerApplication.java
│ │ ├── config
│ │ └── Swagger2Config.java
│ │ ├── controller
│ │ └── UserController.java
│ │ ├── entity
│ │ └── User.java
│ │ ├── mapper
│ │ ├── UserMapper.java
│ │ └── xml
│ │ │ └── UserMapper.xml
│ │ └── service
│ │ ├── UserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application.yml
│ └── mapper
│ └── user
│ └── UserMapper.xml
└── viboot-uploader
├── pom.xml
└── src
└── main
├── java
└── indi
│ └── viyoung
│ └── viboot
│ └── uploader
│ ├── ViBootUploaderApplication.java
│ ├── controller
│ └── UploadController.java
│ ├── service
│ ├── IUploadService.java
│ └── impl
│ │ └── UploadServiceImpl.java
│ └── vo
│ └── Chunk.java
└── resources
└── application.yml
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | *.iml
3 | logs/
4 | **/target
--------------------------------------------------------------------------------
/config/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | datasource:
3 | driver-class-name: com.mysql.cj.jdbc.Driver
4 | url: jdbc:mysql://localhost:3306/viboot?useUnicode=true&characterEncoding=utf-8
5 | username: root
6 | password: Passw0rd
7 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | indi.viyoung.course
8 | viboot
9 | pom
10 | 1.0-SNAPSHOT
11 |
12 |
13 | viboot-mybatis
14 | viboot-mybatis-grace
15 | viboot-mybatis-plus
16 | viboot-mybatis-sqlsession
17 | viboot-mybatis-xml
18 | viboot-exception-annotation
19 | viboot-common
20 | viboot-restful
21 | viboot-apilog
22 | viboot-swagger2
23 | viboot-pagehelper
24 | viboot-rds
25 | viboot-uploader
26 | viboot-es
27 | viboot-shiro
28 | viboot-email
29 |
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-starter-parent
34 | 2.1.1.RELEASE
35 |
36 |
37 |
38 |
39 | UTF-8
40 | UTF-8
41 | 1.8
42 |
43 |
44 |
45 |
46 |
47 | mysql
48 | mysql-connector-java
49 |
50 |
51 | org.springframework.boot
52 | spring-boot-starter-web
53 |
54 |
55 | org.projectlombok
56 | lombok
57 | true
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-starter-test
62 | test
63 |
64 |
65 |
66 |
67 |
68 | org.springframework.boot
69 | spring-boot-maven-plugin
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/viboot-apilog/.classpath:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/viboot-apilog/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | viboot-apilog
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/viboot-apilog/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding//src/main/resources=UTF-8
4 | encoding//src/test/java=UTF-8
5 | encoding/=UTF-8
6 |
--------------------------------------------------------------------------------
/viboot-apilog/.settings/org.eclipse.jdt.apt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.apt.aptEnabled=true
3 | org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
4 | org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations
5 |
--------------------------------------------------------------------------------
/viboot-apilog/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6 | org.eclipse.jdt.core.compiler.processAnnotations=enabled
7 | org.eclipse.jdt.core.compiler.release=disabled
8 | org.eclipse.jdt.core.compiler.source=1.8
9 |
--------------------------------------------------------------------------------
/viboot-apilog/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/viboot-apilog/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | viboot
7 | indi.viyoung.course
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | viboot-apilog
13 |
14 |
15 |
16 |
17 | com.baomidou
18 | mybatis-plus-boot-starter
19 | 3.0.6
20 |
21 |
22 |
23 |
24 | org.apache.velocity
25 | velocity
26 | 1.7
27 |
28 |
29 |
30 |
31 | org.freemarker
32 | freemarker
33 | 2.3.28
34 |
35 |
36 | org.springframework.boot
37 | spring-boot-starter-aop
38 |
39 |
40 | indi.viyoung.course
41 | viboot-common
42 | 1.0-SNAPSHOT
43 |
44 |
45 | eu.bitwalker
46 | UserAgentUtils
47 | 1.20
48 |
49 |
50 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/java/indi/viyoung/viboot/apilog/ViBootApiLogApplication.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.apilog;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.context.annotation.ComponentScan;
7 |
8 | /**
9 | * @author vi
10 | * @since 2019/2/19 7:43 PM
11 | */
12 | @SpringBootApplication
13 | @ComponentScan(value = "indi.viyoung.viboot.*")
14 | @MapperScan(value = "indi.viyoung.viboot.apilog.mapper")
15 | public class ViBootApiLogApplication {
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(ViBootApiLogApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/java/indi/viyoung/viboot/apilog/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.apilog.controller;
2 |
3 |
4 | import indi.viyoung.viboot.apilog.entity.User;
5 | import indi.viyoung.viboot.apilog.service.UserService;
6 | import io.swagger.annotations.Api;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.web.bind.annotation.GetMapping;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.RestController;
12 |
13 | import javax.annotation.Resource;
14 | import java.util.List;
15 |
16 | /**
17 | *
18 | * 前端控制器
19 | *
20 | *
21 | * @author viyoung
22 | * @since 2019-01-23
23 | */
24 | @RestController
25 | @RequestMapping("/users")
26 | @Api
27 | public class UserController {
28 |
29 | @Resource
30 | private UserService userService;
31 |
32 | @GetMapping
33 | public Object findAll() {
34 | return userService.list();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/java/indi/viyoung/viboot/apilog/entity/User.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.apilog.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableId;
5 | import java.io.Serializable;
6 | import lombok.Data;
7 | import lombok.EqualsAndHashCode;
8 | import lombok.experimental.Accessors;
9 |
10 | /**
11 | *
12 | *
13 | *
14 | *
15 | * @author viyoung
16 | * @since 2019-01-23
17 | */
18 | @Data
19 | @EqualsAndHashCode(callSuper = false)
20 | @Accessors(chain = true)
21 | public class User implements Serializable {
22 |
23 | private static final long serialVersionUID = 1L;
24 |
25 | @TableId(value = "id", type = IdType.AUTO)
26 | private Long id;
27 |
28 | private String password;
29 |
30 | private String userName;
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/java/indi/viyoung/viboot/apilog/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.apilog.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import indi.viyoung.viboot.apilog.entity.User;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author viyoung
12 | * @since 2019-01-23
13 | */
14 | public interface UserMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/java/indi/viyoung/viboot/apilog/mapper/xml/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/java/indi/viyoung/viboot/apilog/service/UserService.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.apilog.service;
2 |
3 | import indi.viyoung.viboot.apilog.entity.User;
4 | import com.baomidou.mybatisplus.extension.service.IService;
5 |
6 | /**
7 | *
8 | * 服务类
9 | *
10 | *
11 | * @author viyoung
12 | * @since 2019-01-23
13 | */
14 | public interface UserService extends IService {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/java/indi/viyoung/viboot/apilog/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.apilog.service.impl;
2 |
3 | import indi.viyoung.viboot.apilog.entity.User;
4 | import indi.viyoung.viboot.apilog.mapper.UserMapper;
5 | import indi.viyoung.viboot.apilog.service.UserService;
6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | *
11 | * 服务实现类
12 | *
13 | *
14 | * @author viyoung
15 | * @since 2019-01-23
16 | */
17 | @Service
18 | public class UserServiceImpl extends ServiceImpl implements UserService {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/viboot-apilog/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8090
3 |
4 | mybatis-plus:
5 | configuration:
6 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
--------------------------------------------------------------------------------
/viboot-apilog/src/main/resources/mapper/user/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/viboot-common/.classpath:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/viboot-common/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | viboot-common
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/viboot-common/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding//src/main/resources=UTF-8
4 | encoding//src/test/java=UTF-8
5 | encoding/=UTF-8
6 |
--------------------------------------------------------------------------------
/viboot-common/.settings/org.eclipse.jdt.apt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.apt.aptEnabled=true
3 | org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
4 | org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations
5 |
--------------------------------------------------------------------------------
/viboot-common/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6 | org.eclipse.jdt.core.compiler.processAnnotations=enabled
7 | org.eclipse.jdt.core.compiler.release=disabled
8 | org.eclipse.jdt.core.compiler.source=1.8
9 |
--------------------------------------------------------------------------------
/viboot-common/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/viboot-common/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | viboot
7 | indi.viyoung.course
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | viboot-common
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-aop
17 |
18 |
19 | eu.bitwalker
20 | UserAgentUtils
21 | RELEASE
22 | compile
23 |
24 |
25 | com.google.code.gson
26 | gson
27 |
28 |
29 | io.springfox
30 | springfox-swagger2
31 | 2.9.2
32 |
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-starter-mail
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | com.github.xiaoymin
46 | swagger-bootstrap-ui
47 | 1.9.0
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/viboot-common/src/main/java/indi/viyoung/viboot/aop/ResponseAop.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.aop;
2 |
3 | import eu.bitwalker.useragentutils.UserAgent;
4 | import indi.viyoung.viboot.handler.GlobalExceptionHandler;
5 |
6 | import indi.viyoung.viboot.util.JSONUtil;
7 | import indi.viyoung.viboot.util.ReturnVO;
8 | import jdk.nashorn.internal.parser.JSONParser;
9 | import lombok.extern.slf4j.Slf4j;
10 | import org.aspectj.lang.JoinPoint;
11 | import org.aspectj.lang.ProceedingJoinPoint;
12 | import org.aspectj.lang.annotation.*;
13 | import org.slf4j.Logger;
14 | import org.slf4j.LoggerFactory;
15 | import org.springframework.beans.factory.annotation.Autowired;
16 | import org.springframework.core.annotation.Order;
17 | import org.springframework.stereotype.Component;
18 | import org.springframework.web.context.request.RequestContextHolder;
19 | import org.springframework.web.context.request.ServletRequestAttributes;
20 |
21 | import javax.servlet.http.HttpServletRequest;
22 | import java.util.Arrays;
23 | import java.util.StringTokenizer;
24 |
25 |
26 | /**
27 | * 统一封装返回值和异常处理
28 | *
29 | * @author vi
30 | * @since 2018/12/20 6:09 AM
31 | */
32 | @Aspect
33 | @Order(5)
34 | @Component
35 | @Slf4j
36 | public class ResponseAop {
37 |
38 | @Autowired
39 | private GlobalExceptionHandler exceptionHandler;
40 |
41 | ThreadLocal startTime = new ThreadLocal<>();
42 |
43 | @Before("httpResponse()")
44 | public void doBefore(JoinPoint joinPoint){
45 | startTime.set(System.currentTimeMillis());
46 | //接收到请求,记录请求内容
47 | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
48 | assert attributes != null;
49 | HttpServletRequest request = attributes.getRequest();
50 | System.out.println(request.getServerName());
51 | System.out.println(request.getServerPort());
52 | //记录请求的内容
53 | UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
54 | log.info("接口路径:{}" , request.getRequestURL().toString());
55 | log.info("浏览器:{}", userAgent.getBrowser().toString());
56 | log.info("浏览器版本:{}",userAgent.getBrowserVersion());
57 | log.info("操作系统: {}", userAgent.getOperatingSystem().toString());
58 | log.info("IP : {}" , request.getRemoteAddr());
59 | log.info("请求类型:{}", request.getMethod());
60 | log.info("类方法 : " + joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
61 | log.info("请求参数 : {} " + Arrays.toString(joinPoint.getArgs()));
62 | }
63 |
64 | /**
65 | * 切点
66 | */
67 | @Pointcut("execution(public * indi.viyoung.viboot.*.controller..*(..))")
68 | public void httpResponse() {
69 | }
70 |
71 | /**
72 | * 环切
73 | */
74 | @Around("httpResponse()")
75 | public ReturnVO handlerController(ProceedingJoinPoint proceedingJoinPoint) {
76 | ReturnVO returnVO = new ReturnVO();
77 | try {
78 | startTime.set(System.currentTimeMillis());
79 | Object proceed = proceedingJoinPoint.proceed();
80 | if (proceed instanceof ReturnVO) {
81 | returnVO = (ReturnVO) proceed;
82 | } else {
83 | returnVO.setData(proceed);
84 | }
85 | } catch (Throwable throwable) {
86 | // 这里直接调用刚刚我们在handler中编写的方法
87 | returnVO = exceptionHandler.handlerException(throwable);
88 | }
89 | return returnVO;
90 | }
91 |
92 | @AfterReturning(returning = "ret" , pointcut = "httpResponse()")
93 | public void doAfterReturning(Object ret){
94 | //处理完请求后,返回内容
95 | log.info("方法返回值:{}" , ret);
96 | log.info("方法执行时间:{}毫秒", (System.currentTimeMillis() - startTime.get()));
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/viboot-common/src/main/java/indi/viyoung/viboot/exception/NullResponseException.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.exception;
2 |
3 | /**
4 | * 自定义异常:返回结果为空
5 | * @author vi
6 | * @since 2018/12/24 6:23 PM
7 | */
8 | public class NullResponseException extends RuntimeException {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/viboot-common/src/main/java/indi/viyoung/viboot/handler/GlobalExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package indi.viyoung.viboot.handler;
2 |
3 | import indi.viyoung.viboot.util.CommonUrl;
4 | import indi.viyoung.viboot.util.ReadPropertiesUtil;
5 | import indi.viyoung.viboot.util.ReturnVO;
6 | import org.springframework.http.HttpHeaders;
7 | import org.springframework.http.HttpStatus;
8 | import org.springframework.http.ResponseEntity;
9 | import org.springframework.web.bind.annotation.ExceptionHandler;
10 | import org.springframework.web.bind.annotation.RestControllerAdvice;
11 | import org.springframework.web.context.request.WebRequest;
12 | import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
13 |
14 | import java.util.Properties;
15 |
16 | import static indi.viyoung.viboot.util.ReturnCode.valueOf;
17 |
18 | /**
19 | * 全局异常处理类
20 | * @author yangwei
21 | *
22 | * 用于全局返回json,如需返回ModelAndView请使用@ControllerAdvice
23 | */
24 | @RestControllerAdvice
25 | public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
26 |
27 | private static Properties properties = ReadPropertiesUtil.getProperties(System.getProperty("user.dir") + CommonUrl.RESPONSE_PROP_URL);
28 |
29 |
30 | @Override
31 | protected ResponseEntity