├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.md └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── Readme.md ├── SECURITY.md ├── _config.yml ├── async ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── anysc │ │ ├── AsyncMain.java │ │ ├── controller │ │ └── TestController.java │ │ └── task │ │ └── AsyncTask.java │ └── resources │ └── config │ ├── application.properties │ └── logback-dev.xml ├── changeLog.md ├── core ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── core │ │ ├── base │ │ ├── AuthOperate.java │ │ ├── BaseController.java │ │ ├── BaseDao.java │ │ ├── BaseModel.java │ │ ├── BaseService.java │ │ └── Result.java │ │ ├── constant │ │ ├── CodeConst.java │ │ ├── FileConst.java │ │ ├── GenderConst.java │ │ └── SymbolConst.java │ │ ├── exception │ │ └── UserNotFoundException.java │ │ ├── field │ │ └── LoginField.java │ │ ├── filter │ │ ├── CorsFilter.java │ │ └── CustomDateSerializerFilter.java │ │ └── untils │ │ ├── AuthUtil.java │ │ ├── CastUtil.java │ │ ├── CharUtil.java │ │ ├── DownUtil.java │ │ ├── ExcelUtil.java │ │ ├── FileUtil.java │ │ ├── HtmlUtil.java │ │ ├── HttpUtil.java │ │ ├── IDUtil.java │ │ ├── LunarCalendarUtil.java │ │ ├── MailUtil.java │ │ ├── Md5Util.java │ │ ├── PropsUtil.java │ │ ├── RandomUtil.java │ │ ├── RegExUtil.java │ │ ├── SerializeUtil.java │ │ ├── SqlUtil.java │ │ ├── StringUtil.java │ │ ├── TimeUtil.java │ │ ├── TokenUtil.java │ │ └── XmlUtil.java │ └── resources │ └── config │ └── oauth.properties ├── crawler ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── crawler │ │ ├── CrawlerMain.java │ │ ├── dao │ │ └── ShikigamaDao.java │ │ ├── model │ │ ├── MitamaModel.java │ │ └── ShikigamiModel.java │ │ ├── schedule │ │ └── ScheduledTasks.java │ │ ├── service │ │ ├── ShikigamaService.java │ │ └── impl │ │ │ └── ShikigamaServiceImpl.java │ │ └── spider │ │ ├── Crawler.java │ │ └── OnnmyoujiSpider.java │ └── resources │ └── config │ ├── application.properties │ └── logback-dev.xml ├── freemarker ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── freemarker │ │ ├── FreemarkerMain.java │ │ └── controller │ │ └── FreemarkerController.java │ └── resources │ ├── config │ ├── application.properties │ ├── banner-girl.txt │ └── logback-dev.xml │ └── templates │ └── index.ftl ├── javase ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── javase │ │ ├── QuestionMain.java │ │ ├── controller │ │ └── QuestionController.java │ │ ├── dao │ │ └── QuestionDao.java │ │ ├── model │ │ └── QuestionModel.java │ │ └── service │ │ ├── QuestionService.java │ │ └── impl │ │ └── QuestionServiceImpl.java │ └── resources │ └── config │ ├── application.properties │ ├── banner-girl.txt │ └── logback-dev.xml ├── mongodb ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── mongodb │ │ ├── MongodbMain.java │ │ ├── controller │ │ └── MongoUserController.java │ │ ├── dao │ │ └── MongoUserDao.java │ │ ├── model │ │ └── MongoUser.java │ │ └── service │ │ ├── MongoUserService.java │ │ └── impl │ │ └── MongoUserServiceImpl.java │ └── resources │ └── config │ ├── application.properties │ └── logback-dev.xml ├── multipleSource ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── multiplesource │ │ ├── MultipleSourceMain.java │ │ ├── controller │ │ └── MultipleSourceController.java │ │ ├── domain │ │ └── User.java │ │ └── sql │ │ └── Sql.java │ └── resources │ └── config │ ├── application.properties │ ├── banner-girl.txt │ └── logback-dev.xml ├── mybatis ├── .gitignore ├── README.md ├── USER.sql ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── mybatis │ │ ├── MybatisMain.java │ │ ├── controller │ │ └── MybatisUserController.java │ │ ├── domain │ │ └── User.java │ │ └── mapper │ │ └── UserMapper.java │ └── resources │ └── config │ ├── application.properties │ ├── banner-girl.txt │ └── logback-dev.xml ├── order ├── pom.xml └── src │ └── main │ └── java │ └── info │ └── xiaomo │ └── order │ ├── OrderMain.java │ ├── controller │ └── OrderController.java │ ├── model │ └── OrderModel.java │ └── service │ ├── OrderService.java │ └── impl │ └── OrderServiceImpl.java ├── pom.xml ├── rabbitmq ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── info │ │ │ └── xiaomo │ │ │ └── rabbitmq │ │ │ ├── RabbitMqMain.java │ │ │ └── config │ │ │ ├── Receiver.java │ │ │ └── Sender.java │ └── resources │ │ └── config │ │ ├── application.properties │ │ └── logback-dev.xml │ └── test │ └── java │ └── test │ └── RabbitMqTests.java ├── redis ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── redis │ │ ├── RedisMain.java │ │ ├── controller │ │ └── TestController.java │ │ ├── dao │ │ ├── CommonRedisDao.java │ │ └── impl │ │ │ └── CommonRedisDaoImpl.java │ │ ├── job │ │ └── TaskJob.java │ │ ├── model │ │ └── CityInfo.java │ │ └── service │ │ └── CityService.java │ └── resources │ └── config │ ├── application.properties │ └── logback-dev.xml ├── scheduled ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── scheduled │ │ ├── ScheduledMain.java │ │ └── task │ │ └── ScheduledTasks.java │ └── resources │ └── config │ ├── application.properties │ └── logback-dev.xml ├── screenshot ├── SpringBootUnity.png ├── api.png ├── bootstrap.png ├── crawler.png ├── interface.png ├── lombok.png ├── run.png ├── spring.png ├── support.png ├── swagger-ui.png └── yys.png ├── security ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── security │ │ ├── SecurityMain.java │ │ └── controller │ │ └── HelloController.java │ └── resources │ ├── config │ ├── application.properties │ └── logback-dev.xml │ └── templates │ ├── hello.html │ ├── index.html │ └── login.html ├── socket ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── chat │ │ ├── ChatMain.java │ │ └── socket │ │ └── MyWebSocket.java │ └── resources │ ├── config │ ├── application.properties │ └── logback-dev.xml │ └── public │ ├── chat.html │ ├── image │ └── avatar.png │ └── index.html ├── thymeleaf ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── thymeleaf │ │ ├── ThymeleafMain.java │ │ └── controller │ │ └── ThymeleafController.java │ └── resources │ ├── config │ ├── application.properties │ ├── banner-girl.txt │ └── logback-dev.xml │ └── templates │ └── index.html └── website ├── .gitignore ├── README.md ├── pom.xml ├── src └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── website │ │ ├── XiaomoMain.java │ │ ├── controller │ │ ├── AdminUserController.java │ │ ├── ChangeLogController.java │ │ ├── LinkController.java │ │ ├── MailController.java │ │ ├── TechnologyController.java │ │ ├── UserController.java │ │ └── WorksController.java │ │ ├── dao │ │ ├── AdminUserDao.java │ │ ├── ChangeLogDao.java │ │ ├── LinkDao.java │ │ ├── TechnologyDao.java │ │ ├── UserDao.java │ │ ├── WorksDao.java │ │ └── base │ │ │ └── CommonDao.java │ │ ├── interceptor │ │ └── LoginInterceptor.java │ │ ├── model │ │ ├── AdminModel.java │ │ ├── ChangeLogModel.java │ │ ├── LinkModel.java │ │ ├── TechnologyModel.java │ │ ├── UserModel.java │ │ └── WorksModel.java │ │ ├── service │ │ ├── AdminUserService.java │ │ ├── ChangeLogService.java │ │ ├── LinkService.java │ │ ├── TechnologyService.java │ │ ├── UserService.java │ │ ├── WorksService.java │ │ └── impl │ │ │ ├── AdminUserServiceImpl.java │ │ │ ├── ChangeLogServiceImpl.java │ │ │ ├── LinkServiceImpl.java │ │ │ ├── TechnologyServiceImpl.java │ │ │ ├── UserServiceImpl.java │ │ │ └── WorksServiceImpl.java │ │ ├── util │ │ └── MailUtil.java │ │ └── view │ │ ├── AdminUserView.java │ │ ├── ChangeLogView.java │ │ ├── LinkView.java │ │ ├── TechnologyView.java │ │ ├── UserView.java │ │ └── WorksView.java │ └── resources │ ├── config │ ├── application.properties │ ├── banner-girl.txt │ └── logback-dev.xml │ ├── public │ ├── css │ │ └── style.css │ └── images │ │ ├── collapse.gif │ │ ├── expand.gif │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ ├── index.jpg │ │ ├── landing.png │ │ ├── logo_small.png │ │ ├── pet_store_api.png │ │ └── throbber.gif │ ├── templates │ ├── email.ftl │ ├── index.ftl │ ├── info.ftl │ ├── login.ftl │ └── register.ftl │ └── 项目文档 │ └── 重点记录 │ ├── markdown语法.markdown │ ├── maven使用相关.markdown │ ├── spring boot 相关.markdown │ ├── 前后分离与传统javaweb项目的区别.markdown │ ├── 文件上传.markdown │ ├── 服务器部署.markdown │ └── 跨域.markdown └── web.sql /.gitattributes: -------------------------------------------------------------------------------- 1 | # *.js linguist-language=java 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: houko 4 | patreon: #hupeng 5 | open_collective: SpringBootUnity 6 | ko_fi: #hupeng 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: #houko/SpringBootUnity 11 | otechie: # Replace with a single Otechie username 12 | custom: #https:blog.xiaomo.info 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk11 4 | dist: trusty -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Peng Hu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /async/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /async/README.md: -------------------------------------------------------------------------------- 1 | 异步任务 -------------------------------------------------------------------------------- /async/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | async 13 | 14 | 15 | info.xiaomo 16 | core 17 | 2020.1 18 | 19 | 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-maven-plugin 26 | 27 | 28 | 29 | repackage 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /async/src/main/java/info/xiaomo/anysc/AsyncMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.anysc; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.domain.EntityScan; 7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 8 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 9 | import org.springframework.context.annotation.ComponentScan; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/1 15:38 23 | * Description: RabbitMq启动器 24 | * Copyright(©) 2015 by xiaomo. 25 | **/ 26 | @Configuration 27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 28 | @ComponentScan("info.xiaomo") 29 | @EntityScan("info.xiaomo.*.model") 30 | public class AsyncMain { 31 | public static void main(String[] args) throws Exception { 32 | SpringApplication.run(AsyncMain.class, args); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /async/src/main/java/info/xiaomo/anysc/task/AsyncTask.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.anysc.task; 2 | 3 | import org.springframework.scheduling.annotation.Async; 4 | import org.springframework.scheduling.annotation.AsyncResult; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.Random; 8 | import java.util.concurrent.Future; 9 | 10 | /** 11 | * @author : xiaomo 12 | */ 13 | @Component 14 | public class AsyncTask { 15 | 16 | private static Random random = new Random(); 17 | 18 | @Async 19 | public Future doTaskOne() throws Exception { 20 | System.out.println("开始做任务一"); 21 | long start = System.currentTimeMillis(); 22 | Thread.sleep(random.nextInt(10000)); 23 | long end = System.currentTimeMillis(); 24 | System.out.println("完成任务一,耗时:" + (end - start) + "毫秒"); 25 | return new AsyncResult<>("任务一完成"); 26 | } 27 | 28 | @Async 29 | public Future doTaskTwo() throws Exception { 30 | System.out.println("开始做任务二"); 31 | long start = System.currentTimeMillis(); 32 | Thread.sleep(random.nextInt(10000)); 33 | long end = System.currentTimeMillis(); 34 | System.out.println("完成任务二,耗时:" + (end - start) + "毫秒"); 35 | return new AsyncResult<>("任务二完成"); 36 | } 37 | 38 | @Async 39 | public Future doTaskThree() throws Exception { 40 | System.out.println("开始做任务三"); 41 | long start = System.currentTimeMillis(); 42 | Thread.sleep(random.nextInt(10000)); 43 | long end = System.currentTimeMillis(); 44 | System.out.println("完成任务三,耗时:" + (end - start) + "毫秒"); 45 | return new AsyncResult<>("任务三完成"); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /async/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 7 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 8 | spring.jackson.time-zone=GMT+8 9 | spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl -------------------------------------------------------------------------------- /async/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /changeLog.md: -------------------------------------------------------------------------------- 1 | - 2017-09-02 api模块: 添加swagger-bootstrap-ui,和原有ui并行存在。 2 | http://localhost:8080 默认UI 3 | http://localhost:808/doc.html bootstrap-ui 4 | 5 | ``` 6 | 1. spring boot版本从1.4.3更新到1.5.6 7 | 2. 修复不配置数据库信息无法启动的bug 8 | 3. 版本号更新到2017.1 9 | 4. api模块(swagger)添加开源库swagger-bootstrap-ui,和swagger默认UI同时存在。 10 | 5. web模块添加数据库sql文件,导入后一键启动可直接访问到web界面。 11 | ``` 12 | 13 | 14 | 15 | ![support](screenshot/support.png) 16 | 17 | #### swagger 18 | ![默认](screenshot/swagger-ui.png) 19 | 20 | 21 | #### bootstrap-ui 22 | ![bootstrap](screenshot/bootstrap.png) 23 | 24 | ![bootstrap](screenshot/interface.png) 25 | 26 | ![bootstrap](screenshot/api.png) 27 | 28 | 29 | 30 | - 2017-09-06 更新记录 31 | 32 | ``` 33 | 1. mybatis模块:添加USER.sql,启动后访问:http://localhost:8080 即可看到接口数据 34 | 2. 所有模块: 添加 characterEncoding=utf8&useSSL=true 解决高版本mysql的sll警告 35 | 3. 添加代码贡献者列表和支持者,赞助商链接。 36 | ``` 37 | 38 | - 2017-09-08 更新记录 39 | 40 | ``` 41 | 1. crawler模块(网络爬虫):修复本地文件目录不存在会报错的bug。处理方式为:不存在则自动创建 42 | ``` 43 | 44 | ![crawler](screenshot/crawler.png) 45 | ![yys](screenshot/yys.png) -------------------------------------------------------------------------------- /core/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /core/README.md: -------------------------------------------------------------------------------- 1 | 核心包 -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/base/AuthOperate.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.base; 2 | 3 | import org.springframework.web.bind.annotation.PathVariable; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 9 | * @version : 2017/1/13 9:51 10 | */ 11 | public interface AuthOperate { 12 | 13 | 14 | /** 15 | * 登录 16 | * 17 | * @param name 用户名(邮箱或者电话) 18 | * @param password 密码 19 | * @return 结果 20 | */ 21 | Result login(@PathVariable String name, @PathVariable String password); 22 | 23 | 24 | /** 25 | * 修改密码 26 | * 27 | * @param name 用户名(邮箱或者电话) 28 | * @param password 密码 29 | * @return 结果 30 | */ 31 | Result changePassword(@PathVariable String name, @PathVariable String password); 32 | 33 | /** 34 | * 注册 35 | * 36 | * @param name 用户名(邮箱或者电话) 37 | * @param password 密码 38 | * @return 是否己发送验证码 39 | */ 40 | Result register(@PathVariable String name, @PathVariable String password); 41 | 42 | /** 43 | * 验证 44 | * 45 | * @param validCode 验证码 46 | * @param time 发送时间 47 | * @return 是否验证通过 48 | */ 49 | Result validate(@PathVariable int validCode, @PathVariable Date time); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/base/BaseController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.base; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 14 | * @version : 2017/1/11 16:41 15 | */ 16 | @RestController 17 | public abstract class BaseController { 18 | 19 | protected final Logger LOGGER = LoggerFactory.getLogger(getClass()); 20 | 21 | /** 22 | * 查找所有(不带分页) 23 | * 24 | * @return result 25 | */ 26 | public abstract Result> findAll(); 27 | 28 | /** 29 | * 带分页 30 | * 31 | * @param start 起始页 32 | * @param pageSize 页码数 33 | * @return result 34 | */ 35 | public abstract Result> findAll(@PathVariable int start, @PathVariable int pageSize); 36 | 37 | /** 38 | * 根据id查看模型 39 | * 40 | * @param id id 41 | * @return result 42 | */ 43 | public abstract Result findById(@PathVariable Long id); 44 | 45 | /** 46 | * 根据名字查找模型 47 | * 48 | * @param name name 49 | * @return result 50 | */ 51 | public abstract Result findByName(@PathVariable String name); 52 | 53 | /** 54 | * 根据名字删除模型 55 | * 56 | * @param name name 57 | * @return result 58 | */ 59 | public abstract Result delByName(@PathVariable String name); 60 | 61 | 62 | /** 63 | * 根据id删除模型 64 | * 65 | * @param id id 66 | * @return result 67 | */ 68 | public abstract Result delById(@PathVariable Long id); 69 | 70 | /** 71 | * 添加模型 72 | * 73 | * @param model model 74 | * @return result 75 | */ 76 | public abstract Result add(@RequestBody T model); 77 | 78 | 79 | /** 80 | * 更新 81 | * 82 | * @param model model 83 | * @return result 84 | */ 85 | public abstract Result update(@RequestBody T model); 86 | 87 | 88 | /** 89 | * 批量删除 90 | * 91 | * @param ids ids 92 | * @return result 93 | */ 94 | public abstract Result delByIds(@PathVariable List ids); 95 | 96 | } -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/base/BaseDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.base; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | /** 7 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 8 | * @version : 2017/1/13 11:23 9 | */ 10 | @Repository 11 | public interface BaseDao extends JpaRepository { 12 | 13 | /** 14 | * 根据名字查 15 | * 16 | * @param name 17 | * @return 18 | */ 19 | T findByName(String name); 20 | 21 | /** 22 | * 删除 23 | * 24 | * @param name 25 | * @return 26 | */ 27 | boolean deleteByName(String name); 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/base/BaseModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.base; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.*; 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | 9 | /** 10 | * 把今天最好的表现当作明天最新的起点..~ 11 | * いま 最高の表現 として 明日最新の始発..~ 12 | * Today the best performance as tomorrow newest starter! 13 | 14 | * 15 | * @author : xiaomo 16 | * github: https://github.com/houko 17 | * email: xiaomo@xiaomo.info 18 | *

