Yangbo 9 months ago
parent fa5b423fe5
commit cfdf22cccb

Binary file not shown.

@ -0,0 +1,5 @@
# Created by .ignore support plugin (hsz.mobi)
/target
.idea
*.iml
/src/main/resources/jdbc.properties

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 wsk1103
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,493 @@
# 基于SSM的校园二手交易平台
**完整的设计报告在后面**
视频教程:<br>
https://www.bilibili.com/video/BV1jc411H7aX/
喜欢就点一下star哟谢谢亲的支持
https://github.com/wsk1103/Used-Trading-Platform2
个人主页
https://wsk1103.github.io/
使用 Spring Boot 一键式启动。
下载项目运行c2c.sql文件然后运行 UsedTradingPlatformApplication.main 方法即可启动。
环境
jdk1.8
mysql5.7
先在数据中创建名为c2c的数据库使用Navicat for MySQL运行 c2c.sql文件创建表和导入数据
## 3.2 实现过程
### 3.2.1 商品首页实现
![这里写图片描述](https://img-blog.csdn.net/20180506142520732?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142530664?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
其他部分实现效果
![这里写图片描述](https://img-blog.csdn.net/20180506142550165?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142617150?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.2 二手商城实现
![这里写图片描述](https://img-blog.csdn.net/2018050614262516?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
商城商品展示
![这里写图片描述](https://img-blog.csdn.net/20180506142641307?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142650930?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142655874?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.3 商品详情实现
![这里写图片描述](https://img-blog.csdn.net/20180506142702750?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
留言
![这里写图片描述](https://img-blog.csdn.net/20180506142707609?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.4 站内搜索引擎实现
![这里写图片描述](https://img-blog.csdn.net/20180506142713316?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
搜索结果
![这里写图片描述](https://img-blog.csdn.net/20180506142717344?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.5 发布商品实现
![这里写图片描述](https://img-blog.csdn.net/20180506142725661?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142737493?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142751872?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.6 发布求购信息实现
![这里写图片描述](https://img-blog.csdn.net/20180506142803686?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.7 个人信息页面实现
![这里写图片描述](https://img-blog.csdn.net/20180506142810540?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142815483?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.8 我发布的商品实现
![这里写图片描述](https://img-blog.csdn.net/20180506142820866?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
点击修改
![这里写图片描述](https://img-blog.csdn.net/2018050614282592?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.9我发布的求购信息实现
![这里写图片描述](https://img-blog.csdn.net/2018050614284365?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142847753?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.10购物车实现
![这里写图片描述](https://img-blog.csdn.net/20180506142855913?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
点击添加数量和减少
![这里写图片描述](https://img-blog.csdn.net/20180506142901134?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.11登录注册实现
![这里写图片描述](https://img-blog.csdn.net/20180506142908919?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142916295?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142923392?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
# 一、设计概要
  本次设计的是一个校园二手交易平台C2CC2C指个人与个人之间的电子商务买家可以查看所有卖家发布的商品并且根据分类进行商品过滤也可以根据站内搜索引擎进行商品的查询并且与卖家联系达成交易的意向也可以发布求购的信息让卖家查看之后与之联系进行交易。而此次主要是针对校园用户所设计的网站对于数据的分类应该更多的考虑校园用户的需求例如二手书籍、二手数码等的分类应该更加细致。本次设计的主要难度在于数据的详细分类对于数据的过滤必须要严谨应当考虑敏感字体和敏感图片的过滤。
  可能遇到的问题有在数据交互过程中出现由于属性名的差距导致的数据交互失败。由于Css属性设置的问题导致界面不完整等等。设计的算法都是自己编写的可能存在不是最优算法的情况。
# 二、设计正文
## 1 需求分析
  建立一个用户可以自由交易的平台通过ajax实现局部刷新实现网站更具人性化具有更良好的互动。以下是总体需求
### 1.1 通过手机号码注册账号并且登陆
  每个手机号码只可以注册一个账号,并且通过账号完善个人信息和浏览商品,发布商品等,注册时需要通过手机号码获取验证码进行验证才能注册。
### 1.2 实现二手商城
  商城主要显示总的商品信息,并且可以通过侧边栏点击进行信息过滤。商品点击之后可以查看详细信息。
### 1.3 站内搜索引擎
  实现本站内特有的搜索引擎,可以输入字段,模糊查询合适的商品并且显示出来。
### 1.4 求购信息发布
  根据需求输入相应的信息,发布求购商品。
### 1.5 求购商城
  卖东西的用户,也可以通过求购商城查看是否有用户对自己拥有的二手物品有需求,查看详细的需求,有的话可以跟买家联系进行交易。
### 1.6 货物出售信息发布
  卖家可以发布二手商品的信息,对商品进行描述,并且添加图片增加可信度,也方便买家查看相应的信息。
### 1.7 购物车
  将想要的物品添加到购物车,可以修改数量,选择是否要支付,移除商品。选择收货地址,并且进行结算。
### 1.8 个人信息
  用户发表求购信息和发布商品时需要先进行信息的完善,用户可以查看自己发布的商品,对发布的商品进行修改或删除,查看已发布求购信息,对求购的商品进行修改或删除。
## 2 概要设计
  系统的整体结构流程图如下
![这里写图片描述](https://img-blog.csdn.net/20180506142214677?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 2.1 系统模块
  本系统的可以分为以下几个模块。
#### 2.1.1 商品首页
  负责显示热门的商品信息以及显示本网站的网站信息导航栏负责跳转到各个页面没有登录显示按钮可以让用户进行登陆和注册。已登录的用户显示用户名并且可以发布商品信息查看个人信息等。进入首页的时候通过Ajax获取数据库中存在的热门商品数据集合并且刷新页面的内容点击商品之后跳转到商品详细信息模块。
#### 2.1.2 二手商城模块
  负责显示所有的二手商品提供类别的侧边栏给用户点击之后显示对应的商品信息。类别侧边栏的实现后需要为每一个类别的元素都添加一个id通过id来获取数据库中的数据用Ajax获取数据并且刷新页面的信息。采用分页技术防止数据过多的时候显示在同一个页面给用户带来不好的体验分页支持点击下一页上一页或者直接点击指定页面跳转到指定的页面。商品点击之后就要跳转到商品详情。
#### 2.1.3 商品详情模块
  负责显示指定的商品详细信息包括图片、名字、价格、数量等当一个商品被点击之后通过返回的id查询到这个数据集合跳转到商品详细信息的页面商品发布者可以在下方查看留言并且与有意者打成交易意向。将对应的信息显示出来并且提供加入到购物车的功能。商品详细信息下方显示其他用户的留言并且已经登录的用户可以对这件商品进行评论商品发布者可以在下方查看留言并且与有意者打成交易意向。商品发布者可以在下方查看留言并且与有意者打成交易意向。
#### 2.1.4 站内搜索引擎
  每一个页面顶部都存在一个搜索输入框,用户通过输入模糊的商品信息,后台数据库通过查询过滤相关的商品信息,并且显示出来给用户查看,显示出来的商品点击之后可以显示商品的详细信息。
#### 2.1.5 发布商品
  用户输入指定的信息以及选择商品的图片之后将这些信息结合当前登陆的用户通过Ajax发表到后台并且通过框架存储数据到数据库指定表。
#### 2.1.6 发布求购信息
  用户输入指定的信息以及选择商品的图片之后将这些信息结合当前登陆的用户通过Ajax发表到后台并且通过框架存储数据到数据库指定的求购信息表。
#### 2.1.7 个人信息模块
  显示个人信息例如用户名、真实姓名、宿舍号、学号等显示之后还需要支持对于数据进行修改修改之后要同步修改页面的信息这需要用到Ajax进行数据的提交并且进行页面的局部刷新。
#### 2.1.8 我发布的商品模块
  显示个人发表的商品信息,支持点击之后对数据进行修改,例如修改商品名字,修改商品的单价和数量等,修改之后将新的数据提交到数据库,数据库执行相应的修改操作,也可以直接下架某件商品,点击删除按钮之后,直接在后台数据库删除这一件商品,并且刷新当前页面上显示的个人发布的商品。给用户带来更好的体验效果。
#### 2.1.9 我发布的求购信息模块
  显示个人发表的求购商品信息,支持点击之后对数据进行修改,例如修改商品名字,修改商品的单价和数量等,修改之后将新的数据提交到数据库,数据库执行相应的修改操作,也可以直接下架某件商品,点击删除按钮之后,直接在后台数据库删除这一件商品,并且刷新当前页面上显示的个人求购的商品。
#### 2.1.10 购物车模块
  显示用户加入购物车的商品计算总的价格提供全选和取消全选的按钮从后台获取商品的单价判断当前剩余的数量当用户点击数量添加或者减少之后对于总价要实时刷新采用jQuery对数据进行修改当用户取消选中其中的某一个商品要相应的减少价格并且刷新提供选择收货地址对收获地址进行管理选好收货地址之后结算购物车弹出支付页面让用户选择付款方式并且提交。
#### 2.1.11 登录注册模块
  用户通过手机号码和密码进行登录登录之后显示首页。当用户没有账号的时候提示用户进行注册从登录界面切换到注册界面注册需要通过手机号码获取验证码后台通过页面传递的手机号码随机生成4位数的验证码并且缓存之后通过发送139邮箱的方式发送到指定的手机手机收取到验证码之后输入验证码提交判断是否正确正确则注册成功失败则注册失败。用户注册完之后直接跳转到首页。
## 2.2 数据结构设计
  首页需要的数据是热门商品的信息商品信息需要建立一个Bean对象存储内容是商品的id、商品名称、商品单价、商品类别、商品数量、商品详细信息、商品成色、商品附带的图片地址、热门程度、发表用户的id、留言的集合当用户发表之后保存数据到Bean对象中并将它存储到数据库。首页请求数据之后根据热门度返回多个数据将数据存储到list集合中并且将它转换为JSON格式数据返回到页面页面解析数据并且显示。
  商场则负责显示所有的商品数据实现侧边栏点击指定的类别之后显示对应类别的数据需要的是类别的id因此类别Bean对象的数据是类别id、类别名称点击之后通过类别id获取到商品详情集合并且将它转为JSON格式的数据返回到前端页面显示数据。
  点击商品之后需要显示商品详细信息通过商品的id返回指定商品的Bean对象转化为JSON格式的数据返回到前端页面显示需要显示商品的留言信息因此需要留言的Bean对象包括数据留言id、留言的商品id、留言内容、留言时间结合商品的详情返回JSON格式数据前端解析之后显示。
  求购商城负责显示所有的求购商品需要求购商品的Bean内容包括求购商品id、求购商品名称、求购商品数量、求购商品单价、求购商品详细信息、求购商品留言集合。页面显示时从后台返回对象集合转变的JSON数据前端解析数据并且显示出来。
  登陆界面需要验证用户信息用户信息包括内容用户id、用户名、用户的手机号码、用户密码、用户真实姓名、用户地址、用户email、用户性别、用户学号。验证的时候只需要判断手机号码和密码是否符合符合则验证通过返回验证结果用JSON存储数据。失败则返回失败信息。
  主要用到的数据结构是ArrayList负责组合各种信息并且转换为JSON格式数据返回。数据需要排序的时候用到的是快速排序负责排列热门商品等的信息并且返回数据到前端页面进行显示。
# 3 详细设计
## 3.1 数据字典
用户信息表
| 字段名 | 字段类型| 是否可为空| 备注|
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键|
|Modify |Datetime| 是| 修改时间|
|Username| Varchar(50) | 否| 用户昵称|
|Phone| Char(11)| 否 | 用户手机号码|
|realName| Varchar(20) | 是| 用户真实姓名|
|Clazz| Varchar(20) |是| 用户所在班级|
|Sno| Char(12)| 是| 用户学号|
|Dormitory| Varchar(20) | 是| 宿舍号|
|Gender| Char2| 是| 性别|
|Createtime |Datetime| 是| 创建时间|
|Avatar| Varchar(200)| 是 | 头像|
用户密码表
|字段名 |字段类型| 是否可为空| 备注|
|:------:|:------:|:------:|:------:|
|Id| Int | 否| 主键|
|Modify |Datetime| 是 |修改时间|
|Password| Varchar(24) | 否| 用户密码|
|Uid| Int| 否| 用户id|
商品表
|字段名 |字段类型| 是否可为空| 备注|
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键
|Modify| Datetime| 是| 修改时间
|Name| Varchar(50) | 否| 商品名称
|Level| Int |否| 商品成色
|Remark |Varchar(255)| 是| 商品详细信息
|Price| Decimal(0.00)| 否| 商品价格
|Sort| Int | 否| 商品类别
|Count| Int | 否| 商品数量
|Display| Int | 否| 商品是否被下架
|Transaction |Int| 否 | 交易方式
|Sales| Int | 否| 商品销量|
|Uid |Int | 否| 发表的用户id|
|Image| Varchar(255)| 否| 商品的图片地址
商品留言
|字段名 |字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11)| 否| 主键
|Modify| Datetime| 是| 修改时间
|Sid| Int | 否| 商品的id
|Content| Varchar(122)| 否| 留言内容
|Display |Int| 否| 是否可见
|Uid |Int | 否| 评论的用户id
我的收藏
|字段名 |字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键
|Modify| Datetime| 是| 修改时间
|Sid |Int | 否 |商品的id
|Display |Int| 否| 是否可见
|Uid |Int | 否| 评论的用户id
求购商品
|字段名| 字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键
|Modify| Datetime| 是| 修改时间
|Name| Varchar(50) |否| 求购商品名称
|Remark| Varchar(255)| 是| 求购商品详情
|Price| Decimal(0.00)| 否| 求购商品价格
|Sort| Int | 否| 求购商品类别
|Count| Int | 否| 求购商品数量
|Display| Int | 否| 信息是否被删除
|Transaction| Int | 否| 交易方式
|Uid |Int | 否| 发表的用户id
|Image| Varchar(255)| 否| 商品的图片地址
求购商品留言
|字段名| 字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键
|Modify| Datetime| 是| 修改时间
|Qid |Int | 否| 求购商品的id
|Content| Varchar(122)| 否| 留言内容
|Display| Int| 否| 是否可见
|Uid |Int | 否| 评论的用户id
我发布的商品
|字段名| 字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键
|Modify| Datetime| 是| 修改时间
|Display |Int | 否| 是否被删除
|Uid |Int | 否| 用户id
|Sid |Int| 否| 对应商品id
我求购的商品
|字段名| 字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键
|Modify| Datetime| 是| 修改时间
|Display| Int | 否| 是否被删除
|Uid| Int | 否| 用户id
|Qid| Int | 否 |求购商品id
已购买的商品
|字段名| 字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否 |主键
|Modify| Datetime| 是| 修改时间
|State| Int | 否| 商品当前的状态
|Uid |Int | 否| 用户id
|Sid| Int | 否| 商品id
|Quantity| Int | 否| 商品数量
购物车
|字段名| 字段类型| 是否可为空| 备注
|:------:|:------:|:------:|:------:|
| Id| Int(11) | 否| 主键
|Modify| Datetime | 是| 修改时间
|Display| Int| 否| 商品是否被删除
|Uid| Int| 否| 用户id
|Sid| Int| 否| 商品id
|Quantity| Int | 否| 商品数量
## 3.2 实现过程
### 3.2.1 商品首页实现
  负责显示热门的商品信息以及显示本网站的网站信息导航栏负责跳转到各个页面没有登录显示按钮可以让用户进行登陆和注册。已登录的用户显示用户名并且可以发布商品信息查看个人信息等。进入首页的时候通过Ajax获取数据库中存在的热门商品数据集合并且刷新页面的内容点击商品之后跳转到商品详细信息模块。
  首页的前端设计大体如下
  顶部实现导航栏导航栏包括网站logo支持点击之后返回到首页、输入框和按钮负责站内搜索引擎的实现、以及一个span包裹的数据当有用户登陆时将它替换为用户名没有用户登录时则将它设置为登录注册按钮方便用户进行登录和注册。用户登陆之后显示出来的用户名可以通过绑定鼠标进入事件弹出选择框让用户选择相应的操作例如显示个人信息、查看发布的商品、查看求购的商品、发布商品、发布求购商品信息。导航栏与其他页面共用。
![这里写图片描述](https://img-blog.csdn.net/20180506142520732?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  显示热门商品信息采用轮播图实现主要是先定义一个顶级的div指定position是绝对位置将除了当前显示的页面之外的轮播图div都隐藏起来为当前的div添加一个current类判断点击的方向如果是右则先获取到current的下一个div并且将它准备在右侧等候进入当前的div移出之后就将下一个进入并且删除原来的current类将它添加给新的div。在此过程中控制动画就可以实现一个精美的轮播图。
![这里写图片描述](https://img-blog.csdn.net/20180506142530664?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  其他部分实现效果
![这里写图片描述](https://img-blog.csdn.net/20180506142550165?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142617150?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.2 二手商城实现
  负责显示所有的二手商品提供类别的侧边栏给用户点击之后显示对应的商品信息。类别侧边栏的实现后需要为每一个类别的元素都添加一个id通过id来获取数据库中的数据用Ajax获取数据并且刷新页面的信息。采用分页技术防止数据过多的时候显示在同一个页面给用户带来不好的体验分页支持点击下一页上一页或者直接点击指定页面跳转到指定的页面。商品点击之后就要跳转到商品详情。
  二手商城前端实现
  主要是设计侧边栏比较有难度,首先获取后台返回的三级类别,并且将顶级类别显示在侧边栏中,当鼠标移动上去的时候,显示其余两级目录,显示次级目录作为标题,而第三级的目录则是可点击的按钮,点击之后显示相应类别的商品信息。
![这里写图片描述](https://img-blog.csdn.net/2018050614262516?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
商城商品展示
![这里写图片描述](https://img-blog.csdn.net/20180506142641307?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  其次是底部分页按钮的实现左右切换需要通过jQuery来控制下一页则判断是否已经到达当前显示的页数倒数第二个如果是就删除第一个页数并且添加下一页的页数前提是还有页数可以继续如果不是倒数第二个就将当前元素的current类名删除并将它赋给下一个元素。
![这里写图片描述](https://img-blog.csdn.net/20180506142650930?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142655874?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.3 商品详情实现
  负责显示指定的商品详细信息包括图片、名字、价格、数量等当一个商品被点击之后通过返回的id查询到这个数据集合跳转到商品详细信息的页面商品发布者可以在下方查看留言并且与有意者打成交易意向。将对应的信息显示出来并且提供加入到购物车的功能。商品详细信息下方显示其他用户的留言并且已经登录的用户可以对这件商品进行评论商品发布者可以在下方查看留言并且与有意者打成交易意向。商品发布者可以在下方查看留言并且与有意者打成交易意向。
  显示商品的详细信息并且添加可以留言的模块用户发表留言之后会在下方的留言板通过ajax进行实时的刷新。
![这里写图片描述](https://img-blog.csdn.net/20180506142702750?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  留言
![这里写图片描述](https://img-blog.csdn.net/20180506142707609?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.4 站内搜索引擎实现
  每一个页面顶部都存在一个搜索输入框,用户通过输入模糊的商品信息,后台数据库通过查询过滤相关的商品信息,并且显示出来给用户查看,显示出来的商品点击之后可以显示商品的详细信息。
![这里写图片描述](https://img-blog.csdn.net/20180506142713316?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  搜索结果
![这里写图片描述](https://img-blog.csdn.net/20180506142717344?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.5 发布商品实现
  用户输入指定的信息以及选择商品的图片之后将这些信息结合当前登陆的用户通过Ajax发表到后台并且通过框架存储数据到数据库指定表。
  三级联动的实现用Ajax获取到三级的类别JSON数据之后解析JSON数据将第一级的添加到第一个下拉框第二级的添加到第二个下拉框第三级的添加到第三个下拉框当第一个或者是第二个发生改变的时候通过获取父容器的子集合修改后两级或者一级的下拉框内容用jQuery的html替换即可。
![这里写图片描述](https://img-blog.csdn.net/20180506142725661?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142737493?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
 点击图片后显示缩略图需要先采用一个file的input获取到file的文件集合并且获取它的网页缓存地址获取后将它设置到img的src中可以添加一个渐变的动画效果给用户带来更好的视觉体验。
![这里写图片描述](https://img-blog.csdn.net/20180506142751872?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.6 发布求购信息实现
 用户输入指定的信息以及选择商品的图片之后将这些信息结合当前登陆的用户通过Ajax发表到后台并且通过框架存储数据到数据库指定的求购信息表。三级联动采用前一个的即可。
![这里写图片描述](https://img-blog.csdn.net/20180506142803686?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.7 个人信息页面实现
  显示个人信息例如用户名、真实姓名、宿舍号、学号等显示之后还需要支持对于数据进行修改修改之后要同步修改页面的信息这需要用到Ajax进行数据的提交并且进行页面的局部刷新。
  所有信息采用jQuery的EasyUI中的accordion显示标题显示信息而底部内容则显示修改的组件之后Ajax修改具体信息后需要将对应的新的内容采用jQuery显示到标题中。
![这里写图片描述](https://img-blog.csdn.net/20180506142810540?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142815483?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.8 我发布的商品实现
  显示个人发表的商品信息,支持点击之后对数据进行修改,例如修改商品名字,修改商品的单价和数量等,修改之后将新的数据提交到数据库,数据库执行相应的修改操作,也可以直接下架某件商品,点击删除按钮之后,直接在后台数据库删除这一件商品,并且刷新当前页面上显示的个人发布的商品。给用户带来更好的体验效果。
![这里写图片描述](https://img-blog.csdn.net/20180506142820866?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  点击修改
![这里写图片描述](https://img-blog.csdn.net/2018050614282592?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.9我发布的求购信息实现
  显示个人发表的求购商品信息,支持点击之后对数据进行修改,例如修改商品名字,修改商品的单价和数量等,修改之后将新的数据提交到数据库,数据库执行相应的修改操作,也可以直接下架某件商品,点击删除按钮之后,直接在后台数据库删除这一件商品,并且刷新当前页面上显示的个人求购的商品。
![这里写图片描述](https://img-blog.csdn.net/2018050614284365?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142847753?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.10购物车实现
显示用户加入购物车的商品计算总的价格提供全选和取消全选的按钮从后台获取商品的单价判断当前剩余的数量当用户点击数量添加或者减少之后对于总价要实时刷新采用jQuery对数据进行修改当用户取消选中其中的某一个商品要相应的减少价格并且刷新提供选择收货地址对收获地址进行管理选好收货地址之后结算购物车弹出支付页面让用户选择付款方式并且提交。
![这里写图片描述](https://img-blog.csdn.net/20180506142855913?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  点击添加数量和减少
![这里写图片描述](https://img-blog.csdn.net/20180506142901134?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
### 3.2.11登录注册实现
  用户通过手机号码和密码进行登录登录之后显示首页。当用户没有账号的时候提示用户进行注册从登录界面切换到注册界面注册需要通过手机号码获取验证码后台通过页面传递的手机号码随机生成4位数的验证码并且缓存之后通过发送139邮箱的方式发送到指定的手机手机收取到验证码之后输入验证码提交判断是否正确正确则注册成功失败则注册失败。用户注册完之后直接跳转到首页。
  登录界面需要4个页面第一个是登录界面显示手机号码和密码的组件并且需要底部添加注册按钮以及忘记密码。第二个是注册界面注册界面首先提供用户输入手机号码以及验证码获取验证码的按钮获取之后跳转到下一步也就是输入密码界面。输入密码界面需要两次确认密码输入确认之后就是跳转到首页。最后一个界面是忘记密码同样通过输入手机号码获取验证码即可。之后将这四个界面通过CSS3的transform属性将四个界面组合成一个立方体当用户点击切换到各自界面的按钮时就采用transform的rotateY将切换的效果实现成立体翻转的效果。
![这里写图片描述](https://img-blog.csdn.net/20180506142908919?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142916295?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述](https://img-blog.csdn.net/20180506142923392?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
##### 后台实现的过程
  1. 总述本次后台使用的编程语言为Java使用的框架是Spring+SpringMVC+Mybatis前端网页渲染的语言不使用JSP而我选择使用的是thymeleaf框架  
  原因如下:
  a. thymeleaf可以直接渲染出HTML5和CSS3的效果。
  b.前端写的网页合并到后台处理的时候不需要转换成jsp页面方便快捷。
  c. thymeleaf可以很方便的解析后台传输到前端的值。
  d. thymeleaf我个人认为是个比较好的模板性能也比一般的比如freemaker的要高而且把将美工和程序员能够结合起来美工能够在浏览器中查看静态效果程序员可以在应用服务器查看带数据的效果。
  e. thymeleaf是一个支持html原型的自然引擎它在html标签增加额外的属性来达到模板+数据的展示方式由于浏览器解释html时忽略未定义的标签属性因此thymeleaf的模板可以静态运行。
  2. 后台结构总图
![这里写图片描述](https://img-blog.csdn.net/20180506142931448?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dzazExMDM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
  java:存放Java代码
  bean用于序列化到前端然后解析的实体类。
  controllerspring和springMVC的控制器用于处理请求的链接
  dao和数据库进行交互
  pojo普通的Java实体类
  service定义接口用于连接controller和dao
  token生成唯一标识用于防止用户重复提交。
  tool工具类例如处理文件文本敏感词过滤图片色情鉴别等等。
  resources存放资源文件例如Mybatis生成的xml文件springspringMVCmybatis配置文件等等
  css网站样式
  img网站部分图片
  jsJavaScript文件
  templates网站html文件
  3.后台实现了一个只能单用户登录的功能如果有两个用户使用同一个账号分别登录那么后一个登录的用户会踢掉第一个用户登录的账号也就是说先登录的用户会被强制退出。实现细节主要使用的是websockt和spring websockt。首先前端判断用户有没有登录如果有登录的话就将用户的手机号码当前时间发送到后台后台接收到信息解析信息将信息存储到Map中前台循环提交这些信息并判断Map中手机号码对应的时间是否相等如果不相等证明有其他用户登录了该账号后台发送下线信息到前端前端收到信息后触发退出当前账号事件。
  4.常规数据库增删查改考虑到密码是重要的信息所以当操作密码的时候都是先使用MD5对其进行加密后处理。例如修改密码注册用户等等。各个数据表之间的关联都是通过逻辑处理进行数据联系的。
  5.防止用户重复提交在每个界面都会由后台生成一个token然后前端页面存储该token如果用户进行提交按钮等事件时就会连这个token一起发送到后台进行处理后台若获取不到token或者token不相匹配那么就判定该用户重复提交这个事件后台直接返回原本页面。
  6.敏感词过滤:管理员将敏感词编入到数据库中,用户发布商品时附带的商品名称,商品备注等等,都会被过滤,将其中的敏感词替代成**。然后返回对应的数值。用户在填写商品名称详情的时候还会ajax自动和后台进行验证判断并实时提醒用户有没有输入敏感词。
  7.图片色情鉴别:使用的是百度的百度开发者平台中的色情图片识别功能。通过提交一张图片到百度的这个功能中,该项目功能就会返回一个数字,姑且称该值为色情值,如果该色情值超过一个给定的数值,那么就可以判定该图片为色情图片,如果用户上传的是色情图片,那么就无法插入,修改,后台会直接返回一个错误值给前端,提示使用了非法的图片。
## 4.问题分析
  4.1 在实现只能单用户登录的时候由于是第一次编写以前没有经验刚开始的想法是设计2个Mapm1,m2用于存储前一次登录m1和再次登录m2的手机号码和对应的时间。首先当用户第一次登录的时候m1和m2必定都为空m2先通过手机号码存储当前的时间然后前端通过websockt发送定时信息过来请求判断在后台处理前端发送过来的信息的时先判断m1是否存在m2中该的该手机如果不存在则证明为第一次登录那么m1存储m2中对应手机的对应时间。如果存在那么将m1中时间和m2中的时间进行比较若比较结果一致是单用户登录若不一致该手机为前一次登录强迫下线。当用户再次登录的时候m2中存储手机对应的当前的时间那么前一次登录的时候m1中存储的手机对应的时间必然小于再次登录中m2中存储的时间此时前一次登录强迫下线m1中的时间刷新为m2中对应的时间。但是这个思路出现了一个严重的问题在测试的时候首次登录后第二次登录确实会踢掉第一次登录但是第三次登录的时候所有的用户都平安无事不会互相排挤此时出现的问题应该是线程不安全导致的结果。m1m2这2个map都可能会出现这种情况。
  解决方法设计一个Mapm用于存储手机号码和其对应的时间。首先用户登录后将当前的时间手机号码通过websockt发送到后台后台进行判断处理如果发送过来的时间和m中存储的时间进行比较若一致证明没有其他用户登录若不一致证明其他用户登录过那么当前这次用户就会被迫下线
  4.2 设计的工具类中因为存在很多个类和包如果没有使用工厂模式进行设计的时候那么在启动项目的时候多用户登录时就会导致线程不安全或者线程堵塞并且将类中的所有方法声明为static时会占用了许多的内存。
  解决方法:使用静态工厂模式-静态内部类。将所有的工具类集中到一个总类中然后为给总类设计一个静态内部类其他将要调用的方法设计为public非静态方法如果调用的时候用工厂调用就可以了。
  4.3 当使用多个参数通过mybatis获取数据库数据时出现了参数未定义的情况这是因为多个参数的时候要将这些参数封装为一个Map。
  解决方法将多个参数封装为一个Map然后将该Map作为参数传递给mybatis的处理方法。
  4.4 发送手机验证码出现的错误:一开始像使用邮箱验证用户的,但是在通过邮箱给用法发送信息的时候,这个时候就有多个邮箱作发送者供选择-QQ,163,127,sina等等。原先使用的是163邮箱进行发送信息但是由于发送的内容过于少被系统认定为垃圾邮件不给发送或者接收。其他邮箱也类似。后来感觉使用邮箱发送验证码已经被淘汰了现在流行手机验证了所以改为发送手机验证码。但是手机发送验证码的话不想使用网上别人提供的服务打算自己写一个关键是怎么将验证码发送到手机上。
  解决方法将验证码发送到139邮箱上就可以了一般的手机用户都会默认绑定139邮箱的如果139邮箱收到信息那么就会通过发送短信的形式提示到对应的手机上这样就可以实现手机验证码的发送了。
  4.5 前端使用Ajax局部刷新时有可能会导致新显示的内容无法绑定点击事件最终导致在点击相应的按钮例如加入购物车按钮页面没有反应。
  解决方法在Ajax的for循环显示结果内容后为按钮等绑定相应的事件。这样就可以解决该问题。
## 6.用户使用说明
### 6.1 首页
  首先访问本站网址进入首页可以浏览首页的商品信息首页轮播图可以左右切换查看商品信息如果没有主动切换那么每3.5s之后会自动往右切换一张,往下滑动显示的是其他的一些热门商品缩略信息,点击商品名字之后可以查看该商品的详细信息和留言。再下方是一些其他信息,可以忽略。
### 6.2 普通游客的限制
  普通游客可以随意访问首页,可以通过导航栏访问商城,求购商城等。但是如要要发布求购、发布商品则需要先登录。
### 6.3 没有账号?
  如果用户还没有账号,那么点击右上角的注册按钮,之后会跳转到注册界面,用户需要输入手机号,再通过它获取验证码,注意输入的手机号必须要格式正确并且有效,获取验证码之后,便点击下一步,此时到达的界面是确认密码界面,重复输入密码,两次输入的密码必须一致。确认完毕之后就会进入首页。如果用户忘记了自己注册过的账号密码,那么点击登录界面的忘记密码选项,输入注册时使用的手机号码,通过此手机号码获取验证码,输入验证码之后,点击下一步开始重置密码,重置完毕之后就会重新进入到首页。
### 6.4 商城
  用户想要查看其他用户发布的商品需要通过点击导航栏处的商城进入到商城页面在此可以浏览所有的商品每页显示12个底部的分页按钮可以点击之后切换到用户想找的页面。而用户如果需要过滤信息找到自己想要的类别左侧悬浮的悬浮框鼠标移动到指定的类别中查看详细的类别点击自己想要找的商品类别网站便会过滤出指定的商品呈现给用户。
  商城显示的商品信息只是一部分,通过点击商品名可以跳转到商品详细信息页面,用户可以在此查看商品的所有信息,可以将它添加到购物车,或者查看下方其他用户的留言,也可以针对自己的意见,对商品做出评价。
### 6.5 模糊查询
  如果想要模糊查询商品,最顶部有一个输入框,输入商品的信息,点击搜索按钮,系统会自动过滤合适的商品呈现给用户。
### 6.6 求购商城
  如果用户有商品想要出售,可以进入求购商城,浏览其他用户的求购信息,通过点击顶部的导航栏 求购商城 进入查看所有的求购信息,同样有分页和侧边栏的功能。
### 6.7 发布商品信息
  如果已经登录过,那么右上角显示的是用户名,将鼠标移动到上面,会弹出一个下拉框,点击发布商品信息,按照提示输入各自的信息,之后确认信息无误之后点击发布按钮即可。
### 6.8 发布求购信息
  发布求购信息的过程跟发布商品信息一样,主要是点击下拉框的发布求购信息,在发表即可。
### 6.9 查看我发布的商品
  鼠标移动到左上角的用户名,点击显示出来的下拉框的我发布的商品,就可以进入到自己发布过的商品,可以点击每一个商品下方的修改图标可以对商品进行修改,点击删除图片可以下架这个商品。
### 6.10 查看我的求购商品
  跟查看我发布的商品基本一致,只是点击的是我的求购商品。
### 6.11 购物车
  用户浏览到合适的商品,可以点击添加至购物车的按钮,之后可以将鼠标移动至右上角用户名处,点击显示出来的下拉列表,点击我的购物车,进入到我的购物车查看自己有意向购买的商品。此时可以选择收货地址,或者修改购物车中的一些信息,例如修改数量,或者删除某一件商品。也可以同时选中所有的商品,或者是取消选中所有的商品,之后便可以结算。
# 三、设计总结或结论
  该C2C校园二手交易平台界面简洁明了能给用户一种美的视觉上的享受。并且操作简单易懂可以大胆但是毫不夸张的说本系统适用于99%的青少年愉快的使用对于不是很了解智能科技的人来说只要看看就基本可以掌握然后熟练的使用该系统了。并且本系统的动画效果做得非常的完美前端工作人员争取使用最少的代码实现最炫酷的动态效果例如3D页面转换动态加入购物车效果搜索的时候动态自动提示商品名字功能等等无一不是本系统的亮点。由于前端本着使用最少的代码实现最炫酷的动态效果所以其性能可以来说是杠杠的。并且前端所构建的网站为响应式网站当页面的大小发送变化的时候页面会随着变化但是我们的变化不会出现任何的纰漏。在兼容性方面本网站可以完美的兼容ie8+Firefox8+chrome6+等等,虽然目前比较少用户使用这些版本以下的浏览器,但是要做的话,我们就要力争做到完美,前端人员通过查询资料,目前可以最完美的兼容上诉浏览器的以下版本。
  前端页面缺点对于那些不兼容HTML5和CSS3的浏览器使用的是JavaScript来动态实现这些3D效果的所以可能展示的效果不如支持HTML5和CSS3的本身效果好。对应浏览器版本真的是过低的用户无法完美的显示本系统的动态网页。JavaScript实现的那些动画效果可能存在某些目前未知的bug导致性能上的加载可能会出现瑕疵。
  后台实现的优点:后台为了提高性能,使用了一些目前属于比较好的设计模式,例如工厂方法模式,代理模式,备忘录模式,单例模式等等。数据库表的设计思想主要是参考阿里巴巴的开发手册进行设计的,在性能上,建立了适当的索引,增强了查询速度,并且自己设计了许多的算法对后台数据的处理进行优化等等。本来想使用集群和分布式来实现后台,但是考虑到现在如果使用集群,分布式来实现,那么开发周期得提升不止一个档次的时间。
  网站加载图片的时候通常耗费的主要流量和影响速度的原因之一就是这个所以后台设计了一个比较有意思的算法对图片进行适当的压缩在前端显示的时候主要显示的压缩后的图片当鼠标移到图片上的时候那么通过ajax显示未被压缩过的图片的放大版。这样既可以节省带宽又可以提高用户的体验。
  为了防止XSS攻击可以使用消毒和HttpOnly防止该现象对于注入攻击使用的方法为错误回显盲注参数绑定对于CSRF攻击可以使用表单token验证码和Rererfer check。
  对于密码,手机号码,真实信息等等敏感信息,通常都需要对其进行信息加密,我使用的是单向散列表加密和对称加密,还有就是使用公钥密钥配对核实认证。但是如果使用到密钥的话,那么一般会要求用户下载安全证书到本机。
  信息过滤和反垃圾是目前一个比较主流的问题。我使用的主要是文本匹配来过滤敏感词的。当用户发布的信息很长的时候使用的过滤算法是双数组Trie算法进行敏感词过滤该算法利用两个稀疏数组存储树结构base数组存储Trie树的节点check数组进行状态检查。该算法需要根据业务场景和经验确定数组大小避免数组过大或者冲突过多。
  简而言之,前端效果简洁炫酷,操作简单易懂。
  没有实现的功能秒杀系统前端反向代理CDN加速。
## 参考文献
[1] 李智慧. 大型网站技术架构 核心原理与案例分析[M].北京工业机械出版社2013.
[2] 马丁著 韩磊译.代码整洁之道[Clean Code A Handbook of Agile Software Craftsmanship] [M]. 北京人们邮电出版社2010.
[3] Craig Walls 著 张卫滨译. Spring In Action[M]. 北京人民邮电出版社2016
[4] Thomas H.Cormen , Charles E.Leiserson, Ronald L.Rivest, Clifford Stein著徐云王刚等译. 算法导论原书第3版[M]. 北京机械工业出版社2015
[5] Joshua Bloch 著 杨春花 俞黎敏 译. Effective Java(Second Edition) [M]. 北京机械工业出版社2016
[6] 本·弗莱恩Ben Frain著奇舞团 译. 响应式Web设计 HTML5和CSS3实战第2版[M]. 人民邮电出版社2017
[7] 达科特Jon Duckett 著 刘涛,陈学敏 译. JavaScript&jQuery交互式Web前端开发[M]. 清华大学出版社2015
[8] NicholasC.Zakas著 李松峰曹力 译. JavaScript高级程序设计(第3版)[M]. 人民邮电出版社2016

File diff suppressed because it is too large Load Diff

@ -0,0 +1,13 @@
参考地址https://blog.csdn.net/wsk1103/article/details/80214238
使用 Spring Boot 一键式启动。
下载项目运行c2c.sql文件然后运行 UsedTradingPlatformApplication.main 方法即可启动。
环境
jdk1.8
mysql5.7
先在数据中创建名为c2c的数据库使用Navicat for MySQL运行 c2c.sql文件创建表和导入数据

@ -0,0 +1,126 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>utp</groupId>
<artifactId>utp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>utp Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring-version>5.3.19</spring-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.6.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.6.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-websocket -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${spring-version}</version>
</dependency>
<!--Thymeleaf模板依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.6.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M4</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/net.coobird/thumbnailator -->
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.19</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.6.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.9</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<version>2.6.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.41</version>
</dependency>
<!--https://mvnrepository.com/artifact/org.apache.commons/commons-email-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<finalName>UTP</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,27 @@
package com.wsk;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
/**
* @author sk
* @date 2022/5/1
* @description
*/
@SpringBootApplication
@EntityScan(basePackages = "com.wsk.*")
@ComponentScan({"com.wsk.*"})
@MapperScan({"com.wsk.dao"}) //扫描mybatis需注解 @Repository
@EnableAsync
public class UsedTradingPlatformApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(UsedTradingPlatformApplication.class).run(args);
}
}

@ -0,0 +1,19 @@
/*
package com.wsk.aspect;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
*/
/**
* Created by wsk1103 on 2017/10/18.
*//*
@Aspect
public class OnlyOneUser {
@Before(value = "execution(* com.wsk.controller.UserController.login(..))")
public void isExit(){
}
}
*/

@ -0,0 +1,109 @@
package com.wsk.bean;
import java.io.Serializable;
import java.util.Date;
/**
* Created by wsk1103 on 2017/5/22.
*/
public class GoodsCarBean implements Serializable{
private int id;
private int uid;
private int sid;
private String name;
private Date modified;
private int quantity;
private int level;
private String remark;
private String sort;
private String image;
private double price;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public int getSid() {
return sid;
}
public void setSid(int sid) {
this.sid = sid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}

@ -0,0 +1,64 @@
package com.wsk.bean;
import java.io.Serializable;
import java.util.Date;
/**
* Created by wsk1103 on 2017/5/21.
*/
public class ShopContextBean implements Serializable {
private int id;
private Date modified;
private int sid;
private String context;
private int uid;
private String username;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public int getSid() {
return sid;
}
public void setSid(int sid) {
this.sid = sid;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}

@ -0,0 +1,99 @@
package com.wsk.bean;
import java.io.Serializable;
/**
* Created by wsk1103 on 2017/5/19.
*/
public class ShopInformationBean implements Serializable{
private int id;
private String name;
private int level;
private String remark;
private double price;
private String sort;
private int quantity;
private int transaction;
private int uid;
private String image;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getTransaction() {
return transaction;
}
public void setTransaction(int transaction) {
this.transaction = transaction;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}

@ -0,0 +1,83 @@
package com.wsk.bean;
import java.io.Serializable;
import java.util.Date;
/**
* Created by wsk1103 on 2017/5/21.
*/
public class UserWantBean implements Serializable{
private int id;
private Date modified;
private String name;
private String sort;
private int quantity;
private double price;
private String remark;
private int uid;
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

@ -0,0 +1,32 @@
package com.wsk.config;
import cn.hutool.core.io.FileUtil;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
/**
* @author sk
* @date 2023/4/18
*/
@Configuration
@Getter
public class FileConfig {
@Value("${my.file.save}")
private String fileSave;
@Value("${my.file.saveImage}")
private String saveImage;
@Value("${my.file.saveThumbnails}")
private String saveThumbnails;
@PostConstruct
public void init() {
String si = "file:" + fileSave + ":" + saveImage;
FileUtil.mkdir(si);
String st = "file:" + fileSave + ":" + saveThumbnails;
FileUtil.mkdir(st);
}
}

@ -0,0 +1,28 @@
package com.wsk.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author sk
* @date 2022/5/1
* @description
*/
@Configuration
public class MyWebAppConfigurer implements WebMvcConfigurer {
@Autowired
private FileConfig fileConfig;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/image/**", "/images/**", "/css/**", "/js/**", "/img/**")
.addResourceLocations("classpath:/mystatic/image/", "classpath:/mystatic/images/", "classpath:/mystatic/css/",
"classpath:/mystatic/js/", "classpath:/mystatic/img/");
String saveFile = "file:" + fileConfig.getFileSave() + ":/toImage/";
registry.addResourceHandler("/toImage/**").addResourceLocations(saveFile);
WebMvcConfigurer.super.addResourceHandlers(registry);
}
}

@ -0,0 +1,17 @@
package com.wsk.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by wsk1103 on 2017/5/23.
*/
@Controller
public class ErrorController {
@RequestMapping(value = "/error2")
public String error() {
return "error";
}
}

@ -0,0 +1,99 @@
package com.wsk.controller;
import com.wsk.pojo.UserInformation;
import com.wsk.pojo.UserPassword;
import com.wsk.response.BaseResponse;
import com.wsk.service.UserInformationService;
import com.wsk.service.UserPasswordService;
import com.wsk.tool.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Created by wsk1103 on 2017/5/9.
*/
@RestController
public class ForgetController {
@Resource
private UserPasswordService userPasswordService;
@Resource
private UserInformationService userInformationService;
@RequestMapping(value = "checkCode.do", method = {RequestMethod.POST, RequestMethod.GET})
public Map checkPhone(HttpServletRequest request, Model model,
@RequestParam String code, @RequestParam String token) {
Map<String, Integer> map = new HashMap<>();
String name = request.getParameter("name");
if (!StringUtils.getInstance().isNullOrEmpty(name)) {
request.getSession().setAttribute("name", name);
}
String checkCodeToken = (String) request.getSession().getAttribute("token");
if (StringUtils.getInstance().isNullOrEmpty(checkCodeToken) || !checkCodeToken.equals(token)) {
map.put("result", 0);
return map;
}
//验证码错误
if (!checkCodePhone(code, request)) {
map.put("result", 0);
return map;
}
map.put("result", 1);
return map;
}
//更新密码
@RequestMapping("updatePassword.do")
public BaseResponse updatePassword(HttpServletRequest request, Model model,
@RequestParam String password, @RequestParam String token) {
//防止重复提交
String updatePasswordToken = (String) request.getSession().getAttribute("token");
if (StringUtils.getInstance().isNullOrEmpty(updatePasswordToken) || !updatePasswordToken.equals(token)) {
return BaseResponse.fail();
}
String realPhone = (String) request.getSession().getAttribute("phone");
UserPassword userPassword = new UserPassword();
String newPassword = StringUtils.getInstance().getMD5(password);
int uid;
try {
uid = userInformationService.selectIdByPhone(realPhone);
if (uid == 0) {
return BaseResponse.fail();
}
} catch (Exception e) {
e.printStackTrace();
return BaseResponse.fail();
}
int id = userPasswordService.selectByUid(uid).getId();
userPassword.setId(id);
userPassword.setUid(uid);
userPassword.setModified(new Date());
userPassword.setPassword(newPassword);
int result;
try {
result = userPasswordService.updateByPrimaryKeySelective(userPassword);
} catch (Exception e) {
return BaseResponse.fail();
}
//更新失败
if (result != 1) {
return BaseResponse.fail();
}
UserInformation userInformation = userInformationService.selectByPrimaryKey(uid);
request.getSession().setAttribute("userInformation", userInformation);
return BaseResponse.success();
}
//check the phone`s code
private boolean checkCodePhone(String codePhone, HttpServletRequest request) {
String trueCodePhone = "1479";
return codePhone.equals(trueCodePhone);
}
}

@ -0,0 +1,242 @@
package com.wsk.controller;
import com.wsk.bean.ShopContextBean;
import com.wsk.bean.ShopInformationBean;
import com.wsk.bean.UserWantBean;
import com.wsk.pojo.*;
import com.wsk.service.*;
import com.wsk.token.TokenProccessor;
import com.wsk.tool.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by wsk1103 on 2017/5/14.
*/
@Controller
public class GoodsController {
@Resource
private ShopInformationService shopInformationService;
@Resource
private ShopContextService shopContextService;
@Resource
private UserInformationService userInformationService;
@Resource
private SpecificeService specificeService;
@Resource
private ClassificationService classificationService;
@Resource
private AllKindsService allKindsService;
@Resource
private UserWantService userWantService;
//进入到发布商品页面
@RequestMapping(value = "/publish_product.do", method = RequestMethod.GET)
public String publish(HttpServletRequest request, Model model) {
//先判断用户有没有登录
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (StringUtils.getInstance().isNullOrEmpty(userInformation)) {
//如果没有登录
return "redirect:/login.do";
} else {
model.addAttribute("userInformation", userInformation);
}
//如果登录了,判断该用户有没有经过认证
try {
String realName = userInformation.getRealname();
String sno = userInformation.getSno();
String dormitory = userInformation.getDormitory();
if (StringUtils.getInstance().isNullOrEmpty(realName) || StringUtils.getInstance().isNullOrEmpty(sno) || StringUtils.getInstance().isNullOrEmpty(dormitory)) {
//没有
model.addAttribute("message", "请先认证真实信息");
return "redirect:personal_info.do";
}
} catch (Exception e) {
e.printStackTrace();
return "redirect:/login.do";
}
String goodsToken = TokenProccessor.getInstance().makeToken();
request.getSession().setAttribute("goodsToken", goodsToken);
model.addAttribute("shopInformation", new ShopInformation());
model.addAttribute("action", 1);
model.addAttribute("token", goodsToken);
return "page/publish_product";
}
//模糊查询商品
@RequestMapping(value = "/findShopByName.do")
public String findByName(HttpServletRequest request, Model model,
@RequestParam String name) {
try {
List<ShopInformation> shopInformations = shopInformationService.selectByName(name);
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (StringUtils.getInstance().isNullOrEmpty(userInformation)) {
userInformation = new UserInformation();
model.addAttribute("userInformation", userInformation);
} else {
model.addAttribute("userInformation", userInformation);
}
List<ShopInformationBean> shopInformationBeans = new ArrayList<>();
String sortName;
for (ShopInformation shopInformation : shopInformations) {
int sort = shopInformation.getSort();
sortName = getSort(sort);
ShopInformationBean shopInformationBean = new ShopInformationBean();
shopInformationBean.setId(shopInformation.getId());
shopInformationBean.setName(shopInformation.getName());
shopInformationBean.setLevel(shopInformation.getLevel());
shopInformationBean.setRemark(shopInformation.getRemark());
shopInformationBean.setPrice(shopInformation.getPrice().doubleValue());
shopInformationBean.setQuantity(shopInformation.getQuantity());
shopInformationBean.setTransaction(shopInformation.getTransaction());
shopInformationBean.setSort(sortName);
shopInformationBean.setUid(shopInformation.getUid());
shopInformationBean.setImage(shopInformation.getImage());
shopInformationBeans.add(shopInformationBean);
}
model.addAttribute("shopInformationBean", shopInformationBeans);
} catch (Exception e) {
e.printStackTrace();
return "redirect:mall_page.do";
}
return "page/mall_page";
}
//进入查看商品详情
@RequestMapping(value = "/selectById.do")
public String selectById(@RequestParam int id,
HttpServletRequest request, Model model) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (StringUtils.getInstance().isNullOrEmpty(userInformation)) {
userInformation = new UserInformation();
model.addAttribute("userInformation", userInformation);
}
try {
ShopInformation shopInformation = shopInformationService.selectByPrimaryKey(id);
model.addAttribute("shopInformation", shopInformation);
List<ShopContext> shopContexts = shopContextService.selectById(id);
List<ShopContextBean> shopContextBeans = new ArrayList<>();
for (ShopContext s : shopContexts) {
ShopContextBean shopContextBean = new ShopContextBean();
UserInformation u = userInformationService.selectByPrimaryKey(s.getUid());
shopContextBean.setContext(s.getContext());
shopContextBean.setId(s.getId());
shopContextBean.setModified(s.getModified());
shopContextBean.setUid(u.getId());
shopContextBean.setUsername(u.getUsername());
shopContextBeans.add(shopContextBean);
}
String sort = getSort(shopInformation.getSort());
String goodsToken = TokenProccessor.getInstance().makeToken();
request.getSession().setAttribute("goodsToken", goodsToken);
model.addAttribute("token", goodsToken);
model.addAttribute("sort", sort);
model.addAttribute("userInformation", userInformation);
model.addAttribute("shopContextBeans", shopContextBeans);
return "page/product_info";
} catch (Exception e) {
e.printStackTrace();
return "redirect:/";
}
}
//进入到求购商城
@RequestMapping(value = "/require_mall.do")
public String requireMall(HttpServletRequest request, Model model) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (StringUtils.getInstance().isNullOrEmpty(userInformation)) {
userInformation = new UserInformation();
model.addAttribute("userInformation", userInformation);
} else {
model.addAttribute("userInformation", userInformation);
}
List<UserWant> userWants = userWantService.selectAll();
List<UserWantBean> list = new ArrayList<>();
for (UserWant userWant : userWants) {
UserWantBean u = new UserWantBean();
u.setSort(getSort(userWant.getSort()));
u.setRemark(userWant.getRemark());
u.setQuantity(userWant.getQuantity());
u.setPrice(userWant.getPrice().doubleValue());
u.setUid(userWant.getUid());
u.setId(userWant.getId());
u.setModified(userWant.getModified());
u.setName(userWant.getName());
list.add(u);
}
model.addAttribute("list", list);
return "page/require_mall";
}
//通过id查看商品的详情
@RequestMapping(value = "/findShopById.do")
@ResponseBody
public ShopInformation findShopById(@RequestParam int id) {
return shopInformationService.selectByPrimaryKey(id);
}
//通过分类选择商品
@RequestMapping(value = "/selectBySort.do")
@ResponseBody
public List<ShopInformation> selectBySort(@RequestParam int sort) {
return shopInformationService.selectBySort(sort);
}
//分页查询
@RequestMapping(value = "/selectByCounts.do")
@ResponseBody
public List<ShopInformation> selectByCounts(@RequestParam int counts) {
Map<String, Integer> map = new HashMap<>();
map.put("start", (counts - 1) * 12);
map.put("end", 12);
return shopInformationService.selectTen(map);
}
// //通过id查看商品详情
// @RequestMapping(value = "/showShop")
// public String showShop(@RequestParam int id, HttpServletRequest request, Model model) {
// ShopInformation shopInformation =
// }
//获取最详细的分类,第三层
private Specific selectSpecificBySort(int sort) {
return specificeService.selectByPrimaryKey(sort);
}
//获得第二层分类
private Classification selectClassificationByCid(int cid) {
return classificationService.selectByPrimaryKey(cid);
}
//获得第一层分类
private AllKinds selectAllKindsByAid(int aid) {
return allKindsService.selectByPrimaryKey(aid);
}
private String getSort(int sort) {
StringBuilder sb = new StringBuilder();
Specific specific = selectSpecificBySort(sort);
int cid = specific.getCid();
Classification classification = selectClassificationByCid(cid);
int aid = classification.getAid();
AllKinds allKinds = selectAllKindsByAid(aid);
String allName = allKinds.getName();
sb.append(allName);
sb.append("-");
sb.append(classification.getName());
sb.append("-");
sb.append(specific.getName());
return sb.toString();
}
}

@ -0,0 +1,241 @@
package com.wsk.controller;
import com.wsk.bean.ShopInformationBean;
import com.wsk.pojo.*;
import com.wsk.service.*;
import com.wsk.tool.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by wsk1103 on 2017/5/11.
*/
@Controller
public class HomeController {
@Resource
private ShopInformationService shopInformationService;
@Resource
private SpecificeService specificeService;
@Resource
private ClassificationService classificationService;
@Resource
private AllKindsService allKindsService;
@Resource
private ShopContextService shopContextService;
@RequestMapping(value = {"/", "/home.do"})
public String home(HttpServletRequest request, Model model) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
// if user login,the session will have the "userInformation"
if (!StringUtils.getInstance().isNullOrEmpty(userInformation)) {
model.addAttribute("userInformation", userInformation);
} else {
userInformation = new UserInformation();
model.addAttribute("userInformation", userInformation);
}
//一般形式进入首页
try {
List<ShopInformation> shopInformations = selectTen(1, 5);
List<ShopInformationBean> list = new ArrayList<>();
int counts = getShopCounts();
model.addAttribute("shopInformationCounts", counts);
String stringBuffer;
for (ShopInformation shopInformation : shopInformations) {
stringBuffer = getSortName(shopInformation.getSort());
ShopInformationBean shopInformationBean = new ShopInformationBean();
shopInformationBean.setId(shopInformation.getId());
shopInformationBean.setName(shopInformation.getName());
shopInformationBean.setLevel(shopInformation.getLevel());
shopInformationBean.setPrice(shopInformation.getPrice().doubleValue());
shopInformationBean.setRemark(shopInformation.getRemark());
shopInformationBean.setSort(stringBuffer);
shopInformationBean.setQuantity(shopInformation.getQuantity());
shopInformationBean.setUid(shopInformation.getUid());
shopInformationBean.setTransaction(shopInformation.getTransaction());
shopInformationBean.setImage(shopInformation.getImage());
list.add(shopInformationBean);
}
model.addAttribute("shopInformationBean", list);
} catch (Exception e) {
e.printStackTrace();
return "page/login_page";
}
return "index";
}
//进入商城
@RequestMapping(value = "/mall_page.do")
public String mallPage(HttpServletRequest request, Model model) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (StringUtils.getInstance().isNullOrEmpty(userInformation)) {
userInformation = new UserInformation();
model.addAttribute("userInformation", userInformation);
} else {
model.addAttribute("userInformation", userInformation);
}
try {
List<ShopInformation> shopInformations = selectTen(1, 12);
List<ShopInformationBean> list = new ArrayList<>();
int counts = getShopCounts();
model.addAttribute("shopInformationCounts", counts);
String sortName;
for (ShopInformation shopInformation : shopInformations) {
int sort = shopInformation.getSort();
sortName = getSortName(sort);
ShopInformationBean shopInformationBean = new ShopInformationBean();
shopInformationBean.setId(shopInformation.getId());
shopInformationBean.setName(shopInformation.getName());
shopInformationBean.setLevel(shopInformation.getLevel());
shopInformationBean.setRemark(shopInformation.getRemark());
shopInformationBean.setPrice(shopInformation.getPrice().doubleValue());
shopInformationBean.setSort(sortName);
shopInformationBean.setQuantity(shopInformation.getQuantity());
shopInformationBean.setTransaction(shopInformation.getTransaction());
shopInformationBean.setUid(shopInformation.getUid());
shopInformationBean.setImage(shopInformation.getImage());
list.add(shopInformationBean);
}
model.addAttribute("shopInformationBean", list);
} catch (Exception e) {
e.printStackTrace();
return "page/login_page";
}
return "page/mall_page";
}
//通过分类的第三层id获取全名
private String getSortName(int sort) {
StringBuilder stringBuffer = new StringBuilder();
Specific specific = selectSpecificBySort(sort);
int cid = specific.getCid();
Classification classification = selectClassificationByCid(cid);
int aid = classification.getAid();
AllKinds allKinds = selectAllKindsByAid(aid);
stringBuffer.append(allKinds.getName());
stringBuffer.append("-");
stringBuffer.append(classification.getName());
stringBuffer.append("-");
stringBuffer.append(specific.getName());
// System.out.println(sort);
return stringBuffer.toString();
}
//获得分类中的第一层
@RequestMapping(value = "/getAllKinds.do")
@ResponseBody
public List<AllKinds> getAllKind() {
return getAllKinds();
}
//获得分类中的第二层通过第一层的id
@RequestMapping(value = "/getClassification.do", method = RequestMethod.POST)
@ResponseBody
public List<Classification> getClassificationByAid(@RequestParam int id) {
return selectAllClassification(id);
}
//通过第二层的id获取对应的第三层
@RequestMapping(value = "/getSpecific.do")
@ResponseBody
public List<Specific> getSpecificByCid(@RequestParam int id) {
return selectAllSpecific(id);
}
//get the shops counts
@RequestMapping(value = "/getShopsCounts.do")
@ResponseBody
public Map getShopsCounts() {
Map<String, Integer> map = new HashMap<>();
int counts = 0;
try {
counts = shopInformationService.getCounts();
} catch (Exception e) {
e.printStackTrace();
map.put("counts", counts);
return map;
}
map.put("counts", counts);
return map;
}
@RequestMapping(value = "/getShops.do")
@ResponseBody
public List getShops(@RequestParam int start) {
List<ShopInformation> list = new ArrayList<>();
try {
int end = 12;
list = selectTen(start, end);
} catch (Exception e) {
e.printStackTrace();
return list;
}
return list;
}
//获取商品,分页,一次性获取end个
private List<ShopInformation> selectTen(int start, int end) {
Map map = new HashMap();
map.put("start", (start - 1) * end);
map.put("end", end);
List<ShopInformation> list = shopInformationService.selectTen(map);
return list;
}
//获取最详细的分类,第三层
private Specific selectSpecificBySort(int sort) {
return specificeService.selectByPrimaryKey(sort);
}
//获得第二层分类
private Classification selectClassificationByCid(int cid) {
return classificationService.selectByPrimaryKey(cid);
}
//获得第一层分类
private AllKinds selectAllKindsByAid(int aid) {
return allKindsService.selectByPrimaryKey(aid);
}
//获得第一层所有
private List<AllKinds> getAllKinds() {
return allKindsService.selectAll();
}
//根据第一层的id获取该层下的第二层
private List<Classification> selectAllClassification(int aid) {
return classificationService.selectByAid(aid);
}
//根据第二层的id获取其对应的第三层所有id
private List<Specific> selectAllSpecific(int cid) {
return specificeService.selectByCid(cid);
}
//获得商品总页数
private int getShopCounts() {
return shopInformationService.getCounts();
}
//获得商品留言总页数
private int getShopContextCounts(int sid) {
return shopContextService.getCounts(sid);
}
//获得商品留言10条
private List<ShopContext> selectShopContextBySid(int sid, int start) {
return shopContextService.findById(sid, (start - 1) * 10);
}
}

@ -0,0 +1,83 @@
package com.wsk.controller;
import com.wsk.pojo.UserInformation;
import com.wsk.pojo.UserPassword;
import com.wsk.response.BaseResponse;
import com.wsk.service.UserInformationService;
import com.wsk.service.UserPasswordService;
import com.wsk.tool.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Created by wsk1103 on 2017/5/9.
*
*/
@Controller
public class RegisterController {
@Resource
private UserPasswordService userPasswordService;
@Resource
private UserInformationService userInformationService;
//开始注册用户
@RequestMapping("/insertUser.do")
@ResponseBody
public BaseResponse insertUser(HttpServletRequest request,
@RequestParam String password, @RequestParam String token) {
//存储与session中的手机号码
String realPhone = (String) request.getSession().getAttribute("phone");
//token唯一标识
String insertUserToken = (String) request.getSession().getAttribute("token");
//防止重复提交
if (StringUtils.getInstance().isNullOrEmpty(insertUserToken) || !insertUserToken.equals(token)) {
return BaseResponse.fail();
}
//该手机号码已经存在
int uid = userInformationService.selectIdByPhone(realPhone);
if (uid != 0) {
return BaseResponse.fail();
}
//用户信息
UserInformation userInformation = new UserInformation();
userInformation.setPhone(realPhone);
userInformation.setCreatetime(new Date());
String username = (String) request.getSession().getAttribute("name");
userInformation.setUsername(username);
userInformation.setModified(new Date());
int result;
result = userInformationService.insertSelective(userInformation);
//如果用户基本信息写入成功
if (result == 1) {
uid = userInformationService.selectIdByPhone(realPhone);
String newPassword = StringUtils.getInstance().getMD5(password);
UserPassword userPassword = new UserPassword();
userPassword.setModified(new Date());
userPassword.setUid(uid);
userPassword.setPassword(newPassword);
result = userPasswordService.insertSelective(userPassword);
//密码写入失败
if (result != 1) {
userInformationService.deleteByPrimaryKey(uid);
return BaseResponse.fail();
} else {
//注册成功
userInformation = userInformationService.selectByPrimaryKey(uid);
request.getSession().setAttribute("userInformation", userInformation);
return BaseResponse.success();
}
}
return BaseResponse.fail();
}
}

@ -0,0 +1,131 @@
package com.wsk.controller;
import com.wsk.pojo.UserInformation;
import com.wsk.response.BaseResponse;
import com.wsk.service.UserInformationService;
import com.wsk.tool.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
/**
* Created by wsk1103 on 2017/4/30.
*/
@Controller
public class SendEmailController {
@Resource
private UserInformationService userInformationService;
private static final Logger log = LoggerFactory.getLogger(SendEmailController.class);
//send the Email to the phone
@RequestMapping(value = "sendCode.do", method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody
public BaseResponse sendEmail(HttpServletRequest req, HttpServletResponse res,
@RequestParam String phone, @RequestParam String action,
@RequestParam String token) {
res.setContentType("text/html;charset=UTF-8");
//token防止重复提交
String sendCodeToken = (String) req.getSession().getAttribute("token");
if (StringUtils.getInstance().isNullOrEmpty(sendCodeToken) || !sendCodeToken.equals(token)) {
return BaseResponse.fail();
}
//判断手机号码是否为正确
if (!StringUtils.getInstance().isPhone(phone)) {
return BaseResponse.fail();
}
//如果是忘记密码提交的发送短信
if ("forget".equals(action)) {
if (!isUserPhoneExists(phone)) {
//失败
return BaseResponse.fail();
}
} else if ("register".equals(action)) {
//失败
if (isUserPhoneExists(phone)) {
return BaseResponse.fail();
}
}
//get the random num to phone which should check the phone to judge the phone is belong user
getRandomForCodePhone(req);
String ra = (String) req.getSession().getAttribute("codePhone");
String text1 = "【WSK的验证码】您的验证码是";
String text2 = ",请保护好自己的验证码。";
String text = text1 + ra + text2;
Properties prop = new Properties();
prop.setProperty("mail.host", "smtp.139.com");
prop.setProperty("mail.transport.protocol", "smtp");
prop.setProperty("mail.smtp.auth", "true");
prop.setProperty("mail.smtp.port", "25");
try {
String realPhone = phone;
// phone += "@139.com";
// message.setRecipient(Message.RecipientType.TO, new InternetAddress(phone));
// message.setSubject("来自WSK的验证码");
// message.setContent(text, "text/html;charset=UTF-8");
//这里先不发生信息,以后要开启的
// ts.sendMessage(message, message.getAllRecipients());
// ts.close();
req.getSession().setAttribute("phone", realPhone);
return BaseResponse.success();
} catch (Exception me) {
me.printStackTrace();
return BaseResponse.fail();
}
}
// get the random phone`s code
private void getRandomForCodePhone(HttpServletRequest req) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 4; i++) {
sb.append(random.nextInt(10));
}
log.info("短信验证码={}", sb);
System.out.println(sb.toString());
req.getSession().setAttribute("codePhone", sb.toString());
}
// //检验验证码
// private boolean checkPhoto(String photo, HttpServletRequest request) {
// photo = photo.toLowerCase();
// String true_photo = (String) request.getSession().getAttribute("rand");
// return true_photo.equals(photo);
// }
//To determine whether the user's mobile phone number exists
private boolean isUserPhoneExists(String phone) {
boolean result = false;
try {
int id = userInformationService.selectIdByPhone(phone);
if (id == 0) {
return result;
}
UserInformation userInformation = userInformationService.selectByPrimaryKey(id);
if (StringUtils.getInstance().isNullOrEmpty(userInformation)) {
return false;
}
String userPhone = userInformation.getPhone();
result = !userPhone.equals("");
} catch (Exception e) {
e.printStackTrace();
return result;
}
return result;
}
}

@ -0,0 +1,79 @@
package com.wsk.controller.webSocket;
import com.wsk.tool.SaveSession;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException;
import java.util.*;
/**
* Created by wsk1103 on 2017/5/22.
*/
public class ChatWebSocketHandler extends TextWebSocketHandler {
private final static List<WebSocketSession> sessions = Collections.synchronizedList(new ArrayList<WebSocketSession>());
//接收文本消息,并发送出去
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
// System.out.println(session.getId()+":send....");
// chatTextMessageHandler(message.getPayload());
try {
// super.handleTextMessage(session, message);
// System.out.println(session.getId()+" :"+message.getPayload() + " " + new Date());
String m = message.getPayload();
String[] wsk = m.split(",");
String phone = wsk[0];
long time = Long.parseLong(wsk[1]);
String action = wsk[2];
if (action.equals("start")){
session.sendMessage(new TextMessage("success"));
SaveSession.getInstance().save(phone,time);
return;
}
boolean b = SaveSession.getInstance().isHave(phone,time);
if (b) {
if (session.isOpen()) {
session.sendMessage(new TextMessage("error"));
}
} else {
if (session.isOpen())
session.sendMessage(new TextMessage("success"));
}
} catch (Exception e) {
e.printStackTrace();
try {
session.sendMessage(new TextMessage("error"));
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
//连接建立后处理
@SuppressWarnings("unchecked")
@Override
public void afterConnectionEstablished(WebSocketSession session) {
sessions.add(session);
//处理离线消息
}
//抛出异常时处理
@Override
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
if (session.isOpen()) {
session.close();
}
sessions.remove(session);
}
//连接关闭后处理
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) {
sessions.remove(session);
}
}

@ -0,0 +1,29 @@
package com.wsk.controller.webSocket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
/**
* Created by wsk1103 on 2017/5/22.
*/
@Configuration
@EnableWebMvc
@EnableWebSocket
public class WebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
//WebIM WebSocket通道
registry.addHandler(chatWebSocketHandler(),"/webSocketIMServer");
registry.addHandler(chatWebSocketHandler(),"/sockjs/webSocketIMServer");
registry.addHandler(chatWebSocketHandler(), "/sockjs/webSocketIMServer").withSockJS();
}
@Bean
public ChatWebSocketHandler chatWebSocketHandler() {
return new ChatWebSocketHandler();
}
}

@ -0,0 +1,19 @@
package com.wsk.dao;
import com.wsk.pojo.AdminInformation;
public interface AdminInformationMapper {
int deleteByPrimaryKey(Integer id);
int insert(AdminInformation record);
int insertSelective(AdminInformation record);
AdminInformation selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AdminInformation record);
int updateByPrimaryKey(AdminInformation record);
AdminInformation selectByNo(int ano);
}

@ -0,0 +1,17 @@
package com.wsk.dao;
import com.wsk.pojo.AdminOperation;
public interface AdminOperationMapper {
int deleteByPrimaryKey(Integer id);
int insert(AdminOperation record);
int insertSelective(AdminOperation record);
AdminOperation selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AdminOperation record);
int updateByPrimaryKey(AdminOperation record);
}

@ -0,0 +1,21 @@
package com.wsk.dao;
import com.wsk.pojo.AllKinds;
import java.util.List;
public interface AllKindsMapper {
int deleteByPrimaryKey(Integer id);
int insert(AllKinds record);
int insertSelective(AllKinds record);
AllKinds selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AllKinds record);
int updateByPrimaryKey(AllKinds record);
List<AllKinds> selectAll();
}

@ -0,0 +1,23 @@
package com.wsk.dao;
import com.wsk.pojo.BoughtShop;
import java.util.List;
public interface BoughtShopMapper {
int deleteByPrimaryKey(Integer id);
int insert(BoughtShop record);
int insertSelective(BoughtShop record);
BoughtShop selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(BoughtShop record);
int updateByPrimaryKey(BoughtShop record);
int getCounts(int uid);
List<BoughtShop> selectByUid(int uid, int start);
}

@ -0,0 +1,20 @@
package com.wsk.dao;
import com.wsk.pojo.Classification;
import java.util.List;
public interface ClassificationMapper {
int deleteByPrimaryKey(Integer id);
int insert(Classification record);
int insertSelective(Classification record);
Classification selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Classification record);
int updateByPrimaryKey(Classification record);
List<Classification> selectByAid(int aid);
}

@ -0,0 +1,21 @@
package com.wsk.dao;
import com.wsk.pojo.GoodsCar;
import java.util.List;
public interface GoodsCarMapper {
int deleteByPrimaryKey(Integer id);
int insert(GoodsCar record);
int insertSelective(GoodsCar record);
GoodsCar selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(GoodsCar record);
int updateByPrimaryKey(GoodsCar record);
List<GoodsCar> selectByUid(int uid);
}

@ -0,0 +1,21 @@
package com.wsk.dao;
import com.wsk.pojo.GoodsOfOrderForm;
import java.util.List;
public interface GoodsOfOrderFormMapper {
int deleteByPrimaryKey(Integer id);
int insert(GoodsOfOrderForm record);
int insertSelective(GoodsOfOrderForm record);
GoodsOfOrderForm selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(GoodsOfOrderForm record);
int updateByPrimaryKey(GoodsOfOrderForm record);
List<GoodsOfOrderForm> selectByOFid(int ofid);
}

@ -0,0 +1,23 @@
package com.wsk.dao;
import com.wsk.pojo.OrderForm;
import java.util.List;
public interface OrderFormMapper {
int deleteByPrimaryKey(Integer id);
int insert(OrderForm record);
int insertSelective(OrderForm record);
OrderForm selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(OrderForm record);
int updateByPrimaryKey(OrderForm record);
int getCounts(int uid);
List<OrderForm> selectByUid(int uid, int start);
}

@ -0,0 +1,23 @@
package com.wsk.dao;
import com.wsk.pojo.ShopCar;
public interface ShopCarMapper {
int deleteByPrimaryKey(Integer id);
int insert(ShopCar record);
int insertSelective(ShopCar record);
ShopCar selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ShopCar record);
int updateByPrimaryKey(ShopCar record);
int getCounts(int uid);
// List<ShopCar> selectByUid(int uid, int start);
ShopCar selectByUid(int uid);
}

@ -0,0 +1,27 @@
package com.wsk.dao;
import com.wsk.pojo.ShopContext;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface ShopContextMapper {
int deleteByPrimaryKey(Integer id);
int insert(ShopContext record);
int insertSelective(ShopContext record);
ShopContext selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ShopContext record);
int updateByPrimaryKey(ShopContext record);
int getCounts(int sid);
List<ShopContext> findById(int sid, int start);
@Select("select * from shopcontext where sid=#{id,jdbcType=INTEGER} and display=1")
List<ShopContext> selectBySid(int id);
}

@ -0,0 +1,41 @@
package com.wsk.dao;
import com.wsk.pojo.ShopInformation;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
public interface ShopInformationMapper {
int deleteByPrimaryKey(Integer id);
int insert(ShopInformation record);
int insertSelective(ShopInformation record);
ShopInformation selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ShopInformation record);
int updateByPrimaryKey(ShopInformation record);
List<ShopInformation> selectTen(Map map);
List<ShopInformation> selectOffShelf(Integer uid, Integer start);
int getCountsOffShelf(Integer uid);
int getCounts();
int selectIdByImage(String image);
List<ShopInformation> selectByName(String name);
//通过分类选择
@Select("select * from shopinformation where sort=#{sort} and display =1 limit 12")
List<ShopInformation> selectBySort(int sort);
//选择用户的发布
@Select("select * from shopinformation where uid=#{uid} and display=1 order by id desc limit 12")
List<ShopInformation> selectUserReleaseByUid(int uid);
}

@ -0,0 +1,23 @@
package com.wsk.dao;
import com.wsk.pojo.ShopPicture;
import java.util.List;
public interface ShopPictureMapper {
int deleteByPrimaryKey(Integer id);
int insert(ShopPicture record);
int insertSelective(ShopPicture record);
ShopPicture selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ShopPicture record);
int updateByPrimaryKey(ShopPicture record);
ShopPicture selectBySidOnlyOne(Integer sid);
List<ShopPicture> selectBySid(Integer sid);
}

@ -0,0 +1,21 @@
package com.wsk.dao;
import com.wsk.pojo.Specific;
import java.util.List;
public interface SpecificMapper {
int deleteByPrimaryKey(Integer id);
int insert(Specific record);
int insertSelective(Specific record);
Specific selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Specific record);
int updateByPrimaryKey(Specific record);
List<Specific> selectByCid(int cid);
}

@ -0,0 +1,23 @@
package com.wsk.dao;
import com.wsk.pojo.UserCollection;
import java.util.List;
public interface UserCollectionMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserCollection record);
int insertSelective(UserCollection record);
UserCollection selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserCollection record);
int updateByPrimaryKey(UserCollection record);
int getCounts(int uid);
List<UserCollection> selectByUid(int uid, int start);
}

@ -0,0 +1,23 @@
package com.wsk.dao;
import com.wsk.pojo.UserInformation;
import java.util.List;
public interface UserInformationMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserInformation record);
int insertSelective(UserInformation record);
UserInformation selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserInformation record);
int updateByPrimaryKey(UserInformation record);
int selectIdByPhone(String phone);
List<UserInformation> getAllForeach(List<Integer> list);
}

@ -0,0 +1,19 @@
package com.wsk.dao;
import com.wsk.pojo.UserPassword;
public interface UserPasswordMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserPassword record);
int insertSelective(UserPassword record);
UserPassword selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserPassword record);
int updateByPrimaryKey(UserPassword record);
UserPassword selectByUid(Integer uid);
}

@ -0,0 +1,27 @@
package com.wsk.dao;
import com.wsk.pojo.UserRelease;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface UserReleaseMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserRelease record);
int insertSelective(UserRelease record);
UserRelease selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserRelease record);
int updateByPrimaryKey(UserRelease record);
int getCounts(int uid);
List<UserRelease> selectByUid(int uid, int start);
@Select("select * from userrelease where uid=#{uid} and display=1 order by id desc limit 12")
List<UserRelease> selectUserProductByUid(int uid);
}

@ -0,0 +1,20 @@
package com.wsk.dao;
import com.wsk.pojo.UserState;
public interface UserStateMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserState record);
int insertSelective(UserState record);
UserState selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserState record);
int updateByPrimaryKey(UserState record);
UserState selectByUid(int uid);
}

@ -0,0 +1,29 @@
package com.wsk.dao;
import com.wsk.pojo.UserWant;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface UserWantMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserWant record);
int insertSelective(UserWant record);
UserWant selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserWant record);
int updateByPrimaryKey(UserWant record);
int getCounts(int uid);
List<UserWant> selectByUid(int uid, int start);
@Select("select * from userwant where uid=#{id} and display=1 order by id desc limit 12")
List<UserWant> selectMineByUid(int id);
List<UserWant> selectAll();
}

@ -0,0 +1,23 @@
package com.wsk.dao;
import com.wsk.pojo.WantContext;
import java.util.List;
public interface WantContextMapper {
int deleteByPrimaryKey(Integer id);
int insert(WantContext record);
int insertSelective(WantContext record);
WantContext selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(WantContext record);
int updateByPrimaryKey(WantContext record);
List<WantContext> selectByUWid(int uwid, int start);
int getCounts(int uwid);
}

@ -0,0 +1,20 @@
package com.wsk.error;
import lombok.Data;
/**
* @author wsk1103
* @date 2019/5/8
* @description
*/
@Data
public class BaseException extends RuntimeException {
private int code;
private String msg;
public BaseException(int code, String msg) {
super(msg);
this.code = code;
}
}

@ -0,0 +1,59 @@
package com.wsk.handle;
import com.wsk.error.BaseException;
import com.wsk.response.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import javax.servlet.http.HttpServletRequest;
/**
* @author wsk1103
* @date 2019/5/8
* @description
*/
@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
/**
*
*/
public static final String DEFAULT_ERROR_MESSAGE = "系统维护,请稍后访问";
/**
* 500
*
* @param req
* @param e
* @return
* @throws Exception
*/
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public BaseResponse handleAllError(HttpServletRequest req, Exception e) {
log.error("系统内部异常", e);
return BaseResponse.fail();
}
/**
* 500
*
* @param req
* @param e
* @return
* @throws Exception
*/
@ExceptionHandler(BaseException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public BaseResponse handleBizError(HttpServletRequest req, BaseException e) {
log.error("业务异常", e);
return BaseResponse.fail(e.getMsg());
}
}

@ -0,0 +1,46 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class AdminInformation implements Serializable{
private Integer id;
private String ano;
private String password;
private Date modified;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAno() {
return ano;
}
public void setAno(String ano) {
this.ano = ano == null ? null : ano.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Date getModified() {
return (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = (Date) modified.clone();
}
}

@ -0,0 +1,46 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class AdminOperation implements Serializable{
private Integer id;
private Integer aid;
private Date modified;
private String operation;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAid() {
return aid;
}
public void setAid(Integer aid) {
this.aid = aid;
}
public Date getModified() {
return (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = (Date) modified.clone();
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation == null ? null : operation.trim();
}
}

@ -0,0 +1,36 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class AllKinds implements Serializable {
private Integer id;
private String name;
private Date modified;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Date getModified() {
return (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = (Date) modified.clone();
}
}

@ -0,0 +1,66 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class BoughtShop implements Serializable {
private Integer id;
private Date modified;
private Integer state;
private Integer uid;
private Integer sid;
private Integer quantity;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
}

@ -0,0 +1,46 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class Classification implements Serializable {
private Integer id;
private String name;
private Date modified;
private Integer aid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getAid() {
return aid;
}
public void setAid(Integer aid) {
this.aid = aid;
}
}

@ -0,0 +1,66 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class GoodsCar implements Serializable {
private Integer id;
private Date modified;
private Integer sid;
private Integer uid;
private Integer quantity;
private Integer display;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
}

@ -0,0 +1,66 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class GoodsOfOrderForm implements Serializable {
private Integer id;
private Integer ofid;
private Integer sid;
private Date modified;
private Integer quantity;
private Integer display;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getOfid() {
return ofid;
}
public void setOfid(Integer ofid) {
this.ofid = ofid;
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
}

@ -0,0 +1,66 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class OrderForm implements Serializable {
private Integer id;
private Date modified;
private Integer display;
private Integer uid;
private String address;
private String context;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context == null ? null : context.trim();
}
}

@ -0,0 +1,46 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class ShopCar implements Serializable {
private Integer id;
private Date modified;
private Integer display;
private Integer uid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
}

@ -0,0 +1,66 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class ShopContext implements Serializable {
private Integer id;
private Date modified;
private Integer sid;
private String context;
private Integer display;
private int uid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context == null ? null : context.trim();
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
}

@ -0,0 +1,147 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class ShopInformation implements Serializable {
private Integer id;
private Date modified;
private String name;
private Integer level;
private String remark;
private BigDecimal price;
private Integer sort;
private Integer display;
private Integer quantity;
private Integer transaction;
private Integer uid;
private String image;
private Integer sales;
private String thumbnails;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort ;
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Integer getTransaction() {
return transaction;
}
public void setTransaction(Integer transaction) {
this.transaction = transaction;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public Integer getSales() {
return sales;
}
public void setSales(Integer sales) {
this.sales = sales;
}
public String getThumbnails() {
return thumbnails;
}
public void setThumbnails(String thumbnails) {
this.thumbnails = thumbnails;
}
}

@ -0,0 +1,56 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class ShopPicture implements Serializable {
private Integer id;
private Date modified;
private Integer sid;
private String picture;
private Integer display;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture == null ? null : picture.trim();
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
}

@ -0,0 +1,46 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class Specific implements Serializable {
private Integer id;
private String name;
private Date modified;
private Integer cid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getCid() {
return cid;
}
public void setCid(Integer cid) {
this.cid = cid;
}
}

@ -0,0 +1,56 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class UserCollection implements Serializable {
private Integer id;
private Date modified;
private Integer uid;
private Integer sid;
private Integer display;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
}

@ -0,0 +1,116 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class UserInformation implements Serializable {
private Integer id;
private Date modified;
private String username;
private String phone;
private String realname;
private String clazz;
private String sno;
private String dormitory;
private String gender;
private Date createtime;
private String avatar;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname == null ? null : realname.trim();
}
public String getClazz() {
return clazz;
}
public void setClazz(String clazz) {
this.clazz = clazz == null ? null : clazz.trim();
}
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno == null ? null : sno.trim();
}
public String getDormitory() {
return dormitory;
}
public void setDormitory(String dormitory) {
this.dormitory = dormitory == null ? null : dormitory.trim();
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender == null ? null : gender.trim();
}
public Date getCreatetime() {
return createtime == null ? null : (Date) createtime.clone();
}
public void setCreatetime(Date createtime) {
this.createtime = createtime == null ? null : (Date) createtime.clone();
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar == null ? null : avatar.trim();
}
}

@ -0,0 +1,46 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class UserPassword implements Serializable {
private Integer id;
private Date modified;
private String password;
private Integer uid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
}

@ -0,0 +1,56 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class UserRelease implements Serializable {
private Integer id;
private Date modified;
private Integer display;
private Integer uid;
private Integer sid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
}

@ -0,0 +1,57 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class UserState implements Serializable {
private Integer id;
private Integer credit;
private BigDecimal balance;
private Date modified;
private Integer uid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCredit() {
return credit;
}
public void setCredit(Integer credit) {
this.credit = credit;
}
public BigDecimal getBalance() {
return balance;
}
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
}

@ -0,0 +1,97 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class UserWant implements Serializable {
private Integer id;
private Date modified;
private Integer display;
private String name;
private Integer sort;
private Integer uid;
private Integer quantity;
private BigDecimal price;
private String remark;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort ;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
}

@ -0,0 +1,56 @@
package com.wsk.pojo;
import java.io.Serializable;
import java.util.Date;
public class WantContext implements Serializable{
private Integer id;
private Date modified;
private Integer uwid;
private String context;
private Integer display;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getModified() {
return modified == null ? null : (Date) modified.clone();
}
public void setModified(Date modified) {
this.modified = modified == null ? null : (Date) modified.clone();
}
public Integer getUwid() {
return uwid;
}
public void setUwid(Integer uwid) {
this.uwid = uwid;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context == null ? null : context.trim();
}
public Integer getDisplay() {
return display;
}
public void setDisplay(Integer display) {
this.display = display;
}
}

@ -0,0 +1,46 @@
package com.wsk.response;
import com.wsk.handle.GlobalExceptionHandler;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* @author wsk1103
* @date 2019/5/8
* @description
*/
@Data
public class BaseResponse {
private int result;
private String msg;
public BaseResponse(int result, String msg) {
this.result = result;
this.msg = msg;
}
public BaseResponse(int result) {
this.result = result;
}
public static BaseResponse fail() {
return new BaseResponse(0, GlobalExceptionHandler.DEFAULT_ERROR_MESSAGE);
}
public static BaseResponse fail(String msg) {
return new BaseResponse(0, msg);
}
public static BaseResponse fail(int result) {
return new BaseResponse(result);
}
public static BaseResponse success() {
return new BaseResponse(1, "success");
}
public static BaseResponse success(String msg) {
return new BaseResponse(1, msg);
}
}

@ -0,0 +1,24 @@
package com.wsk.service;
import com.wsk.pojo.AllKinds;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface AllKindsService {
int deleteByPrimaryKey(Integer id);
int insert(AllKinds record);
int insertSelective(AllKinds record);
AllKinds selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AllKinds record);
int updateByPrimaryKey(AllKinds record);
List<AllKinds> selectAll();
}

@ -0,0 +1,26 @@
package com.wsk.service;
import com.wsk.pojo.BoughtShop;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface BoughtShopService {
int deleteByPrimaryKey(Integer id);
int insert(BoughtShop record);
int insertSelective(BoughtShop record);
BoughtShop selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(BoughtShop record);
int updateByPrimaryKey(BoughtShop record);
int getCounts(int uid);
List<BoughtShop> selectByUid(int uid, int start);
}

@ -0,0 +1,24 @@
package com.wsk.service;
import com.wsk.pojo.Classification;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface ClassificationService {
int deleteByPrimaryKey(Integer id);
int insert(Classification record);
int insertSelective(Classification record);
Classification selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Classification record);
int updateByPrimaryKey(Classification record);
List<Classification> selectByAid(int aid);
}

@ -0,0 +1,24 @@
package com.wsk.service;
import com.wsk.pojo.GoodsCar;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface GoodsCarService {
int deleteByPrimaryKey(Integer id);
int insert(GoodsCar record);
int insertSelective(GoodsCar record);
GoodsCar selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(GoodsCar record);
int updateByPrimaryKey(GoodsCar record);
List<GoodsCar> selectByUid(int uid);
}

@ -0,0 +1,24 @@
package com.wsk.service;
import com.wsk.pojo.GoodsOfOrderForm;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface GoodsOfOrderFormService {
int deleteByPrimaryKey(Integer id);
int insert(GoodsOfOrderForm record);
int insertSelective(GoodsOfOrderForm record);
GoodsOfOrderForm selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(GoodsOfOrderForm record);
int updateByPrimaryKey(GoodsOfOrderForm record);
List<GoodsOfOrderForm> selectByOFid(int ofid);
}

@ -0,0 +1,52 @@
package com.wsk.service.Impl;
import com.wsk.dao.AllKindsMapper;
import com.wsk.pojo.AllKinds;
import com.wsk.service.AllKindsService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class AllKindsServiceImpl implements AllKindsService {
@Resource
private AllKindsMapper allKindsMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(AllKinds record) {
return allKindsMapper.insert(record);
}
@Override
public int insertSelective(AllKinds record) {
return allKindsMapper.insertSelective(record);
}
@Override
public AllKinds selectByPrimaryKey(Integer id) {
return allKindsMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(AllKinds record) {
return allKindsMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(AllKinds record) {
return allKindsMapper.updateByPrimaryKey(record);
}
@Override
public List<AllKinds> selectAll() {
return allKindsMapper.selectAll();
}
}

@ -0,0 +1,58 @@
package com.wsk.service.Impl;
import com.wsk.dao.BoughtShopMapper;
import com.wsk.pojo.BoughtShop;
import com.wsk.service.BoughtShopService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class BoughtShopServiceImpl implements BoughtShopService {
@Resource
private BoughtShopMapper boughtShopMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(BoughtShop record) {
return boughtShopMapper.insert(record);
}
@Override
public int insertSelective(BoughtShop record) {
return boughtShopMapper.insertSelective(record);
}
@Override
public BoughtShop selectByPrimaryKey(Integer id) {
return boughtShopMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(BoughtShop record) {
return boughtShopMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(BoughtShop record) {
return boughtShopMapper.updateByPrimaryKey(record);
}
@Override
public int getCounts(int uid) {
return boughtShopMapper.getCounts(uid);
}
@Override
public List<BoughtShop> selectByUid(int uid, int start) {
return boughtShopMapper.selectByUid(uid, start);
}
}

@ -0,0 +1,53 @@
package com.wsk.service.Impl;
import com.wsk.dao.ClassificationMapper;
import com.wsk.pojo.Classification;
import com.wsk.service.ClassificationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class ClassificationServiceImpl implements ClassificationService {
@Resource
private ClassificationMapper classificationMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(Classification record) {
return classificationMapper.insert(record);
}
@Override
public int insertSelective(Classification record) {
return classificationMapper.insertSelective(record);
}
@Override
public Classification selectByPrimaryKey(Integer id) {
return classificationMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(Classification record) {
return classificationMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(Classification record) {
return classificationMapper.updateByPrimaryKey(record);
}
@Override
public List<Classification> selectByAid(int aid) {
return classificationMapper.selectByAid(aid);
}
}

@ -0,0 +1,52 @@
package com.wsk.service.Impl;
import com.wsk.dao.GoodsCarMapper;
import com.wsk.pojo.GoodsCar;
import com.wsk.service.GoodsCarService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class GoodsCarServiceImpl implements GoodsCarService {
@Resource
private GoodsCarMapper goodsCarMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(GoodsCar record) {
return goodsCarMapper.insert(record);
}
@Override
public int insertSelective(GoodsCar record) {
return goodsCarMapper.insertSelective(record);
}
@Override
public GoodsCar selectByPrimaryKey(Integer id) {
return goodsCarMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(GoodsCar record) {
return goodsCarMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(GoodsCar record) {
return goodsCarMapper.updateByPrimaryKey(record);
}
@Override
public List<GoodsCar> selectByUid(int scid) {
return goodsCarMapper.selectByUid(scid);
}
}

@ -0,0 +1,53 @@
package com.wsk.service.Impl;
import com.wsk.dao.GoodsOfOrderFormMapper;
import com.wsk.pojo.GoodsOfOrderForm;
import com.wsk.service.GoodsOfOrderFormService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class GoodsOfOrderFormServiceImpl implements GoodsOfOrderFormService {
@Resource
private GoodsOfOrderFormMapper goodsOfOrderFormMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(GoodsOfOrderForm record) {
return goodsOfOrderFormMapper.insert(record);
}
@Override
public int insertSelective(GoodsOfOrderForm record) {
return goodsOfOrderFormMapper.insertSelective(record);
}
@Override
public GoodsOfOrderForm selectByPrimaryKey(Integer id) {
return goodsOfOrderFormMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(GoodsOfOrderForm record) {
return goodsOfOrderFormMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(GoodsOfOrderForm record) {
return goodsOfOrderFormMapper.updateByPrimaryKey(record);
}
@Override
public List<GoodsOfOrderForm> selectByOFid(int ofid) {
return goodsOfOrderFormMapper.selectByOFid(ofid);
}
}

@ -0,0 +1,57 @@
package com.wsk.service.Impl;
import com.wsk.dao.OrderFormMapper;
import com.wsk.pojo.OrderForm;
import com.wsk.service.OrderFormService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class OrderFormServiceImpl implements OrderFormService {
@Resource
private OrderFormMapper orderFormMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(OrderForm record) {
return orderFormMapper.insert(record);
}
@Override
public int insertSelective(OrderForm record) {
return orderFormMapper.insertSelective(record);
}
@Override
public OrderForm selectByPrimaryKey(Integer id) {
return orderFormMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(OrderForm record) {
return orderFormMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(OrderForm record) {
return orderFormMapper.updateByPrimaryKey(record);
}
@Override
public int getCounts(int uid) {
return orderFormMapper.getCounts(uid);
}
@Override
public List<OrderForm> selectByUid(int uid, int start) {
return orderFormMapper.selectByUid(uid, start);
}
}

@ -0,0 +1,62 @@
package com.wsk.service.Impl;
import com.wsk.dao.ShopCarMapper;
import com.wsk.pojo.ShopCar;
import com.wsk.service.ShopCarService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class ShopCarServiceImpl implements ShopCarService {
@Resource
private ShopCarMapper shopCarMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(ShopCar record) {
return shopCarMapper.insert(record);
}
@Override
public int insertSelective(ShopCar record) {
return shopCarMapper.insertSelective(record);
}
@Override
public ShopCar selectByPrimaryKey(Integer id) {
return shopCarMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(ShopCar record) {
return shopCarMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(ShopCar record) {
return shopCarMapper.updateByPrimaryKey(record);
}
@Override
public int getCounts(int uid) {
return shopCarMapper.getCounts(uid);
}
// @Override
// public List<ShopCar> selectByUid(int uid, int start) {
// return shopCarMapper.selectByUid(uid, start);
// }
@Override
public ShopCar selectByUid(int uid) {
return shopCarMapper.selectByUid(uid);
}
}

@ -0,0 +1,62 @@
package com.wsk.service.Impl;
import com.wsk.dao.ShopContextMapper;
import com.wsk.pojo.ShopContext;
import com.wsk.service.ShopContextService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class ShopContextServiceImpl implements ShopContextService {
@Resource
private ShopContextMapper shopContextMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(ShopContext record) {
return shopContextMapper.insert(record);
}
@Override
public int insertSelective(ShopContext record) {
return shopContextMapper.insertSelective(record);
}
@Override
public ShopContext selectByPrimaryKey(Integer id) {
return shopContextMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(ShopContext record) {
return shopContextMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(ShopContext record) {
return shopContextMapper.updateByPrimaryKey(record);
}
@Override
public int getCounts(int sid) {
return shopContextMapper.getCounts(sid);
}
@Override
public List<ShopContext> findById(int sid, int start) {
return shopContextMapper.findById(sid,start);
}
@Override
public List<ShopContext> selectById(int id) {
return shopContextMapper.selectBySid(id);
}
}

@ -0,0 +1,89 @@
package com.wsk.service.Impl;
import com.wsk.dao.ShopInformationMapper;
import com.wsk.pojo.ShopInformation;
import com.wsk.service.ShopInformationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* Created by wsk1103 on 2017/5/12.
*/
@Service
public class ShopInformationServiceImpl implements ShopInformationService{
@Resource
private ShopInformationMapper shopInformationMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(ShopInformation record) {
return shopInformationMapper.insert(record);
}
@Override
public int insertSelective(ShopInformation record) {
return shopInformationMapper.insertSelective(record);
}
@Override
public ShopInformation selectByPrimaryKey(Integer id) {
return shopInformationMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(ShopInformation record) {
return shopInformationMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(ShopInformation record) {
return shopInformationMapper.updateByPrimaryKey(record);
}
@Override
public List<ShopInformation> selectTen(Map map) {
return shopInformationMapper.selectTen(map);
}
@Override
public List<ShopInformation> selectOffShelf(int uid, int start) {
return shopInformationMapper.selectOffShelf(uid,start);
}
@Override
public int getCountsOffShelf(int uid) {
return shopInformationMapper.getCountsOffShelf(uid);
}
@Override
public int getCounts() {
return shopInformationMapper.getCounts();
}
@Override
public int selectIdByImage(String image) {
return shopInformationMapper.selectIdByImage(image);
}
@Override
public List<ShopInformation> selectByName(String name){
return shopInformationMapper.selectByName(name);
}
@Override
public List<ShopInformation> selectBySort(int sort) {
return shopInformationMapper.selectBySort(sort);
}
@Override
public List<ShopInformation> selectUserReleaseByUid(int uid) {
return shopInformationMapper.selectUserReleaseByUid(uid);
}
}

@ -0,0 +1,57 @@
package com.wsk.service.Impl;
import com.wsk.dao.ShopPictureMapper;
import com.wsk.pojo.ShopPicture;
import com.wsk.service.ShopPictureService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/12.
*/
@Service
public class ShopPictureServiceImpl implements ShopPictureService {
@Resource
private ShopPictureMapper shopPictureMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(ShopPicture record) {
return shopPictureMapper.insert(record);
}
@Override
public int insertSelective(ShopPicture record) {
return shopPictureMapper.insertSelective(record);
}
@Override
public ShopPicture selectByPrimaryKey(Integer id) {
return shopPictureMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(ShopPicture record) {
return shopPictureMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(ShopPicture record) {
return shopPictureMapper.updateByPrimaryKey(record);
}
@Override
public ShopPicture selectBySidOnlyOne(Integer sid) {
return shopPictureMapper.selectBySidOnlyOne(sid);
}
@Override
public List<ShopPicture> selectBySid(Integer sid) {
return null;
}
}

@ -0,0 +1,53 @@
package com.wsk.service.Impl;
import com.wsk.dao.SpecificMapper;
import com.wsk.pojo.Specific;
import com.wsk.service.SpecificeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class SpecificeServiceImpl implements SpecificeService {
@Resource
private SpecificMapper specificMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(Specific record) {
return specificMapper.insert(record);
}
@Override
public int insertSelective(Specific record) {
return specificMapper.insertSelective(record);
}
@Override
public Specific selectByPrimaryKey(Integer id) {
return specificMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(Specific record) {
return specificMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(Specific record) {
return specificMapper.updateByPrimaryKey(record);
}
@Override
public List<Specific> selectByCid(int cid) {
return specificMapper.selectByCid(cid);
}
}

@ -0,0 +1,58 @@
package com.wsk.service.Impl;
import com.wsk.dao.UserCollectionMapper;
import com.wsk.pojo.UserCollection;
import com.wsk.service.UserCollectionService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class UserCollectionServiceImpl implements UserCollectionService {
@Resource
private UserCollectionMapper userCollectionMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(UserCollection record) {
return userCollectionMapper.insert(record);
}
@Override
public int insertSelective(UserCollection record) {
return userCollectionMapper.insertSelective(record);
}
@Override
public UserCollection selectByPrimaryKey(Integer id) {
return userCollectionMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(UserCollection record) {
return userCollectionMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(UserCollection record) {
return userCollectionMapper.updateByPrimaryKey(record);
}
@Override
public int getCounts(int uid) {
return userCollectionMapper.getCounts(uid);
}
@Override
public List<UserCollection> selectByUid(int uid, int start) {
return userCollectionMapper.selectByUid(uid, start);
}
}

@ -0,0 +1,62 @@
package com.wsk.service.Impl;
import com.wsk.dao.UserInformationMapper;
import com.wsk.pojo.UserInformation;
import com.wsk.service.UserInformationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/4/26.
*/
@Service("userInformationService")
public class UserInformationServiceImpl implements UserInformationService {
@Resource
private UserInformationMapper userInformationMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(UserInformation record) {
return this.userInformationMapper.insert(record);
}
@Override
public int insertSelective(UserInformation record) {
return this.userInformationMapper.insertSelective(record);
}
@Override
public UserInformation selectByPrimaryKey(Integer id) {
return this.userInformationMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(UserInformation record) {
return this.userInformationMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(UserInformation record) {
return this.userInformationMapper.updateByPrimaryKey(record);
}
@Override
public int selectIdByPhone(String phone) {
try {
return this.userInformationMapper.selectIdByPhone(phone);
} catch (Exception e) {
return 0;
}
}
@Override
public List<UserInformation> getAllForeach(List<Integer> list) {
return this.userInformationMapper.getAllForeach(list);
}
}

@ -0,0 +1,53 @@
package com.wsk.service.Impl;
import com.wsk.dao.UserPasswordMapper;
import com.wsk.pojo.UserPassword;
import com.wsk.service.UserPasswordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Created by wsk1103 on 2017/4/27.
*/
@Service("userPasswordService")
public class UserPasswordServiceImpl implements UserPasswordService{
@Resource
private
UserPasswordMapper userPasswordMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(UserPassword record) {
return userPasswordMapper.insert(record);
}
@Override
public int insertSelective(UserPassword record) {
return userPasswordMapper.insertSelective(record);
}
@Override
public UserPassword selectByPrimaryKey(Integer id) {
return userPasswordMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(UserPassword record) {
return userPasswordMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(UserPassword record) {
return userPasswordMapper.updateByPrimaryKey(record);
}
@Override
public UserPassword selectByUid(Integer uid) {
return this.userPasswordMapper.selectByUid(uid);
}
}

@ -0,0 +1,63 @@
package com.wsk.service.Impl;
import com.wsk.dao.UserReleaseMapper;
import com.wsk.pojo.UserRelease;
import com.wsk.service.UserReleaseService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class UserReleaseServiceImpl implements UserReleaseService {
@Resource
private UserReleaseMapper userReleaseMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(UserRelease record) {
return userReleaseMapper.insert(record);
}
@Override
public int insertSelective(UserRelease record) {
return userReleaseMapper.insertSelective(record);
}
@Override
public UserRelease selectByPrimaryKey(Integer id) {
return userReleaseMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(UserRelease record) {
return userReleaseMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(UserRelease record) {
return userReleaseMapper.updateByPrimaryKey(record);
}
@Override
public int getCounts(int uid) {
return userReleaseMapper.getCounts(uid);
}
@Override
public List<UserRelease> selectByUid(int uid, int start) {
return userReleaseMapper.selectByUid(uid, start);
}
@Override
public List<UserRelease> selectUserProductByUid(int uid) {
return userReleaseMapper.selectUserProductByUid(uid);
}
}

@ -0,0 +1,52 @@
package com.wsk.service.Impl;
import com.wsk.dao.UserStateMapper;
import com.wsk.pojo.UserState;
import com.wsk.service.UserStateService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class UserStateServiceImpl implements UserStateService {
@Resource
private UserStateMapper userStateMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(UserState record) {
return userStateMapper.insert(record);
}
@Override
public int insertSelective(UserState record) {
return userStateMapper.insertSelective(record);
}
@Override
public UserState selectByPrimaryKey(Integer id) {
return userStateMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(UserState record) {
return userStateMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(UserState record) {
return userStateMapper.updateByPrimaryKey(record);
}
@Override
public UserState selectByUid(int uid) {
return userStateMapper.selectByUid(uid);
}
}

@ -0,0 +1,68 @@
package com.wsk.service.Impl;
import com.wsk.dao.UserWantMapper;
import com.wsk.pojo.UserWant;
import com.wsk.service.UserWantService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class UserWantServiceImpl implements UserWantService {
@Resource
private UserWantMapper userWantMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(UserWant record) {
return userWantMapper.insert(record);
}
@Override
public int insertSelective(UserWant record) {
return userWantMapper.insertSelective(record);
}
@Override
public UserWant selectByPrimaryKey(Integer id) {
return userWantMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(UserWant record) {
return userWantMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(UserWant record) {
return userWantMapper.updateByPrimaryKey(record);
}
@Override
public int getCounts(int uid) {
return userWantMapper.getCounts(uid);
}
@Override
public List<UserWant> selectByUid(int uid, int start) {
return userWantMapper.selectByUid(uid, start);
}
@Override
public List<UserWant> selectMineByUid(int id) {
return userWantMapper.selectMineByUid(id);
}
@Override
public List<UserWant> selectAll() {
return userWantMapper.selectAll();
}
}

@ -0,0 +1,58 @@
package com.wsk.service.Impl;
import com.wsk.dao.WantContextMapper;
import com.wsk.pojo.WantContext;
import com.wsk.service.WantContextService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
@Service
public class WantContextServiceImpl implements WantContextService {
@Resource
private WantContextMapper wantContextMapper;
@Override
public int deleteByPrimaryKey(Integer id) {
return 0;
}
@Override
public int insert(WantContext record) {
return wantContextMapper.insert(record);
}
@Override
public int insertSelective(WantContext record) {
return wantContextMapper.insertSelective(record);
}
@Override
public WantContext selectByPrimaryKey(Integer id) {
return wantContextMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(WantContext record) {
return wantContextMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(WantContext record) {
return wantContextMapper.updateByPrimaryKey(record);
}
@Override
public List<WantContext> selectByUWid(int uwid, int start) {
return wantContextMapper.selectByUWid(uwid, start);
}
@Override
public int getCounts(int uwid) {
return wantContextMapper.getCounts(uwid);
}
}

@ -0,0 +1,26 @@
package com.wsk.service;
import com.wsk.pojo.OrderForm;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface OrderFormService {
int deleteByPrimaryKey(Integer id);
int insert(OrderForm record);
int insertSelective(OrderForm record);
OrderForm selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(OrderForm record);
int updateByPrimaryKey(OrderForm record);
int getCounts(int uid);
List<OrderForm> selectByUid(int uid, int start);
}

@ -0,0 +1,26 @@
package com.wsk.service;
import com.wsk.pojo.ShopCar;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface ShopCarService {
int deleteByPrimaryKey(Integer id);
int insert(ShopCar record);
int insertSelective(ShopCar record);
ShopCar selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ShopCar record);
int updateByPrimaryKey(ShopCar record);
int getCounts(int uid);
// List<ShopCar> selectByUid(int uid, int start);
ShopCar selectByUid(int uid);
}

@ -0,0 +1,28 @@
package com.wsk.service;
import com.wsk.pojo.ShopContext;
import java.util.List;
/**
* Created by wsk1103 on 2017/5/13.
*/
public interface ShopContextService {
int deleteByPrimaryKey(Integer id);
int insert(ShopContext record);
int insertSelective(ShopContext record);
ShopContext selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ShopContext record);
int updateByPrimaryKey(ShopContext record);
int getCounts(int sid);
List<ShopContext> findById(int sid, int start);
List<ShopContext> selectById(int id);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save