├── .gitignore
├── doc
├── java_shop.docx
└── 毕设论文.docx
├── java_shop.sql
├── readme.md
├── server
├── .gitignore
├── Readme.md
├── pom.xml
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── gk
│ │ │ └── study
│ │ │ ├── MySpringApplication.java
│ │ │ ├── common
│ │ │ ├── APIResponse.java
│ │ │ ├── ResponeCode.java
│ │ │ └── TestUtils.java
│ │ │ ├── config
│ │ │ └── MyConfig.java
│ │ │ ├── controller
│ │ │ ├── AdController.java
│ │ │ ├── AddressController.java
│ │ │ ├── BannerController.java
│ │ │ ├── ClassificationController.java
│ │ │ ├── CommentController.java
│ │ │ ├── ErrorLogController.java
│ │ │ ├── NoticeController.java
│ │ │ ├── OpLogController.java
│ │ │ ├── OrderController.java
│ │ │ ├── OverViewController.java
│ │ │ ├── TagController.java
│ │ │ ├── ThingCollectController.java
│ │ │ ├── ThingController.java
│ │ │ ├── ThingWishController.java
│ │ │ └── UserController.java
│ │ │ ├── entity
│ │ │ ├── Ad.java
│ │ │ ├── Address.java
│ │ │ ├── Banner.java
│ │ │ ├── Classification.java
│ │ │ ├── Comment.java
│ │ │ ├── ErrorLog.java
│ │ │ ├── Notice.java
│ │ │ ├── OpLog.java
│ │ │ ├── Order.java
│ │ │ ├── Tag.java
│ │ │ ├── Thing.java
│ │ │ ├── ThingCollect.java
│ │ │ ├── ThingTag.java
│ │ │ ├── ThingWish.java
│ │ │ ├── User.java
│ │ │ └── VisitData.java
│ │ │ ├── handler
│ │ │ └── CustomExceptionHandler.java
│ │ │ ├── interceptor
│ │ │ └── AccessInterceptor.java
│ │ │ ├── mapper
│ │ │ ├── AdMapper.java
│ │ │ ├── AddressMapper.java
│ │ │ ├── BannerMapper.java
│ │ │ ├── ClassificationMapper.java
│ │ │ ├── CommentMapper.java
│ │ │ ├── ErrorLogMapper.java
│ │ │ ├── NoticeMapper.java
│ │ │ ├── OpLogMapper.java
│ │ │ ├── OrderMapper.java
│ │ │ ├── OverviewMapper.java
│ │ │ ├── TagMapper.java
│ │ │ ├── ThingCollectMapper.java
│ │ │ ├── ThingMapper.java
│ │ │ ├── ThingTagMapper.java
│ │ │ ├── ThingWishMapper.java
│ │ │ └── UserMapper.java
│ │ │ ├── permission
│ │ │ ├── Access.java
│ │ │ └── AccessLevel.java
│ │ │ ├── service
│ │ │ ├── AdService.java
│ │ │ ├── AddressService.java
│ │ │ ├── BannerService.java
│ │ │ ├── ClassificationService.java
│ │ │ ├── CommentService.java
│ │ │ ├── ErrorLogService.java
│ │ │ ├── NoticeService.java
│ │ │ ├── OpLogService.java
│ │ │ ├── OrderService.java
│ │ │ ├── TagService.java
│ │ │ ├── ThingCollectService.java
│ │ │ ├── ThingService.java
│ │ │ ├── ThingWishService.java
│ │ │ ├── UserService.java
│ │ │ └── impl
│ │ │ │ ├── AdServiceImpl.java
│ │ │ │ ├── AddressServiceImpl.java
│ │ │ │ ├── BannerServiceImpl.java
│ │ │ │ ├── ClassificationServiceImpl.java
│ │ │ │ ├── CommentServiceImpl.java
│ │ │ │ ├── ErrorLogServiceImpl.java
│ │ │ │ ├── NoticeServiceImpl.java
│ │ │ │ ├── OpLogServiceImpl.java
│ │ │ │ ├── OrderServiceImpl.java
│ │ │ │ ├── TagServiceImpl.java
│ │ │ │ ├── ThingCollectServiceImpl.java
│ │ │ │ ├── ThingServiceImpl.java
│ │ │ │ ├── ThingWishServiceImpl.java
│ │ │ │ └── UserServiceImpl.java
│ │ │ └── utils
│ │ │ ├── HttpContextUtils.java
│ │ │ ├── IpUtils.java
│ │ │ └── JsonUtils.java
│ │ └── resources
│ │ ├── application.yml
│ │ ├── logback-spring.xml
│ │ └── mapper
│ │ ├── CommentMapper.xml
│ │ ├── OrderMapper.xml
│ │ ├── OverviewMapper.xml
│ │ ├── ThingCollectMapper.xml
│ │ ├── ThingMapper.xml
│ │ ├── ThingWishMapper.xml
│ │ └── UserMapper.xml
├── start.sh
└── upload
│ ├── avatar
│ ├── 137b9040-b3a4-4de5-b5f2-8efc9014f28f.jpeg
│ ├── 4ef360ce-9fb9-4080-bf10-83a6f3c0a3f2.png
│ ├── b3a4fd2c-cbf4-4fad-8064-c22e09e72676.jpeg
│ └── ec794bf4-da3c-4c69-ad67-ae17ef3803b1.jpeg
│ └── image
│ ├── 02669227-c406-45b5-8656-8d0817aaaf75.jpeg
│ ├── 066794d5-285c-467c-b2dc-de0b2597b758.jpeg
│ ├── 07dfd814-28a7-408a-ba89-368789592361.jpeg
│ ├── 09c48dc0-9e4b-4304-9798-48e8b659f5ef.jpeg
│ ├── 1085cacc-bd97-451b-b9f0-a5a3bfa0cd13.jpeg
│ ├── 119c87c5-b59e-4936-9fbc-cd8351470dc1.jpeg
│ ├── 1316bb64-a45c-4154-b333-a8cdd74e8c48.jpeg
│ ├── 1693fa26-ea7f-455b-86c6-3d3d73082562.jpeg
│ ├── 1c3f9fe6-6680-4da3-a217-0ed37042de81.jpeg
│ ├── 1de697b6-a299-4f0b-9bc0-f26518f2b6fd.jpeg
│ ├── 1fbbae3b-887b-45f3-8ef9-a2904edee5b6.jpeg
│ ├── 2013778b-2460-4d76-ac9c-90ec5e1d7f2f.jpeg
│ ├── 266001d1-d4bd-41cb-9a09-8ab94991f35d.jpeg
│ ├── 2baa3f45-61ac-4cf4-a837-48c419621dde.jpeg
│ ├── 2c9276dc-b3ee-4328-be6f-a8739eaf3531.jpeg
│ ├── 31ab2951-96f8-4d8e-adee-5fd6c46a4e5d.jpeg
│ ├── 36509a1c-65a9-4e53-b919-4b592c32a04d.jpeg
│ ├── 3a24c6d2-40ab-4bb4-a744-80bf04220e39.jpeg
│ ├── 3b456cbf-0fff-44c1-8adc-5e6261a6b25f.jpeg
│ ├── 3c4b2947-aa34-4e69-8f3c-904e01a6791a.jpeg
│ ├── 3d01f74c-20b3-47f5-8fa9-740c7cddbf07.jpeg
│ ├── 3d5c44b6-de8b-42ac-8a15-910ec593c72a.jpeg
│ ├── 3dc65bc1-32e6-42f5-a426-1cdf0b5b12d2.jpeg
│ ├── 3e96dae1-8f41-4d70-9de0-c9e4c529d81b.jpeg
│ ├── 3f75945f-46c2-4bb7-9d16-3f89dda111bf.jpeg
│ ├── 45fa2ea1-c066-4770-a6d7-57b9846005d9.jpeg
│ ├── 4a5c51b4-f837-40c5-9925-fdb63d494533.jpeg
│ ├── 4aa269a6-4c83-4263-a6cb-740ad108bcd1.jpeg
│ ├── 4e5065a6-4dbd-4c20-97b6-92f1e4192647.jpeg
│ ├── 4ec354f7-8651-4919-b878-342896444193.jpeg
│ ├── 4fdc13c2-1f8c-499b-ac75-c6fa18f54205.png
│ ├── 50b04075-6b81-46a9-90da-4d5af215265b.jpeg
│ ├── 55c42013-b94e-44c6-b839-81471cc04dcb.jpeg
│ ├── 58cd7cef-c4c6-4dd4-8d25-fc8d3e0af8ad.jpeg
│ ├── 5a7fc4c7-4327-4e69-9e5e-82182d19bc03.jpeg
│ ├── 5f299ffb-c2f8-4ade-980e-cba7d4938519.png
│ ├── 63538afc-533a-44b1-8e00-7466e0c528ae.jpeg
│ ├── 63e916d9-75c2-4398-bd10-0a578c13031a.jpeg
│ ├── 64c66b8f-b82e-4c7a-b714-9adc32cd5ff6.jpeg
│ ├── 701d29e3-8c39-46c3-95ae-264c87ee13d2.jpeg
│ ├── 70e77e0a-019a-44b3-ac28-8399ef030728.jpeg
│ ├── 7859b029-5bc2-4ece-8546-4408ce8d69bb.jpeg
│ ├── 791e2e6a-6db9-4d54-9f92-cbb9c91c57d9.jpeg
│ ├── 7b730c2e-be16-4914-a754-4ecbafc4cfce.png
│ ├── 7c37dbd8-956a-43d8-a476-0fe7f0b36e95.jpeg
│ ├── 7da385db-6603-4e08-ad6b-2de775dfab68.jpeg
│ ├── 7fc5f045-ac08-4be1-b88a-f07545a0e45c.jpeg
│ ├── 8164fc3b-f47b-4b0e-ba26-50602d4ef276.png
│ ├── 839fb8e2-636e-47bb-a39f-7c6d326de88f.jpeg
│ ├── 88f76aa8-b9dd-4831-b772-e5466e877da9.jpeg
│ ├── 8e50750e-cada-47ff-8fcc-9b531d67e780.jpeg
│ ├── 92b6a1c4-f786-441b-a285-ad8262db560f.jpeg
│ ├── 94c9900c-1922-4616-9d9f-46917eb177ef.jpeg
│ ├── 98be90a3-8c89-436c-a24b-c16ac3c379df.jpeg
│ ├── 9a6c7d68-6856-424d-897c-804bdca2f4a5.jpeg
│ ├── 9da218e9-becd-4b16-aedf-82fc46b6b2ce.jpeg
│ ├── 9f576635-f270-4e3a-92ec-741692d80cb7.jpeg
│ ├── a281dfe1-3c78-4522-b38e-c53de2ff22c9.jpeg
│ ├── a2e19f07-c866-4b93-b429-2e8a6937afd1.png
│ ├── af235af7-f71f-416a-9e38-68c3ad26ad20.jpeg
│ ├── af4777cd-2f23-4c05-9fdd-bd07274f008b.jpeg
│ ├── b395ea5c-e5a9-4a56-9b5e-f1736078e722.jpeg
│ ├── b5de8200-ff15-4574-8e38-7642fe952f77.jpeg
│ ├── b6dbbb0e-262f-4267-83ef-bf527d0c8aa0.jpeg
│ ├── b7c5ee92-17f1-4040-bed8-6f61f3f5930d.jpeg
│ ├── b86fc2cd-f135-419d-8039-600d10cf674f.jpeg
│ ├── b988bb82-552b-4ae9-acfb-b6eff78e221f.jpeg
│ ├── ca174798-a1fe-4e1a-ab03-8d80d74ad0d4.jpeg
│ ├── cad0f753-04da-4ebd-aeed-d2ce83cf0b9c.jpeg
│ ├── d139c44e-d24a-47ac-9f8b-72807b5a3849.jpeg
│ ├── debc41a3-20b8-4e01-b17d-fca1a7820574.jpeg
│ ├── dfbbcffe-362e-42d0-bcdd-063f5b307553.jpeg
│ ├── e1d4e3a4-06e7-4d96-b60d-71cb8db4b019.jpeg
│ ├── e98af765-4b0f-4f4b-8e8a-f232133ab100.jpeg
│ ├── e9bbf322-28a9-4b87-83da-f1028971ac72.jpeg
│ ├── e9c140a4-e077-4750-8e3d-9db540a150d0.jpeg
│ ├── ea71ad95-7da2-41c0-9e49-ea2b96f81e53.jpeg
│ ├── eb71dae5-b84d-4b9a-8e36-5b2adf25c4e2.png
│ ├── ed17adc0-d18a-4ea4-9447-7817fc2a4168.jpeg
│ ├── ed6410b5-16ea-4f90-b853-c4d6e48a8548.jpeg
│ ├── edff6448-f92e-4f92-a475-1556ca7a7615.jpeg
│ ├── f08190e5-502e-476c-a4f9-f7eac0be937b.jpeg
│ ├── f3c07fdd-dada-4eda-ac8a-91c583fd0a85.png
│ ├── f480ca9b-abc5-4bbf-8a69-e872fc842679.jpeg
│ ├── f6b8099e-9c89-4795-b3fc-ee128b5b637c.jpeg
│ ├── f77de97e-b79d-48b7-b6e5-6567df26585f.jpeg
│ ├── f79c3ceb-9690-4be8-b188-ff91933bffab.jpeg
│ ├── f7f12f87-7a98-4175-a900-45f4f84f758c.jpeg
│ ├── f7f8a920-5a79-480e-9288-d3caf83df406.jpeg
│ ├── fb209198-480a-4e4c-a665-56efa58c1942.jpeg
│ └── fe1245c5-0d59-4d50-90d6-ca680267027e.jpeg
└── web
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── .stylelintignore
├── README.md
├── build
├── constant.ts
└── vite
│ └── plugins
│ ├── autoImport.ts
│ ├── component.ts
│ ├── compress.ts
│ ├── imagemin.ts
│ ├── index.ts
│ ├── progress.ts
│ ├── restart.ts
│ ├── unocss.ts
│ └── visualizer.ts
├── index.html
├── package-lock.json
├── package.json
├── postcss.config.js
├── prettier.config.js
├── public
├── favicon.ico
└── images
│ ├── admin-login-bg.jpg
│ ├── bg2.jpg
│ └── demo.jpg
├── src
├── App.vue
├── api
│ ├── ad.ts
│ ├── address.ts
│ ├── classification.ts
│ ├── comment.ts
│ ├── log.ts
│ ├── notice.ts
│ ├── order.ts
│ ├── overview.ts
│ ├── tag.ts
│ ├── thing.ts
│ ├── thingCollect.ts
│ ├── thingWish.ts
│ └── user.ts
├── assets
│ ├── fonts
│ │ ├── Blimone-ExtraBold.woff
│ │ ├── Blimone-ExtraLight.woff
│ │ ├── Blimone-Light.woff
│ │ └── Blimone-Regular.woff
│ ├── icons
│ │ ├── logo.png
│ │ └── svg
│ │ │ ├── github.svg
│ │ │ ├── logo.svg
│ │ │ ├── marks.svg
│ │ │ ├── test.svg
│ │ │ ├── ts.svg
│ │ │ └── twitter.svg
│ ├── images
│ │ ├── add.svg
│ │ ├── address-right-icon.svg
│ │ ├── ali-pay-icon.svg
│ │ ├── avatar.jpg
│ │ ├── banner-02.webp
│ │ ├── banner2.svg
│ │ ├── cart-icon.svg
│ │ ├── clear-search.svg
│ │ ├── code-icon.svg
│ │ ├── delete-icon.svg
│ │ ├── ebook-download-icon.svg
│ │ ├── k-logo.png
│ │ ├── login-banner.png
│ │ ├── login.png
│ │ ├── logo.png
│ │ ├── mail-icon.svg
│ │ ├── message-icon.svg
│ │ ├── order-address-icon.svg
│ │ ├── order-icon.svg
│ │ ├── order-point-icon.svg
│ │ ├── order-thing-icon.svg
│ │ ├── pwd-hidden.svg
│ │ ├── pwd-icon.svg
│ │ ├── qunerweima.jpg
│ │ ├── read-online-icon.svg
│ │ ├── recommend-hover.svg
│ │ ├── register-name.svg
│ │ ├── search-icon.svg
│ │ ├── searchIcon.svg
│ │ ├── setting-card-icon.svg
│ │ ├── setting-icon.svg
│ │ ├── setting-msg-icon.svg
│ │ ├── setting-push-icon.svg
│ │ ├── setting-safe-icon.svg
│ │ ├── share-icon.svg
│ │ ├── tel-icon.svg
│ │ ├── want-read-hover.svg
│ │ ├── wb-share.svg
│ │ └── wx-pay-icon.svg
│ └── styles
│ │ └── base.less
├── core
│ └── bootstrap.js
├── main.ts
├── router
│ ├── index.ts
│ └── root.ts
├── store
│ ├── constants.ts
│ ├── index.ts
│ └── modules
│ │ ├── app
│ │ ├── index.ts
│ │ └── types.ts
│ │ └── user
│ │ ├── index.ts
│ │ └── types.ts
├── styles
│ ├── index.less
│ └── reset.less
├── utils
│ ├── auth.ts
│ ├── http
│ │ └── axios
│ │ │ ├── index.ts
│ │ │ ├── status.ts
│ │ │ └── type.ts
│ ├── index.ts
│ └── result.ts
└── views
│ ├── admin
│ ├── ad.vue
│ ├── admin-login.vue
│ ├── classification.vue
│ ├── comment.vue
│ ├── error-log.vue
│ ├── login-log.vue
│ ├── main.vue
│ ├── notice.vue
│ ├── op-log.vue
│ ├── order.vue
│ ├── overview.vue
│ ├── sys-info.vue
│ ├── tag.vue
│ ├── thing.vue
│ └── user.vue
│ └── index
│ ├── components
│ ├── content.vue
│ ├── footer.vue
│ ├── header.vue
│ └── search-content-view.vue
│ ├── confirm.vue
│ ├── detail.vue
│ ├── index.vue
│ ├── login.vue
│ ├── pay.vue
│ ├── portal.vue
│ ├── register.vue
│ ├── search.vue
│ ├── user
│ ├── address-view.vue
│ ├── collect-thing-view.vue
│ ├── comment-view.vue
│ ├── fans-view.vue
│ ├── follow-view.vue
│ ├── message-view.vue
│ ├── mine-infos-view.vue
│ ├── modal
│ │ └── edit-address.vue
│ ├── order-view.vue
│ ├── push-view.vue
│ ├── score-view.vue
│ ├── security-view.vue
│ ├── userinfo-edit-view.vue
│ └── wish-thing-view.vue
│ └── usercenter.vue
├── stylelint.config.js
├── tsconfig.json
├── types
├── auto-imports.d.ts
├── components.d.ts
└── env.d.ts
├── vite.config.ts
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 |
--------------------------------------------------------------------------------
/doc/java_shop.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/geeeeeeeek/java_shop/8b20423032358386466e87f3abeee5cc4b9a7581/doc/java_shop.docx
--------------------------------------------------------------------------------
/doc/毕设论文.docx:
--------------------------------------------------------------------------------
1 | 完整文章可以联系vx:lengqin1024
2 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # 基于Java的商城网站系统设计与实现
2 |
3 | > *一直想做一款管理系统,看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套管理系统。现将部分源码开源,如需完整源码,可以联系客服微信购买:Lengqin1024*
4 |
5 |
6 | ### 演示地址
7 |
8 | 前台地址: http://shop.gitapp.cn
9 |
10 | 后台地址:http://shop.gitapp.cn/admin
11 |
12 | 后台管理帐号:
13 |
14 | 用户名:admin123
15 | 密码:admin123
16 |
17 | ### 功能介绍
18 |
19 | 平台采用B/S结构,后端采用主流的Springboot框架进行开发,前端采用主流的Vue.js进行开发。
20 |
21 | 整个平台包括前台和后台两个部分。
22 |
23 | - 前台功能包括:首页、商品详情页、订单、用户中心模块。
24 | - 后台功能包括:总览、订单管理、商品管理、分类管理、标签管理、评论管理、用户管理、运营管理、日志管理、系统信息模块。
25 |
26 | ### 适合人群
27 |
28 | 大学生、系统设计人员、课程作业
29 |
30 |
31 | ### 代码结构
32 |
33 | - server目录是后端代码
34 | - web目录是前端代码
35 |
36 | ### 部署运行
37 |
38 | #### 后端运行步骤
39 |
40 | 1. 下载JDK 1.8,并配置环境变量
41 |
42 | 2. 下载本代码后,使用IntelliJ IDEA打开server目录
43 |
44 | 3. 配置server目录中的application.yml文件,配置BASE_LOCATION、DB_NAME、数据库账号密码
45 |
46 | 4. 安装mysql 5.7数据库,并创建数据库,创建SQL如下:
47 | ```
48 | CREATE DATABASE IF NOT EXISTS java_shop DEFAULT CHARSET utf8 COLLATE utf8_general_ci
49 | ```
50 | 5. 恢复sql数据。在mysql下依次执行如下命令:
51 |
52 | ```
53 | mysql> use java_shop;
54 | mysql> source D:/xxx/xxx/xxx.sql;
55 | ```
56 |
57 | 6. 启动后端服务:点击IDEA顶部run按钮
58 |
59 |
60 | #### 前端运行步骤
61 |
62 | 1. 安装node 16.14
63 |
64 | 2. 修改web/src/store下的constansts.ts文件中的BASE_URL,改成你自己后端的地址
65 |
66 | 3. cmd命令进入web目录下,安装依赖,执行:
67 | ```
68 | npm install
69 | ```
70 | 4. 运行项目
71 | ```
72 | npm run dev
73 | ```
74 | 5. 在浏览器输入: http://localhost:3000 即可预览
75 |
76 |
77 | ### 界面预览
78 |
79 | 首页
80 |
81 | 
82 |
83 |
84 | 后台页面
85 |
86 | 
87 |
88 |
89 |
90 | ### 参考论文
91 | [点击进入](doc/java_shop.docx)
92 |
93 |
94 | ### 视频讲解
95 |
96 | [点击进入](https://www.youtube.com/watch?v=vVKU4VjmaGE)
97 |
98 |
99 | ### 付费咨询
100 |
101 | 微信:Lengqin1024
102 |
103 | ### 打赏作者
104 |
105 |
106 |
--------------------------------------------------------------------------------
/server/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 | !**/src/main/**/target/
4 | !**/src/test/**/target/
5 |
6 | ### STS ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 |
15 | ### IntelliJ IDEA ###
16 | .idea
17 | *.iws
18 | *.iml
19 | *.ipr
20 |
21 | ### NetBeans ###
22 | /nbproject/private/
23 | /nbbuild/
24 | /dist/
25 | /nbdist/
26 | /.nb-gradle/
27 | build/
28 | !**/src/main/**/build/
29 | !**/src/test/**/build/
30 |
31 | ### VS Code ###
32 | .vscode/
33 | my-log
34 |
--------------------------------------------------------------------------------
/server/Readme.md:
--------------------------------------------------------------------------------
1 | # Document of this project
2 | > 学习过程中,遇到问题可以咨询作者:lengqin1024(微信)
3 |
4 | ### 功能
5 |
6 | * 增删改查
7 | * 文件上传
8 | * 数据库配置
9 | * 日志管理
10 | * 权限控制
11 |
12 | ### 后端部署流程
13 |
14 | 1. 配置端口 位于application.yml
15 | 2. 配置DB_NAME 位于application.yml
16 | 3. 配置BASE_LOCATION 位于application.yml
17 | 4. 修改logback-spring.xml下的LOG_HOME的value值
18 | 5. maven clean -> maven package
19 | 6. 将jar包复制到服务器
20 | 7. 将upload文件夹复制到服务器
21 | 8. 迁移mysql数据库
22 | 9. 运行启动jar包命令
23 |
24 | ### 运行jar命令(或双击start.sh)
25 |
26 | title xxxx
27 | java -jar -Xms64m -Xmx128m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=64m xxxxx.jar
28 |
29 |
30 | ### 数据库相关
31 |
32 | 删除数据库命令:
33 |
34 | drop database if exists book;
35 |
36 | 创建数据库命令:
37 |
38 | CREATE DATABASE IF NOT EXISTS book DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
39 |
40 | 数据库备份命令:
41 |
42 | mysqldump -u root -p --databases 数据库名称 > xxx.sql
43 |
44 | 数据库恢复命令:
45 |
46 | source D:\\xxx.sql
47 |
48 |
49 | ### 常见问题
50 |
51 | #### 日志路径
52 |
53 | 修改logback-spring.xml下的LOG_HOME的value值
54 |
55 | #### 配置数据库
56 |
57 | application.yml中
58 |
59 | #### Druid连接池配置
60 |
61 | * application.yml中配置druid
62 | * 参考链接:https://blog.csdn.net/nothingavenger/article/details/114119585
63 | * 监控地址:http://localhost:8009/druid/index.html
64 |
65 | #### mysql主键id过长
66 |
67 | https://blog.csdn.net/qq_46728644/article/details/120772577
68 |
69 | #### yml不起作用
70 |
71 | 需要maven clean一下
72 |
73 | #### 注意实体字段最好是String类型
74 |
75 | 实体字段最好是String类型,mybatis-plus的update的时候,null的不更新
76 |
77 | #### 打包步骤
78 |
79 | maven clean -> maven package
80 |
81 | https://blog.csdn.net/weixin_42822484/article/details/107893586
82 |
83 | #### 配置文件上传大小
84 |
85 | application.yml中multipart下
86 |
87 | #### 静态资源路径配置
88 |
89 | https://blog.csdn.net/cylcjsg/article/details/128102776?
90 |
91 | #### 跨域配置
92 |
93 | 见CorsConfig.java
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/MySpringApplication.java:
--------------------------------------------------------------------------------
1 | package com.gk.study;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author lengqin1024(微信)
8 | * @email net936@163.com
9 | */
10 | @SpringBootApplication
11 | public class MySpringApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(MySpringApplication.class, args);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/common/APIResponse.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.common;
2 |
3 |
4 | import java.io.Serializable;
5 |
6 | import lombok.Data;
7 |
8 | /**
9 | * @功能描述: 响应报文,统一封装类
10 | */
11 | @Data
12 | public class APIResponse implements Serializable {
13 | private int code;
14 | private String msg;
15 | private T data;
16 | private String trace;
17 | private long timestamp;
18 |
19 | public APIResponse() {
20 | this.timestamp = System.currentTimeMillis();
21 | }
22 |
23 | public APIResponse(ResponeCode responseCode) {
24 | this.timestamp = System.currentTimeMillis();
25 | this.code = responseCode.getCode();
26 | this.msg = responseCode.getMsg();
27 | }
28 |
29 | public APIResponse(ResponeCode responseCode, String msg) {
30 | this(responseCode);
31 | this.msg = msg;
32 | }
33 |
34 | public APIResponse(ResponeCode responseCode, T data) {
35 | this(responseCode);
36 | this.data = data;
37 | }
38 |
39 | public APIResponse(ResponeCode responseCode, String msg, T data) {
40 | this(responseCode);
41 | this.trace = msg;
42 | this.data = data;
43 | }
44 |
45 | @Override
46 | public String toString() {
47 | return "APIResponse{" +
48 | "timestamp=" + timestamp +
49 | ", code=" + code +
50 | ", msg='" + msg + '\'' +
51 | ", trace='" + trace + '\'' +
52 | ", data=" + data +
53 | //", count=" + count +
54 | '}';
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/common/ResponeCode.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.common;
2 |
3 | /**
4 | * @功能描述: 响应报文,统一封装类
5 | */
6 | public enum ResponeCode {
7 | SUCCESS(200, "成功"),
8 | FAIL(400, "失败"),
9 | UNAUTHORIZED(401, "未认证"),
10 | NOT_FOUND(404, "接口不存在"),
11 | INTERNAL_SERVER_ERROR(500, "服务器内部错误");
12 |
13 | private int code;
14 | private String msg;
15 |
16 | private ResponeCode(int code, String msg) {
17 | this.code = code;
18 | this.msg = msg;
19 | }
20 |
21 | public int getCode() {
22 | return this.code;
23 | }
24 |
25 | public String getMsg() {
26 | return this.msg;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/common/TestUtils.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.common;
2 |
3 | public class TestUtils {
4 | }
5 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/config/MyConfig.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.config;
2 |
3 | import com.gk.study.interceptor.AccessInterceptor;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.web.servlet.config.annotation.CorsRegistry;
6 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
8 |
9 | @Configuration
10 | public class MyConfig implements WebMvcConfigurer {
11 | @Override
12 | public void addCorsMappings(CorsRegistry registry) {
13 | registry.addMapping("/**")//项目中的所有接口都支持跨域
14 | .allowedOriginPatterns("*") //所有地址都可以访问,也可以配置具体地址
15 | .allowCredentials(true)
16 | .allowedMethods("*");//"GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS"
17 | }
18 |
19 | @Override
20 | public void addInterceptors(InterceptorRegistry registry) {
21 | // 自定义拦截器
22 | registry.addInterceptor(new AccessInterceptor());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/controller/ErrorLogController.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.controller;
2 |
3 | import com.gk.study.common.APIResponse;
4 | import com.gk.study.common.ResponeCode;
5 | import com.gk.study.entity.ErrorLog;
6 | import com.gk.study.service.ErrorLogService;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.transaction.annotation.Transactional;
11 | import org.springframework.web.bind.annotation.RequestMapping;
12 | import org.springframework.web.bind.annotation.RequestMethod;
13 | import org.springframework.web.bind.annotation.RestController;
14 |
15 | import java.io.IOException;
16 | import java.util.List;
17 |
18 | @RestController
19 | @RequestMapping("/errorLog")
20 | public class ErrorLogController {
21 |
22 | private final static Logger logger = LoggerFactory.getLogger(ErrorLogController.class);
23 |
24 | @Autowired
25 | ErrorLogService service;
26 |
27 | @RequestMapping(value = "/list", method = RequestMethod.GET)
28 | public APIResponse list(){
29 | List list = service.getErrorLogList();
30 | return new APIResponse(ResponeCode.SUCCESS, "查询成功", list);
31 | }
32 |
33 | @RequestMapping(value = "/create", method = RequestMethod.POST)
34 | @Transactional
35 | public APIResponse create(ErrorLog errorLog) throws IOException {
36 | service.createErrorLog(errorLog);
37 | return new APIResponse(ResponeCode.SUCCESS, "创建成功");
38 | }
39 |
40 | @RequestMapping(value = "/delete", method = RequestMethod.POST)
41 | public APIResponse delete(String ids){
42 | System.out.println("ids===" + ids);
43 | // 批量删除
44 | String[] arr = ids.split(",");
45 | for (String id : arr) {
46 | service.deleteErrorLog(id);
47 | }
48 | return new APIResponse(ResponeCode.SUCCESS, "删除成功");
49 | }
50 |
51 | @RequestMapping(value = "/update", method = RequestMethod.POST)
52 | @Transactional
53 | public APIResponse update(ErrorLog errorLog) throws IOException {
54 | service.updateErrorLog(errorLog);
55 | return new APIResponse(ResponeCode.SUCCESS, "更新成功");
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/controller/NoticeController.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.controller;
2 |
3 | import com.gk.study.common.APIResponse;
4 | import com.gk.study.common.ResponeCode;
5 | import com.gk.study.entity.Notice;
6 | import com.gk.study.permission.Access;
7 | import com.gk.study.permission.AccessLevel;
8 | import com.gk.study.service.NoticeService;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.transaction.annotation.Transactional;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 | import org.springframework.web.bind.annotation.RequestMethod;
15 | import org.springframework.web.bind.annotation.RestController;
16 |
17 | import java.io.IOException;
18 | import java.util.List;
19 |
20 | @RestController
21 | @RequestMapping("/notice")
22 | public class NoticeController {
23 |
24 | private final static Logger logger = LoggerFactory.getLogger(NoticeController.class);
25 |
26 | @Autowired
27 | NoticeService service;
28 |
29 | @RequestMapping(value = "/list", method = RequestMethod.GET)
30 | public APIResponse list(){
31 | List list = service.getNoticeList();
32 | return new APIResponse(ResponeCode.SUCCESS, "查询成功", list);
33 | }
34 |
35 | @Access(level = AccessLevel.ADMIN)
36 | @RequestMapping(value = "/create", method = RequestMethod.POST)
37 | @Transactional
38 | public APIResponse create(Notice notice) throws IOException {
39 | service.createNotice(notice);
40 | return new APIResponse(ResponeCode.SUCCESS, "创建成功");
41 | }
42 |
43 | @Access(level = AccessLevel.ADMIN)
44 | @RequestMapping(value = "/delete", method = RequestMethod.POST)
45 | public APIResponse delete(String ids){
46 | System.out.println("ids===" + ids);
47 | // 批量删除
48 | String[] arr = ids.split(",");
49 | for (String id : arr) {
50 | service.deleteNotice(id);
51 | }
52 | return new APIResponse(ResponeCode.SUCCESS, "删除成功");
53 | }
54 |
55 | @Access(level = AccessLevel.ADMIN)
56 | @RequestMapping(value = "/update", method = RequestMethod.POST)
57 | @Transactional
58 | public APIResponse update(Notice notice) throws IOException {
59 | service.updateNotice(notice);
60 | return new APIResponse(ResponeCode.SUCCESS, "更新成功");
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/controller/OpLogController.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.controller;
2 |
3 | import com.gk.study.common.APIResponse;
4 | import com.gk.study.common.ResponeCode;
5 | import com.gk.study.entity.OpLog;
6 | import com.gk.study.service.OpLogService;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.transaction.annotation.Transactional;
11 | import org.springframework.web.bind.annotation.RequestMapping;
12 | import org.springframework.web.bind.annotation.RequestMethod;
13 | import org.springframework.web.bind.annotation.RestController;
14 |
15 | import java.io.IOException;
16 | import java.util.List;
17 |
18 | // 负责操作日志和登录日志
19 | @RestController
20 | @RequestMapping("/opLog")
21 | public class OpLogController {
22 |
23 | private final static Logger logger = LoggerFactory.getLogger(OpLogController.class);
24 |
25 | @Autowired
26 | OpLogService service;
27 |
28 | @RequestMapping(value = "/list", method = RequestMethod.GET)
29 | public APIResponse list(){
30 | List list = service.getOpLogList();
31 | return new APIResponse(ResponeCode.SUCCESS, "查询成功", list);
32 | }
33 |
34 | @RequestMapping(value = "/loginLogList", method = RequestMethod.GET)
35 | public APIResponse loginLogList(){
36 | List list = service.getLoginLogList();
37 | return new APIResponse(ResponeCode.SUCCESS, "查询成功", list);
38 | }
39 |
40 | @RequestMapping(value = "/create", method = RequestMethod.POST)
41 | @Transactional
42 | public APIResponse create(OpLog opLog) throws IOException {
43 | service.createOpLog(opLog);
44 | return new APIResponse(ResponeCode.SUCCESS, "创建成功");
45 | }
46 |
47 | @RequestMapping(value = "/delete", method = RequestMethod.POST)
48 | public APIResponse delete(String ids){
49 | System.out.println("ids===" + ids);
50 | // 批量删除
51 | String[] arr = ids.split(",");
52 | for (String id : arr) {
53 | service.deleteOpLog(id);
54 | }
55 | return new APIResponse(ResponeCode.SUCCESS, "删除成功");
56 | }
57 |
58 | @RequestMapping(value = "/update", method = RequestMethod.POST)
59 | @Transactional
60 | public APIResponse update(OpLog opLog) throws IOException {
61 | service.updateOpLog(opLog);
62 | return new APIResponse(ResponeCode.SUCCESS, "更新成功");
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/controller/TagController.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.controller;
2 |
3 | import com.gk.study.common.APIResponse;
4 | import com.gk.study.common.ResponeCode;
5 | import com.gk.study.entity.Tag;
6 | import com.gk.study.permission.Access;
7 | import com.gk.study.permission.AccessLevel;
8 | import com.gk.study.service.TagService;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.transaction.annotation.Transactional;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 | import org.springframework.web.bind.annotation.RequestMethod;
15 | import org.springframework.web.bind.annotation.RestController;
16 |
17 | import java.io.IOException;
18 | import java.util.List;
19 | /**
20 | * @author lengqin1024(微信)
21 | * @email net936@163.com
22 | */
23 | @RestController
24 | @RequestMapping("/tag")
25 | public class TagController {
26 |
27 | private final static Logger logger = LoggerFactory.getLogger(TagController.class);
28 |
29 | @Autowired
30 | TagService service;
31 |
32 | @RequestMapping(value = "/list", method = RequestMethod.GET)
33 | public APIResponse list(){
34 | List list = service.getTagList();
35 |
36 | return new APIResponse(ResponeCode.SUCCESS, "查询成功", list);
37 | }
38 |
39 | @Access(level = AccessLevel.ADMIN)
40 | @RequestMapping(value = "/create", method = RequestMethod.POST)
41 | @Transactional
42 | public APIResponse create(Tag tag) throws IOException {
43 | service.createTag(tag);
44 | return new APIResponse(ResponeCode.SUCCESS, "创建成功");
45 | }
46 |
47 | @Access(level = AccessLevel.ADMIN)
48 | @RequestMapping(value = "/delete", method = RequestMethod.POST)
49 | public APIResponse delete(String ids){
50 | System.out.println("ids===" + ids);
51 | // 批量删除
52 | String[] arr = ids.split(",");
53 | for (String id : arr) {
54 | service.deleteTag(id);
55 | }
56 | return new APIResponse(ResponeCode.SUCCESS, "删除成功");
57 | }
58 |
59 | @Access(level = AccessLevel.ADMIN)
60 | @RequestMapping(value = "/update", method = RequestMethod.POST)
61 | @Transactional
62 | public APIResponse update(Tag tag) throws IOException {
63 | service.updateTag(tag);
64 | return new APIResponse(ResponeCode.SUCCESS, "更新成功");
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Ad.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 | import org.springframework.web.multipart.MultipartFile;
9 |
10 | import java.io.File;
11 | import java.io.Serializable;
12 |
13 | @Data
14 | @TableName("b_ad")
15 | public class Ad implements Serializable {
16 | @TableId(value = "id",type = IdType.AUTO)
17 | public Long id;
18 | @TableField
19 | public String image;
20 | @TableField(exist = false)
21 | public MultipartFile imageFile;
22 | @TableField
23 | public String link;
24 | @TableField
25 | public String createTime;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Address.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 | @Data
12 | @TableName("b_address")
13 | public class Address implements Serializable {
14 | @TableId(value = "id",type = IdType.AUTO)
15 | public Long id;
16 | @TableField
17 | public String name;
18 | @TableField
19 | public String mobile;
20 | @TableField
21 | public String description;
22 | @TableField
23 | public String def; // 默认
24 | @TableField
25 | public String createTime;
26 | @TableField
27 | public String userId;
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Banner.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 | import org.springframework.web.multipart.MultipartFile;
9 |
10 | import java.io.Serializable;
11 |
12 | @Data
13 | @TableName("b_banner")
14 | public class Banner implements Serializable {
15 | @TableId(value = "id",type = IdType.AUTO)
16 | public Long id;
17 | @TableField
18 | public String image;
19 | @TableField(exist = false)
20 | public MultipartFile imageFile;
21 | @TableField
22 | public Long thingId;
23 | @TableField
24 | public String createTime;
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Classification.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.*;
4 | import lombok.Data;
5 | import org.springframework.web.multipart.MultipartFile;
6 |
7 | import java.io.Serializable;
8 | import java.sql.Date;
9 |
10 | @Data
11 | @TableName("b_classification")
12 | public class Classification implements Serializable {
13 | @TableId(value = "id",type = IdType.AUTO)
14 | public Long id;
15 | @TableField
16 | public String title;
17 | @TableField
18 | public String createTime;
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Comment.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 | @Data
12 | @TableName("b_comment")
13 | public class Comment implements Serializable {
14 | @TableId(value = "id",type = IdType.AUTO)
15 | public Long id;
16 | @TableField
17 | public String content;
18 | @TableField
19 | public String commentTime;
20 | @TableField
21 | public String likeCount;
22 | @TableField
23 | public String userId;
24 | @TableField(exist = false)
25 | public String username; // 用户名
26 | @TableField
27 | public String thingId;
28 | @TableField(exist = false)
29 | public String title; // 商品名称
30 | @TableField(exist = false)
31 | public String cover; // 商品封面
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/ErrorLog.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 | @Data
12 | @TableName("b_error_log")
13 | public class ErrorLog implements Serializable {
14 | @TableId(value = "id",type = IdType.AUTO)
15 | public Long id;
16 | @TableField
17 | public String ip;
18 | @TableField
19 | public String url;
20 | @TableField
21 | public String method;
22 | @TableField
23 | public String content;
24 | @TableField
25 | public String logTime;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Notice.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 | @Data
12 | @TableName("b_notice")
13 | public class Notice implements Serializable {
14 | @TableId(value = "id",type = IdType.AUTO)
15 | public Long id;
16 | @TableField
17 | public String title;
18 | @TableField
19 | public String content;
20 | @TableField
21 | public String createTime;
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/OpLog.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.*;
4 | import com.fasterxml.jackson.annotation.JsonFormat;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 | import java.util.Date;
9 |
10 | @Data
11 | @TableName("b_op_log")
12 | public class OpLog implements Serializable {
13 | @TableId(value = "id",type = IdType.AUTO)
14 | public Long id;
15 | @TableField
16 | public String reIp;
17 | @TableField
18 | public String reTime;
19 | @TableField
20 | public String reUa;
21 | @TableField
22 | public String reUrl;
23 | @TableField
24 | public String reMethod;
25 | @TableField
26 | public String reContent;
27 | @TableField
28 | public String accessTime;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Order.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 | @Data
12 | @TableName("b_order")
13 | public class Order implements Serializable {
14 | @TableId(value = "id",type = IdType.AUTO)
15 | public Long id;
16 | @TableField
17 | public String status;
18 | @TableField
19 | public String orderTime;
20 | @TableField
21 | public String payTime;
22 | @TableField
23 | public String thingId;
24 | @TableField
25 | public String userId;
26 | @TableField
27 | public String count;
28 | @TableField
29 | public String orderNumber; // 订单编号
30 | @TableField
31 | public String receiverAddress;
32 | @TableField
33 | public String receiverName;
34 | @TableField
35 | public String receiverPhone;
36 | @TableField
37 | public String remark;
38 |
39 | @TableField(exist = false)
40 | public String username; // 用户名
41 | @TableField(exist = false)
42 | public String title; // 商品名称
43 | @TableField(exist = false)
44 | public String cover; // 商品封面
45 | @TableField(exist = false)
46 | public String price; // 商品价格
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Tag.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 | @Data
12 | @TableName("b_tag")
13 | public class Tag implements Serializable {
14 | @TableId(value = "id",type = IdType.AUTO)
15 | public Long id;
16 | @TableField
17 | public String title;
18 | @TableField
19 | public String createTime;
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/Thing.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 | import org.springframework.web.multipart.MultipartFile;
9 |
10 | import java.io.Serializable;
11 | import java.util.List;
12 |
13 | @Data
14 | @TableName("b_thing")
15 | public class Thing implements Serializable {
16 | @TableId(value = "id",type = IdType.AUTO)
17 | public Long id;
18 | @TableField
19 | public String title;
20 | @TableField
21 | public String cover;
22 | @TableField
23 | public String description;
24 | @TableField
25 | public String price;
26 | @TableField
27 | public String status;
28 | @TableField
29 | public String createTime;
30 | @TableField
31 | public String repertory;
32 | @TableField
33 | public String score;
34 | @TableField
35 | public String pv;
36 | @TableField
37 | public String recommendCount;
38 | @TableField
39 | public String wishCount;
40 | @TableField
41 | public String collectCount;
42 | @TableField
43 | public Long classificationId;
44 |
45 | @TableField(exist = false)
46 | public List tags; // 标签
47 |
48 | @TableField(exist = false)
49 | public MultipartFile imageFile;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/ThingCollect.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 |
12 | @Data
13 | @TableName("b_thing_collect")
14 | public class ThingCollect implements Serializable {
15 | @TableId(value = "id",type = IdType.AUTO)
16 | public Long id;
17 | @TableField
18 | public String thingId;
19 | @TableField
20 | public String userId;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/ThingTag.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 | @Data
12 | @TableName("b_thing_tag")
13 | public class ThingTag implements Serializable {
14 | @TableId(value = "id",type = IdType.AUTO)
15 | public Long id;
16 | @TableField
17 | public Long thingId;
18 | @TableField
19 | public Long tagId;
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/ThingWish.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 |
11 |
12 | @Data
13 | @TableName("b_thing_wish")
14 | public class ThingWish implements Serializable {
15 | @TableId(value = "id",type = IdType.AUTO)
16 | public Long id;
17 | @TableField
18 | public String thingId;
19 | @TableField
20 | public String userId;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/User.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import com.fasterxml.jackson.annotation.JsonFormat;
8 | import com.fasterxml.jackson.annotation.JsonIgnore;
9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
10 | import lombok.Data;
11 | import org.springframework.web.multipart.MultipartFile;
12 |
13 | import java.io.Serializable;
14 |
15 | @Data
16 | @TableName("b_user")
17 | public class User implements Serializable {
18 | public static final int NormalUser = 1;
19 | public static final int DemoUser = 2;
20 | public static final int AdminUser = 3;
21 |
22 | @TableId(value = "id",type = IdType.AUTO)
23 | public String id;
24 | @TableField
25 | public String username;
26 | @TableField
27 | public String password;
28 | @TableField(exist = false)
29 | public String rePassword;
30 | @TableField
31 | public String nickname;
32 | @TableField
33 | public String mobile;
34 | @TableField
35 | public String email;
36 | @TableField
37 | public String description;
38 | @TableField
39 | public String role;
40 | @TableField
41 | public String status;
42 | @TableField
43 | public String score;
44 | @TableField
45 | public String avatar;
46 | @TableField(exist = false)
47 | public MultipartFile avatarFile;
48 | @TableField
49 | public String token;
50 | @TableField
51 | public String createTime;
52 | @TableField
53 | public String pushEmail;
54 | @TableField
55 | public String pushSwitch;
56 |
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/entity/VisitData.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.entity;
2 |
3 | public class VisitData {
4 |
5 | public String reIp;
6 | public int count;
7 | }
8 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/handler/CustomExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.handler;
2 |
3 |
4 | import com.gk.study.common.APIResponse;
5 | import com.gk.study.service.ErrorLogService;
6 | import com.gk.study.common.ResponeCode;
7 | import com.gk.study.entity.ErrorLog;
8 | import com.gk.study.utils.HttpContextUtils;
9 | import com.gk.study.utils.IpUtils;
10 | import org.slf4j.Logger;
11 | import org.slf4j.LoggerFactory;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.web.bind.annotation.ExceptionHandler;
14 | import org.springframework.web.bind.annotation.RestControllerAdvice;
15 |
16 | import javax.servlet.http.HttpServletRequest;
17 | import java.util.Arrays;
18 | import java.util.Map;
19 |
20 | @RestControllerAdvice
21 | public class CustomExceptionHandler {
22 | private static final Logger logger = LoggerFactory.getLogger(CustomExceptionHandler.class);
23 |
24 | @Autowired
25 | private ErrorLogService service;
26 |
27 | @ExceptionHandler(Exception.class)
28 | public APIResponse handleException(Exception ex){
29 | logger.error("error log======>" + ex.getMessage(), ex);
30 |
31 | saveLog(ex);
32 | return new APIResponse(ResponeCode.FAIL, ex.getMessage());
33 | }
34 |
35 | /**
36 | * 保存异常日志
37 | */
38 | private void saveLog(Exception ex){
39 | ErrorLog log = new ErrorLog();
40 | //请求相关信息
41 | HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
42 | log.setIp(IpUtils.getIpAddr(request));
43 | log.setUrl(request.getRequestURI());
44 | log.setMethod(request.getMethod());
45 | // 请求参数
46 | Map params = HttpContextUtils.getParameterMap(request);
47 | if(!params.isEmpty()){
48 | //log.setRequestParams(JsonUtils.toJsonString(params));
49 | }
50 |
51 | //异常信息
52 | log.setContent(Arrays.toString(ex.getStackTrace()));
53 | log.setLogTime(String.valueOf(System.currentTimeMillis()));
54 |
55 | //保存
56 | service.createErrorLog(log);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/AdMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.Ad;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | @Mapper
8 | public interface AdMapper extends BaseMapper {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/AddressMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.Address;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | @Mapper
8 | public interface AddressMapper extends BaseMapper {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/BannerMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.Banner;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | @Mapper
8 | public interface BannerMapper extends BaseMapper {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/ClassificationMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.Classification;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | @Mapper
8 | public interface ClassificationMapper extends BaseMapper {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/CommentMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.Comment;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | import java.util.List;
8 |
9 | @Mapper
10 | public interface CommentMapper extends BaseMapper {
11 |
12 | List getList();
13 |
14 | List selectThingCommentList(String thingId, String order);
15 |
16 | List selectUserCommentList(String userId);
17 | }
18 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/ErrorLogMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.ErrorLog;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | @Mapper
8 | public interface ErrorLogMapper extends BaseMapper {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/NoticeMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.Notice;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | @Mapper
8 | public interface NoticeMapper extends BaseMapper {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/OpLogMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.OpLog;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | @Mapper
8 | public interface OpLogMapper extends BaseMapper {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/OrderMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.Order;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | import java.util.List;
8 |
9 | @Mapper
10 | public interface OrderMapper extends BaseMapper {
11 |
12 | List getList();
13 |
14 | List getUserOrderList(String userId, String status);
15 | }
16 |
--------------------------------------------------------------------------------
/server/src/main/java/com/gk/study/mapper/OverviewMapper.java:
--------------------------------------------------------------------------------
1 | package com.gk.study.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.gk.study.entity.VisitData;
5 | import org.apache.ibatis.annotations.Mapper;
6 | import org.apache.ibatis.annotations.Param;
7 |
8 | import java.util.List;
9 |
10 | @Mapper
11 | public interface OverviewMapper extends BaseMapper