19 | * Date: 2016/4/1 20:37 20 | * Copyright(©) 2015 by xiaomo. 21 | **/ 22 | 23 | @MappedSuperclass 24 | @Data 25 | public abstract class BaseModel implements Serializable { 26 | 27 | @Id 28 | @GeneratedValue(strategy = GenerationType.AUTO) 29 | @Column(name = "Id") 30 | private Long id; 31 | 32 | @Column(name = "Name") 33 | private String name; 34 | 35 | @Column(name = "CreateTime") 36 | private Date createTime; 37 | 38 | @Column(name = "UpdateTime") 39 | private Date updateTime; 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/base/BaseService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.base; 2 | 3 | import org.springframework.data.domain.Page; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 10 | * @version : 2017/1/11 16:42 11 | */ 12 | @Service 13 | public interface BaseService { 14 | 15 | /** 16 | * 根据id查 17 | * 18 | * @param id 19 | * @return 20 | */ 21 | T findById(Long id); 22 | 23 | /** 24 | * 根据名字查 25 | * 26 | * @param name 27 | * @return 28 | */ 29 | T findByName(String name); 30 | 31 | /** 32 | * 查找所有 33 | * 34 | * @return 35 | */ 36 | List findAll(); 37 | 38 | /** 39 | * 分页查询 40 | * 41 | * @param start 42 | * @param pageSize 43 | * @return 44 | */ 45 | Page findAll(int start, int pageSize); 46 | 47 | /** 48 | * 根据id删除 49 | * 50 | * @param id 51 | * @return 52 | */ 53 | boolean deleteById(Long id); 54 | 55 | /** 56 | * 根据名字删除 57 | * 58 | * @param name 59 | * @return 60 | */ 61 | boolean deleteByName(String name); 62 | 63 | /** 64 | * 增加 65 | * 66 | * @param model 67 | * @return 68 | */ 69 | boolean add(T model); 70 | 71 | /** 72 | * 更新 73 | * 74 | * @param model 75 | * @return 76 | */ 77 | boolean update(T model); 78 | 79 | /** 80 | * 批量删除 81 | * 82 | * @param ids 83 | * @return 84 | */ 85 | boolean deleteByIds(List ids); 86 | } 87 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/base/Result.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.base; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 把今天最好的表现当作明天最新的起点..~ 7 | * いま 最高の表現 として 明日最新の始発..~ 8 | * Today the best performance as tomorrow newest starter! 9 | 10 | * 11 | * @author : xiaomo 12 | * github: https://github.com/houko 13 | * email: xiaomo@xiaomo.info 14 | *

15 | * Date: 2016/10/31 15:25 16 | * Description: 返回结果 17 | * Copyright(©) 2015 by xiaomo. 18 | */ 19 | @Data 20 | public class Result { 21 | 22 | private int resultCode = 200; 23 | 24 | private String message = "SUCCESS"; 25 | 26 | private T data; 27 | 28 | /** 29 | * 只返回错误码 30 | * 31 | * @param resultCode resultCode 32 | */ 33 | public Result(int resultCode) { 34 | this.resultCode = resultCode; 35 | } 36 | 37 | /** 38 | * 只有返回数据的(验证成功) 39 | * 40 | * @param data data 41 | */ 42 | public Result(T data) { 43 | this.data = data; 44 | } 45 | 46 | /** 47 | * 只有错误码和错误信息的 48 | * 49 | * @param resultCode resultCode 50 | * @param message message 51 | */ 52 | public Result(int resultCode, String message) { 53 | this.resultCode = resultCode; 54 | this.message = message; 55 | } 56 | 57 | 58 | /** 59 | * 全部参数 60 | * 61 | * @param resultCode resultCode 62 | * @param message message 63 | * @param data data 64 | */ 65 | public Result(int resultCode, String message, T data) { 66 | this.resultCode = resultCode; 67 | this.message = message; 68 | this.data = data; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/constant/CodeConst.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.constant; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/10/29 10:59 14 | * Description: 错误码 15 | * Copyright(©) 2015 by xiaomo. 16 | */ 17 | public enum CodeConst { 18 | /** 19 | * success 20 | */ 21 | SUCCESS(200, "成功"), 22 | NOT_FOUNT(404, "找不到"), 23 | REPEAT(992, "数据重复"), 24 | CodeOR(993, "系统错误"), 25 | ADMIN_USER_REPEAT(994, "后台用户名重复"), 26 | NULL_DATA(995, "没有数据"), 27 | TIME_PASSED(996, "时间己过期"), 28 | USER_NOT_FOUND(997, "找不到用户"), 29 | USER_REPEAT(998, "用户重复"), 30 | AUTH_FAILED(999, "用户名或密码错误"); 31 | 32 | 33 | private int resultCode; 34 | private String message; 35 | 36 | CodeConst(int resultCode) { 37 | this.resultCode = resultCode; 38 | } 39 | 40 | CodeConst(String message) { 41 | this.message = message; 42 | } 43 | 44 | CodeConst(int resultCode, String message) { 45 | this.resultCode = resultCode; 46 | this.message = message; 47 | } 48 | 49 | public int getResultCode() { 50 | return resultCode; 51 | } 52 | 53 | public void setResultCode(int resultCode) { 54 | this.resultCode = resultCode; 55 | } 56 | 57 | public String getMessage() { 58 | return message; 59 | } 60 | 61 | public void setMessage(String message) { 62 | this.message = message; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/constant/GenderConst.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.constant; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/1/12 16:37 14 | * Description: 性别 15 | * Copyright(©) 2015 by xiaomo. 16 | **/ 17 | public interface GenderConst { 18 | 19 | int SECRET = 0; 20 | 21 | int MAN = 1; 22 | 23 | int WOMAN = 2; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/constant/SymbolConst.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.constant; 2 | 3 | /** 4 | * @author : xiaomo 5 | */ 6 | public class SymbolConst { 7 | public static final String JINHAO = "#"; 8 | public static final String AND = "&"; 9 | public static final String SHUXIAN = "\\|"; 10 | public static final String JINHAO_TWO = "##"; 11 | public static final String GANTANHAO = "!"; 12 | public static final String FENHAO = ";"; 13 | public static final String HENGXIAN = "-"; 14 | public static final String JINHAO__AND_GANTANHAO = "#!"; 15 | public static final String JINHAO_AND_BAIFENHAO = "#%"; 16 | public static final String DOUHAO = ","; 17 | public static final String DIAN = "."; 18 | public static final String ZHENGXIEXIAN = "/"; 19 | public static final String DENGHAO = "="; 20 | public static final String SPACE = " "; 21 | public static final String AT = "@"; 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/exception/UserNotFoundException.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.exception; 2 | 3 | /** 4 | * │\__╭╭╭╭╭__/│ 5 | * │         │ 6 | * │         │ 7 | * │ -      -│ 8 | * │≡    o ≡ │ 9 | * │         │ 10 | * ╰——┬O◤▽◥O┬——╯ 11 | * |  o  | 12 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 16/4/3 11:08 22 | * Description: 找不到用户异常 23 | * Copyright(©) 2015 by xiaomo. 24 | */ 25 | public class UserNotFoundException extends Exception { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/field/LoginField.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.field; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info(83387856) 12 | * Date: 2016/1/8 13:16 13 | * Description: QQ登录常量类 14 | * Copyright(©) 2015 by xiaomo. 15 | */ 16 | public interface LoginField { 17 | 18 | String Q_Q_OPEN_ID = "openid"; 19 | String Q_Q_NICKNAME = "nickname"; 20 | String Q_Q_PHOTOURL = "figureurl_qq_2"; 21 | String Q_Q_GENDER = "gender"; 22 | String SINA_NICK_NAME = "screen_name"; 23 | String SINA_OPEN_ID = "id"; 24 | String SINA_HEAD_PHOTO = "avatar_large"; 25 | String GITHUB_NICK_NAME = "name"; 26 | String GITHUB_OPEN_ID = "id"; 27 | String GITHUB_HEAD_PHOTO = "avatar_url"; 28 | String GITHUB_EMAIL = "email"; 29 | String BAIDU_NICK_NAME = "name"; 30 | String BAIDU_OPEN_ID = "id"; 31 | String BAIDU_HEAD_PHOTO = "avatar_url"; 32 | String BAIDU_GENDER = ""; 33 | 34 | String OSC_NICK_NAME = "name"; 35 | String OSC_OPEN_ID = "id"; 36 | String OSC_HEAD_PHOTO = "avatar"; 37 | String OSC_EMAIL = "email"; 38 | String OSC_GENDER = "gender"; 39 | 40 | String RENREN_NICK_NAME = "name"; 41 | String RENREN_OPEN_ID = "id"; 42 | String RENREN_HEAD_PHOTO = "url"; 43 | String RENREN_EMAIL = "email"; 44 | String RENREN_GENDER = "gender"; 45 | String RENREN_PHOTO = "avatar"; 46 | 47 | String ID = "id"; 48 | String PASSWORD = "password"; 49 | String EMAIL = "email"; 50 | String EMAILVERIFY = "emailVerify"; 51 | String SEX = "gender"; 52 | String BIRTHDAY = "birthday"; 53 | String STATUS = "status"; 54 | String LAST_LOGIN_TIME = "lastLoginTime"; 55 | 56 | String TYPE = "type"; 57 | String CONTRIBUTION = "contribution"; 58 | String AUTHORITY = "authority"; 59 | String UPDATETIME = "updateTime"; 60 | String CREATETIME = "createTime"; 61 | String INDEX = "/index.html"; 62 | } 63 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/filter/CorsFilter.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.filter; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import javax.servlet.*; 6 | import javax.servlet.http.HttpServletResponse; 7 | import java.io.IOException; 8 | 9 | /** 10 | * 把今天最好的表现当作明天最新的起点..~ 11 | * いま 最高の表現 として 明日最新の始発..~ 12 | * Today the best performance as tomorrow newest starter! 13 | 14 | * 15 | * @author : xiaomo 16 | * github: https://github.com/houko 17 | * email: xiaomo@xiaomo.info 18 | *

19 | * Date: 2016/4/1516:25 20 | * Description: 21 | * Copyright(©) 2015 by xiaomo. 22 | **/ 23 | @Component 24 | public class CorsFilter implements Filter { 25 | 26 | 27 | /** 28 | * 初始化 29 | * 30 | * @param filterConfig filterConfig 31 | * @throws ServletException ServletException 32 | */ 33 | @Override 34 | public void init(FilterConfig filterConfig) throws ServletException { 35 | 36 | } 37 | 38 | /** 39 | * CORS 过滤器 40 | * 41 | * @param req rq 42 | * @param res res 43 | * @param chain chin 44 | * @throws IOException IOException 45 | * @throws ServletException ServletException 46 | */ 47 | @Override 48 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { 49 | HttpServletResponse response = (HttpServletResponse) res; 50 | response.setHeader("Access-Control-Allow-Origin", "*"); 51 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); 52 | response.setHeader("Access-Control-Max-Age", "3600"); 53 | response.setHeader("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, If-Modified-Since"); 54 | chain.doFilter(req, res); 55 | } 56 | 57 | 58 | /** 59 | * 销毁对象 60 | */ 61 | @Override 62 | public void destroy() { 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/filter/CustomDateSerializerFilter.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.filter; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | import info.xiaomo.core.untils.TimeUtil; 7 | 8 | import java.io.IOException; 9 | import java.text.SimpleDateFormat; 10 | import java.util.Date; 11 | 12 | /** 13 | * @author : xiaomo 14 | */ 15 | public class CustomDateSerializerFilter extends JsonSerializer { 16 | 17 | @Override 18 | public void serialize(Date value, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException { 19 | SimpleDateFormat sdf = new SimpleDateFormat(TimeUtil.DEFAULT_FORMAT2); 20 | jsonGenerator.writeString(sdf.format(value)); 21 | } 22 | } -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/AuthUtil.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import javax.servlet.http.HttpSession; 4 | 5 | /** 6 | * 把今天最好的表现当作明天最新的起点..~ 7 | * いま 最高の表現 として 明日最新の始発..~ 8 | * Today the best performance as tomorrow newest starter! 9 | 10 | * 11 | * @author : xiaomo 12 | * github: https://github.com/houko 13 | * @email: xiaomo@xiaomo.info 14 | *

15 | * Date: 2016/11/31 9:50 16 | * Copyright(©) 2015 by xiaomo. 17 | **/ 18 | 19 | public class AuthUtil { 20 | public static boolean isAuthorized(HttpSession session) { 21 | String currentUser = (String) session.getAttribute("currentUser"); 22 | return !(currentUser == null || currentUser.isEmpty()); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/DownUtil.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | import java.io.File; 6 | import java.io.FileOutputStream; 7 | import java.io.InputStream; 8 | import java.io.OutputStream; 9 | import java.net.URL; 10 | import java.net.URLConnection; 11 | 12 | /** 13 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 14 | * @created : 2016/12/26 13:25 15 | */ 16 | @Slf4j 17 | public class DownUtil { 18 | 19 | public static void download(String urlString) throws Exception { 20 | File file = new File(urlString); 21 | String filename = file.getName(); 22 | // 构造URL 23 | URL url = new URL(urlString); 24 | // 打开连接 25 | URLConnection con = url.openConnection(); 26 | // 输入流 27 | InputStream is = con.getInputStream(); 28 | // 1K的数据缓冲 29 | byte[] bs = new byte[1024]; 30 | // 读取到的数据长度 31 | int len; 32 | // 输出的文件流 33 | OutputStream os = new FileOutputStream(filename); 34 | // 开始读取 35 | while ((len = is.read(bs)) != -1) { 36 | os.write(bs, 0, len); 37 | } 38 | // 完毕,关闭所有链接 39 | os.close(); 40 | is.close(); 41 | } 42 | 43 | 44 | /** 45 | * 下载图片 46 | * 47 | * @param urlString url 48 | * @param filePath 存储路径 D:\MIR\config\data\ 49 | */ 50 | public static void download(String urlString, String filePath) throws Exception { 51 | File file = new File(urlString); 52 | String filename = file.getName(); 53 | // 构造URL 54 | URL url = new URL(urlString); 55 | // 打开连接 56 | URLConnection con = url.openConnection(); 57 | // 输入流 58 | InputStream is = con.getInputStream(); 59 | // 1K的数据缓冲 60 | byte[] bs = new byte[1024]; 61 | // 读取到的数据长度 62 | int len; 63 | // 输出的文件流 64 | 65 | File output = new File(filePath); 66 | if (!output.exists()) { 67 | boolean res = output.mkdir(); 68 | if (res) { 69 | log.debug("{} 目录创建成功", filePath); 70 | } 71 | } 72 | 73 | OutputStream os = new FileOutputStream(filePath + filename); 74 | // 开始读取 75 | while ((len = is.read(bs)) != -1) { 76 | os.write(bs, 0, len); 77 | } 78 | // 完毕,关闭所有链接 79 | os.close(); 80 | is.close(); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/IDUtil.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | 7 | /** 8 | * @author : xiaomo 9 | */ 10 | public class IDUtil { 11 | private static final Logger LOGGER = LoggerFactory.getLogger(IDUtil.class); 12 | /** 13 | * 锁 14 | */ 15 | private static final Object ID_LOCK = new Object(); 16 | /** 17 | * 当前秒数 18 | */ 19 | private static long CURRENT_SECOND = System.currentTimeMillis() / 1000L; 20 | private static int ID = 0; 21 | 22 | public static void main(String[] args) { 23 | LOGGER.info(String.valueOf(Integer.MAX_VALUE / (365 * 24 * 60 * 60))); 24 | LOGGER.info(Integer.toBinaryString((int) (System.currentTimeMillis() / 1000))); 25 | } 26 | 27 | /** 28 | * 获取唯一一个id 29 | * 30 | * @return long 31 | */ 32 | public static long getId() { 33 | int tempId; 34 | long tempCurSec = System.currentTimeMillis() / 1000L; 35 | synchronized (ID_LOCK) { 36 | ID += 1; 37 | tempId = ID; 38 | int i = 65000; 39 | if (ID > i) { 40 | ID = 0; 41 | CURRENT_SECOND += 1L; 42 | } 43 | if (tempCurSec > CURRENT_SECOND) { 44 | CURRENT_SECOND = tempCurSec; 45 | } else { 46 | tempCurSec = CURRENT_SECOND; 47 | } 48 | } 49 | return ((tempCurSec) << 16 | tempId & 0xFFFF); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/Md5Util.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import java.security.MessageDigest; 4 | 5 | /** 6 | * │\__╭╭╭╭╭__/│ 7 | * │         │ 8 | * │         │ 9 | * │ -      -│ 10 | * │≡    o ≡ │ 11 | * │         │ 12 | * ╰——┬O◤▽◥O┬——╯ 13 | * |  o  | 14 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 15 | * いま 最高の表現 として 明日最新の始発..~ 16 | * Today the best performance as tomorrow newest starter! 17 | 18 | * 19 | * @author : xiaomo 20 | * github: https://github.com/houko 21 | * email: xiaomo@xiaomo.info 22 | *

23 | * Date: 16/4/3 10:03 24 | * Description: md5加密解密 25 | * Copyright(©) 2015 by xiaomo. 26 | */ 27 | public class Md5Util { 28 | 29 | private final static String[] HEX_DIGITS = { 30 | "0", "1", "2", "3", "4", "5", "6", "7", 31 | "8", "9", "a", "b", "c", "d", "e", "f"}; 32 | 33 | /** 34 | * 转换字节数组为16进制字串 35 | * 36 | * @param b 字节数组 37 | * @return 16进制字串 38 | */ 39 | public static String byteArrayToString(byte[] b) { 40 | StringBuilder resultSb = new StringBuilder(); 41 | for (byte aB : b) { 42 | //若使用本函数转换则可得到加密结果的16进制表示,即数字字母混合的形式 43 | resultSb.append(byteToHexString(aB)); 44 | } 45 | return resultSb.toString(); 46 | } 47 | 48 | private static String byteToNumString(byte b) { 49 | 50 | int tempB = b; 51 | if (tempB < 0) { 52 | tempB = 256 + tempB; 53 | } 54 | 55 | return String.valueOf(tempB); 56 | } 57 | 58 | private static String byteToHexString(byte b) { 59 | int n = b; 60 | if (n < 0) { 61 | n = 256 + n; 62 | } 63 | int d1 = n / 16; 64 | int d2 = n % 16; 65 | return HEX_DIGITS[d1] + HEX_DIGITS[d2]; 66 | } 67 | 68 | public static String encode(String password, String salt) { 69 | String resultString = null; 70 | try { 71 | resultString = password + salt; 72 | MessageDigest md = MessageDigest.getInstance("md5"); 73 | resultString = byteArrayToString(md.digest(resultString.getBytes())); 74 | } catch (Exception ex) { 75 | ex.printStackTrace(); 76 | } 77 | return resultString; 78 | } 79 | 80 | public static void main(String[] args) { 81 | String password = "xiaomo"; 82 | String salt = RandomUtil.createSalt(); 83 | System.out.println("原数据:" + password); 84 | System.out.println("盐值:" + salt); 85 | System.out.println("MD5后:" + encode(password, salt)); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/PropsUtil.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.InputStream; 5 | import java.util.Properties; 6 | 7 | /** 8 | * @author : xiaomo 9 | */ 10 | public class PropsUtil { 11 | 12 | /** 13 | * 构造函数 14 | * 找到数据源,并用这个数据源创建连接 15 | */ 16 | private PropsUtil() { 17 | 18 | } 19 | 20 | public static Properties getProperties(String url) { 21 | Properties properties = null; 22 | try { 23 | InputStream fs = new FileInputStream(url); 24 | properties = new Properties(); 25 | properties.load(fs); 26 | } catch (Exception e) { 27 | e.printStackTrace(); 28 | } 29 | return properties; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/SerializeUtil.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import java.io.*; 4 | import java.nio.charset.StandardCharsets; 5 | 6 | /** 7 | * │\__╭╭╭╭╭__/│ 8 | * │         │ 9 | * │         │ 10 | * │ -      -│ 11 | * │≡    o ≡ │ 12 | * │         │ 13 | * ╰——┬O◤▽◥O┬——╯ 14 | * |  o  | 15 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 16 | * いま 最高の表現 として 明日最新の始発..~ 17 | * Today the best performance as tomorrow newest starter! 18 | 19 | * 20 | * @author : xiaomo 21 | * github: https://github.com/houko 22 | * email: xiaomo@xiaomo.info 23 | *

24 | * Date: 15/9/6 16:05 25 | * Description: 序列化通用方法 26 | * Copyright(©) 2015 by xiaomo. 27 | */ 28 | public class SerializeUtil { 29 | 30 | /** 31 | * 序列化 32 | */ 33 | public static String serialize(Object object) { 34 | if (object == null) { 35 | return null; 36 | } 37 | ObjectOutputStream oos; 38 | ByteArrayOutputStream baos; 39 | try { 40 | baos = new ByteArrayOutputStream(); 41 | oos = new ObjectOutputStream(baos); 42 | oos.writeObject(object); 43 | byte[] bytes = baos.toByteArray(); 44 | return new String(bytes, StandardCharsets.UTF_8); 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | } 48 | return null; 49 | } 50 | 51 | /** 52 | * 反序列化 53 | */ 54 | public static Object unserialize(String s) throws UnsupportedEncodingException { 55 | byte[] bytes = s.getBytes(StandardCharsets.UTF_8); 56 | ByteArrayInputStream bais; 57 | try { 58 | //反序列化 59 | bais = new ByteArrayInputStream(bytes); 60 | ObjectInputStream ois = new ObjectInputStream(bais); 61 | return ois.readObject(); 62 | } catch (Exception e) { 63 | e.printStackTrace(); 64 | } 65 | return null; 66 | } 67 | } -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/SqlUtil.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import java.util.Arrays; 6 | import java.util.StringTokenizer; 7 | 8 | /** 9 | * 把今天最好的表现当作明天最新的起点..~ 10 | * いま 最高の表現 として 明日最新の始発..~ 11 | * Today the best performance as tomorrow newest starter! 12 | *

13 | * 14 | * @author : xiaomo 15 | * github: https://github.com/syoubaku 16 | * email: xiaomo@xiamoo.info 17 | * QQ_NO: 83387856 18 | * Date: 17/5/11 17:56 19 | * Description: 20 | * Copyright(©) 2017 by xiaomo. 21 | */ 22 | public class SqlUtil { 23 | 24 | 25 | /** 26 | * 功能描述: 生成sql占位符 ?,?,? 27 | * 28 | * @return String 返回类型 29 | */ 30 | public static String sqlHolder(int size) { 31 | String[] paras = new String[size]; 32 | Arrays.fill(paras, "?"); 33 | return StringUtils.join(paras, ','); 34 | } 35 | 36 | /** 37 | * sql语句 处理 38 | * 39 | * @param sql 要进行处理的sql语句 40 | * @param dbtype 数据库类型 41 | * @return 处理后的sql语句 42 | */ 43 | public static String sql4DB(String sql, String dbtype) { 44 | String oracle = "oracle"; 45 | if (!oracle.equalsIgnoreCase(dbtype)) { 46 | sql = StringUtil.toISO(sql); 47 | } 48 | return sql; 49 | } 50 | 51 | private String delNewSQlString(String sql) { 52 | return "in (" + sql.replace('|', ',') + ")"; 53 | } 54 | 55 | private String delSQlString(String sql) { 56 | StringBuilder delSql = new StringBuilder("in("); 57 | StringTokenizer tokenizer = new StringTokenizer(sql, "|"); 58 | 59 | // 标记本身等于分隔符的特殊情况 60 | delSql.append(tokenizer.nextToken()); 61 | while (tokenizer.hasMoreTokens()) { 62 | delSql.append(tokenizer.nextToken()).append(","); 63 | } 64 | delSql = new StringBuilder(delSql.substring(0, delSql.length() - 1) + ")"); 65 | return delSql.toString(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /core/src/main/java/info/xiaomo/core/untils/TokenUtil.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.core.untils; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import info.xiaomo.core.constant.SymbolConst; 5 | 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * Token 帮助类 11 | * 12 | * @author : xiaomo 13 | */ 14 | public class TokenUtil { 15 | 16 | private static final String STR_S = "abcdefghijklmnopqrstuvwxyz0123456789"; 17 | 18 | /** 19 | * 参考自 qq sdk 20 | * 21 | * @param string string 22 | * @return String 返回类型 23 | */ 24 | public static String getAccessToken(String string) { 25 | String accessToken = ""; 26 | try { 27 | JSONObject json = JSONObject.parseObject(string); 28 | if (null != json) { 29 | accessToken = json.getString("access_token"); 30 | } 31 | } catch (Exception e) { 32 | String regex = "^access_token=(\\w+)&expires_in=(\\w+)&refresh_token=(\\w+)$"; 33 | Matcher m = Pattern.compile(regex).matcher(string); 34 | if (m.find()) { 35 | accessToken = m.group(1); 36 | } else { 37 | String regex1 = "^access_token=(\\w+)&expires_in=(\\w+)$"; 38 | Matcher m2 = Pattern.compile(regex1).matcher(string); 39 | if (m2.find()) { 40 | accessToken = m2.group(1); 41 | } else { 42 | String temp = string.split(SymbolConst.DENGHAO)[1]; 43 | accessToken = temp.split(SymbolConst.AND)[0]; 44 | } 45 | } 46 | } 47 | return accessToken; 48 | } 49 | 50 | /** 51 | * 匹配openid 52 | * 53 | * @return String 返回类型 54 | */ 55 | public static String getOpenId(String string) { 56 | String openid = null; 57 | String regex = "\"openid\"\\s*:\\s*\"(\\w+)\""; 58 | Matcher m = Pattern.compile(regex).matcher(string); 59 | if (m.find()) { 60 | openid = m.group(1); 61 | } 62 | return openid; 63 | } 64 | 65 | /** 66 | * sina uid于qq分离 67 | * 68 | * @return String 返回类型 69 | */ 70 | public static String getUid(String string) { 71 | JSONObject json = JSONObject.parseObject(string); 72 | return json.getString("uid"); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /core/src/main/resources/config/oauth.properties: -------------------------------------------------------------------------------- 1 | ## qq openid 2 | openid_qq=101292993 3 | openkey_qq=e1bee0c32c149b66a295f295646ad092 4 | redirect_qq=http://static.xiaomo.info/qq/callback 5 | ## sina openid 6 | openid_sina=4193705357 7 | openkey_sina=bc7bbdfe92be06b42b38206f8bca3645 8 | redirect_sina=http://static.xiaomo.info/sina/callback 9 | ## baidu openid 10 | openid_baidu=xwKOgtKjbbrn9dOb7ZkGrAo5 11 | openkey_baidu=dNlKN4vVqgZvROrWW8twc4wESGWkSfF8 12 | redirect_baidu=http://static.xiaomo.info/baidu/callback 13 | ## renren openid 14 | openid_renren=80cd6ab8bc924c97b78e06568196456e 15 | openkey_renren=51aab0e2633f43a2aeda89f299a7b4f8 16 | redirect_renren=http://static.xiaomo.info/renren/callback 17 | ## osc openid 18 | openid_osc=R6XS1Qnhist6jy5UABer 19 | openkey_osc=llvILNi5ThQj2YwgbM6qx7BOEKIfJjjM 20 | redirect_osc=http://static.xiaomo.info/osc/callback 21 | ## douban openid 22 | openid_douban=04e962ea4e22c5980ebc28beea6850c8 23 | openkey_douban=d7ae6ac47ddf75e2 24 | redirect_douban=http://static.xiaomo.info/douban/callback 25 | ## github openid `no tested` 26 | openid_github= 27 | openkey_github= 28 | redirect_github= -------------------------------------------------------------------------------- /crawler/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /crawler/README.md: -------------------------------------------------------------------------------- 1 | 网络爬虫 -------------------------------------------------------------------------------- /crawler/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | crawler 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.jsoup 26 | jsoup 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-maven-plugin 36 | 37 | 38 | 39 | repackage 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /crawler/src/main/java/info/xiaomo/crawler/CrawlerMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.crawler; 2 | 3 | import org.springframework.beans.factory.annotation.Configurable; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.context.annotation.ComponentScan; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 9 | import org.springframework.scheduling.annotation.EnableScheduling; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | *

17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/1 15:38 23 | * Copyright(©) 2015 by xiaomo. 24 | **/ 25 | @Configuration 26 | @EnableAutoConfiguration 27 | @EnableScheduling 28 | @Configurable 29 | @EnableJpaRepositories("info.xiaomo.*.dao") 30 | @ComponentScan("info.xiaomo") 31 | public class CrawlerMain { 32 | public static void main(String[] args) throws Exception { 33 | SpringApplication.run(CrawlerMain.class, args); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /crawler/src/main/java/info/xiaomo/crawler/dao/ShikigamaDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.crawler.dao; 2 | 3 | import info.xiaomo.crawler.model.ShikigamiModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 9 | * @created : 2016/12/24 15:55 10 | */ 11 | @Repository 12 | public interface ShikigamaDao extends JpaRepository { 13 | 14 | /** 15 | * 根据名字查式神 16 | * 17 | * @param name 18 | * @return 19 | */ 20 | ShikigamiModel findByName(String name); 21 | } 22 | -------------------------------------------------------------------------------- /crawler/src/main/java/info/xiaomo/crawler/model/MitamaModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.crawler.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | 6 | /** 7 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 8 | * @created : 2016/12/24 18:06 9 | * 御魂模型 10 | */ 11 | public class MitamaModel extends BaseModel { 12 | 13 | /** 14 | * 名字 15 | * 火灵 16 | */ 17 | private String name; 18 | 19 | /** 20 | * icon 21 | * http://uus-ng.img.d.cn/snapshot/201610/999/image/388/388/hd/20161012151646257.jpeg 22 | */ 23 | private String image; 24 | 25 | /** 26 | * 两件套效果 27 | * 效果命中+15% 28 | */ 29 | private String effect2; 30 | 31 | /** 32 | * 四件套效果 33 | * 初次出场时获得额外3点鬼火(新回目战斗开始也会被计为初次出场) 34 | */ 35 | private String effect4; 36 | 37 | /** 38 | * 关键字 39 | */ 40 | private String keyworld; 41 | 42 | /** 43 | * 推荐式神 44 | * 青行灯 45 | */ 46 | private String suggest; 47 | 48 | 49 | /** 50 | * 获取方式 51 | * 神秘商店、周末御魂 52 | */ 53 | private String getWay; 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /crawler/src/main/java/info/xiaomo/crawler/model/ShikigamiModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.crawler.model; 2 | 3 | import info.xiaomo.core.base.BaseModel; 4 | import lombok.*; 5 | 6 | import javax.persistence.Entity; 7 | import javax.persistence.Table; 8 | 9 | /** 10 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 11 | * @created : 2016/12/24 15:09 12 | */ 13 | 14 | @Entity 15 | @Table(name = "shikigame") 16 | // lomlok 17 | @Data 18 | @ToString(callSuper = true) 19 | @EqualsAndHashCode(callSuper = false) 20 | @AllArgsConstructor 21 | @NoArgsConstructor 22 | public class ShikigamiModel extends BaseModel { 23 | 24 | /** 25 | * 名字 26 | */ 27 | private String name; 28 | 29 | /** 30 | * 图片 31 | */ 32 | private String image; 33 | 34 | /** 35 | * 声优 36 | */ 37 | private String seiyou; 38 | 39 | 40 | /** 41 | * 性别 42 | */ 43 | private String sex; 44 | 45 | /** 46 | * 星级 47 | */ 48 | private String star; 49 | 50 | /** 51 | * 获取方式 52 | */ 53 | private String getWay; 54 | 55 | 56 | /** 57 | * N/R/SR/SSR 58 | */ 59 | private String level; 60 | 61 | 62 | /** 63 | * 描述 64 | */ 65 | private String des; 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /crawler/src/main/java/info/xiaomo/crawler/schedule/ScheduledTasks.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.crawler.schedule; 2 | 3 | import info.xiaomo.core.untils.DownUtil; 4 | import info.xiaomo.crawler.model.ShikigamiModel; 5 | import info.xiaomo.crawler.service.ShikigamaService; 6 | import info.xiaomo.crawler.spider.OnnmyoujiSpider; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.scheduling.annotation.Scheduled; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.text.SimpleDateFormat; 14 | import java.util.Date; 15 | import java.util.List; 16 | 17 | /** 18 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 19 | * @created : 2016/12/24 15:59 20 | */ 21 | @Component 22 | public class ScheduledTasks { 23 | 24 | private static final Logger LOGGER = LoggerFactory.getLogger(ScheduledTasks.class); 25 | 26 | private final ShikigamaService shikigamaService; 27 | 28 | @Autowired 29 | public ScheduledTasks(ShikigamaService shikigamaService) { 30 | this.shikigamaService = shikigamaService; 31 | } 32 | 33 | 34 | @Scheduled(fixedRate = 1000 * 30) 35 | public void reportCurrentTime() { 36 | System.out.println("Scheduling Tasks Examples: The time is now " + dateFormat().format(new Date())); 37 | } 38 | 39 | //每1分钟执行一次 40 | @Scheduled(cron = "0 */1 * * * * ") 41 | public void reportCurrentByCron() { 42 | LOGGER.debug("开始执行任务:"); 43 | List shikigamiModel = OnnmyoujiSpider.getShikigamiModel(); 44 | for (ShikigamiModel model : shikigamiModel) { 45 | shikigamaService.save(model); 46 | } 47 | } 48 | 49 | @Scheduled(fixedRate = 1000) 50 | public void downImage() throws Exception { 51 | LOGGER.debug("开始执行任务:"); 52 | List shikigamiModel = shikigamaService.findAll(); 53 | for (ShikigamiModel aShikigamiModel : shikigamiModel) { 54 | String url = aShikigamiModel.getImage(); 55 | DownUtil.download(url, "D:\\yys\\"); 56 | LOGGER.debug("开始下载图片:{}", url); 57 | } 58 | } 59 | 60 | 61 | private SimpleDateFormat dateFormat() { 62 | return new SimpleDateFormat("HH:mm:ss"); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /crawler/src/main/java/info/xiaomo/crawler/service/ShikigamaService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.crawler.service; 2 | 3 | import info.xiaomo.crawler.model.ShikigamiModel; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 9 | * @created : 2016/12/24 15:54 10 | */ 11 | public interface ShikigamaService { 12 | 13 | /** 14 | * 根据名字查式神 15 | * 16 | * @param name 17 | * @return 18 | */ 19 | ShikigamiModel findByName(String name); 20 | 21 | /** 22 | * 保存 23 | * 24 | * @param model 25 | */ 26 | void save(ShikigamiModel model); 27 | 28 | /** 29 | * 查所有 30 | * 31 | * @return 32 | */ 33 | List findAll(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /crawler/src/main/java/info/xiaomo/crawler/service/impl/ShikigamaServiceImpl.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.crawler.service.impl; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import info.xiaomo.crawler.dao.ShikigamaDao; 5 | import info.xiaomo.crawler.model.ShikigamiModel; 6 | import info.xiaomo.crawler.service.ShikigamaService; 7 | import org.slf4j.Logger; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko) 15 | * @created : 2016/12/24 15:54 16 | */ 17 | @Service 18 | public class ShikigamaServiceImpl implements ShikigamaService { 19 | 20 | 21 | private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(ShikigamaServiceImpl.class); 22 | 23 | private final ShikigamaDao dao; 24 | 25 | 26 | @Autowired 27 | public ShikigamaServiceImpl(ShikigamaDao dao) { 28 | this.dao = dao; 29 | } 30 | 31 | @Override 32 | public ShikigamiModel findByName(String name) { 33 | return dao.findByName(name); 34 | } 35 | 36 | @Override 37 | public void save(ShikigamiModel model) { 38 | ShikigamiModel shikigamiModel = dao.findByName(model.getName()); 39 | if (shikigamiModel == null) { 40 | dao.save(model); 41 | LOGGER.debug("插入数据:{}", JSON.toJSONString(model)); 42 | } 43 | } 44 | 45 | @Override 46 | public List findAll() { 47 | return dao.findAll(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /crawler/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | server.max-http-header-size=20971520 4 | 5 | #datasource 6 | spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true 7 | # ?useUnicode=true&characterEncoding=UTF-8 8 | spring.datasource.username=username 9 | spring.datasource.password=password 10 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 11 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 12 | #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 13 | #spring.jackson.time-zone=GMT+8 14 | 15 | #jpa 16 | spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect 17 | spring.jpa.hibernate.ddl-auto=update 18 | spring.jpa.show-sql=true 19 | -------------------------------------------------------------------------------- /crawler/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /freemarker/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /freemarker/README.md: -------------------------------------------------------------------------------- 1 | freemarker -------------------------------------------------------------------------------- /freemarker/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | freemarker 13 | 14 | 15 | info.xiaomo 16 | core 17 | 2020.1 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-freemarker 22 | 23 | 24 | 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-maven-plugin 30 | 31 | 32 | 33 | repackage 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /freemarker/src/main/java/info/xiaomo/freemarker/FreemarkerMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.freemarker; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.autoconfigure.domain.EntityScan; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 8 | import org.springframework.context.annotation.ComponentScan; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/4/1 15:38 22 | * Copyright(©) 2015 by xiaomo. 23 | **/ 24 | @Configuration 25 | @ComponentScan("info.xiaomo") 26 | @EntityScan("info.xiaomo.*.model") 27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 28 | public class FreemarkerMain { 29 | 30 | public static void main(String[] args) throws Exception { 31 | SpringApplication.run(FreemarkerMain.class, args); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /freemarker/src/main/java/info/xiaomo/freemarker/controller/FreemarkerController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.freemarker.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.ui.ModelMap; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | /** 8 | * 把今天最好的表现当作明天最新的起点..~ 9 | * いま 最高の表現 として 明日最新の始発..~ 10 | * Today the best performance as tomorrow newest starter! 11 | 12 | * 13 | * @author : xiaomo 14 | * github: https://github.com/houko 15 | * email: xiaomo@xiaomo.info 16 | *

17 | * Date: 2016/11/16 10:19 18 | * Copyright(©) 2015 by xiaomo. 19 | **/ 20 | 21 | @Controller 22 | public class FreemarkerController { 23 | 24 | @RequestMapping("hello") 25 | public String hello(ModelMap map) { 26 | map.put("host", "使用freemarker!"); 27 | return "index"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /freemarker/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 7 | spring.jackson.time-zone=GMT+8 8 | 9 | spring.freemarker.charset=utf-8 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /freemarker/src/main/resources/config/banner-girl.txt: -------------------------------------------------------------------------------- 1 | .::::. 2 | .::::::::. 3 | ::::::::::: 4 | ..:::::::::::' 5 | '::::::::::::' 6 | .:::::::::: 7 | '::::::::::::::.. 8 | ..::::::::::::. 9 | ``:::::::::::::::: 10 | ::::``:::::::::' .:::. 11 | ::::' ':::::' .::::::::. 12 | .::::' :::: .:::::::'::::. 13 | .:::' ::::: .:::::::::' ':::::. 14 | .::' :::::.:::::::::' ':::::. 15 | .::' ::::::::::::::' ``::::. 16 | ...::: ::::::::::::' ``::. 17 | ```` ':. ':::::::::' ::::.. 18 | '.:::::' ':'````.. 19 | :: Spring Boot :: (v2.0.0.RELEASE) -------------------------------------------------------------------------------- /freemarker/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /freemarker/src/main/resources/templates/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FreeMarker模板引擎 9 |

${host}

10 | 11 | -------------------------------------------------------------------------------- /javase/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | javase 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-devtools 27 | true 28 | 29 | 30 | io.springfox 31 | springfox-swagger2 32 | 33 | 34 | io.springfox 35 | springfox-swagger-ui 36 | 37 | 38 | com.github.xiaoymin 39 | swagger-bootstrap-ui 40 | 1.5 41 | 42 | 43 | 44 | 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-maven-plugin 49 | 50 | 51 | 52 | repackage 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /javase/src/main/java/info/xiaomo/javase/controller/QuestionController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.javase.controller; 2 | 3 | import info.xiaomo.core.base.Result; 4 | import info.xiaomo.core.constant.CodeConst; 5 | import info.xiaomo.javase.model.QuestionModel; 6 | import info.xiaomo.javase.service.QuestionService; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiImplicitParam; 9 | import io.swagger.annotations.ApiImplicitParams; 10 | import io.swagger.annotations.ApiOperation; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | /** 16 | * 把今天最好的表现当作明天最新的起点..~ 17 | * いま 最高の表現 として 明日最新の始発..~ 18 | * Today the best performance as tomorrow newest starter! 19 | * 20 | * @author : xiaomo 21 | * github : https://github.com/houko 22 | * email : xiaomo@xiaomo.info 23 | * QQ : 83387856 24 | * Date : 2017/11/20 19:00 25 | * desc : 26 | * Copyright(©) 2017 by xiaomo. 27 | */ 28 | @RestController 29 | @RequestMapping("/question") 30 | @Api(value = "question", description = "question") 31 | public class QuestionController { 32 | 33 | 34 | private final QuestionService service; 35 | 36 | @Autowired 37 | public QuestionController(QuestionService service) { 38 | this.service = service; 39 | } 40 | 41 | /** 42 | * 根据id 查找用户 43 | * 44 | * @param id id 45 | * @return result 46 | */ 47 | @ApiOperation(value = "查找问题", notes = "查找问题", httpMethod = "GET") 48 | @RequestMapping(value = "findById/{id}", method = RequestMethod.GET) 49 | @ApiImplicitParams({ 50 | @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"), 51 | }) 52 | public Result findUserById(@PathVariable("id") Long id) { 53 | QuestionModel questionModel = service.findById(id); 54 | if (questionModel == null) { 55 | return new Result<>(CodeConst.NOT_FOUNT.getResultCode(), CodeConst.NOT_FOUNT.getMessage()); 56 | } 57 | return new Result<>(questionModel); 58 | } 59 | 60 | /** 61 | * 根据id 查找用户 62 | * 63 | * @return result 64 | */ 65 | @ApiOperation(value = "添加", notes = "添加", httpMethod = "POST") 66 | @RequestMapping(value = "findById/{id}", method = RequestMethod.POST) 67 | public Result addQuestion(@RequestBody QuestionModel questionModel) { 68 | boolean add = service.add(questionModel); 69 | return new Result<>(add); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /javase/src/main/java/info/xiaomo/javase/dao/QuestionDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.javase.dao; 2 | 3 | import info.xiaomo.javase.model.QuestionModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 把今天最好的表现当作明天最新的起点..~ 9 | * いま 最高の表現 として 明日最新の始発..~ 10 | * Today the best performance as tomorrow newest starter! 11 | * 12 | * @author : xiaomo 13 | * github : https://github.com/houko 14 | * email : xiaomo@xiaomo.info 15 | * QQ : 83387856 16 | * Date : 2017/11/20 19:00 17 | * desc : 18 | * Copyright(©) 2017 by xiaomo. 19 | */ 20 | @Repository 21 | public interface QuestionDao extends JpaRepository { 22 | } 23 | -------------------------------------------------------------------------------- /javase/src/main/java/info/xiaomo/javase/model/QuestionModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.javase.model; 2 | 3 | import info.xiaomo.core.base.BaseModel; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | import javax.persistence.Entity; 8 | import javax.persistence.Table; 9 | import java.io.Serializable; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | * 16 | * @author : xiaomo 17 | * github : https://github.com/houko 18 | * email : xiaomo@xiaomo.info 19 | * QQ : 83387856 20 | * Date : 2017/11/20 18:57 21 | * desc : 22 | * Copyright(©) 2017 by xiaomo. 23 | */ 24 | @EqualsAndHashCode(callSuper = true) 25 | @Entity 26 | @Table(name = "question") 27 | @Data 28 | public class QuestionModel extends BaseModel implements Serializable { 29 | /** 30 | * 问题 31 | */ 32 | private String question; 33 | // /** 34 | // * 选项 35 | // */ 36 | // private List choice; 37 | // /** 38 | // * 答案 39 | // */ 40 | // private List answer; 41 | } 42 | -------------------------------------------------------------------------------- /javase/src/main/java/info/xiaomo/javase/service/QuestionService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.javase.service; 2 | 3 | import info.xiaomo.javase.model.QuestionModel; 4 | 5 | /** 6 | * 把今天最好的表现当作明天最新的起点..~ 7 | * いま 最高の表現 として 明日最新の始発..~ 8 | * Today the best performance as tomorrow newest starter! 9 | * 10 | * @author : xiaomo 11 | * github : https://github.com/houko 12 | * email : xiaomo@xiaomo.info 13 | * QQ : 83387856 14 | * Date : 2017/11/20 19:00 15 | * desc : 16 | * Copyright(©) 2017 by xiaomo. 17 | */ 18 | public interface QuestionService { 19 | 20 | /** 21 | * 根据id查找 22 | * 23 | * @param id id 24 | * @return QuestionModel 25 | */ 26 | QuestionModel findById(Long id); 27 | 28 | /** 29 | * 添加 30 | * 31 | * @param questionModel questionModel 32 | * @return 33 | */ 34 | boolean add(QuestionModel questionModel); 35 | } 36 | -------------------------------------------------------------------------------- /javase/src/main/java/info/xiaomo/javase/service/impl/QuestionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.javase.service.impl; 2 | 3 | import info.xiaomo.javase.dao.QuestionDao; 4 | import info.xiaomo.javase.model.QuestionModel; 5 | import info.xiaomo.javase.service.QuestionService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.Optional; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | * 16 | * @author : xiaomo 17 | * github : https://github.com/houko 18 | * email : xiaomo@xiaomo.info 19 | * QQ : 83387856 20 | * Date : 2017/11/20 19:01 21 | * desc : 22 | * Copyright(©) 2017 by xiaomo. 23 | */ 24 | @Service 25 | public class QuestionServiceImpl implements QuestionService { 26 | 27 | private final QuestionDao questionDao; 28 | 29 | @Autowired 30 | public QuestionServiceImpl(QuestionDao questionDao) { 31 | this.questionDao = questionDao; 32 | } 33 | 34 | 35 | @Override 36 | public QuestionModel findById(Long id) { 37 | Optional optionalModel = questionDao.findById(id); 38 | return optionalModel.orElse(null); 39 | } 40 | 41 | @Override 42 | public boolean add(QuestionModel questionModel) { 43 | questionDao.save(questionModel); 44 | return true; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /javase/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | server.max-http-header-size=20971520 4 | #datasource 5 | spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true 6 | # ?useUnicode=true&characterEncoding=UTF-8 7 | spring.datasource.username=xiaomo 8 | spring.datasource.password=password 9 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 10 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 11 | #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 12 | #spring.jackson.time-zone=GMT+8 13 | #jpa 14 | spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect 15 | spring.jpa.hibernate.ddl-auto=update 16 | spring.jpa.show-sql=true 17 | spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 18 | # redis 19 | # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09 20 | spring.redis.database=0 21 | spring.redis.host=ip 22 | spring.redis.port=6379 23 | spring.redis.password= 24 | # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 25 | #spring.redis.pool.max-active=8 26 | ## \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 27 | #spring.redis.pool.max-wait=-1 28 | ## \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5 29 | #spring.redis.pool.max-idle=8 30 | ## \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5 31 | #spring.redis.pool.min-idle=0 32 | # \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 33 | spring.redis.timeout=0 34 | -------------------------------------------------------------------------------- /javase/src/main/resources/config/banner-girl.txt: -------------------------------------------------------------------------------- 1 | .::::. 2 | .::::::::. 3 | ::::::::::: 4 | ..:::::::::::' 5 | '::::::::::::' 6 | .:::::::::: 7 | '::::::::::::::.. 8 | ..:::::::::::::. 9 | ..:::::::::::::::. 10 | ``::::::::::::::::::: 11 | ::::``::::::::::::' .:::. 12 | ::::' ':::::' .::::::::. 13 | .::::' :::: .:::::::'::::. 14 | .:::' ::::: .:::::::::' ':::::. 15 | .::' :::::.:::::::::' ':::::. 16 | .::' ::::::::::::::' ``::::. 17 | ...::: ::::::::::::' ``::. 18 | ```` ':. ':::::::::' ::::.. 19 | '.:::::' ':'````.. 20 | :: Spring Boot :: (v2.0.0.RELEASE) -------------------------------------------------------------------------------- /javase/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mongodb/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /mongodb/README.md: -------------------------------------------------------------------------------- 1 | mongodb -------------------------------------------------------------------------------- /mongodb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | mongodb 13 | 14 | 15 | info.xiaomo 16 | core 17 | 2020.1 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-data-mongodb 22 | 23 | 24 | io.springfox 25 | springfox-swagger-ui 26 | 27 | 28 | io.springfox 29 | springfox-swagger2 30 | 31 | 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-maven-plugin 37 | 38 | 39 | 40 | repackage 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /mongodb/src/main/java/info/xiaomo/mongodb/controller/MongoUserController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mongodb.controller; 2 | 3 | import info.xiaomo.core.base.Result; 4 | import info.xiaomo.core.constant.CodeConst; 5 | import info.xiaomo.mongodb.model.MongoUser; 6 | import info.xiaomo.mongodb.service.MongoUserService; 7 | import io.swagger.annotations.Api; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/11/15 15:49 22 | * Copyright(©) 2015 by xiaomo. 23 | **/ 24 | 25 | @RestController 26 | @RequestMapping("mongodb") 27 | @Api("mongodb測試") 28 | public class MongoUserController { 29 | 30 | private final MongoUserService service; 31 | 32 | @Autowired 33 | public MongoUserController(MongoUserService service) { 34 | this.service = service; 35 | } 36 | 37 | @RequestMapping(value = "get/{id}", method = RequestMethod.GET) 38 | public Result get(@PathVariable("id") Long id) { 39 | MongoUser mongoUser = service.findById(id); 40 | return new Result<>(mongoUser); 41 | } 42 | 43 | @RequestMapping(value = "findAll", method = RequestMethod.GET) 44 | public Result findAll() { 45 | return new Result<>(service.findAll()); 46 | } 47 | 48 | 49 | @RequestMapping(value = "add", method = RequestMethod.POST) 50 | public Result add(@RequestBody MongoUser user) { 51 | return new Result<>(service.add(user)); 52 | } 53 | 54 | @RequestMapping(value = "delete/{id}", method = RequestMethod.GET) 55 | public Result delete(@PathVariable("id") Long id) { 56 | service.delete(id); 57 | return new Result<>(CodeConst.SUCCESS.getResultCode(), CodeConst.SUCCESS.getMessage()); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /mongodb/src/main/java/info/xiaomo/mongodb/dao/MongoUserDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mongodb.dao; 2 | 3 | import info.xiaomo.mongodb.model.MongoUser; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 把今天最好的表现当作明天最新的起点..~ 9 | * いま 最高の表現 として 明日最新の始発..~ 10 | * Today the best performance as tomorrow newest starter! 11 | 12 | * 13 | * @author : xiaomo 14 | * github: https://github.com/houko 15 | * email: xiaomo@xiaomo.info 16 | *

17 | * Date: 2016/11/15 15:42 18 | * Description: 用户实体类 19 | * Copyright(©) 2015 by xiaomo. 20 | **/ 21 | 22 | @Repository 23 | public interface MongoUserDao extends MongoRepository { 24 | 25 | /** 26 | * 根据字字查用户 27 | * 28 | * @param userName 29 | * @return 30 | */ 31 | MongoUser findByUserName(String userName); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mongodb/src/main/java/info/xiaomo/mongodb/model/MongoUser.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mongodb.model; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.ToString; 8 | import org.springframework.data.annotation.Id; 9 | 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/11/15 15:39 22 | * Description: 用户实体类 23 | * Copyright(©) 2015 by xiaomo. 24 | **/ 25 | 26 | @Data 27 | @ToString(callSuper = false) 28 | @NoArgsConstructor 29 | @AllArgsConstructor 30 | public class MongoUser { 31 | 32 | @Id 33 | private int id; 34 | 35 | @ApiModelProperty(value = "登录用户") 36 | private String email; 37 | 38 | @ApiModelProperty(value = "昵称") 39 | private String userName; 40 | 41 | @ApiModelProperty(value = "密码") 42 | private String password; 43 | 44 | @ApiModelProperty(value = "盐值") 45 | private String salt; 46 | 47 | @ApiModelProperty(value = "激活码") 48 | private String validateCode; 49 | 50 | @ApiModelProperty(value = "性别:1男2女0保密") 51 | private int gender = 0; 52 | 53 | @ApiModelProperty(value = "电话") 54 | private Long phone = 0L; 55 | 56 | @ApiModelProperty(value = "图片地址") 57 | private String imgUrl = ""; 58 | 59 | @ApiModelProperty(value = "地址") 60 | private String address = ""; 61 | 62 | @ApiModelProperty(value = "注册时间(时间戳)") 63 | private Long registerTime = 0L; 64 | } 65 | -------------------------------------------------------------------------------- /mongodb/src/main/java/info/xiaomo/mongodb/service/MongoUserService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mongodb.service; 2 | 3 | import info.xiaomo.mongodb.model.MongoUser; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 把今天最好的表现当作明天最新的起点..~ 9 | * いま 最高の表現 として 明日最新の始発..~ 10 | * Today the best performance as tomorrow newest starter! 11 | 12 | * 13 | * @author : xiaomo 14 | * github: https://github.com/houko 15 | * email: xiaomo@xiaomo.info 16 | *

17 | * Date: 2016/11/15 15:45 18 | * Copyright(©) 2015 by xiaomo. 19 | **/ 20 | 21 | 22 | public interface MongoUserService { 23 | 24 | /** 25 | * 查所有 26 | * 27 | * @return 28 | */ 29 | List findAll(); 30 | 31 | /** 32 | * 根据id查 33 | * 34 | * @param id 35 | * @return 36 | */ 37 | MongoUser findById(Long id); 38 | 39 | /** 40 | * 根据名字查 41 | * 42 | * @param userName 43 | * @return 44 | */ 45 | MongoUser findByName(String userName); 46 | 47 | /** 48 | * 添加 49 | * 50 | * @param mongoUser 51 | * @return 52 | */ 53 | MongoUser add(MongoUser mongoUser); 54 | 55 | /** 56 | * 删除 57 | * 58 | * @param id 59 | */ 60 | void delete(Long id); 61 | 62 | /** 63 | * 更新 64 | * 65 | * @param mongoUser 66 | * @return 67 | */ 68 | MongoUser update(MongoUser mongoUser); 69 | 70 | } 71 | -------------------------------------------------------------------------------- /mongodb/src/main/java/info/xiaomo/mongodb/service/impl/MongoUserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mongodb.service.impl; 2 | 3 | import info.xiaomo.mongodb.dao.MongoUserDao; 4 | import info.xiaomo.mongodb.model.MongoUser; 5 | import info.xiaomo.mongodb.service.MongoUserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | import java.util.Optional; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/11/15 15:45 23 | * Copyright(©) 2015 by xiaomo. 24 | **/ 25 | 26 | @Service 27 | public class MongoUserServiceImpl implements MongoUserService { 28 | private final MongoUserDao dao; 29 | 30 | @Autowired 31 | public MongoUserServiceImpl(MongoUserDao dao) { 32 | this.dao = dao; 33 | } 34 | 35 | @Override 36 | public List findAll() { 37 | return dao.findAll(); 38 | } 39 | 40 | @Override 41 | public MongoUser findById(Long id) { 42 | Optional optionalUser = dao.findById(id); 43 | return optionalUser.orElse(null); 44 | } 45 | 46 | @Override 47 | public MongoUser findByName(String userName) { 48 | return dao.findByUserName(userName); 49 | } 50 | 51 | @Override 52 | public MongoUser add(MongoUser mongoUser) { 53 | return dao.save(mongoUser); 54 | } 55 | 56 | @Override 57 | public void delete(Long id) { 58 | Optional optional = dao.findById(id); 59 | if (!optional.isPresent()) { 60 | return; 61 | } 62 | dao.delete(optional.get()); 63 | } 64 | 65 | @Override 66 | public MongoUser update(MongoUser mongoUser) { 67 | return dao.save(mongoUser); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /mongodb/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | #mongodb 7 | spring.data.mongodb.uri=mongodb://\u4F60\u7684\u5E10\u53F7:\u4F60\u7684\u5BC6\u7801@ip:27017/admin 8 | 9 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 10 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 11 | spring.jackson.time-zone=GMT+8 12 | -------------------------------------------------------------------------------- /mongodb/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /multipleSource/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /multipleSource/README.md: -------------------------------------------------------------------------------- 1 | 多数据源 -------------------------------------------------------------------------------- /multipleSource/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | multipleSource 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-jdbc 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-maven-plugin 31 | 32 | 33 | 34 | repackage 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /multipleSource/src/main/java/info/xiaomo/multiplesource/MultipleSourceMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.multiplesource; 2 | 3 | import org.springframework.beans.factory.annotation.Qualifier; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.boot.jdbc.DataSourceBuilder; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Primary; 10 | import org.springframework.jdbc.core.JdbcTemplate; 11 | 12 | import javax.sql.DataSource; 13 | 14 | /** 15 | * 把今天最好的表现当作明天最新的起点..~ 16 | * いま 最高の表現 として 明日最新の始発..~ 17 | * Today the best performance as tomorrow newest starter! 18 | 19 | * 20 | * @author : xiaomo 21 | * github: https://github.com/houko 22 | * email: xiaomo@xiaomo.info 23 | 24 | * Date: 2016/11/16 10:34 25 | * Description: 多数据源(在配置文件中自定义字段,在这里取出并创建不同的数据源) 26 | * Copyright(©) 2015 by xiaomo. 27 | **/ 28 | 29 | @SpringBootApplication 30 | public class MultipleSourceMain { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication.run(MultipleSourceMain.class, args); 34 | } 35 | 36 | 37 | /** 38 | * 第一个数据源 39 | * @return 数据源实例 40 | */ 41 | @Bean(name = "primaryDataSource") 42 | @Qualifier("primaryDataSource") 43 | @ConfigurationProperties(prefix = "spring.datasource.primary") 44 | public DataSource primaryDataSource() { 45 | return DataSourceBuilder.create().build(); 46 | } 47 | 48 | /** 49 | * 第二个数据源 50 | * @return 数据源实例 51 | */ 52 | @Bean(name = "secondaryDataSource") 53 | @Qualifier("secondaryDataSource") 54 | @Primary 55 | @ConfigurationProperties(prefix = "spring.datasource.secondary") 56 | public DataSource secondaryDataSource() { 57 | return DataSourceBuilder.create().build(); 58 | } 59 | 60 | /** 61 | * 第一个JDBC模板 62 | * @param dataSource dataSource 63 | * @return JDBC模板 64 | */ 65 | @Bean(name = "primaryJdbcTemplate") 66 | public JdbcTemplate primaryJdbcTemplate( 67 | @Qualifier("primaryDataSource") DataSource dataSource) { 68 | return new JdbcTemplate(dataSource); 69 | } 70 | 71 | /** 72 | * 第二个JDBC模板 73 | * @param dataSource dataSource 74 | * @return JDBC模板 75 | */ 76 | @Bean(name = "secondaryJdbcTemplate") 77 | public JdbcTemplate secondaryJdbcTemplate( 78 | @Qualifier("secondaryDataSource") DataSource dataSource) { 79 | return new JdbcTemplate(dataSource); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /multipleSource/src/main/java/info/xiaomo/multiplesource/controller/MultipleSourceController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.multiplesource.controller; 2 | 3 | import info.xiaomo.core.base.Result; 4 | import info.xiaomo.multiplesource.sql.Sql; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.jdbc.core.JdbcTemplate; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/11/16 10:45 22 | * Description: 用户实体类 23 | * Copyright(©) 2015 by xiaomo. 24 | **/ 25 | 26 | @RestController 27 | public class MultipleSourceController { 28 | private final JdbcTemplate jdbcTemplate1; 29 | 30 | private final JdbcTemplate jdbcTemplate2; 31 | 32 | @Autowired 33 | public MultipleSourceController(@Qualifier("primaryJdbcTemplate") JdbcTemplate jdbcTemplate1, @Qualifier("secondaryJdbcTemplate") JdbcTemplate jdbcTemplate2) { 34 | this.jdbcTemplate1 = jdbcTemplate1; 35 | this.jdbcTemplate2 = jdbcTemplate2; 36 | this.jdbcTemplate1.update(Sql.dropUser); 37 | this.jdbcTemplate2.update(Sql.dropUser); 38 | } 39 | 40 | 41 | @RequestMapping("/") 42 | public Result index() { 43 | // 往第一个数据源中插入两条数据 44 | jdbcTemplate1.update(Sql.addUser, "xiaomo", 20); 45 | jdbcTemplate2.update(Sql.addUser, "xiaoming", 30); 46 | 47 | int count1 = jdbcTemplate1.queryForObject(Sql.selectUser, Integer.class); 48 | int count2 = jdbcTemplate2.queryForObject(Sql.selectUser, Integer.class); 49 | return new Result<>(new Object[]{count1, count2}); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /multipleSource/src/main/java/info/xiaomo/multiplesource/domain/User.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.multiplesource.domain; 2 | 3 | 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | /** 9 | * @author : xiaomo 10 | */ 11 | @Data 12 | @ToString(callSuper = false) 13 | @NoArgsConstructor 14 | public class User { 15 | 16 | private Long id; 17 | 18 | private String name; 19 | 20 | private Integer age; 21 | 22 | public User(Long id, String name, Integer age) { 23 | this.id = id; 24 | this.name = name; 25 | this.age = age; 26 | } 27 | 28 | public User(String name, Integer age) { 29 | this.name = name; 30 | this.age = age; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /multipleSource/src/main/java/info/xiaomo/multiplesource/sql/Sql.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.multiplesource.sql; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | * 8 | * @author : xiaomo 9 | * github: https://github.com/houko 10 | * email: xiaomo@xiaomo.info 11 | *

12 | * Date: 2016/11/16 11:29 13 | * Description: 用户实体类 14 | * Copyright(©) 2015 by xiaomo. 15 | **/ 16 | 17 | public class Sql { 18 | 19 | public static String dropUser = "DELETE FROM user"; 20 | public static String addUser = "insert into user(name,age) values(?, ?)"; 21 | public static String selectUser = "select count(1) from user"; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /multipleSource/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 7 | spring.jackson.time-zone=GMT+8 8 | 9 | #database1 10 | spring.datasource.primary.url=jdbc:mysql://ip:3306/test1?characterEncoding=utf8&useSSL=true 11 | spring.datasource.primary.username=\u4F60\u7684\u5E10\u53F7 12 | spring.datasource.primary.password=\u4F60\u7684\u5BC6\u7801 13 | spring.datasource.primary.driver-class-name=com.mysql.cj.jdbc.Driver 14 | 15 | #database2 16 | spring.datasource.secondary.url=jdbc:mysql://ip:3306/test2?characterEncoding=utf8&useSSL=true 17 | spring.datasource.secondary.username=\u5E10\u53F7 18 | spring.datasource.secondary.password=\u4F60\u7684\u5BC6\u7801 19 | spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /multipleSource/src/main/resources/config/banner-girl.txt: -------------------------------------------------------------------------------- 1 | .::::. 2 | .::::::::. 3 | ::::::::::: 4 | ..:::::::::::' 5 | '::::::::::::' 6 | .:::::::::: 7 | '::::::::::::::.. 8 | ..::::::::::::. 9 | ``:::::::::::::::: 10 | ::::``:::::::::' .:::. 11 | ::::' ':::::' .::::::::. 12 | .::::' :::: .:::::::'::::. 13 | .:::' ::::: .:::::::::' ':::::. 14 | .::' :::::.:::::::::' ':::::. 15 | .::' ::::::::::::::' ``::::. 16 | ...::: ::::::::::::' ``::. 17 | ```` ':. ':::::::::' ::::.. 18 | '.:::::' ':'````.. 19 | :: Spring Boot :: (v2.0.0.RELEASE) -------------------------------------------------------------------------------- /multipleSource/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mybatis/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /mybatis/README.md: -------------------------------------------------------------------------------- 1 | mybatis -------------------------------------------------------------------------------- /mybatis/USER.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : xiaomo2017(106.15.188.160) 5 | Source Server Version : 50717 6 | Source Host : 106.15.188.160:3306 7 | Source Database : xiaomo 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50717 11 | File Encoding : 65001 12 | 13 | Date: 2017-09-06 17:45:51 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for USER 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `USER`; 22 | CREATE TABLE `USER` ( 23 | `id` bigint(20) DEFAULT NULL, 24 | `name` varchar(255) DEFAULT NULL, 25 | `age` int(11) DEFAULT NULL 26 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 27 | 28 | -- ---------------------------- 29 | -- Records of USER 30 | -- ---------------------------- 31 | INSERT INTO `USER` VALUES ('1', 'xiaomo', '25'); 32 | -------------------------------------------------------------------------------- /mybatis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | mybatis 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.mybatis.spring.boot 22 | mybatis-spring-boot-starter 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-maven-plugin 31 | 32 | 33 | 34 | repackage 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /mybatis/src/main/java/info/xiaomo/mybatis/MybatisMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mybatis; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.autoconfigure.domain.EntityScan; 6 | import org.springframework.context.annotation.ComponentScan; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * 把今天最好的表现当作明天最新的起点..~ 11 | * いま 最高の表現 として 明日最新の始発..~ 12 | * Today the best performance as tomorrow newest starter! 13 | 14 | * 15 | * @author : xiaomo 16 | * github: https://github.com/houko 17 | * email: xiaomo@xiaomo.info 18 | *

19 | * Date: 2016/4/1 15:38 20 | * Copyright(©) 2015 by xiaomo. 21 | **/ 22 | @Configuration 23 | @EnableAutoConfiguration 24 | @ComponentScan("info.xiaomo") 25 | @EntityScan("info.xiaomo.*.model") 26 | public class MybatisMain { 27 | 28 | public static void main(String[] args) throws Exception { 29 | SpringApplication.run(MybatisMain.class, args); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /mybatis/src/main/java/info/xiaomo/mybatis/controller/MybatisUserController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mybatis.controller; 2 | 3 | import info.xiaomo.core.base.Result; 4 | import info.xiaomo.mybatis.domain.User; 5 | import info.xiaomo.mybatis.mapper.UserMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/11/16 9:41 23 | * Description: 用户实体类 24 | * Copyright(©) 2015 by xiaomo. 25 | **/ 26 | 27 | @RestController 28 | public class MybatisUserController { 29 | 30 | private final UserMapper userMapper; 31 | 32 | @Autowired 33 | public MybatisUserController(UserMapper userMapper) { 34 | this.userMapper = userMapper; 35 | } 36 | 37 | 38 | @RequestMapping("/") 39 | public Result> findAll() { 40 | List all = userMapper.findAll(); 41 | return new Result<>(all); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /mybatis/src/main/java/info/xiaomo/mybatis/domain/User.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mybatis.domain; 2 | 3 | 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | /** 9 | * @author : xiaomo 10 | */ 11 | @Data 12 | @ToString(callSuper = false) 13 | @NoArgsConstructor 14 | public class User { 15 | 16 | private Long id; 17 | 18 | private String name; 19 | 20 | private Integer age; 21 | 22 | public User(Long id, String name, Integer age) { 23 | this.id = id; 24 | this.name = name; 25 | this.age = age; 26 | } 27 | 28 | public User(String name, Integer age) { 29 | this.name = name; 30 | this.age = age; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mybatis/src/main/java/info/xiaomo/mybatis/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.mybatis.mapper; 2 | 3 | 4 | import info.xiaomo.mybatis.domain.User; 5 | import org.apache.ibatis.annotations.*; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * @author : xiaomo 13 | */ 14 | @Mapper 15 | @Repository 16 | public interface UserMapper { 17 | 18 | @Results({ 19 | @Result(property = "name", column = "name"), 20 | @Result(property = "age", column = "age") 21 | }) 22 | 23 | /** 24 | * 根据名字查 25 | * @param name 26 | * @return user 27 | */ 28 | @Select("SELECT * FROM USER WHERE NAME = #{name}") 29 | User findByName(@Param("name") String name); 30 | 31 | /** 32 | * 插入 33 | * 34 | * @param name 35 | * @param age 36 | * @return 37 | */ 38 | @Insert("INSERT INTO USER(NAME, AGE) VALUES(#{name}, #{age})") 39 | int insert(@Param("name") String name, @Param("age") Integer age); 40 | 41 | /** 42 | * 查所有 43 | * 44 | * @return 45 | */ 46 | @Select("SELECT * FROM USER WHERE 1=1") 47 | List findAll(); 48 | 49 | /** 50 | * 更新 51 | * 52 | * @param user 53 | */ 54 | @Update("UPDATE USER SET age=#{age} WHERE name=#{name}") 55 | void update(User user); 56 | 57 | /** 58 | * 删除 59 | * 60 | * @param id 61 | */ 62 | @Delete("DELETE FROM USER WHERE id =#{id}") 63 | void delete(Long id); 64 | 65 | /** 66 | * 添加 67 | * 68 | * @param user 69 | * @return 70 | */ 71 | @Insert("INSERT INTO USER(name, age) VALUES(#{name}, #{age})") 72 | int insertByUser(User user); 73 | 74 | /** 75 | * 添加 76 | * 77 | * @param map 78 | * @return 79 | */ 80 | @Insert("INSERT INTO user(name, age) VALUES(#{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER})") 81 | int insertByMap(Map map); 82 | 83 | } -------------------------------------------------------------------------------- /mybatis/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 7 | spring.jackson.time-zone=GMT+8 8 | 9 | 10 | #database 11 | spring.datasource.url=jdbc:mysql://ip:3306/db?characterEncoding=utf8&useSSL=true 12 | spring.datasource.username=username 13 | spring.datasource.password=password 14 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mybatis/src/main/resources/config/banner-girl.txt: -------------------------------------------------------------------------------- 1 | .::::. 2 | .::::::::. 3 | ::::::::::: 4 | ..:::::::::::' 5 | '::::::::::::' 6 | .:::::::::: 7 | '::::::::::::::.. 8 | ..::::::::::::. 9 | ``:::::::::::::::: 10 | ::::``:::::::::' .:::. 11 | ::::' ':::::' .::::::::. 12 | .::::' :::: .:::::::'::::. 13 | .:::' ::::: .:::::::::' ':::::. 14 | .::' :::::.:::::::::' ':::::. 15 | .::' ::::::::::::::' ``::::. 16 | ...::: ::::::::::::' ``::. 17 | ```` ':. ':::::::::' ::::.. 18 | '.:::::' ':'````.. 19 | :: Spring Boot :: (v2.0.0.RELEASE) -------------------------------------------------------------------------------- /mybatis/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /order/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | order 13 | 14 | 15 | info.xiaomo 16 | core 17 | 2020.1 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-devtools 22 | true 23 | 24 | 25 | io.springfox 26 | springfox-swagger2 27 | 28 | 29 | io.springfox 30 | springfox-swagger-ui 31 | 32 | 33 | com.google.zxing 34 | javase 35 | 3.2.1 36 | 37 | 38 | com.google.zxing 39 | core 40 | 3.3.3 41 | 42 | 43 | 44 | com.github.xiaoymin 45 | swagger-bootstrap-ui 46 | 1.5 47 | 48 | 49 | 50 | 51 | 52 | 53 | org.springframework.boot 54 | spring-boot-maven-plugin 55 | 56 | 57 | 58 | repackage 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /order/src/main/java/info/xiaomo/order/OrderMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.order; 2 | 3 | import io.swagger.annotations.ApiOperation; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.domain.EntityScan; 7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 8 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.ComponentScan; 11 | import org.springframework.context.annotation.Configuration; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestMethod; 15 | import org.springframework.web.servlet.ModelAndView; 16 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 17 | import springfox.documentation.annotations.ApiIgnore; 18 | import springfox.documentation.builders.ApiInfoBuilder; 19 | import springfox.documentation.builders.PathSelectors; 20 | import springfox.documentation.builders.RequestHandlerSelectors; 21 | import springfox.documentation.service.ApiInfo; 22 | import springfox.documentation.spi.DocumentationType; 23 | import springfox.documentation.spring.web.plugins.Docket; 24 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 25 | 26 | 27 | /** 28 | * @author xiaomo 29 | */ 30 | @Configuration 31 | @ComponentScan("info.xiaomo") 32 | @EntityScan("info.xiaomo.*.model") 33 | @EnableSwagger2 34 | @Controller 35 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 36 | public class OrderMain implements WebMvcConfigurer { 37 | 38 | public static void main(String[] args) { 39 | SpringApplication.run(OrderMain.class, args); 40 | } 41 | 42 | /** 43 | * 接口 44 | * 45 | * @return 接口 46 | */ 47 | @RequestMapping(value = "/", method = RequestMethod.GET) 48 | @ApiIgnore() 49 | @ApiOperation(value = "重定向到api首页") 50 | public ModelAndView api() { 51 | return new ModelAndView("redirect:/swagger-ui.html"); 52 | } 53 | 54 | 55 | @Bean 56 | public Docket createRestApi() { 57 | return new Docket(DocumentationType.SWAGGER_2) 58 | .apiInfo(apiInfo()) 59 | .select() 60 | .apis(RequestHandlerSelectors.basePackage("info.xiaomo.order")) 61 | .paths(PathSelectors.any()) 62 | .build(); 63 | } 64 | 65 | private ApiInfo apiInfo() { 66 | return new ApiInfoBuilder() 67 | .title("Spring Boot中使用Swagger2构建RESTful APIs") 68 | .contact("小莫") 69 | .version("1.0") 70 | .build(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /order/src/main/java/info/xiaomo/order/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.order.controller; 2 | 3 | import info.xiaomo.core.base.Result; 4 | import info.xiaomo.order.service.OrderService; 5 | import io.swagger.annotations.*; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.MediaType; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | 14 | /** 15 | * @author xiaomo 16 | */ 17 | @RestController 18 | @RequestMapping("/order") 19 | @Api(value = "识别订单") 20 | public class OrderController { 21 | 22 | private final OrderService service; 23 | 24 | @Autowired 25 | public OrderController(OrderService orderService) { 26 | this.service = orderService; 27 | } 28 | 29 | 30 | @RequestMapping(value = "forbid/{id}", method = RequestMethod.GET) 31 | @ApiOperation(value = "封号", notes = "根据传入的id对修改对应帐号状态", httpMethod = "GET") 32 | @ApiImplicitParams({ 33 | @ApiImplicitParam(name = "id", value = "后台用户唯一id", required = true, dataType = "Long", paramType = "path") 34 | }) 35 | @ApiResponses(value = { 36 | @ApiResponse(code = 404, message = "Not Found"), 37 | @ApiResponse(code = 400, message = "No Name Provided"), 38 | }) 39 | public Result forbid(@PathVariable("id") Long id) { 40 | return new Result<>(null); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /order/src/main/java/info/xiaomo/order/model/OrderModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.order.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | import lombok.*; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | import java.io.Serializable; 11 | 12 | /** 13 | * │\__╭╭╭╭╭__/│ 14 | * │         │ 15 | * │         │ 16 | * │ -      -│ 17 | * │≡    o ≡ │ 18 | * │         │ 19 | * ╰——┬O◤▽◥O┬——╯ 20 | * |  o  | 21 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 22 | * いま 最高の表現 として 明日最新の始発..~ 23 | * Today the best performance as tomorrow newest starter! 24 | 25 | * 26 | * @author : xiaomo 27 | * github: https://github.com/houko 28 | * email: xiaomo@xiaomo.info 29 | *

30 | * Date: 16/4/2 12:39 31 | * Copyright(©) 2015 by xiaomo. 32 | */ 33 | @Entity 34 | @Table(name = "adminUser") 35 | @Data 36 | @ToString(callSuper = true) 37 | @EqualsAndHashCode(callSuper = false) 38 | @AllArgsConstructor 39 | @NoArgsConstructor 40 | public class OrderModel extends BaseModel implements Serializable { 41 | 42 | @Column(name = "UserName") 43 | private String userName; 44 | 45 | @Column(name = "Password") 46 | private String password; 47 | 48 | @Column(name = "Status") 49 | private int status = 1; 50 | 51 | @Column(name = "Salt") 52 | private String salt; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /order/src/main/java/info/xiaomo/order/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.order.service; 2 | 3 | /** 4 | * @author xiaomo 5 | */ 6 | public interface OrderService { 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /order/src/main/java/info/xiaomo/order/service/impl/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.order.service.impl; 2 | 3 | import info.xiaomo.order.service.OrderService; 4 | import org.springframework.stereotype.Service; 5 | 6 | /** 7 | * @author xiaomo 8 | */ 9 | @Service 10 | public class OrderServiceImpl implements OrderService { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /rabbitmq/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /rabbitmq/README.md: -------------------------------------------------------------------------------- 1 | 消息队列 -------------------------------------------------------------------------------- /rabbitmq/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | rabbitmq 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-amqp 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-maven-plugin 32 | 33 | 34 | 35 | repackage 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /rabbitmq/src/main/java/info/xiaomo/rabbitmq/RabbitMqMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.rabbitmq; 2 | 3 | import org.springframework.amqp.core.Queue; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.ComponentScan; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.scheduling.annotation.EnableScheduling; 12 | 13 | /** 14 | * 把今天最好的表现当作明天最新的起点..~ 15 | * いま 最高の表現 として 明日最新の始発..~ 16 | * Today the best performance as tomorrow newest starter! 17 | 18 | *

19 | * 20 | * @author : xiaomo 21 | * github: https://github.com/houko 22 | * email: xiaomo@xiaomo.info 23 | *

24 | * Date: 2016/4/1 15:38 25 | * Description: RabbitMq启动器 26 | * Copyright(©) 2015 by xiaomo. 27 | **/ 28 | @Configuration 29 | @ComponentScan("info.xiaomo") 30 | @EnableScheduling 31 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 32 | public class RabbitMqMain { 33 | public static void main(String[] args) throws Exception { 34 | SpringApplication.run(RabbitMqMain.class, args); 35 | } 36 | 37 | @Bean 38 | public Queue helloQueue() { 39 | return new Queue("hello"); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /rabbitmq/src/main/java/info/xiaomo/rabbitmq/config/Receiver.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.rabbitmq.config; 2 | 3 | import org.springframework.amqp.rabbit.annotation.RabbitHandler; 4 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * @author : xiaomo 9 | */ 10 | @Component 11 | @RabbitListener(queues = "hello") 12 | public class Receiver { 13 | 14 | @RabbitHandler 15 | public void process(String hello) { 16 | System.out.println("Receiver : " + hello); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /rabbitmq/src/main/java/info/xiaomo/rabbitmq/config/Sender.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.rabbitmq.config; 2 | 3 | import org.springframework.amqp.core.AmqpTemplate; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * @author : xiaomo 11 | */ 12 | @Component 13 | public class Sender { 14 | 15 | private final AmqpTemplate rabbitTemplate; 16 | 17 | @Autowired 18 | public Sender(AmqpTemplate rabbitTemplate) { 19 | this.rabbitTemplate = rabbitTemplate; 20 | } 21 | 22 | public void send() { 23 | String context = "hello " + new Date(); 24 | System.out.println("Sender : " + context); 25 | this.rabbitTemplate.convertAndSend("hello", context); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /rabbitmq/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 7 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 8 | spring.jackson.time-zone=GMT+8 9 | 10 | # rabbitmq 11 | spring.application.name=rabbitmq-\u4F60\u7684\u5BC6\u7801 12 | spring.rabbitmq.host=ip 13 | spring.rabbitmq.port=5672 14 | spring.rabbitmq.username=\u4F60\u7684\u5BC6\u7801 15 | spring.rabbitmq.password=\u4F60\u7684\u5BC6\u7801 -------------------------------------------------------------------------------- /rabbitmq/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /rabbitmq/src/test/java/test/RabbitMqTests.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import info.xiaomo.rabbitmq.config.Sender; 4 | import org.junit.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | 7 | public class RabbitMqTests { 8 | 9 | @Autowired() 10 | private Sender sender; 11 | 12 | @Test 13 | public void hello() throws Exception { 14 | sender.send(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /redis/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /redis/README.md: -------------------------------------------------------------------------------- 1 | redis -------------------------------------------------------------------------------- /redis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | redis 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-redis 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-maven-plugin 32 | 33 | 34 | 35 | repackage 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /redis/src/main/java/info/xiaomo/redis/RedisMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.redis; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 7 | import org.springframework.cache.annotation.EnableCaching; 8 | import org.springframework.context.annotation.ComponentScan; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.scheduling.annotation.EnableScheduling; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/1 15:38 23 | * Description: Redis启动器 24 | * Copyright(©) 2015 by xiaomo. 25 | **/ 26 | @Configuration 27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 28 | @ComponentScan("info.xiaomo") 29 | @EnableCaching 30 | @EnableScheduling 31 | public class RedisMain { 32 | public static void main(String[] args) throws Exception { 33 | SpringApplication.run(RedisMain.class, args); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /redis/src/main/java/info/xiaomo/redis/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.redis.controller; 2 | 3 | import info.xiaomo.core.base.Result; 4 | import info.xiaomo.redis.dao.CommonRedisDao; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/11/14 17:25 22 | * Copyright(©) 2015 by xiaomo. 23 | **/ 24 | 25 | @RestController 26 | @RequestMapping("/redis") 27 | public class TestController { 28 | 29 | private final CommonRedisDao dao; 30 | 31 | @Autowired 32 | public TestController(CommonRedisDao dao) { 33 | this.dao = dao; 34 | } 35 | 36 | @RequestMapping(value = "get/{key}", method = RequestMethod.GET) 37 | public Result find(@PathVariable("key") String key) { 38 | String value = dao.getValue(key); 39 | return new Result<>(value); 40 | } 41 | 42 | @RequestMapping(value = "add/{key}/{value}", method = RequestMethod.GET) 43 | public Result add(@PathVariable("value") String value, @PathVariable("key") String key) { 44 | return new Result<>(dao.cacheValue(key, value)); 45 | } 46 | 47 | @RequestMapping(value = "del/{key}", method = RequestMethod.GET) 48 | public Result del(@PathVariable("key") String key) { 49 | return new Result<>(dao.removeValue(key)); 50 | } 51 | 52 | @RequestMapping(value = "count/{key}", method = RequestMethod.GET) 53 | public Result count(@PathVariable("key") String key) { 54 | return new Result<>(dao.getListSize(key)); 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /redis/src/main/java/info/xiaomo/redis/job/TaskJob.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.redis.job; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import info.xiaomo.redis.model.CityInfo; 5 | import info.xiaomo.redis.service.CityService; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.scheduling.annotation.Scheduled; 10 | import org.springframework.stereotype.Component; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | import java.util.Random; 15 | 16 | /** 17 | * @author : xiaomo 18 | */ 19 | @Component 20 | public class TaskJob { 21 | 22 | private static final Logger LOGGER = LoggerFactory.getLogger(TaskJob.class); 23 | private static final List LIST = Arrays.asList("北京市", "上海市", "天津市", "重庆市", "河北省", "山西省", "内蒙古自治区", "辽宁省", 24 | "吉林省", "黑龙江", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省", "湖北省", "湖南省", "广东省", "广西自治区", "海南省", "四川省", 25 | "贵州省", "云南省", "西藏自治区", "陕西省", "甘肃省", "青海省", "宁夏自治区", "新疆自治区", "香港特别行政区", "澳门特别行政区", "台湾省"); 26 | private final CityService cityService; 27 | 28 | @Autowired 29 | public TaskJob(CityService cityService) { 30 | this.cityService = cityService; 31 | } 32 | 33 | /** 34 | * Job 35 | */ 36 | @Scheduled(fixedDelay = 5000) 37 | public void retrieveCountry() { 38 | int index = new Random().nextInt(LIST.size()); 39 | String city = find(index); 40 | CityInfo info = cityService.getCity(index, city); 41 | LOGGER.debug("{}", JSON.toJSONString(info)); 42 | } 43 | 44 | private String find(int index) { 45 | return LIST.get(index); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /redis/src/main/java/info/xiaomo/redis/model/CityInfo.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.redis.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author : xiaomo 7 | */ 8 | public class CityInfo implements Serializable { 9 | private static final long serialVersionUID = 2845294956907027149L; 10 | 11 | private int id; 12 | private String city; 13 | 14 | public CityInfo() { 15 | 16 | } 17 | 18 | public CityInfo(int id, String city) { 19 | this.id = id; 20 | this.city = city; 21 | } 22 | 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | public void setId(int id) { 28 | this.id = id; 29 | } 30 | 31 | public String getCity() { 32 | return city; 33 | } 34 | 35 | public void setCity(String city) { 36 | this.city = city; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /redis/src/main/java/info/xiaomo/redis/service/CityService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.redis.service; 2 | 3 | import info.xiaomo.redis.model.CityInfo; 4 | import org.springframework.cache.annotation.CacheConfig; 5 | import org.springframework.cache.annotation.Cacheable; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @author : xiaomo 10 | */ 11 | @Component 12 | @CacheConfig(cacheNames = "CityService") 13 | public class CityService { 14 | 15 | @Cacheable 16 | public CityInfo getCity(int id, String city) { 17 | return new CityInfo(id, city); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /redis/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | # redis 7 | # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09 8 | spring.redis.database=0 9 | spring.redis.host=ip 10 | spring.redis.port=6379 11 | # Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 12 | spring.redis.password= 13 | # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 14 | spring.redis.pool.max-active=8 15 | # \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 16 | spring.redis.pool.max-wait=-1 17 | spring.redis.pool.max-idle=8 18 | spring.redis.pool.min-idle=0 19 | spring.redis.timeout=0 -------------------------------------------------------------------------------- /redis/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /scheduled/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /scheduled/README.md: -------------------------------------------------------------------------------- 1 | 定时任务 -------------------------------------------------------------------------------- /scheduled/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | scheduled 13 | 14 | 15 | info.xiaomo 16 | core 17 | 2020.1 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-maven-plugin 28 | 29 | 30 | 31 | repackage 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /scheduled/src/main/java/info/xiaomo/scheduled/ScheduledMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.scheduled; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 7 | import org.springframework.context.annotation.ComponentScan; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.scheduling.annotation.EnableAsync; 10 | import org.springframework.scheduling.annotation.EnableScheduling; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/1 15:31 23 | * Description: 任务启动器 24 | * Copyright(©) 2015 by xiaomo. 25 | **/ 26 | @Configuration 27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 28 | @ComponentScan("info.xiaomo") 29 | @EnableScheduling 30 | @EnableAsync 31 | public class ScheduledMain { 32 | public static void main(String[] args) { 33 | SpringApplication.run(ScheduledMain.class, args); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /scheduled/src/main/java/info/xiaomo/scheduled/task/ScheduledTasks.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.scheduled.task; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.scheduling.annotation.Scheduled; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.text.SimpleDateFormat; 8 | 9 | /** 10 | * @author : xiaomo 11 | */ 12 | @Component 13 | @Slf4j 14 | public class ScheduledTasks { 15 | 16 | private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss"); 17 | 18 | // 定义某个定时任务 19 | @Scheduled(fixedRate = 5000) 20 | public void reportCurrentTime() { 21 | log.debug("每5秒钟执行一次,注意观察日志时间"); 22 | } 23 | 24 | 25 | /** 26 | * 字段 允许值 允许的特殊字符 27 | * 秒 0-59 , - * / 28 | * 分 0-59 , - * / 29 | * 小时 0-23 , - * / 30 | * 日期 1-31 , - * / L W C 31 | * 月份 1-12 或者 JAN-DEC , - * / 32 | * 星期 1-7 或者 SUN-SAT , - * / L C # 33 | * 年(可选) 留空, 1970-2099 , - * / 34 | *

35 | * “*”字符被用来指定所有的值。如:”*“在分钟的字段域里表示“每分钟”。 36 | * “-”字符被用来指定一个范围。如:“10-12”在小时域意味着“10点、11点、12点”。 37 | * “,”字符被用来指定另外的值。如:“MON,WED,FRI”在星期域里表示”星期一、星期三、星期五”. 38 | * “?”字符只在日期域和星期域中使用。它被用来指定“非明确的值”。当你需要通过在这两个域中的一个来指定一些东西的时候,它是有用的。看下面的例子你就会明白。 39 | * “L”字符指定在月或者星期中的某天(最后一天)。即“Last ”的缩写。但是在星期和月中“L”表示不同的意思,如:在月子段中“L”指月份的最后一天-1月31日,2月28日,如果在星期字段中则简单的表示为“7”或者“SAT”。如果在星期字段中在某个value值得后面,则表示“某月的最后一个星期value”,如“6L”表示某月的最后一个星期五。 40 | * “W”字符只能用在月份字段中,该字段指定了离指定日期最近的那个星期日。 41 | * “#”字符只能用在星期字段,该字段指定了第几个星期value在某月中 42 | **/ 43 | //每1分钟执行一次 44 | @Scheduled(cron = "0 */1 * * * * ") 45 | public void reportCurrentByCron() { 46 | log.debug("每分钟执行一次,注意观察日志时间"); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /scheduled/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 7 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 8 | spring.jackson.time-zone=GMT+8 9 | -------------------------------------------------------------------------------- /scheduled/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /screenshot/SpringBootUnity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/SpringBootUnity.png -------------------------------------------------------------------------------- /screenshot/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/api.png -------------------------------------------------------------------------------- /screenshot/bootstrap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/bootstrap.png -------------------------------------------------------------------------------- /screenshot/crawler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/crawler.png -------------------------------------------------------------------------------- /screenshot/interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/interface.png -------------------------------------------------------------------------------- /screenshot/lombok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/lombok.png -------------------------------------------------------------------------------- /screenshot/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/run.png -------------------------------------------------------------------------------- /screenshot/spring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/spring.png -------------------------------------------------------------------------------- /screenshot/support.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/support.png -------------------------------------------------------------------------------- /screenshot/swagger-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/swagger-ui.png -------------------------------------------------------------------------------- /screenshot/yys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/screenshot/yys.png -------------------------------------------------------------------------------- /security/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /security/README.md: -------------------------------------------------------------------------------- 1 | 安全 -------------------------------------------------------------------------------- /security/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | security 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-security 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-thymeleaf 27 | 28 | 29 | 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-maven-plugin 35 | 36 | 37 | 38 | repackage 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /security/src/main/java/info/xiaomo/security/SecurityMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.security; 2 | 3 | 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 7 | import org.springframework.boot.autoconfigure.domain.EntityScan; 8 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 9 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 10 | import org.springframework.context.annotation.ComponentScan; 11 | import org.springframework.context.annotation.Configuration; 12 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 13 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 14 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 15 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 16 | 17 | /** 18 | * 把今天最好的表现当作明天最新的起点..~ 19 | * いま 最高の表現 として 明日最新の始発..~ 20 | * Today the best performance as tomorrow newest starter! 21 | 22 | * 23 | * @author : xiaomo 24 | * github: https://github.com/houko 25 | * email: xiaomo@xiaomo.info 26 | *

27 | * Date: 2016/4/1 15:38 28 | * Description: RabbitMq启动器 29 | * Copyright(©) 2015 by xiaomo. 30 | **/ 31 | @Configuration 32 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 33 | @ComponentScan("info.xiaomo") 34 | @EntityScan("info.xiaomo.*.model") 35 | @EnableWebSecurity 36 | public class SecurityMain extends WebSecurityConfigurerAdapter { 37 | public static void main(String[] args) throws Exception { 38 | SpringApplication.run(SecurityMain.class, args); 39 | } 40 | 41 | @Override 42 | protected void configure(HttpSecurity http) throws Exception { 43 | http.authorizeRequests() 44 | .antMatchers("/", "/home").permitAll() 45 | .anyRequest().authenticated() 46 | .and() 47 | .formLogin() 48 | .loginPage("/login") 49 | .permitAll() 50 | .and() 51 | .logout() 52 | .permitAll(); 53 | } 54 | 55 | @Autowired 56 | public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { 57 | auth.inMemoryAuthentication() 58 | .withUser("test").password("test").roles("USER"); 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /security/src/main/java/info/xiaomo/security/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.security.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RequestMethod; 6 | 7 | /** 8 | * @author : xiaomo 9 | */ 10 | @Controller 11 | public class HelloController { 12 | 13 | @RequestMapping("/") 14 | public String index() { 15 | return "index"; 16 | } 17 | 18 | @RequestMapping("/hello") 19 | public String hello() { 20 | return "hello"; 21 | } 22 | 23 | @RequestMapping(value = "/login", method = RequestMethod.GET) 24 | public String login() { 25 | return "login"; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /security/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 7 | spring.jackson.time-zone=GMT+8 8 | -------------------------------------------------------------------------------- /security/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /security/src/main/resources/templates/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Hello World! 6 | 7 | 8 |

Hello [[${#httpServletRequest.remoteUser}]]!

9 |
10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /security/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Spring Security入门 6 | 7 | 8 |

欢迎使用Spring Security!

9 | 10 |

点击 这里 打个招呼吧

11 | 12 | -------------------------------------------------------------------------------- /security/src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Spring Security Example 7 | 8 | 9 |
10 | 用户名或密码错 11 |
12 |
13 | 您已注销成功 14 |
15 |
16 |
17 |
18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /socket/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /socket/README.md: -------------------------------------------------------------------------------- 1 | socket -------------------------------------------------------------------------------- /socket/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | socket 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-websocket 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-maven-plugin 32 | 33 | 34 | 35 | repackage 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /socket/src/main/java/info/xiaomo/chat/ChatMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.chat; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.autoconfigure.domain.EntityScan; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.ComponentScan; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.web.socket.server.standard.ServerEndpointExporter; 12 | 13 | /** 14 | * 把今天最好的表现当作明天最新的起点..~ 15 | * いま 最高の表現 として 明日最新の始発..~ 16 | * Today the best performance as tomorrow newest starter! 17 | 18 | * 19 | * @author : xiaomo 20 | * github: https://github.com/houko 21 | * email: xiaomo@xiaomo.info 22 | *

23 | * Date: 2016/4/1 15:38 24 | * Description: 后台管理启动器 25 | * Copyright(©) 2015 by xiaomo. 26 | **/ 27 | @Configuration 28 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 29 | @ComponentScan("info.xiaomo") 30 | @EntityScan("info.xiaomo.*.model") 31 | public class ChatMain { 32 | 33 | public static void main(String[] args) throws Exception { 34 | SpringApplication.run(ChatMain.class, args); 35 | } 36 | 37 | 38 | @Bean 39 | public ServerEndpointExporter serverEndpointExporter() { 40 | return new ServerEndpointExporter(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /socket/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8081 3 | 4 | server.max-http-header-size=20971520 5 | 6 | 7 | -------------------------------------------------------------------------------- /socket/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /socket/src/main/resources/public/image/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/socket/src/main/resources/public/image/avatar.png -------------------------------------------------------------------------------- /socket/src/main/resources/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 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 | 57 | 58 | -------------------------------------------------------------------------------- /thymeleaf/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /thymeleaf/README.md: -------------------------------------------------------------------------------- 1 | velocity -------------------------------------------------------------------------------- /thymeleaf/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | thymeleaf 13 | 14 | 15 | info.xiaomo 16 | core 17 | 2020.1 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-thymeleaf 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-maven-plugin 31 | 32 | 33 | 34 | repackage 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /thymeleaf/src/main/java/info/xiaomo/thymeleaf/ThymeleafMain.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.thymeleaf; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.autoconfigure.domain.EntityScan; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; 8 | import org.springframework.context.annotation.ComponentScan; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/12/1 15:38 22 | * Copyright(©) 2015 by xiaomo. 23 | **/ 24 | @Configuration 25 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 26 | @ComponentScan("info.xiaomo") 27 | @EntityScan("info.xiaomo.*.model") 28 | public class ThymeleafMain { 29 | 30 | public static void main(String[] args) throws Exception { 31 | SpringApplication.run(ThymeleafMain.class, args); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /thymeleaf/src/main/java/info/xiaomo/thymeleaf/controller/ThymeleafController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.thymeleaf.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.ui.ModelMap; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | /** 8 | * 把今天最好的表现当作明天最新的起点..~ 9 | * いま 最高の表現 として 明日最新の始発..~ 10 | * Today the best performance as tomorrow newest starter! 11 | 12 | * 13 | * @author : xiaomo 14 | * github: https://github.com/houko 15 | * email: xiaomo@xiaomo.info 16 | *

17 | * Date: 2016/11/16 10:19 18 | * Copyright(©) 2015 by xiaomo. 19 | **/ 20 | 21 | @Controller 22 | public class ThymeleafController { 23 | 24 | @RequestMapping("/") 25 | public String hello(ModelMap map) { 26 | map.put("hello", "使用thymeleaf!"); 27 | return "index"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /thymeleaf/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 7 | spring.jackson.time-zone=GMT+8 8 | 9 | -------------------------------------------------------------------------------- /thymeleaf/src/main/resources/config/banner-girl.txt: -------------------------------------------------------------------------------- 1 | .::::. 2 | .::::::::. 3 | ::::::::::: 4 | ..:::::::::::' 5 | '::::::::::::' 6 | .:::::::::: 7 | '::::::::::::::.. 8 | ..::::::::::::. 9 | ``:::::::::::::::: 10 | ::::``:::::::::' .:::. 11 | ::::' ':::::' .::::::::. 12 | .::::' :::: .:::::::'::::. 13 | .:::' ::::: .:::::::::' ':::::. 14 | .::' :::::.:::::::::' ':::::. 15 | .::' ::::::::::::::' ``::::. 16 | ...::: ::::::::::::' ``::. 17 | ```` ':. ':::::::::' ::::.. 18 | '.:::::' ':'````.. 19 | :: Spring Boot :: (v2.0.0.RELEASE) -------------------------------------------------------------------------------- /thymeleaf/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /thymeleaf/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Hello World! 6 | 7 | 8 |

Hello.v.2

9 |

10 | 11 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | 我的网站 -------------------------------------------------------------------------------- /website/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | xiaomo 7 | info.xiaomo 8 | 2020.1 9 | 10 | 4.0.0 11 | 12 | website 13 | 14 | 15 | 16 | info.xiaomo 17 | core 18 | 2020.1 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-freemarker 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-devtools 31 | true 32 | 33 | 34 | io.springfox 35 | springfox-swagger2 36 | 37 | 38 | io.springfox 39 | springfox-swagger-ui 40 | 41 | 42 | com.github.xiaoymin 43 | swagger-bootstrap-ui 44 | 1.5 45 | 46 | 47 | org.springframework 48 | spring-webmvc 49 | 50 | 51 | org.projectlombok 52 | lombok 53 | 54 | 55 | org.springframework.boot 56 | spring-boot-starter-web 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.springframework.boot 64 | spring-boot-maven-plugin 65 | 66 | 67 | 68 | repackage 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/controller/MailController.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.controller; 2 | 3 | import info.xiaomo.website.util.MailUtil; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RequestMethod; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | /** 9 | * 把今天最好的表现当作明天最新的起点..~ 10 | * いま 最高の表現 として 明日最新の始発..~ 11 | * Today the best performance as tomorrow newest starter! 12 | 13 | * 14 | * @author : xiaomo 15 | * github: https://github.com/houko 16 | * email: xiaomo@xiaomo.info 17 | *

18 | * Date: 2016/11/14 11:06 19 | * Description: 用户实体类 20 | * Copyright(©) 2015 by xiaomo. 21 | **/ 22 | 23 | @RestController 24 | @RequestMapping("/mail") 25 | public class MailController { 26 | 27 | @RequestMapping(value = "/send", method = RequestMethod.GET) 28 | public boolean sendMail() { 29 | return MailUtil.send("hupengbest@163.com", "测试邮件是否正常", "测试"); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/dao/AdminUserDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.dao; 2 | 3 | import info.xiaomo.website.model.AdminModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * │\__╭╭╭╭╭__/│ 9 | * │         │ 10 | * │         │ 11 | * │ -      -│ 12 | * │≡    o ≡ │ 13 | * │         │ 14 | * ╰——┬O◤▽◥O┬——╯ 15 | * |  o  | 16 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 17 | * いま 最高の表現 として 明日最新の始発..~ 18 | * Today the best performance as tomorrow newest starter! 19 | 20 | * 21 | * @author : xiaomo 22 | * github: https://github.com/houko 23 | * email: xiaomo@xiaomo.info 24 | *

25 | * Date: 16/4/2 13:08 26 | * Copyright(©) 2015 by xiaomo. 27 | */ 28 | @Repository 29 | public interface AdminUserDao extends JpaRepository { 30 | 31 | /** 32 | * 根据名字查用户 33 | * 34 | * @param s 35 | * @return 36 | */ 37 | AdminModel findAdminUserByUserName(String s); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/dao/ChangeLogDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.dao; 2 | 3 | import info.xiaomo.website.model.ChangeLogModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 把今天最好的表现当作明天最新的起点..~ 9 | * いま 最高の表現 として 明日最新の始発..~ 10 | * Today the best performance as tomorrow newest starter! 11 | 12 | * 13 | * @author : xiaomo 14 | * github: https://github.com/houko 15 | * email: xiaomo@xiaomo.info 16 | *

17 | * Date: 2016/4/1119:52 18 | * Copyright(©) 2015 by xiaomo. 19 | **/ 20 | @Repository 21 | public interface ChangeLogDao extends JpaRepository { 22 | 23 | /** 24 | * find 25 | * 26 | * @param name 27 | * @return 28 | */ 29 | ChangeLogModel findByName(String name); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/dao/LinkDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.dao; 2 | 3 | import info.xiaomo.website.model.LinkModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 把今天最好的表现当作明天最新的起点..~ 9 | * いま 最高の表現 として 明日最新の始発..~ 10 | * Today the best performance as tomorrow newest starter! 11 | 12 | * 13 | * @author : xiaomo 14 | * github: https://github.com/houko 15 | * email: xiaomo@xiaomo.info 16 | *

17 | * Date: 2016/4/1119:52 18 | * Copyright(©) 2015 by xiaomo. 19 | **/ 20 | @Repository 21 | public interface LinkDao extends JpaRepository { 22 | 23 | /** 24 | * 根据名字查友链 25 | * 26 | * @param name 27 | * @return 28 | */ 29 | LinkModel findLinkByName(String name); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/dao/TechnologyDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.dao; 2 | 3 | import info.xiaomo.website.model.TechnologyModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * │\__╭╭╭╭╭__/│ 9 | * │         │ 10 | * │         │ 11 | * │ -      -│ 12 | * │≡    o ≡ │ 13 | * │         │ 14 | * ╰——┬O◤▽◥O┬——╯ 15 | * |  o  | 16 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 17 | * いま 最高の表現 として 明日最新の始発..~ 18 | * Today the best performance as tomorrow newest starter! 19 | 20 | * 21 | * @author : xiaomo 22 | * github: https://github.com/houko 23 | * email: xiaomo@xiaomo.info 24 | *

25 | * Date: 16/4/2 13:08 26 | * Copyright(©) 2015 by xiaomo. 27 | */ 28 | @Repository 29 | public interface TechnologyDao extends JpaRepository { 30 | 31 | /** 32 | * 根据名字查 33 | * 34 | * @param name 35 | * @return 36 | */ 37 | TechnologyModel findTechnologyByName(String name); 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.dao; 2 | 3 | import info.xiaomo.website.model.UserModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * │\__╭╭╭╭╭__/│ 9 | * │         │ 10 | * │         │ 11 | * │ -      -│ 12 | * │≡    o ≡ │ 13 | * │         │ 14 | * ╰——┬O◤▽◥O┬——╯ 15 | * |  o  | 16 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 17 | * いま 最高の表現 として 明日最新の始発..~ 18 | * Today the best performance as tomorrow newest starter! 19 | 20 | * 21 | * @author : xiaomo 22 | * github: https://github.com/houko 23 | * email: xiaomo@xiaomo.info 24 | *

25 | * Date: 16/4/3 10:53 26 | * Copyright(©) 2015 by xiaomo. 27 | */ 28 | 29 | @Repository 30 | public interface UserDao extends JpaRepository { 31 | 32 | /** 33 | * 根据邮件查 34 | * 35 | * @param email 36 | * @return 37 | */ 38 | UserModel findUserByEmail(String email); 39 | } 40 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/dao/WorksDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.dao; 2 | 3 | import info.xiaomo.website.model.WorksModel; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * │\__╭╭╭╭╭__/│ 9 | * │         │ 10 | * │         │ 11 | * │ -      -│ 12 | * │≡    o ≡ │ 13 | * │         │ 14 | * ╰——┬O◤▽◥O┬——╯ 15 | * |  o  | 16 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 17 | * いま 最高の表現 として 明日最新の始発..~ 18 | * Today the best performance as tomorrow newest starter! 19 | 20 | * 21 | * @author : xiaomo 22 | * github: https://github.com/houko 23 | * email: xiaomo@xiaomo.info 24 | *

25 | * Date: 16/4/2 13:08 26 | * Copyright(©) 2015 by xiaomo. 27 | */ 28 | @Repository 29 | public interface WorksDao extends JpaRepository { 30 | 31 | /** 32 | * 根据名字查 33 | * 34 | * @param name 35 | * @return 36 | */ 37 | WorksModel findWorkByName(String name); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/dao/base/CommonDao.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.dao.base; 2 | 3 | import info.xiaomo.core.base.BaseModel; 4 | import org.springframework.stereotype.Repository; 5 | import org.springframework.transaction.annotation.Transactional; 6 | 7 | import javax.persistence.EntityManager; 8 | import javax.persistence.PersistenceContext; 9 | import javax.persistence.Query; 10 | import java.util.List; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/1 20:46 23 | * Description: 公共dao层 24 | * Copyright(©) 2015 by xiaomo. 25 | **/ 26 | @Repository 27 | @Transactional(rollbackFor = {}) 28 | public class CommonDao { 29 | 30 | @PersistenceContext 31 | private EntityManager entityManager; 32 | 33 | public T get(Class type, long id) { 34 | return entityManager.find(type, id); 35 | } 36 | 37 | public T update(T entity) { 38 | return entityManager.merge(entity); 39 | } 40 | 41 | public void save(T entity) { 42 | entityManager.persist(entity); 43 | } 44 | 45 | public void delete(T entity) { 46 | entityManager.remove(entity); 47 | } 48 | 49 | public List getAll(Class tableClass) { 50 | Query query = entityManager.createQuery("from " + tableClass.getSimpleName()); 51 | return query.getResultList(); 52 | } 53 | 54 | 55 | } -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.interceptor; 2 | 3 | import info.xiaomo.website.model.UserModel; 4 | import org.springframework.web.servlet.HandlerInterceptor; 5 | import org.springframework.web.servlet.ModelAndView; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | * 16 | * @author : xiaomo 17 | * github: https://github.com/houko 18 | * email: xiaomo@xiaomo.info 19 | *

20 | * Date: 2016/11/21 10:42 21 | * Copyright(©) 2015 by xiaomo. 22 | **/ 23 | 24 | public class LoginInterceptor implements HandlerInterceptor { 25 | @Override 26 | public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { 27 | UserModel user = (UserModel) httpServletRequest.getSession().getAttribute("currentUser"); 28 | if (user == null) { 29 | //用户没有登录 30 | httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/user/toLogin"); 31 | return false; 32 | } 33 | //用户已经登录 34 | return true; 35 | 36 | } 37 | 38 | @Override 39 | public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { 40 | 41 | } 42 | 43 | @Override 44 | public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/model/AdminModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | import lombok.*; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | import java.io.Serializable; 11 | 12 | /** 13 | * │\__╭╭╭╭╭__/│ 14 | * │         │ 15 | * │         │ 16 | * │ -      -│ 17 | * │≡    o ≡ │ 18 | * │         │ 19 | * ╰——┬O◤▽◥O┬——╯ 20 | * |  o  | 21 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 22 | * いま 最高の表現 として 明日最新の始発..~ 23 | * Today the best performance as tomorrow newest starter! 24 | 25 | * 26 | * @author : xiaomo 27 | * github: https://github.com/houko 28 | * email: xiaomo@xiaomo.info 29 | *

30 | * Date: 16/4/2 12:39 31 | * Copyright(©) 2015 by xiaomo. 32 | */ 33 | @Entity 34 | @Table(name = "adminUser") 35 | @Data 36 | @ToString(callSuper = true) 37 | @EqualsAndHashCode(callSuper = false) 38 | @AllArgsConstructor 39 | @NoArgsConstructor 40 | public class AdminModel extends BaseModel implements Serializable { 41 | 42 | @Column(name = "UserName") 43 | private String userName; 44 | 45 | @Column(name = "Password") 46 | private String password; 47 | 48 | @Column(name = "Status") 49 | private int status = 1; 50 | 51 | @Column(name = "Salt") 52 | private String salt; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/model/ChangeLogModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | import lombok.*; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/517:17 23 | * Copyright(©) 2015 by xiaomo. 24 | **/ 25 | @Entity 26 | @Table(name = "changeLog") 27 | @Data 28 | @ToString(callSuper = true) 29 | @EqualsAndHashCode(callSuper = false) 30 | @AllArgsConstructor 31 | @NoArgsConstructor 32 | public class ChangeLogModel extends BaseModel implements Serializable { 33 | 34 | @Column(name = "Name") 35 | private String name; 36 | 37 | @Column(name = "OnlineTime") 38 | private String onlineTime; 39 | } 40 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/model/LinkModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | import lombok.*; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/1119:47 23 | * Copyright(©) 2015 by xiaomo. 24 | **/ 25 | @Entity 26 | @Table(name = "link") 27 | // lomlok 28 | @Data 29 | @ToString(callSuper = true) 30 | @EqualsAndHashCode(callSuper = false) 31 | @AllArgsConstructor 32 | @NoArgsConstructor 33 | public class LinkModel extends BaseModel implements Serializable { 34 | 35 | @Column(name = "Name") 36 | private String name; 37 | 38 | @Column(name = "Url") 39 | private String url; 40 | } 41 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/model/TechnologyModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | import lombok.*; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/11/3 14:27 22 | * Copyright(©) 2015 by xiaomo. 23 | **/ 24 | 25 | @Entity 26 | @Table(name = "technology") 27 | // lomlok 28 | @Data 29 | @ToString(callSuper = true) 30 | @EqualsAndHashCode(callSuper = false) 31 | @AllArgsConstructor 32 | @NoArgsConstructor 33 | public class TechnologyModel extends BaseModel { 34 | 35 | @Column(name = "Name") 36 | private String name; 37 | 38 | @Column(name = "Url") 39 | private String url; 40 | 41 | @Column(name = "Summary") 42 | private String summary; 43 | 44 | @Column(name = "ImgUrl") 45 | private String imgUrl; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/model/UserModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | import lombok.*; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 把今天最好的表现当作明天最新的起点..~ 14 | * いま 最高の表現 として 明日最新の始発..~ 15 | * Today the best performance as tomorrow newest starter! 16 | 17 | * 18 | * @author : xiaomo 19 | * github: https://github.com/houko 20 | * email: xiaomo@xiaomo.info 21 | *

22 | * Date: 2016/4/1 17:36 23 | * Copyright(©) 2015 by xiaomo. 24 | **/ 25 | @Entity 26 | @Table(name = "user") 27 | // lomlok 28 | @Data 29 | @ToString(callSuper = true) 30 | @EqualsAndHashCode(callSuper = false) 31 | @AllArgsConstructor 32 | @NoArgsConstructor 33 | public class UserModel extends BaseModel implements Serializable { 34 | 35 | @Column(name = "Email") 36 | private String email; 37 | 38 | @Column(name = "NickName") 39 | private String nickName; 40 | 41 | @Column(name = "Password") 42 | private String password; 43 | 44 | @Column(name = "Salt") 45 | private String salt; 46 | 47 | @Column(name = "Gender") 48 | private int gender = 0; 49 | 50 | @Column(name = "Phone") 51 | private Long phone = 0L; 52 | 53 | @Column(name = "ValidateCode") 54 | private String validateCode = ""; 55 | 56 | @Column(name = "ImgUrl") 57 | private String imgUrl = ""; 58 | 59 | @Column(name = "Address") 60 | private String address = ""; 61 | 62 | @Column(name = "RegisterTime") 63 | private Long registerTime = 0L; 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/model/WorksModel.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.model; 2 | 3 | 4 | import info.xiaomo.core.base.BaseModel; 5 | import lombok.*; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/11/3 14:15 22 | * Copyright(©) 2015 by xiaomo. 23 | **/ 24 | 25 | // hibernate 26 | @Entity 27 | @Table(name = "works") 28 | // lomlok 29 | @Data 30 | @ToString(callSuper = true) 31 | @EqualsAndHashCode(callSuper = false) 32 | @AllArgsConstructor 33 | @NoArgsConstructor 34 | public class WorksModel extends BaseModel { 35 | 36 | @Column(name = "Name") 37 | private String name; 38 | 39 | @Column(name = "Url") 40 | private String url; 41 | 42 | @Column(name = "Summary") 43 | private String summary; 44 | 45 | @Column(name = "CompleteTime") 46 | private String completeTime; 47 | 48 | @Column(name = "ImgUrl") 49 | private String imgUrl; 50 | } 51 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/service/AdminUserService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.service; 2 | 3 | import info.xiaomo.core.exception.UserNotFoundException; 4 | import info.xiaomo.website.model.AdminModel; 5 | import org.springframework.data.domain.Page; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * │\__╭╭╭╭╭__/│ 11 | * │         │ 12 | * │         │ 13 | * │ -      -│ 14 | * │≡    o ≡ │ 15 | * │         │ 16 | * ╰——┬O◤▽◥O┬——╯ 17 | * |  o  | 18 | * |╭---╮把今天最好的表现当作明天最新的起点..~ 19 | * いま 最高の表現 として 明日最新の始発..~ 20 | * Today the best performance as tomorrow newest starter! 21 | 22 | * 23 | * @author : xiaomo 24 | * github: https://github.com/houko 25 | * email: xiaomo@xiaomo.info 26 | *

27 | * Date: 16/4/2 13:04 28 | * Copyright(©) 2015 by xiaomo. 29 | */ 30 | public interface AdminUserService { 31 | 32 | /** 33 | * 根据用户名查用户 34 | * 35 | * @param userName 36 | * @return 37 | */ 38 | AdminModel findAdminUserByUserName(String userName); 39 | 40 | /** 41 | * 根据id查用户 42 | * 43 | * @param id 44 | * @return 45 | */ 46 | AdminModel findAdminUserById(Long id); 47 | 48 | /** 49 | * 添加用户 50 | * 51 | * @param model 52 | * @return 53 | */ 54 | AdminModel addAdminUser(AdminModel model); 55 | 56 | /** 57 | * 更新用户 58 | * 59 | * @param model 60 | * @return 61 | * @throws UserNotFoundException 62 | */ 63 | AdminModel updateAdminUser(AdminModel model) throws UserNotFoundException; 64 | 65 | /** 66 | * 获取分页 67 | * 68 | * @param start 69 | * @param pageSize 70 | * @return 71 | */ 72 | Page getAdminUsers(int start, int pageSize); 73 | 74 | /** 75 | * 查所有 76 | * 77 | * @return 78 | */ 79 | List getAdminUsers(); 80 | 81 | /** 82 | * 删除 83 | * 84 | * @param id 85 | * @return 86 | * @throws UserNotFoundException 87 | */ 88 | AdminModel deleteAdminUserById(Long id) throws UserNotFoundException; 89 | 90 | /** 91 | * 禁 92 | * 93 | * @param id 94 | * @return 95 | * @throws UserNotFoundException 96 | */ 97 | AdminModel forbidAdminUserById(Long id) throws UserNotFoundException; 98 | 99 | } 100 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/service/ChangeLogService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.service; 2 | 3 | import info.xiaomo.website.model.ChangeLogModel; 4 | import org.springframework.data.domain.Page; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 把今天最好的表现当作明天最新的起点..~ 10 | * いま 最高の表現 として 明日最新の始発..~ 11 | * Today the best performance as tomorrow newest starter! 12 | 13 | * 14 | * @author : xiaomo 15 | * github: https://github.com/houko 16 | * email: xiaomo@xiaomo.info 17 | *

18 | * Date: 2016/4/1119:49 19 | * Copyright(©) 2015 by xiaomo. 20 | **/ 21 | public interface ChangeLogService { 22 | 23 | /** 24 | * 根据id查 25 | * 26 | * @param id 27 | * @return 28 | */ 29 | ChangeLogModel findById(Long id); 30 | 31 | /** 32 | * 根据名字查 33 | * 34 | * @param name 35 | * @return 36 | */ 37 | ChangeLogModel findByName(String name); 38 | 39 | /** 40 | * find all 41 | * 42 | * @param start 43 | * @param pageSize 44 | * @return 45 | */ 46 | Page findAll(int start, int pageSize); 47 | 48 | /** 49 | * find all 50 | * 51 | * @return 52 | */ 53 | List findAll(); 54 | 55 | /** 56 | * add 57 | * 58 | * @param model 59 | * @return 60 | */ 61 | ChangeLogModel add(ChangeLogModel model); 62 | 63 | /** 64 | * update 65 | * 66 | * @param model 67 | * @return 68 | */ 69 | ChangeLogModel update(ChangeLogModel model); 70 | 71 | /** 72 | * delete 73 | * 74 | * @param id 75 | * @return 76 | */ 77 | ChangeLogModel delete(Long id); 78 | } 79 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/service/LinkService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.service; 2 | 3 | 4 | import info.xiaomo.website.model.LinkModel; 5 | import org.springframework.data.domain.Page; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 把今天最好的表现当作明天最新的起点..~ 11 | * いま 最高の表現 として 明日最新の始発..~ 12 | * Today the best performance as tomorrow newest starter! 13 | 14 | * 15 | * @author : xiaomo 16 | * github: https://github.com/houko 17 | * email: xiaomo@xiaomo.info 18 | *

19 | * Date: 2016/4/1119:49 20 | * Copyright(©) 2015 by xiaomo. 21 | **/ 22 | public interface LinkService { 23 | 24 | /** 25 | * 根据id查友链 26 | * 27 | * @param id 28 | * @return 29 | */ 30 | LinkModel findById(Long id); 31 | 32 | /** 33 | * 根据名字查友链 34 | * 35 | * @param name 36 | * @return 37 | */ 38 | LinkModel findByName(String name); 39 | 40 | /** 41 | * 分页查 42 | * 43 | * @param start 44 | * @param pageSize 45 | * @return 46 | */ 47 | Page findAll(int start, int pageSize); 48 | 49 | /** 50 | * 查所有 51 | * 52 | * @return 53 | */ 54 | List findAll(); 55 | 56 | /** 57 | * 添加 58 | * 59 | * @param model 60 | * @return 61 | */ 62 | LinkModel add(LinkModel model); 63 | 64 | /** 65 | * 更新 66 | * 67 | * @param model 68 | * @return 69 | */ 70 | LinkModel update(LinkModel model); 71 | 72 | /** 73 | * 删除 74 | * 75 | * @param id 76 | * @return 77 | */ 78 | LinkModel delete(Long id); 79 | 80 | } 81 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/service/TechnologyService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.service; 2 | 3 | 4 | import info.xiaomo.website.model.TechnologyModel; 5 | import org.springframework.data.domain.Page; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 把今天最好的表现当作明天最新的起点..~ 11 | * いま 最高の表現 として 明日最新の始発..~ 12 | * Today the best performance as tomorrow newest starter! 13 | 14 | * 15 | * @author : xiaomo 16 | * github: https://github.com/houko 17 | * email: xiaomo@xiaomo.info 18 | *

19 | * Date: 2016/11/3 14:33 20 | * Copyright(©) 2015 by xiaomo. 21 | **/ 22 | 23 | public interface TechnologyService { 24 | 25 | /** 26 | * find all 27 | * 28 | * @return 29 | */ 30 | List findAll(); 31 | 32 | /** 33 | * find all 34 | * 35 | * @param start 36 | * @param pageSize 37 | * @return 38 | */ 39 | Page findAll(int start, int pageSize); 40 | 41 | /** 42 | * find 43 | * 44 | * @param id 45 | * @return 46 | */ 47 | TechnologyModel findById(Long id); 48 | 49 | /** 50 | * find 51 | * 52 | * @param name 53 | * @return 54 | */ 55 | TechnologyModel findByName(String name); 56 | 57 | /** 58 | * update 59 | * 60 | * @param model 61 | * @return 62 | */ 63 | TechnologyModel update(TechnologyModel model); 64 | 65 | /** 66 | * add 67 | * 68 | * @param model 69 | * @return 70 | */ 71 | TechnologyModel add(TechnologyModel model); 72 | 73 | /** 74 | * del 75 | * 76 | * @param id 77 | */ 78 | void del(Long id); 79 | 80 | } 81 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/service/UserService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.service; 2 | 3 | 4 | import info.xiaomo.core.exception.UserNotFoundException; 5 | import info.xiaomo.website.model.UserModel; 6 | import org.springframework.data.domain.Page; 7 | 8 | import java.util.List; 9 | import java.util.Optional; 10 | 11 | /** 12 | * 把今天最好的表现当作明天最新的起点..~ 13 | * いま 最高の表現 として 明日最新の始発..~ 14 | * Today the best performance as tomorrow newest starter! 15 | 16 | * 17 | * @author : xiaomo 18 | * github: https://github.com/houko 19 | * email: xiaomo@xiaomo.info 20 | *

21 | * Date: 2016/4/1 17:45 22 | * Copyright(©) 2015 by xiaomo. 23 | **/ 24 | public interface UserService { 25 | /** 26 | * 根据id查用户 27 | * 28 | * @param id id 29 | * @return UserModel 30 | */ 31 | Optional findUserById(Long id); 32 | 33 | /** 34 | * 根据邮件查用户 35 | * 36 | * @param email email 37 | * @return UserModel 38 | */ 39 | UserModel findUserByEmail(String email); 40 | 41 | /** 42 | * 添加用户 43 | * 44 | * @param model model 45 | * @return UserModel 46 | */ 47 | UserModel addUser(UserModel model); 48 | 49 | /** 50 | * 更新用户 51 | * 52 | * @param model model 53 | * @return UserModel 54 | * @throws UserNotFoundException UserNotFoundException 55 | */ 56 | UserModel updateUser(UserModel model) throws UserNotFoundException; 57 | 58 | /** 59 | * 查找所有 带分页 60 | * 61 | * @param start start 62 | * @param pageSize pageSize 63 | * @return Page 64 | */ 65 | Page findAll(int start, int pageSize); 66 | 67 | /** 68 | * 查找所有 不带分页 69 | * 70 | * @return List 71 | */ 72 | List findAll(); 73 | 74 | /** 75 | * 删除用户 76 | * 77 | * @param id id 78 | * @return UserModel 79 | * @throws UserNotFoundException 80 | */ 81 | UserModel deleteUserById(Long id) throws UserNotFoundException; 82 | 83 | } 84 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/service/WorksService.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.service; 2 | 3 | 4 | import info.xiaomo.website.model.WorksModel; 5 | import org.springframework.data.domain.Page; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 把今天最好的表现当作明天最新的起点..~ 11 | * いま 最高の表現 として 明日最新の始発..~ 12 | * Today the best performance as tomorrow newest starter! 13 | 14 | * 15 | * @author : xiaomo 16 | * github: https://github.com/houko 17 | * email: xiaomo@xiaomo.info 18 | *

19 | * Date: 2016/11/3 14:33 20 | * Copyright(©) 2015 by xiaomo. 21 | **/ 22 | 23 | public interface WorksService { 24 | 25 | /** 26 | * find all 27 | * 28 | * @return 29 | */ 30 | List findAll(); 31 | 32 | /** 33 | * find all page 34 | * 35 | * @param start 36 | * @param pageSize 37 | * @return 38 | */ 39 | Page findAll(int start, int pageSize); 40 | 41 | /** 42 | * find 43 | * 44 | * @param id 45 | * @return 46 | */ 47 | WorksModel findById(Long id); 48 | 49 | /** 50 | * find 51 | * 52 | * @param name 53 | * @return 54 | */ 55 | WorksModel findByName(String name); 56 | 57 | /** 58 | * update 59 | * 60 | * @param model 61 | * @return 62 | */ 63 | WorksModel update(WorksModel model); 64 | 65 | 66 | /** 67 | * add 68 | * 69 | * @param model 70 | * @return 71 | */ 72 | WorksModel add(WorksModel model); 73 | 74 | 75 | /** 76 | * del 77 | * 78 | * @param id 79 | */ 80 | void del(Long id); 81 | } 82 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/view/AdminUserView.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.view; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/11/21 11:12 14 | * Copyright(©) 2015 by xiaomo. 15 | **/ 16 | 17 | public enum AdminUserView { 18 | 19 | /** 20 | * login 21 | */ 22 | LOGIN("login"), 23 | REGISTER("register"), 24 | REGISTER_INFO("info"), 25 | INDEX("/web/index"); 26 | 27 | private String name; 28 | 29 | AdminUserView(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/view/ChangeLogView.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.view; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/11/21 11:12 14 | * Copyright(©) 2015 by xiaomo. 15 | **/ 16 | 17 | public enum ChangeLogView { 18 | /** 19 | * Login 20 | */ 21 | LOGIN("login"), 22 | REGISTER("register"), 23 | REGISTER_INFO("info"), 24 | INDEX("/web/index"); 25 | 26 | private String name; 27 | 28 | ChangeLogView(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/view/LinkView.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.view; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/11/21 11:12 14 | * Copyright(©) 2015 by xiaomo. 15 | **/ 16 | 17 | public enum LinkView { 18 | /** 19 | * login 20 | */ 21 | LOGIN("login"), 22 | REGISTER("register"), 23 | REGISTER_INFO("info"), 24 | INDEX("/web/index"); 25 | 26 | private String name; 27 | 28 | LinkView(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/view/TechnologyView.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.view; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/11/21 11:12 14 | * Copyright(©) 2015 by xiaomo. 15 | **/ 16 | 17 | public enum TechnologyView { 18 | /** 19 | * login 20 | */ 21 | LOGIN("login"), 22 | REGISTER("register"), 23 | REGISTER_INFO("info"), 24 | INDEX("/web/index"); 25 | 26 | private String name; 27 | 28 | TechnologyView(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/view/UserView.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.view; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/11/21 11:12 14 | * Copyright(©) 2015 by xiaomo. 15 | **/ 16 | 17 | public enum UserView { 18 | /** 19 | * login 20 | */ 21 | LOGIN("login"), 22 | REGISTER("register"), 23 | REGISTER_INFO("info"), 24 | INDEX("index"), 25 | API("swagger-ui.html"); 26 | 27 | private String name; 28 | 29 | UserView(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /website/src/main/java/info/xiaomo/website/view/WorksView.java: -------------------------------------------------------------------------------- 1 | package info.xiaomo.website.view; 2 | 3 | /** 4 | * 把今天最好的表现当作明天最新的起点..~ 5 | * いま 最高の表現 として 明日最新の始発..~ 6 | * Today the best performance as tomorrow newest starter! 7 | 8 | * 9 | * @author : xiaomo 10 | * github: https://github.com/houko 11 | * email: xiaomo@xiaomo.info 12 | *

13 | * Date: 2016/11/21 11:12 14 | * Copyright(©) 2015 by xiaomo. 15 | **/ 16 | 17 | public enum WorksView { 18 | 19 | /** 20 | * login 21 | */ 22 | LOGIN("login"), 23 | REGISTER("register"), 24 | REGISTER_INFO("info"), 25 | INDEX("/web/index"); 26 | 27 | private String name; 28 | 29 | WorksView(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /website/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | logging.config=classpath:config/logback-dev.xml 2 | server.port=8080 3 | 4 | server.max-http-header-size=20971520 5 | 6 | #datasource 7 | spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true 8 | # ?useUnicode=true&characterEncoding=UTF-8 9 | spring.datasource.username=username 10 | spring.datasource.password=password 11 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 12 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 13 | #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss 14 | #spring.jackson.time-zone=GMT+8 15 | 16 | #jpa 17 | spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect 18 | spring.jpa.hibernate.ddl-auto=update 19 | spring.jpa.show-sql=true 20 | spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 21 | 22 | 23 | # redis 24 | # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09 25 | spring.redis.database=0 26 | spring.redis.host=ip 27 | spring.redis.port=6379 28 | spring.redis.password= 29 | # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 30 | spring.redis.pool.max-active=8 31 | # \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 32 | spring.redis.pool.max-wait=-1 33 | # \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5 34 | spring.redis.pool.max-idle=8 35 | # \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5 36 | spring.redis.pool.min-idle=0 37 | # \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 38 | spring.redis.timeout=0 39 | 40 | #\u90AE\u4EF6 41 | mail.host=smtp.163.com 42 | mail.username=\u4F60\u7684\u5BC6\u7801test@163.com 43 | mail.password=\u4F60\u7684\u5BC6\u7801\u4F60\u7684\u5BC6\u7801 44 | mail.smtp.auth=true 45 | mail.port=25 46 | mail.protocol=smtp 47 | 48 | # DEVTOOLS (DevToolsProperties) 49 | spring.devtools.restart.additional-exclude=/** 50 | spring.devtools.restart.enabled=true 51 | spring.devtools.restart.poll-interval=1000 52 | spring.devtools.restart.quiet-period=400 -------------------------------------------------------------------------------- /website/src/main/resources/config/banner-girl.txt: -------------------------------------------------------------------------------- 1 | .::::. 2 | .::::::::. 3 | ::::::::::: 4 | ..:::::::::::' 5 | '::::::::::::' 6 | .:::::::::: 7 | '::::::::::::::.. 8 | ..:::::::::::::. 9 | ..:::::::::::::::. 10 | ``::::::::::::::::::: 11 | ::::``::::::::::::' .:::. 12 | ::::' ':::::' .::::::::. 13 | .::::' :::: .:::::::'::::. 14 | .:::' ::::: .:::::::::' ':::::. 15 | .::' :::::.:::::::::' ':::::. 16 | .::' ::::::::::::::' ``::::. 17 | ...::: ::::::::::::' ``::. 18 | ```` ':. ':::::::::' ::::.. 19 | '.:::::' ':'````.. 20 | :: Spring Boot :: (v2.0.0.RELEASE) -------------------------------------------------------------------------------- /website/src/main/resources/config/logback-dev.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /website/src/main/resources/public/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/collapse.gif -------------------------------------------------------------------------------- /website/src/main/resources/public/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/expand.gif -------------------------------------------------------------------------------- /website/src/main/resources/public/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/favicon-16x16.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/favicon-32x32.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/favicon.ico -------------------------------------------------------------------------------- /website/src/main/resources/public/images/index.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/index.jpg -------------------------------------------------------------------------------- /website/src/main/resources/public/images/landing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/landing.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/logo_small.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/pet_store_api.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/public/images/throbber.gif -------------------------------------------------------------------------------- /website/src/main/resources/templates/email.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | お返事 9 | 10 | 11 |

亲爱的${email!}
12 |      13 | 欢迎加入xiaomo.info!
14 |
15 |      16 | 请点击链接验证:${url!}
17 |
18 |      19 | 如果您的email程序不支持链接点击,请将上面的地址拷贝至您的浏览器(如Chrome)的地址栏进入。
20 |
21 |      22 | 我们对您产生的不便,深表歉意。
23 |
24 |      25 | 希望您在xiaomo.info度过快乐的时光!
26 |
27 |      28 | -----------------------
29 |      30 | (这是一封自动产生的email,请勿回复。)
31 |




32 |
小莫(${now!})
33 |
34 | 35 | -------------------------------------------------------------------------------- /website/src/main/resources/templates/info.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 提示 9 | 10 | 11 | 请前往邮箱查看邮件并激活 12 | 13 | -------------------------------------------------------------------------------- /website/src/main/resources/templates/login.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 登录 9 | 10 | 11 |
12 |
13 |
14 |

${CodeMsg!}

15 |
16 |
17 |
18 | 23 | 24 | -------------------------------------------------------------------------------- /website/src/main/resources/templates/register.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 注册 9 | 10 | 11 |
12 |
13 |
14 |

${CodeMsg!}

15 |
16 |
17 | 18 | -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/markdown语法.markdown: -------------------------------------------------------------------------------- 1 | # 1.标题(h标签) 2 | h1-h6对应1-6个# 3 | # 2.列表(li>li) 4 | #### 有序列表 5 | * 1 6 | * 2 7 | * 3 8 | #### 无序列表 9 | 1. 1 10 | 2. 2 11 | 3. 3 12 | # 3.引用(blockquote) 13 | >这个是引用的内容 14 | # 4.图片与链接 15 | #### 图片:名字、url 16 | ![小莫](http://mouapp.com/Mou_128.png) 17 | #### 链接 18 | [小莫的主页](http://www.xiaomo.info) 19 | # 5.粗体与斜体 20 | #### 说明:用两个 * 包含一段文本就是粗体的语法,用一个 * 包含一段文本就是斜体的语法。 21 | **这里是粗体** 22 | 23 | *这里是斜体* 24 | 25 | # 6.表格 26 | | Tables | Are | Cool | 27 | | ----------- |:-----------:| -----:| 28 | | col 3 is | right-aligned | $1600 | 29 | | col 2 is | centered | $12 | 30 | | zebra stripes | are neat | $1 | 31 | # 7.代码框(一个tab即可) 32 | 33 | function Hello(){ 34 | console.log("hello"); 35 | } 36 | # 8.分割线(hr) 37 | 三个或三个以上的星号、减号或者下划线 38 | *** 39 | 40 | # 9.换行、分段 41 | 行末加两个或以上个空格 42 | 分段:两个回车 -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/maven使用相关.markdown: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/项目文档/重点记录/maven使用相关.markdown -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/spring boot 相关.markdown: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/项目文档/重点记录/spring boot 相关.markdown -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/前后分离与传统javaweb项目的区别.markdown: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/项目文档/重点记录/前后分离与传统javaweb项目的区别.markdown -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/文件上传.markdown: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/项目文档/重点记录/文件上传.markdown -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/服务器部署.markdown: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/项目文档/重点记录/服务器部署.markdown -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/跨域.markdown: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/719fc77b25019286b4e8471d9ae8666574ccb480/website/src/main/resources/项目文档/重点记录/跨域.markdown --------------------------------------------------------------------------------