├── .gitignore ├── README.md ├── doc ├── demo │ ├── HMStrange-mongodb-Noseparte │ │ ├── .gitignore │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── noseparte │ │ │ │ │ ├── HmStrangeMongodbApplication.java │ │ │ │ │ ├── api │ │ │ │ │ └── web │ │ │ │ │ │ └── bean │ │ │ │ │ │ ├── EMsgCode.java │ │ │ │ │ │ ├── EnumResCode.java │ │ │ │ │ │ └── ResponseResult.java │ │ │ │ │ ├── constant │ │ │ │ │ └── MongoDBConstant.java │ │ │ │ │ ├── controller │ │ │ │ │ ├── AbstractController.java │ │ │ │ │ └── StageTreeController.java │ │ │ │ │ ├── dao │ │ │ │ │ └── StageTreeDao.java │ │ │ │ │ ├── logic │ │ │ │ │ └── StageTreeShop.java │ │ │ │ │ └── service │ │ │ │ │ ├── StageTreeService.java │ │ │ │ │ └── impl │ │ │ │ │ └── StageTreeServiceImpl.java │ │ │ └── resources │ │ │ │ ├── application-dev.properties │ │ │ │ └── application.properties │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── noseparte │ │ │ └── HmStrangeMongodbApplicationTests.java │ ├── datademo │ │ ├── .gitignore │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── myself │ │ │ │ │ └── mybatis │ │ │ │ │ ├── DatademoApplication.java │ │ │ │ │ ├── controller │ │ │ │ │ └── TMsgController.java │ │ │ │ │ ├── entity │ │ │ │ │ └── TMsg.java │ │ │ │ │ ├── mapper │ │ │ │ │ └── TMsgMapper.java │ │ │ │ │ └── service │ │ │ │ │ ├── TMsgService.java │ │ │ │ │ └── impl │ │ │ │ │ └── TMsgServiceImpl.java │ │ │ └── resources │ │ │ │ ├── application.yml │ │ │ │ └── mapper │ │ │ │ └── TMsgMapper.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── myself │ │ │ └── mybatis │ │ │ └── DatademoApplicationTests.java │ ├── redisdemo │ │ ├── .gitignore │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── github │ │ │ │ │ └── myself │ │ │ │ │ ├── RedisdemoApplication.java │ │ │ │ │ ├── controller │ │ │ │ │ └── MsgController.java │ │ │ │ │ └── service │ │ │ │ │ ├── MsgService.java │ │ │ │ │ └── impl │ │ │ │ │ └── MsgServiceImpl.java │ │ │ └── resources │ │ │ │ └── application.yml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── myself │ │ │ └── RedisdemoApplicationTests.java │ └── springboot-redis │ │ ├── .gitignore │ │ ├── doc │ │ └── springboot -redis.pdf │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── springboot_redis_example │ │ │ │ ├── SpringbootRedisApplication.java │ │ │ │ ├── config │ │ │ │ └── redisConfig.java │ │ │ │ ├── controller │ │ │ │ └── StudentController.java │ │ │ │ ├── entity │ │ │ │ └── Student.java │ │ │ │ ├── mapper │ │ │ │ └── StudentMapper.java │ │ │ │ └── service │ │ │ │ ├── StudentImpl.java │ │ │ │ └── StudentService.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── mybatis │ │ │ ├── mapper │ │ │ └── StudentMapper.xml │ │ │ └── mybatis-config.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── springboot_redis_example │ │ └── SpringbootRedisApplicationTests.java ├── details │ └── update_record.md ├── members │ ├── homework.md │ ├── informations.md │ └── specification.md ├── milestone │ └── milestone-doc.md └── study │ ├── organization.md │ └── system_01.md ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── github │ │ └── HmStrangeApplication.java └── resources │ └── application.properties └── test └── java └── com └── github └── HmStrangeApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HMStrange 2 | 3 | ## 简介 4 | 5 | > An e-commerce back-end framework that supports diversified configurations 6 | 7 | 一个支持多元化配置的电商后端框架 8 | 9 | ## 里程碑 10 | 11 | * [HMStrange-项目里程碑](doc/milestone/milestone-doc.md) 12 | 13 | ## 项目详情 14 | 15 | * [HMStrange-项目组织架构](doc/study/organization.md) 16 | * [HMStrange-项目更新记录](doc/details/update_record.md) 17 | * [HMStrange-项目模块说明]() 18 | 19 | ## 学习相关 20 | 21 | * [电商商品管理系统说明](doc/study/system_01.md) 22 | 23 | ## 项目组成员信息 24 | 25 | * [HMStrange-项目组成员信息表](doc/members/informations.md) 26 | 27 | ### 当前情况 28 | 29 | 项目组以微信群形式组织,目前群内15人,实质参与10人。 30 | 31 | ### 入门任务 32 | 33 | * [初次提交代码指南](https://www.imooc.com/article/284151) 34 | * [阅读规范并手写签名指南](https://www.imooc.com/article/284213) 35 | 36 | ### 加入我们 37 | 38 | - 添加**MySelf**个人微信号:Dr5204484,备注:HMStrange项目组 39 | - 填写信息登记表 40 | - 首次为项目提交代码 41 | - 基于项目组合作平等原则,参与开发规划任务 42 | - 学有所成! 43 | 44 | ## 下载地址 45 | 46 | https://github.com/UncleCatMySelf/HMStrange/releases 47 | 48 | ## 问题 49 | 50 | https://github.com/UncleCatMySelf/HMStrange/issues 51 | 52 | 53 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /nbbuild/ 22 | /dist/ 23 | /nbdist/ 24 | /.nb-gradle/ 25 | /build/ 26 | 27 | ### VS Code ### 28 | .vscode/ 29 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.0.RELEASE 9 | 10 | 11 | com.noseparte 12 | mongodb 13 | 0.0.1-SNAPSHOT 14 | HMStrange-mongodb 15 | Demo project for Spring Boot integration mongodb 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-starter-test 33 | test 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-data-mongodb 38 | 39 | 40 | org.projectlombok 41 | lombok 42 | true 43 | 44 | 45 | 46 | org.apache.commons 47 | commons-lang3 48 | 3.8 49 | 50 | 51 | com.alibaba 52 | fastjson 53 | 1.2.47 54 | 55 | 56 | 57 | 58 | 59 | 60 | org.springframework.boot 61 | spring-boot-maven-plugin 62 | 63 | 64 | 65 | 66 | 67 | 68 | spring-snapshots 69 | Spring Snapshots 70 | https://repo.spring.io/snapshot 71 | 72 | true 73 | 74 | 75 | 76 | spring-milestones 77 | Spring Milestones 78 | https://repo.spring.io/milestone 79 | 80 | 81 | 82 | 83 | spring-snapshots 84 | Spring Snapshots 85 | https://repo.spring.io/snapshot 86 | 87 | true 88 | 89 | 90 | 91 | spring-milestones 92 | Spring Milestones 93 | https://repo.spring.io/milestone 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/HmStrangeMongodbApplication.java: -------------------------------------------------------------------------------- 1 | package com.noseparte; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class HmStrangeMongodbApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(HmStrangeMongodbApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/api/web/bean/EMsgCode.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.api.web.bean; 2 | 3 | public enum EMsgCode { 4 | success(80021), // 成功 5 | error(90013), //失败 6 | ; 7 | 8 | private EMsgCode(int code) { 9 | this.code = code; 10 | } 11 | 12 | public int code; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/api/web/bean/EnumResCode.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.api.web.bean; 2 | 3 | public enum EnumResCode { 4 | SUCCESSFUL(0), SERVER_SUCCESS(2), SERVER_ERROR(-1); 5 | 6 | private EnumResCode(int status) { 7 | this.status = status; 8 | } 9 | 10 | private int status; 11 | 12 | public int value() { 13 | return status; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/api/web/bean/ResponseResult.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.api.web.bean; 2 | 3 | import lombok.Data; 4 | import lombok.ToString; 5 | 6 | @Data 7 | @ToString 8 | public class ResponseResult { 9 | private int status; 10 | private String msg = ""; 11 | private int msgCode; 12 | private Object result; 13 | 14 | @Data 15 | public static class ShareResult { 16 | int energy; 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/constant/MongoDBConstant.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.constant; 2 | 3 | import com.noseparte.logic.StageTreeShop; 4 | import org.springframework.data.annotation.Immutable; 5 | 6 | @Immutable 7 | public final class MongoDBConstant { 8 | 9 | public final static String StageTreeShop = "stageTreeShop"; 10 | 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/controller/AbstractController.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.controller; 2 | 3 | import com.noseparte.api.web.bean.EMsgCode; 4 | import com.noseparte.api.web.bean.EnumResCode; 5 | import com.noseparte.api.web.bean.ResponseResult; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | public abstract class AbstractController { 10 | 11 | private static final Logger log = LoggerFactory.getLogger(AbstractController.class); 12 | 13 | protected ResponseResult successJson(EMsgCode msgCode, Object data) { 14 | ResponseResult result = new ResponseResult(); 15 | result.setStatus(EnumResCode.SUCCESSFUL.value()); 16 | result.setMsgCode(msgCode.code); 17 | result.setResult(data); 18 | return result; 19 | } 20 | 21 | protected ResponseResult successJson(Object data) { 22 | ResponseResult result = new ResponseResult(); 23 | result.setStatus(EnumResCode.SUCCESSFUL.value()); 24 | result.setMsgCode(EMsgCode.success.code); 25 | result.setResult(data); 26 | return result; 27 | } 28 | 29 | public static ResponseResult errorJson(EMsgCode msgCode) { 30 | log.info(msgCode.toString()); 31 | ResponseResult result = new ResponseResult(); 32 | result.setStatus(EnumResCode.SERVER_ERROR.value()); 33 | result.setMsgCode(msgCode.code); 34 | return result; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/controller/StageTreeController.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.noseparte.api.web.bean.EMsgCode; 5 | import com.noseparte.api.web.bean.ResponseResult; 6 | import com.noseparte.logic.StageTreeShop; 7 | import com.noseparte.service.StageTreeService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import java.util.List; 16 | import java.util.Objects; 17 | 18 | @Slf4j 19 | @RestController 20 | @RequestMapping("/api/tree") 21 | public class StageTreeController extends AbstractController { 22 | 23 | @Autowired 24 | private StageTreeService stageTreeService; 25 | 26 | @PostMapping("/covers") 27 | public ResponseResult getStageTreeCovers( 28 | @RequestParam("pageSize") int pageSize, 29 | @RequestParam("pageNumber") int pageNumber, 30 | @RequestParam("storyType") int storyType 31 | ) { 32 | if (Objects.isNull(storyType) && storyType < 0) { 33 | return errorJson(EMsgCode.error); 34 | } 35 | 36 | List stageTreeShops = stageTreeService.findTreeStages(storyType, pageSize, pageNumber); 37 | long count = stageTreeService.countByChannel(storyType); 38 | JSONObject jsonObject = new JSONObject(); 39 | jsonObject.put("datas", stageTreeShops); 40 | jsonObject.put("total", count); 41 | return successJson(jsonObject); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/dao/StageTreeDao.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.dao; 2 | 3 | import com.noseparte.logic.StageTreeShop; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.data.mongodb.core.MongoTemplate; 6 | import org.springframework.data.mongodb.core.query.Criteria; 7 | import org.springframework.data.mongodb.core.query.Query; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import java.util.List; 11 | 12 | @Repository 13 | public class StageTreeDao { 14 | 15 | @Autowired 16 | protected MongoTemplate mongoTemplate; 17 | 18 | public List findTreeStages(int storyType, int pageSize, int pageNumber) { 19 | Query query = new Query(); 20 | query.addCriteria(Criteria.where("isShow").is(1)); //标识未下架的 21 | if(storyType > 0){ 22 | query.addCriteria(Criteria.where("storyType").is(storyType)); //标识未下架的 23 | } 24 | query.skip((pageNumber - 1) * pageSize).limit(pageSize); // 分页 25 | return mongoTemplate.find(query, StageTreeShop.class); 26 | } 27 | 28 | public long countByChannel(int storyType) { 29 | Query query = new Query(); 30 | query.addCriteria(Criteria.where("isShow").is(1)); //标识未下架的 31 | if(storyType > 0){ 32 | query.addCriteria(Criteria.where("storyType").is(storyType)); //标识未下架的 33 | } 34 | return mongoTemplate.count(query, StageTreeShop.class); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/logic/StageTreeShop.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.logic; 2 | 3 | import com.noseparte.constant.MongoDBConstant; 4 | import lombok.Data; 5 | import org.springframework.data.mongodb.core.mapping.Document; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @Document(collection = MongoDBConstant.StageTreeShop) 11 | public class StageTreeShop { 12 | 13 | private String _id; 14 | private Long treeId; 15 | private String name; 16 | private String textureUrl; 17 | private String dec; 18 | private String voiceUrl; 19 | private Long voiceTime; 20 | private Boolean isCanCreateBattle; 21 | private Integer maxEnergy; 22 | private Integer pce; 23 | private Integer eri; 24 | private Integer shareGetEnergy; 25 | private Integer buyEnergyCost; 26 | private Integer buyEnergyCostType; 27 | private Boolean isEnergyRecoveryInterval; 28 | private Boolean isShareGetEnergy; 29 | private Integer storyType; 30 | private Boolean isConditionLimit; 31 | private Integer conditionType; 32 | private Integer conditionValue; 33 | private Boolean isElementLimit1; 34 | private Boolean isElementLimit2; 35 | private Integer serial; 36 | private Long headNodeId; 37 | private Long createTick; 38 | private Long submitTick; 39 | private Long updateTick; 40 | private Integer isShow; 41 | private Integer praise; 42 | private Integer propGetType; 43 | private Integer isShowStage; 44 | private Boolean isUsePropLimit; 45 | private List Props; 46 | 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/service/StageTreeService.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.service; 2 | 3 | import com.noseparte.logic.StageTreeShop; 4 | 5 | import java.util.List; 6 | 7 | public interface StageTreeService { 8 | 9 | List findTreeStages(int storyType, int pageSize, int pageNumber); 10 | 11 | long countByChannel(int storyType); 12 | } 13 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/java/com/noseparte/service/impl/StageTreeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.noseparte.service.impl; 2 | 3 | import com.noseparte.dao.StageTreeDao; 4 | import com.noseparte.logic.StageTreeShop; 5 | import com.noseparte.service.StageTreeService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | @Service 12 | public class StageTreeServiceImpl implements StageTreeService { 13 | 14 | @Autowired 15 | private StageTreeDao stageTreeDao; 16 | 17 | @Override 18 | public List findTreeStages(int storyType, int pageSize, int pageNumber) { 19 | return stageTreeDao.findTreeStages(storyType, pageSize, pageNumber); 20 | } 21 | 22 | @Override 23 | public long countByChannel(int storyType) { 24 | return stageTreeDao.countByChannel(storyType); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | server.port=8371 2 | 3 | spring.data.mongodb.uri=mongodb://localhost:27017/TG_Match 4 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=dev 2 | -------------------------------------------------------------------------------- /doc/demo/HMStrange-mongodb-Noseparte/src/test/java/com/noseparte/HmStrangeMongodbApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.noseparte; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class HmStrangeMongodbApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /doc/demo/datademo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /doc/demo/datademo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.4.RELEASE 9 | 10 | 11 | com.myself.mybatis 12 | datademo 13 | 0.0.1-SNAPSHOT 14 | datademo 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | org.mybatis.spring.boot 28 | mybatis-spring-boot-starter 29 | 2.0.1 30 | 31 | 32 | 33 | mysql 34 | mysql-connector-java 35 | runtime 36 | 37 | 38 | org.projectlombok 39 | lombok 40 | true 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-test 45 | test 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-maven-plugin 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/java/com/myself/mybatis/DatademoApplication.java: -------------------------------------------------------------------------------- 1 | package com.myself.mybatis; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DatademoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DatademoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/java/com/myself/mybatis/controller/TMsgController.java: -------------------------------------------------------------------------------- 1 | package com.myself.mybatis.controller; 2 | 3 | import com.myself.mybatis.entity.TMsg; 4 | import com.myself.mybatis.service.TMsgService; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * Created by MySelf on 2019/4/9. 13 | */ 14 | @RestController 15 | @RequestMapping("/msg") 16 | public class TMsgController { 17 | 18 | @Autowired 19 | private TMsgService tMsgService; 20 | 21 | @GetMapping("/getMsg") 22 | public String getMsg(@Param("id") Integer id){ 23 | TMsg tMsg = tMsgService.findById(id); 24 | return tMsg.getMessage(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/java/com/myself/mybatis/entity/TMsg.java: -------------------------------------------------------------------------------- 1 | package com.myself.mybatis.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Created by MySelf on 2019/4/9. 9 | */ 10 | @Data 11 | public class TMsg implements Serializable { 12 | 13 | private Integer id; 14 | 15 | private String message; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/java/com/myself/mybatis/mapper/TMsgMapper.java: -------------------------------------------------------------------------------- 1 | package com.myself.mybatis.mapper; 2 | 3 | import com.myself.mybatis.entity.TMsg; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | /** 7 | * Created by MySelf on 2019/4/9. 8 | */ 9 | @Mapper 10 | public interface TMsgMapper { 11 | 12 | public TMsg findById(Integer id); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/java/com/myself/mybatis/service/TMsgService.java: -------------------------------------------------------------------------------- 1 | package com.myself.mybatis.service; 2 | 3 | import com.myself.mybatis.entity.TMsg; 4 | 5 | /** 6 | * Created by MySelf on 2019/4/9. 7 | */ 8 | public interface TMsgService { 9 | 10 | public TMsg findById(Integer id); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/java/com/myself/mybatis/service/impl/TMsgServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.myself.mybatis.service.impl; 2 | 3 | import com.myself.mybatis.entity.TMsg; 4 | import com.myself.mybatis.mapper.TMsgMapper; 5 | import com.myself.mybatis.service.TMsgService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * Created by MySelf on 2019/4/9. 11 | */ 12 | @Service 13 | public class TMsgServiceImpl implements TMsgService { 14 | 15 | @Autowired 16 | private TMsgMapper tMsgMapper; 17 | 18 | @Override 19 | public TMsg findById(Integer id) { 20 | return tMsgMapper.findById(id); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | url: jdbc:mysql://192.168.192.133:3306/datademo?characterEncoding=utf-8&useSSL=false 4 | username: root 5 | password: password 6 | driver-class-name: com.mysql.cj.jdbc.Driver 7 | mybatis: 8 | mapper-locations: classpath*:mapper/*Mapper.xml 9 | type-aliases-package: com.myself.mybatis.entity -------------------------------------------------------------------------------- /doc/demo/datademo/src/main/resources/mapper/TMsgMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /doc/demo/datademo/src/test/java/com/myself/mybatis/DatademoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.myself.mybatis; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class DatademoApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /doc/demo/redisdemo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /doc/demo/redisdemo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.4.RELEASE 9 | 10 | 11 | com.github.myself 12 | redisdemo 13 | 0.0.1-SNAPSHOT 14 | redisdemo 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-data-redis 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | 32 | org.projectlombok 33 | lombok 34 | true 35 | 36 | 37 | org.springframework.boot 38 | spring-boot-starter-test 39 | test 40 | 41 | 42 | 43 | 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-maven-plugin 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /doc/demo/redisdemo/src/main/java/com/github/myself/RedisdemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.github.myself; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class RedisdemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(RedisdemoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /doc/demo/redisdemo/src/main/java/com/github/myself/controller/MsgController.java: -------------------------------------------------------------------------------- 1 | package com.github.myself.controller; 2 | 3 | import com.github.myself.service.MsgService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * Created by MySelf on 2019/4/11. 12 | */ 13 | @RestController 14 | @RequestMapping("/msg") 15 | public class MsgController { 16 | 17 | @Autowired 18 | private MsgService msgService; 19 | 20 | @GetMapping("/set") 21 | public String setMsg(@RequestParam(value = "key") String key,@RequestParam(value = "msg") String msg){ 22 | return msgService.setMsg(key,msg); 23 | } 24 | 25 | @GetMapping("/get") 26 | public String getMsg(@RequestParam(value = "key") String key){ 27 | return msgService.getMsg(key); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /doc/demo/redisdemo/src/main/java/com/github/myself/service/MsgService.java: -------------------------------------------------------------------------------- 1 | package com.github.myself.service; 2 | 3 | /** 4 | * Created by MySelf on 2019/4/11. 5 | */ 6 | public interface MsgService { 7 | 8 | public String setMsg(String key,String msg); 9 | 10 | public String getMsg(String key); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /doc/demo/redisdemo/src/main/java/com/github/myself/service/impl/MsgServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.myself.service.impl; 2 | 3 | import com.github.myself.service.MsgService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.data.redis.core.RedisTemplate; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | * Created by MySelf on 2019/4/11. 10 | */ 11 | @Service 12 | public class MsgServiceImpl implements MsgService { 13 | 14 | @Autowired 15 | private RedisTemplate redisTemplate; 16 | 17 | @Override 18 | public String setMsg(String key,String msg) { 19 | redisTemplate.opsForValue().set(key,msg); 20 | return "success"; 21 | } 22 | 23 | @Override 24 | public String getMsg(String key) { 25 | return (String) redisTemplate.opsForValue().get(key); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /doc/demo/redisdemo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | redis: 3 | host: 192.168.192.133 -------------------------------------------------------------------------------- /doc/demo/redisdemo/src/test/java/com/github/myself/RedisdemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.github.myself; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class RedisdemoApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/doc/springboot -redis.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UncleCatMySelf/HMStrange/0a9db2ef7df355780acd69779730564f8034a50b/doc/demo/springboot-redis/doc/springboot -redis.pdf -------------------------------------------------------------------------------- /doc/demo/springboot-redis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.4.RELEASE 9 | 10 | 11 | com.springboot-redis-example 12 | springboot-redis 13 | 0.0.1-SNAPSHOT 14 | springboot-redis 15 | Eeample project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-cache 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-data-redis 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-starter-web 33 | 34 | 35 | org.mybatis.spring.boot 36 | mybatis-spring-boot-starter 37 | 2.0.1 38 | 39 | 40 | 41 | mysql 42 | mysql-connector-java 43 | runtime 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-starter-jdbc 48 | 49 | 50 | org.springframework.boot 51 | spring-boot-starter-test 52 | test 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.springframework.boot 60 | spring-boot-maven-plugin 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/java/com/springboot_redis_example/SpringbootRedisApplication.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cache.annotation.EnableCaching; 7 | 8 | @EnableCaching 9 | @SpringBootApplication 10 | public class SpringbootRedisApplication { 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringbootRedisApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/java/com/springboot_redis_example/config/redisConfig.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example.config; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAutoDetect; 4 | import com.fasterxml.jackson.annotation.PropertyAccessor; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import com.springboot_redis_example.entity.Student; 7 | import org.springframework.cache.CacheManager; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.data.redis.cache.RedisCacheConfiguration; 11 | import org.springframework.data.redis.cache.RedisCacheManager; 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; 13 | import org.springframework.data.redis.core.RedisTemplate; 14 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 15 | import org.springframework.data.redis.serializer.RedisSerializationContext; 16 | import org.springframework.data.redis.serializer.RedisSerializer; 17 | import org.springframework.data.redis.serializer.StringRedisSerializer; 18 | 19 | import java.time.Duration; 20 | 21 | 22 | /** 23 | * @Author: zhangqihao 24 | * @Date: 2019/4/12 17:32 25 | * @Version 1.0 26 | */ 27 | @Configuration 28 | public class redisConfig { 29 | @Bean 30 | public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){ 31 | RedisTemplate template = new RedisTemplate(); 32 | template.setConnectionFactory(redisConnectionFactory); 33 | Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer(Student.class); 34 | template.setDefaultSerializer(serializer); 35 | return template; 36 | } 37 | 38 | @Bean 39 | public CacheManager cacheManager(RedisConnectionFactory factory) { 40 | RedisSerializer redisSerializer = new StringRedisSerializer(); 41 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); 42 | 43 | //解决查询缓存转换异常的问题 44 | ObjectMapper om = new ObjectMapper(); 45 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 46 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 47 | jackson2JsonRedisSerializer.setObjectMapper(om); 48 | 49 | // 配置序列化(解决乱码的问题),过期时间30秒 50 | RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() 51 | .entryTtl(Duration.ofSeconds(30)) 52 | .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer)) 53 | .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer)) 54 | .disableCachingNullValues(); 55 | 56 | RedisCacheManager cacheManager = RedisCacheManager.builder(factory) 57 | .cacheDefaults(config) 58 | .build(); 59 | return cacheManager; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/java/com/springboot_redis_example/controller/StudentController.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example.controller; 2 | 3 | import com.springboot_redis_example.entity.Student; 4 | import com.springboot_redis_example.service.StudentService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | 12 | 13 | /** 14 | * @Author: zhangqihao 15 | * @Date: 2019/4/11 22:44 16 | * @Version 1.0 17 | */ 18 | @RestController 19 | public class StudentController { 20 | 21 | @Autowired 22 | private StudentService studentService; 23 | 24 | @GetMapping("/student/{id}") 25 | public Student getStudentById(@PathVariable("id") Integer id){ 26 | return studentService.selectStudentById(id); 27 | } 28 | 29 | @PostMapping("/student/add") 30 | public int insertStudent(Student student){ 31 | return studentService.insertStudent(student); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/java/com/springboot_redis_example/entity/Student.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example.entity; 2 | 3 | 4 | import java.io.Serializable; 5 | 6 | /** 7 | * @Author: zhangqihao 8 | * @Date: 2019/4/11 20:47 9 | * @Version 1.0 10 | */ 11 | public class Student implements Serializable { 12 | //学生ID 13 | private Integer id; 14 | //学生年龄 15 | private int age; 16 | //学生性别 17 | private String sex; 18 | //学生住址 19 | private String address; 20 | 21 | public Integer getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Integer id) { 26 | this.id = id; 27 | } 28 | 29 | public int getAge() { 30 | return age; 31 | } 32 | 33 | public void setAge(int age) { 34 | this.age = age; 35 | } 36 | 37 | public String getSex() { 38 | return sex; 39 | } 40 | 41 | public void setSex(String sex) { 42 | this.sex = sex; 43 | } 44 | 45 | public String getAddress() { 46 | return address; 47 | } 48 | 49 | public void setAddress(String address) { 50 | this.address = address; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/java/com/springboot_redis_example/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example.mapper; 2 | 3 | import com.springboot_redis_example.entity.Student; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | 7 | /** 8 | * @Author: zhangqihao 9 | * @Date: 2019/4/11 21:18 10 | * @Version 1.0 11 | */ 12 | @Mapper 13 | public interface StudentMapper { 14 | /** 15 | * 查询用户管理信息 16 | */ 17 | public Student selectStudentById(Integer id); 18 | 19 | /** 20 | * 新增用户管理 21 | * 22 | */ 23 | public int insertStudent(Student student); 24 | 25 | /** 26 | * 修改用户管理 27 | * 28 | */ 29 | public int updateStudent(Student student); 30 | 31 | /** 32 | * 删除用户管理 33 | * 34 | */ 35 | public int deleteStudentById(Integer id); 36 | } 37 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/java/com/springboot_redis_example/service/StudentImpl.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example.service; 2 | 3 | import com.springboot_redis_example.entity.Student; 4 | import com.springboot_redis_example.mapper.StudentMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.cache.annotation.Cacheable; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @Author: zhangqihao 11 | * @Date: 2019/4/11 21:18 12 | * @Version 1.0 13 | */ 14 | @Service("StudentService") 15 | public class StudentImpl implements StudentService{ 16 | 17 | @Autowired 18 | private StudentMapper studentMapper; 19 | 20 | /** 21 | * 查询学生信息 22 | * @param id 23 | * @return 24 | */ 25 | @Override 26 | @Cacheable(value = "user",key = "#id") 27 | public Student selectStudentById(Integer id) { 28 | return studentMapper.selectStudentById(id); 29 | } 30 | 31 | /** 32 | * 新增学生信息 33 | * @param student 34 | * @return 35 | */ 36 | @Override 37 | public int insertStudent(Student student) { 38 | return studentMapper.insertStudent(student); 39 | } 40 | 41 | /** 42 | * 更新用户信息 43 | * @param student 44 | * @return 45 | */ 46 | @Override 47 | public int updateStudent(Student student) { 48 | return studentMapper.updateStudent(student); 49 | } 50 | 51 | /** 52 | * 删除用户信息 53 | * @param id 54 | * @return 55 | */ 56 | @Override 57 | public int deleteStudent(Integer id) { 58 | return studentMapper.deleteStudentById(id); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/java/com/springboot_redis_example/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example.service; 2 | 3 | import com.springboot_redis_example.entity.Student; 4 | 5 | 6 | 7 | /** 8 | * @Author: zhangqihao 9 | * @Date: 2019/4/11 20:52 10 | * @Version 1.0 11 | */ 12 | public interface StudentService { 13 | 14 | /* 15 | *查询数据 16 | */ 17 | public Student selectStudentById(Integer id); 18 | //写入数据 19 | public int insertStudent(Student student); 20 | //更新数据 21 | public int updateStudent(Student student); 22 | //删除数据 23 | public int deleteStudent(Integer id); 24 | } 25 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UncleCatMySelf/HMStrange/0a9db2ef7df355780acd69779730564f8034a50b/doc/demo/springboot-redis/src/main/resources/application.properties -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/resources/mybatis/mapper/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | select * from student 16 | 17 | 18 | 22 | 23 | 24 | insert into student (id,age,sex,address) 25 | values (#{id},#{age},#{sex},#{address}) 26 | 27 | 28 | 29 | update student 30 | 31 | id = #{id}, 32 | age = #{age}, 33 | sex = #{sex}, 34 | address = #{address}, 35 | 36 | where idStudent = #{id} 37 | 38 | 39 | 40 | delete from Student where idStudent = #{id} 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/main/resources/mybatis/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/demo/springboot-redis/src/test/java/com/springboot_redis_example/SpringbootRedisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.springboot_redis_example; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.data.redis.core.RedisTemplate; 8 | import org.springframework.data.redis.core.StringRedisTemplate; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | @RunWith(SpringRunner.class) 12 | @SpringBootTest 13 | public class SpringbootRedisApplicationTests { 14 | @Autowired 15 | StringRedisTemplate stringRedisTemplate; 16 | @Autowired 17 | RedisTemplate redisTemplate; 18 | 19 | @Test 20 | public void test01(){ 21 | stringRedisTemplate.opsForValue().append("msg","vlaue"); 22 | } 23 | 24 | @Test 25 | public void contextLoads() { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /doc/details/update_record.md: -------------------------------------------------------------------------------- 1 | ## HMStrange-项目更新记录 2 | 3 | - 【2019年3月29日-09:28】 构建项目,基于SpringBoot2.1.3(web+lombok),并撰写基本文档信息 **BY MySelf** 4 | - 【2019年3月29日-10:38】 修复项目组成员信息 **BY MySelf** 5 | - 【2019年3月29日-17:12】 添加项目组组织合作规范、项目组成员信息 **BY MySelf** 6 | - 【2019年3月29日-17:37】 添加个人签名,签署项目组组织合作规范 **BY MySelf** 7 | - 【2019年3月31日-17:00】 添加HMStrange项目贡献说明 **BY Noseparte** 8 | - 【2019年3月31日-20:39】 修改教程链接地址,修复组员信息 **BY MySelf** 9 | - 【2019年4月01日-09:19】 初次提交 **BY ELLIOT** 10 | - 【2019年4月01日-11: 26】 初次提交 **BY zhangqihao** 11 | - 【2019年4月01日-11: 55】 初次提交 **BY stj** 12 | - 【2019年4月01日-11: 55】 初次提交 **BY wolf** 13 | - 【2019年4月01日-11: 56】 修改组员提交信息格式 **BY MySelf** 14 | - 【2019年4月01日-18: 53】 初次提交 **BY LingBengYing** 15 | - 【2019年4月01日-23: 28】 初次提交 **BY Evans** 16 | - 【2019年4月02日-09: 36】 添加学习资料、组织架构 **BY MySelf** 17 | - 【2019年4月02日-14: 57】 初次提交 **BY Chen** 18 | - 【2019年4月02日-15: 07】 提交签名 **BY Chen** 19 | - 【2019年4月04日-17: 19】 基于SpringBoot+Mongo技术,完成HelloWorld项目教程案例; **BY Noseparte** 20 | -------------------------------------------------------------------------------- /doc/members/homework.md: -------------------------------------------------------------------------------- 1 | ## 初次代码提交修改文件 2 | 3 | ### 任务完成-1 4 | 5 | 【2019年3月29日】 By MySelf 6 | 7 | ### 任务完成-2 8 | 9 | 【2019年4月1日】 By ELLIOT 10 | 11 | ### 任务完成-3 12 | 13 | 【2019年4月1日】 By zhangqihao 14 | 15 | ### 任务完成-4 16 | 17 | 【2019年4月1日】 By stj 18 | 19 | > 每一个人按照以上模板修改此文件 20 | ### 任务完成-成员贡献规则说明 21 | 22 | 【2019年4月1日】 By Noseparte 23 | 24 | 25 | ### 任务完成-5 26 | 27 | 【2019年4月1日】 By LingBengYing 28 | 29 | ### 任务完成-6 30 | 31 | 【2019年4月1日】By wolf 32 | 33 | ### 任务完成-7 34 | 35 | 【2019年4月1日】By Evans 36 | 37 | ### 任务完成-8 38 | 39 | 【2019年4月1日】By Chen 40 | 41 | 42 | ### 任务完成-基于SpringBoot+Mongo技术,完成HelloWorld项目教程案例; 43 | 44 | 【2019年4月4日】By Noseparte 45 | 46 | -------------------------------------------------------------------------------- /doc/members/informations.md: -------------------------------------------------------------------------------- 1 | ## HMStrange-项目组成员信息表 2 | 3 | ### 当前情况 4 | 5 | 项目组以微信群形式组织,目前群内15人,实质参与10人。 6 | 7 | | 成员昵称 | 信息登记表 | 初次提交代码 |阅读规范并手写签名 | 任务执行情况 | 备注 | 8 | |---------|-----------|-------------|-------------|------|--------| 9 | | [Chen](https://github.com/CCCCCCCCCCChen) | √ | √ | √ | 开始 | | 10 | | [ELLIOT](https://github.com/chanjjaeseo) | √ | √ | √ | 开始 | | 11 | | [你笑的好美啊](https://github.com/shen13380308088) | √ | × | × | 未开始 | | 12 | | [沐声](https://github.com/LingBengYing) | √ | √ | √ | 开始 | | 13 | | [TAIN](https://github.com/TIANTIANSTUDY)| √ | √ | √ | 开始 | | 14 | | [leeyiyu](https://github.com/leeyiyu)| √ | × | × | 未开始 | | 15 | | [wolf](https://github.com/lvxinqiao)| √ | √ | √ | 开始 | | 16 | | [末骤雨初歇](https://github.com/wangjiangtao2)| √ | √ | √ | 开始 | | 17 | | [Noseparte](https://github.com/noseparte/)| √ | √ | √ | 开始 | | 18 | | [Evans](https://github.com/yangyong1997)| √ | √ | √ | 开始 | | 19 | 20 | ## 入门任务 21 | 22 | * [初次提交代码指南](https://www.imooc.com/article/284151) 23 | * [阅读规范并手写签名指南](https://www.imooc.com/article/284213) 24 | 25 | ### 加入我们 26 | 27 | - 添加**MySelf**个人微信号:Dr5204484,备注:HMStrange项目组 28 | - 填写信息登记表 29 | - 首次为项目提交代码 30 | - 基于项目组合作平等原则,参与开发规划任务 31 | - 学有所成! 32 | -------------------------------------------------------------------------------- /doc/members/specification.md: -------------------------------------------------------------------------------- 1 | ## 项目组组织合作规范 2 | 3 | 一、本组织以“公平公正、互助学习、互相分享、无私共享”为原则,各个项目组成员保持人品端正,不以利益为中心,坚持开源贡献思想,为推动项目而贡献自身的能力与精力。 4 | 5 | 二、项目组分配任务与调度任务期间,如果因个人时间原因而无法完成任务,需提前在项目组通知,方便其余组员协助完成。 6 | 7 | 三、每一次项目更新都需要在目录为doc/details/update_record.md的文件上填写更新内容,git commit -am *内容*,代码提交的内容也一样,模板为:核心内容+组员昵称。 8 | 9 | 四、组织无权向组员过分要求完成任何指定性工作,而是基于组员自愿自足原则,组员有权任意时间退出项目组。 10 | 11 | 五、项目技术文档撰写为每个组员的学习技能之一,希望组员能抽空按照模板,记录自身开发模块相关的技术文档。 12 | 13 | 六、组织具备一定的组织架构能力,组员接受此组织架构并和谐互助推动项目发展。 14 | 15 | 七、项目版本更新为15天/周期,项目将设定每个版本的核心跟进人员,记录并审查BUG。 16 | 17 | 八、每个组员都有权测试、发现BUG。 18 | 19 | **组员签名(签组员昵称以示认同),请以纸质图片上传:** 20 | 21 | ![MySelf 个人签名](https://raw.githubusercontent.com/UncleCatMySelf/img_HMStrange/master/img/%E7%BB%84%E7%BB%87%E8%A7%84%E8%8C%83%E7%AD%BE%E5%90%8D.png) 22 | 23 | ![LingBengYing 个人签名](https://raw.githubusercontent.com/LingBengYing/img_HMStrange/master/qq_pic_merged_1554165659487.jpg) 24 | 25 | ![sjt 个人签名](https://raw.githubusercontent.com/wangjiangtao2/img_HMStrange/master/img/%E7%BB%84%E7%BB%87%E8%A7%84%E8%8C%83%E7%AD%BE%E5%90%8Dstj.png) 26 | 27 | ![Noseparte_个人签名](https://raw.githubusercontent.com/UncleCatMySelf/img_HMStrange/master/img/%E7%BB%84%E7%BB%87%E8%A7%84%E8%8C%83%E7%AD%BE%E5%90%8DNo.jpg) 28 | 29 | ![TAIN_个人签名](https://raw.githubusercontent.com/TIANTIANSTUDY/img_HMStrange/master/img_self-signed/TAIN%20BY%20self-signed.jpg) 30 | 31 | ![Chen_个人签名](https://raw.githubusercontent.com/CCCCCCCCCCChen/img_HMStrange/master/img/%E7%BB%84%E7%BB%87%E8%A7%84%E8%8C%83%E7%AD%BE%E5%90%8DChen.jpg) 32 | 33 | ![Evans_个人签名](https://raw.githubusercontent.com/yangyong-404/ing_HMStrangeSignature/master/img/Evans.jpg) -------------------------------------------------------------------------------- /doc/milestone/milestone-doc.md: -------------------------------------------------------------------------------- 1 | ## HMStrange-项目里程碑 2 | 3 | - 【2019年3月26日】 HMStrange项目成立 4 | - 【2019年3月28日】 HMStrange项目组成立(15人、实质10人) 5 | - 【2019年4月01日】 HMStrange项目组组织架构初步确立 6 | -------------------------------------------------------------------------------- /doc/study/organization.md: -------------------------------------------------------------------------------- 1 | ## 项目组组织架构 2 | 3 | 【2019年4月02日初版】 4 | 5 | ![组织架构](https://raw.githubusercontent.com/UncleCatMySelf/img_HMStrange/master/organization/%E5%88%9D%E7%89%88%E6%9E%B6%E6%9E%84.png) -------------------------------------------------------------------------------- /doc/study/system_01.md: -------------------------------------------------------------------------------- 1 | ## 电商商品管理系统说明 2 | 3 | ![电商商品管理系统说明](https://raw.githubusercontent.com/UncleCatMySelf/img_HMStrange/master/study/%E7%94%B5%E5%95%86.png) 4 | 5 | ### 电商行业商业模式 6 | 7 | 电商行业现如今有很多成熟的商业模式,大体有一下几种: 8 | 9 | * B2C:企业与消费者之间的电子商务,类似天猫、京东是属于此类模式,企业在电子商务平台上售卖,消费者进行购买,是最常见的电子商务模式。 10 | * B2B:企业与企业之间的电子商务,也可以说是供应方与采购方之间的电子商务,此类模式是解决了上游到中游的采购问题,降低采购成本,类似阿里巴巴的1688。 11 | * C2C:消费者与消费者之间的电子商务,此类模式对商家的包容性更大,很多是个人,比如:淘宝、微店都是此类。 12 | * O2O:线上到线下再到线上,线上消费,线下服务,线上核销,例如:美团、饿了么。 13 | 14 | 15 | ### 商品管理系统说明 16 | 17 | 商品管理系统,是整个电商系统的数据基础,用于记录与商品有关的数据,虽然系统逻辑不复杂,但是由于操作的数据比较多,需要掌控细节,订单,营销,支付,物流等环节都需要从商品中心获取数据。 18 | 19 | 商品管理系统主要包含以下几个部分: 20 | 21 | 1、分类管理:管理商品分类,主要起到对不同商品的归类和; 22 | 2、品牌管理:管理商品品牌,为不同的商品添加品牌; 23 | 3、规格管理:规格也可以叫属性,决定了SKU,SPU,是商品模块重要的部分; 24 | 4、参数管理:参数也叫非关键属性,与规格类似,但是不决定SKU,只起到展示的作用; 25 | 5、商品推荐:商品推荐分常规推荐和个性化推荐; 26 | 6、商品搜索:涉及商品搜索逻辑和之后的展示问题; 27 | 7、商品评论:关键词,敏感词汇的筛选,评论等级等; 28 | 8、商品管理 : 对商品的增删改查以及上下架等其他操作,比较重要。 29 | 30 | ### 前台类目和后台类目 31 | 32 | 我们平时在设计分类的时候可能只有前台分类,然后分类的标题在前段展示,这种方式其实并不好,原因有以下几点: 33 | 34 | 不利于营销,如果我们只有一个分类我们给他起名字我们要考虑到后台的操作性,还要兼顾用户的体验是非常困难的。对于用户这个分类可以叫漂亮的衣服,但是对于后台录入来说就会想什么是漂亮额衣服。 35 | 不利于管理,你是否有时候想要删掉某一个分类,但是分类下有很多商品?这个时候就很头疼了。 36 | 不利于检索,设置丰富的前台类目可以让用户更好的找到分类,可以利用大数据分析用户喜欢搜索什么,然后给分类起名字。 37 | 38 | 解决方法就是设计两个分类,一个前端分类,一个后端分类。 39 | 40 | 几个意思呢,后端分类是给我们自己看的,我们要把商品挂靠在后端分类之下,前端分类是给用户看的,用户喜欢什么我们就起什么名字,也就是说给分类起一个昵称,后端分类就好比我们的姓名,前端分类就好比我们额游戏ID。 41 | 42 | 后端类目要尽量简洁明了让人一看就知道什么意思,同时要易于管理可以加上编号之类的,前台类目根据需求随便其就行了。 43 | 44 | 那么具体怎么设计呢? 45 | 46 | 在后台设置两个菜单一个是后台类目,一个是前台类目,后台类目就是我们平时设计的主要包含以下字段: 47 | 48 | 分类名称:分类的名称,自己起; 49 | 前台类目:对应的前台类目是什么; 50 | 描述:对分类的描述; 51 | 库存:这个分类下还有多少库存; 52 | 创建时间,修改时间:什么时候建的,什么时候修改的; 53 | 操作:只可以编辑,不可以删除(后台类目不可删除,谨慎)。 54 | 55 | 前台类目:前台类目和后台类目基本相同,不同之处在于,我们在创建前端分类的时候要注意下,要选择前端分类是挂靠在哪个后端分类之下的,具体挂靠规则我一会再说,不过前端类目一定是要挂靠在后端类目之下的哦,不然就是小黑孩,没有身份。 56 | 57 | 另外前台类目可以编辑,删除,屏蔽,即便分类下有商品删除也没有关系,因为商品是在后台分类下的,这样的话我们就可以根据营销额需求灵活的变动前端的类目。 58 | 59 | 情人节到了,那就多弄关于礼物,玫瑰花之类的分类,将其他分类屏蔽掉,冬天的时候可以将关于夏季的服装分类全部屏蔽或者删除。 60 | 61 | ### 分类层级 62 | 63 | 那啥,我说说这个分类层级的问题,根据规模和业务的不同,分类的层级肯定也是不同的。那么这里呢,我是建议统一设置成三级,上衣——羽绒服——男士羽绒服,层级太少,如果商品太多是不易于管理的,层级太深也不行,太深的话就会不利于寻找,找了半天找不到也是问题,所以直接设置成三级类目。 64 | 65 | ### 挂靠规则 66 | 67 | 下面说说挂靠规则,首先前台分类一定是要挂靠在后台分类之下的,商品是必须挂靠在后台分类之下的,并且: 68 | 69 | - 商品必须挂靠在最下级分类之下,也就是最小分类,并且只能挂靠一个分类。为什么呢?因为我们创建规格,属性,品牌都必须挂靠在最小分类之下。为啥呢,因为易于管理,如果你不挂靠在最小分类的下面,那你创建这个下级分类的目的是什么,同时挂靠多级会造成理解困难,这个商品到底是什么分类,可能想不明白。 70 | - 前端分类必须挂靠在后端分类之下,对应关系是比较灵活的,一个前端分类可以对应一个后端分类,同时也可以一对N,N对1,N对N,自由组合,因为商品的挂靠已经有后台分类决定了,前台在后台的挂靠只是因为具体需要灵活运用,对逻辑没有影响。因为不管怎么样,前端显示就会寻找前端分类对应那些后端分类,而这些分类下有哪些商品。 71 | 72 | ### 规格管理 73 | 74 | 规格也叫属性,叫什么无所谓,得知道规格是除了分类之外的另外一个重点,因为规格决定了SKU、SPU、库存、价格,我们在添加商品的时候规格也是最重要的。那么现在来说规格的实际基本有两种形式:一种是单规格单选,另外一种是多规格单选。 75 | 76 | - 单规格单选:一件商品在购买的时候进行单选:红色L,蓝色XL,黑色XXL,这是3个SKU,也就是说有三种价格 77 | - 多规格单选:一件商品在购买的时候进行多选:颜色(红色,蓝色,黑色)、尺码(L、XL、XXL),一个颜色可以对应三个尺码,33得9,就是9个SKU,也就是说有9种价格。 78 | 79 | ### 商品推荐 80 | 81 | 商品推荐是商城系统比较常见的功能模块,推荐位置有很多,首页推荐,搜索结果页推荐,购物猜你喜欢。 82 | 83 | 商品推荐属于营销模块,推荐位置是非常珍贵的,一款软件就那么大,推荐的效果不仅影响用户体验还影响商业盈利,如果推荐的商品用户老是不喜欢,那么用户就会对软件产生厌倦,因为没有我想要的东西,同时也就没有商业盈利了,商品推荐分类常规推荐和个性化推荐两种 84 | 85 | - 常规推荐:手动往推荐位置添加商品,或是根据简单的筛选添加推荐商品,比如销量,浏览量,上传时间等,方式比较简单,对技术要求不高,但是推荐效果不好 86 | 87 | - 个性化推荐:个性化推荐是属于产品智能模块,比如只能排序都属于产品智能。 88 | 89 | - 个性化推荐流程:首先要选择相关数据,就是哪些数据会影响推荐效果,哪些数据可以成为推荐的因素,主要是根据用户的行为数据进行用户行为分析,然后创造用户画像,得出用户画像与不同商品的相关性,设计算法模型,最后进行推荐。 90 | 91 | 流程就是:数据的采集,数据的分析,用户个性化推荐,不过个性化推荐对用户规模有一定要求,运用大数据是要依赖庞大的数据基础的,这样得出的算法模型才具有实际意义,对于用户量不是太多的商城,基本是采取常规推荐 92 | 93 | ### 商品搜索 94 | 95 | 用户通过商品搜索可以快速找到自己想要的信息,商品搜索也是流量的入口商品搜索的业务流程是经过4个步骤,其业务流程是这样的,看下面: 96 | 97 | - 输入关键字:首先用户要输入关键字,这个时候后台要对关键字尽心处理,将用户输入的关键字进行拆分处理,比如:春季流行青年运动裤,会被拆分成春季、流行、青年、运动裤,三个关键词,根据用户以往的行为数据找到相关的热点分类。 98 | - 数据查询:查询出数据库后,系统会从数据库中索引包含关键词的商品,商品搜索时,主要是从商品的标题,分类,品牌,规格等进行关联搜索。 99 | - 搜索排序:搜索完成后找到了先关的商品,下面就要对这些商品进行排序,排序可以根据商品的相关性,就是用户输入的搜索词与商品标题,分类,品牌的关联度进行排序,关联度越高排序越靠前。还有其他的排序依据:销量,价格,评论数,上架时间,根据这些对商品进行排序。 100 | - 结果输出:排序完成就要对商品进行前端的展示。 101 | - 搜索筛选:搜索结果页面一般会支持我们进行商品的筛选,商品筛选可以让用户更快的找到自己想要的商品,筛选的依据一般有分类,品牌,服务标签,价格区间,用户根据关键词搜索到的商品有可能不是同一个类目之下的,经过分类的筛选就可以找到同一类商品。品牌筛选用于找到这个品牌下的商品,服务标签是后台为商品贴的标签,比如,包邮,分期。价格区间是吧价格分为多个区间用户进行筛选。 102 | 103 | 104 | > 本文摘抄:[电商前后台设计全面解析之——商品管理系统](http://www.woshipm.com/pd/2122609.html) -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.github 12 | hm-strange 13 | 0.0.1-SNAPSHOT 14 | hm-strange 15 | An e-commerce back-end framework that supports diversified configurations 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | 28 | org.projectlombok 29 | lombok 30 | true 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-test 35 | test 36 | 37 | 38 | 39 | 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-maven-plugin 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/com/github/HmStrangeApplication.java: -------------------------------------------------------------------------------- 1 | package com.github; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class HmStrangeApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(HmStrangeApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/test/java/com/github/HmStrangeApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.github; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class HmStrangeApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | --------------------------------------------------------------------------------