diff --git a/pom.xml b/back-end_code/pom.xml
similarity index 98%
rename from pom.xml
rename to back-end_code/pom.xml
index 2d585063df0e6e1690145003c687e98d98c6e578..f3b00057dcf44dc123c99e4184fb0d6b768c343a 100644
--- a/pom.xml
+++ b/back-end_code/pom.xml
@@ -10,7 +10,7 @@
com.shop
service
- 0.0.1-SNAPSHOT
+ 1.0.1-SNAPSHOT
com.shop.service
购物网站后台
diff --git a/back-end_code/src/main/java/com/shop/controller/ClassController.java b/back-end_code/src/main/java/com/shop/controller/CategoryController.java
similarity index 31%
rename from back-end_code/src/main/java/com/shop/controller/ClassController.java
rename to back-end_code/src/main/java/com/shop/controller/CategoryController.java
index acfe5fe973af6311060fe57d9dd6c4deadc1b6b0..dd834fb5ad1a6b673d26c5f84b74f2bee7a66cc1 100644
--- a/back-end_code/src/main/java/com/shop/controller/ClassController.java
+++ b/back-end_code/src/main/java/com/shop/controller/CategoryController.java
@@ -1,11 +1,10 @@
package com.shop.controller;
-import com.shop.entity.Class;
-import com.shop.service.ClassService;
+import com.shop.entity.Category;
+import com.shop.service.CategoryService;
import net.minidev.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -13,23 +12,43 @@ import java.util.List;
@RestController
-@RequestMapping("/class")
-public class ClassController {
-
- private String message = "error";
+@RequestMapping("/category")
+public class CategoryController {
@Autowired
- private ClassService ClassService;
+ private CategoryService CategoryService;
//添加类别
- @RequestMapping(value = "/addClass")
- public Object addClass(HttpServletRequest request, HttpServletResponse response){
- String class_name = request.getParameter("class_name");
- int parentClass_id = Integer.parseInt(request.getParameter("parentClass_id"));
+ @PostMapping(value = "/addCategory")
+ public Object addCategory(@RequestBody Category category){
+ String message = "error";
+ String category_name = category.getCategory_name();
+ JSONObject jsonObject = new JSONObject();
+ Category categoryExist = CategoryService.searchCategoryByName(category_name);
+ if(categoryExist!=null){
+ message="类别已存在";
+ }else {
+ int parentCategory_id = category.getParentCategory_id();
+ int result = CategoryService.addCategory(category_name,parentCategory_id);
+ if(result>=1){
+ message = "success";
+ } else{
+ message = "error";
+ }
+ }
+ jsonObject.put("message",message);
+ return jsonObject;
+ }
+
+ //查询父类别
+ @GetMapping(value = "/searchParentCategory")
+ public Object searchParentCategory(){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- int result = ClassService.addClass(class_name,parentClass_id);
- if(result>=1){
+ List categoryList = CategoryService.searchParentCategory();
+ if(categoryList != null){
message = "success";
+ jsonObject.put("categorys", categoryList);
} else{
message = "error";
}
@@ -37,30 +56,30 @@ public class ClassController {
return jsonObject;
}
- //查询父类别
- @RequestMapping(value = "/searchParentClass")
- public Object searchParentClass(HttpServletRequest request, HttpServletResponse response){
+ //查询所有类别
+ @GetMapping("/searchAllCategory")
+ public Object searchAllCategory(){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- List classList = ClassService.searchParentClass();
- if(classList != null){
+ List categoryList = CategoryService.searchAllCategory();
+ if(categoryList != null){
message = "success";
- jsonObject.put("classs",classList);
+ jsonObject.put("categories", categoryList);
} else{
message = "error";
}
jsonObject.put("message",message);
return jsonObject;
}
-
- //根据parentClass_id查询子类别
- @RequestMapping(value = "/searchChildClass")
- public Object searchChildClass(HttpServletRequest request, HttpServletResponse response){
- int parentClass_id = Integer.parseInt(request.getParameter("parentClass_id"));
+ //根据parentCategory_id查询子类别
+ @GetMapping(value = "/searchChildCategory")
+ public Object searchChildCategory(@RequestParam (defaultValue = "1") Integer parentCategory_id){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- List classList = ClassService.searchChildClass(parentClass_id);
- if(classList != null){
+ List categoryList = CategoryService.searchChildCategory(parentCategory_id);
+ if(categoryList != null){
message = "success";
- jsonObject.put("classs",classList);
+ jsonObject.put("categories", categoryList);
} else{
message = "error";
}
@@ -68,30 +87,36 @@ public class ClassController {
return jsonObject;
}
- //根据classId删除Class
- @RequestMapping(value = "/deleteClassByItemId")
- public Object deleteClassByItemId(HttpServletRequest request, HttpServletResponse response) {
- int class_id = Integer.parseInt(request.getParameter("class_id"));
+ //根据categoryId删除Category
+ @DeleteMapping(value = "/deleteCategoryByItemId")
+ public Object deleteCategoryByItemId(@RequestParam Integer category_id) {
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- int result = ClassService.deleteClassByItemId(class_id);
+ int result = CategoryService.deleteCategoryByItemId(category_id);
if (result >= 1){
message = "success";
+ }else {
+ message = "error";
}
jsonObject.put("message",message);
return jsonObject;
}
- //根据classId修改Class
- @RequestMapping(value = "/updateClass")
- public Object updateClass(HttpServletRequest request, HttpServletResponse response){
+ //根据categoryId修改Category
+ @PutMapping(value = "/updateCategory")
+ public Object updateCategory(@RequestBody Category category){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- int class_id = Integer.parseInt(request.getParameter("class_id"));
- String class_name = request.getParameter("class_name");
- int parentClass_id = Integer.parseInt(request.getParameter("parentClass_id"));
- Class Class = new Class(class_id,class_name,parentClass_id);
- int result = ClassService.updateClass(Class);
+ int category_id = category.getCategory_id();
+ String category_name = category.getCategory_name();
+ int parentCategory_id = category.getParentCategory_id();
+ Category Category = new Category(category_id,category_name,parentCategory_id);
+ System.out.println(Category);
+ int result = CategoryService.updateCategory(Category);
if (result >= 1){
message = "success";
+ }else {
+ message = "error";
}
jsonObject.put("message",message);
return jsonObject;
diff --git a/back-end_code/src/main/java/com/shop/controller/FileController.java b/back-end_code/src/main/java/com/shop/controller/FileController.java
new file mode 100644
index 0000000000000000000000000000000000000000..1ea4cfceab81a034401f50e1490ffa8352faf947
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/controller/FileController.java
@@ -0,0 +1,42 @@
+package com.shop.controller;
+
+import com.shop.utils.Result;
+import com.shop.utils.StringUtil;
+import net.minidev.json.JSONObject;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+
+@RestController
+@RequestMapping("/file")
+@PropertySource("classpath:application.yml")//读取application.yml文件
+public class FileController {
+
+ @Value("${filepath.bin}")
+ private String fileBinPath;
+
+ @RequestMapping("/uploadBin")
+ public Result uploadBin(@RequestParam MultipartFile file){
+
+ String filename=file.getOriginalFilename();
+ String newFilename = StringUtil.getRandomName(filename);
+ String fullPath = fileBinPath+newFilename;
+ File dest = new File(fullPath);
+ try {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("path",fullPath);
+ file.transferTo(dest);
+ return Result.ok(jsonObject);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return Result.fail();
+ }
+
+ }
+}
diff --git a/back-end_code/src/main/java/com/shop/controller/GOController.java b/back-end_code/src/main/java/com/shop/controller/GOController.java
index de5ba9f738ad97726837fafb0cd74695fa3bc446..ffb45d1755bb1dcfd59172bf4b6cf003dda87f5d 100644
--- a/back-end_code/src/main/java/com/shop/controller/GOController.java
+++ b/back-end_code/src/main/java/com/shop/controller/GOController.java
@@ -20,20 +20,19 @@ import javax.servlet.http.HttpServletResponse;
@RequestMapping("/go")
public class GOController {
- private String message = "error";
-
@Autowired
private GOService GOService;
@RequestMapping(value = "/addGO")
public Object addGO(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
int item_id = Integer.parseInt(request.getParameter("item_id"));
int order_id = Integer.parseInt(request.getParameter("order_id"));
JSONObject jsonObject = new JSONObject();
int result = GOService.addGO(item_id,order_id);
if(result>=1){
message = "success";
- } else{
+ }else {
message = "error";
}
jsonObject.put("message",message);
@@ -41,6 +40,7 @@ public class GOController {
}
@RequestMapping(value = "/searchGOByItemId")
public Object searchGOByItemId(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
int item_id = Integer.parseInt(request.getParameter("item_id"));
// int order_id = Integer.parseInt(request.getParameter("order_id"));
JSONObject jsonObject = new JSONObject();
@@ -48,7 +48,7 @@ public class GOController {
if(go != null){
message = "success";
jsonObject.put("GO",go);
- } else{
+ }else {
message = "error";
}
jsonObject.put("message",message);
@@ -57,6 +57,7 @@ public class GOController {
//@RequestMapping(value = "/searchGOByItemId")
public Object searchGOByOrderId(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
// int item_id = Integer.parseInt(request.getParameter("item_id"));
int order_id = Integer.parseInt(request.getParameter("order_id"));
JSONObject jsonObject = new JSONObject();
@@ -64,7 +65,7 @@ public class GOController {
if(go != null){
message = "success";
jsonObject.put("GO",go);
- } else{
+ }else {
message = "error";
}
jsonObject.put("message",message);
diff --git a/back-end_code/src/main/java/com/shop/controller/GoodsController.java b/back-end_code/src/main/java/com/shop/controller/GoodsController.java
index 04da69870f75f4c7650293187cca739ea0d51340..3c72a8cacc79b1410ac8f20df0fba66f657ff825 100644
--- a/back-end_code/src/main/java/com/shop/controller/GoodsController.java
+++ b/back-end_code/src/main/java/com/shop/controller/GoodsController.java
@@ -5,12 +5,11 @@ import com.shop.service.GOService;
import com.shop.service.GoodsService;
import com.shop.service.OrderService;
import com.shop.service.UploadImageService;
+import com.shop.utils.Result;
import com.shop.utils.StringUtil;
import net.minidev.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@@ -20,12 +19,12 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
@RestController
@RequestMapping("/goods")
public class GoodsController {
- private String message = "error";
@Autowired
private GoodsService goodsService;
@@ -40,30 +39,30 @@ public class GoodsController {
UploadImageService uploadImageService;
//向Goods表中添加商品
- @RequestMapping(value = "/addGoods")
- public Object addGoods(HttpServletRequest request, HttpServletResponse response) {
- String goods_name = request.getParameter("goods_name");
+ @PostMapping(value = "/addGoods")
+ public Object addGoods(@RequestBody Goods goods) {
+ String message = "error";
+ String goods_name = goods.getGoods_name();
String seller_username = "admin";
- int goods_stock = Integer.parseInt(request.getParameter("goods_stock"));
+ int goods_stock =goods.getGoods_stock();
// String goods_img = uploadImageService.uploadQNImg((FileInputStream) file.getInputStream(), StringUtil.getRandomImgName(file.getOriginalFilename()));
- String goods_img = request.getParameter("goods_img");
- String goods_discribe = request.getParameter("goods_discribe");
- float goods_price = Float.parseFloat(request.getParameter("goods_price"));
- int goods_class = Integer.parseInt(request.getParameter("goods_class"));
+ String goods_img = goods.getGoods_img();
+ String goods_discribe = goods.getGoods_discribe();
+ float goods_price = goods.getGoods_price();
+ int goods_category = goods.getGoods_category();
JSONObject jsonObject = new JSONObject();
if (goods_name.length() >= 2 && goods_name.length() <= 20 &&
goods_stock >= 0 &&
goods_img.length() <= 2000 &&
goods_discribe.length() >= 2 && goods_discribe.length() <= 2000 &&
goods_price >= 0 &&
- goods_class >= 0
+ goods_category >= 0
){
- Goods goods = new Goods(goods_name,seller_username,goods_stock,goods_img,goods_discribe,goods_class,goods_price);
- int result = goodsService.addGoods( goods);
+ Goods newGoods = new Goods(goods_name,seller_username,goods_stock,goods_img,goods_discribe,goods_category,goods_price);
+ int result = goodsService.addGoods( newGoods);
if (result >= 1) {
message = "success";
}else {
- System.out.println("aa");
message = "error";
}
}
@@ -72,12 +71,11 @@ public class GoodsController {
}
//买家在goods表中查询goods详细信息
- @RequestMapping(value = "/searchGoods")
- public Object searchGoods(HttpServletRequest request, HttpServletResponse response){
- int item_id = Integer.parseInt(request.getParameter("item_id"));
+ @GetMapping(value = "/searchGoods")
+ public Object searchGoods(@RequestParam int item_id){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
Goods good = goodsService.searchGoods(item_id);
- System.out.println(good.getGoods_price());
if (good != null){
message = "success";
jsonObject.put("good",good);
@@ -89,13 +87,12 @@ public class GoodsController {
}
//修改商品状态
- @RequestMapping(value = "/updateGoodsState")
- public Object updateGoodsState(HttpServletRequest request, HttpServletResponse response){
- String seller_username = request.getParameter("seller_username");
- int item_id = Integer.parseInt(request.getParameter("item_id"));
- int newstate = Integer.parseInt(request.getParameter("newstate"));
+ @PutMapping (value = "/updateGoodsState")
+ public Object updateGoodsState(@RequestBody Map json){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- int result = goodsService.updateGoodsState(seller_username,item_id, newstate);
+ int result = goodsService.updateGoodsState(json.get("seller_username"),Integer.parseInt(json.get("item_id")), Integer.parseInt(json.get("new_state")));
+
if (result >= 1) {
message = "success";
}else {
@@ -105,57 +102,62 @@ public class GoodsController {
return jsonObject;
}
- //在goods表中查找所有正在出售的商品。
- @RequestMapping(value = "/searchSellingGoods")
- public Object searchSellingGoods(HttpServletRequest request, HttpServletResponse response){
- JSONObject jsonObject = new JSONObject();
- List goods= goodsService.searchSellingGoods();
- message = "success";
- jsonObject.put("message",message);
- jsonObject.put("goods",goods);
- return jsonObject;
+ //在goods表中查找所有正在出售的商品
+ @GetMapping(value = "/searchSellingGoods")
+ public Object searchSellingGoods(){
+ try {
+ JSONObject jsonObject = new JSONObject();
+ List goods= goodsService.searchSellingGoods();
+ jsonObject.put("goods",goods);
+ return Result.ok(jsonObject);
+ }catch (Exception e){
+ return Result.fail();
+ }
}
- //在goods表中查找所有正在出售的商品。
- @RequestMapping(value = "/searchWelcomeGoods")
+ //在goods表中查找欢迎界面商品
+ @GetMapping(value = "/searchWelcomeGoods")
public Object searchWelcomeGoods(){
- JSONObject jsonObject = new JSONObject();
- List goods = goodsService.searchWelcomeGoods();
- List stringList = orderService.searchSellingGoodsBuyerRealname();
- message = "success";
- jsonObject.put("goods",goods);
- jsonObject.put("Strings",stringList);
- jsonObject.put("message",message);
- return jsonObject;
+ try{
+ JSONObject jsonObject = new JSONObject();
+ List goods = goodsService.searchWelcomeGoods();
+ List stringList = orderService.searchSellingGoodsBuyerRealname();
+ jsonObject.put("goods",goods);
+ jsonObject.put("Strings",stringList);
+ return Result.ok(jsonObject);
+ }catch (Exception e){
+ return Result.fail();
+ }
+
}
- //在goods表中查询所有商品
- @RequestMapping(value = "/searchHistoryGoods")
- public Object searchHistoryGoods(HttpServletRequest request, HttpServletResponse response){
- String seller_username = request.getParameter("seller_username");
+ //在goods表中查询历史商品
+ @GetMapping(value = "/searchHistoryGoods")
+ public Object searchHistoryGoods(@RequestParam String seller_username){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
List goodsList = goodsService.searchHistoryGoods(seller_username);
- List list = new ArrayList();
- for (int i=0;i < goodsList.size();i++){
- Goods good = (Goods) goodsList.get(i);
- GO go = goService.searchGOByItemId(good.getItem_id());
- Order order = orderService.searchOrderByOrderId(seller_username, go.getOrder_id());
- Order_Goods order_goods = new Order_Goods(
- order.getOrder_id(),
- order.getBuyer_realname(),
- order.getBuyer_phonenumber(),
- order.getBuyer_address(),
- order.getFinish_time(),
- good.getItem_id(),
- good.getGoods_name(),
- good.getGoods_price(),
- good.getGoods_img(),
- good.getGoods_discribe());
- list.add(order_goods);
- }
+// List list = new ArrayList();
+// for (int i=0;i < goodsList.size();i++){
+// Goods good = (Goods) goodsList.get(i);
+// GO go = goService.searchGOByItemId(good.getItem_id());
+// Order order = orderService.searchOrderByOrderId(seller_username, go.getOrder_id());
+// Order_Goods order_goods = new Order_Goods(
+// order.getOrder_id(),
+// order.getBuyer_realname(),
+// order.getBuyer_phonenumber(),
+// order.getBuyer_address(),
+// order.getFinish_time(),
+// good.getItem_id(),
+// good.getGoods_name(),
+// good.getGoods_price(),
+// good.getGoods_img(),
+// good.getGoods_discribe());
+// list.add(order_goods);
+// }
message = "success";
jsonObject.put("message",message);
- jsonObject.put("list",list);
+ jsonObject.put("goods",goodsList);
return jsonObject;
}
@@ -164,33 +166,53 @@ public class GoodsController {
public boolean isHaveSellingGoods(String username){return goodsService.isHaveSellingGoods(username);}
//修改商品信息
- @RequestMapping(value = "/updateGoods")
- public Object updateGoods(HttpServletRequest request, HttpServletResponse response){
- int item_id = Integer.parseInt(request.getParameter("item_id"));
- String goods_name = request.getParameter("goods_name");
+ @PostMapping(value = "/updateGoods")
+ public Object updateGoods(@RequestBody Goods goods){
+ String message = "error";
+// int item_id = Integer.parseInt(request.getParameter("item_id"));
+// String goods_name = request.getParameter("goods_name");
+// String seller_username = "admin";
+// int goods_stock = Integer.parseInt(request.getParameter("goods_stock"));
+// String goods_img = uploadImageService.uploadQNImg((FileInputStream) file.getInputStream(), StringUtil.getRandomImgName(file.getOriginalFilename()));
+// String goods_img = request.getParameter("goods_img");
+// String goods_discribe = request.getParameter("goods_discribe");
+// int goods_category = Integer.parseInt(request.getParameter("goods_category"));
+// float goods_price = Float.parseFloat(request.getParameter("goods_price"));
+// //
+ int item_id = goods.getItem_id();
+ String goods_name = goods.getGoods_name();
String seller_username = "admin";
- int goods_stock = Integer.parseInt(request.getParameter("goods_stock"));
+ int goods_stock =goods.getGoods_stock();
// String goods_img = uploadImageService.uploadQNImg((FileInputStream) file.getInputStream(), StringUtil.getRandomImgName(file.getOriginalFilename()));
- String goods_img = request.getParameter("goods_img");
- String goods_discribe = request.getParameter("goods_discribe");
- int goods_class = Integer.parseInt(request.getParameter("goods_class"));
- float goods_price = Float.parseFloat(request.getParameter("goods_price"));
+ String goods_img = goods.getGoods_img();
+ String goods_discribe = goods.getGoods_discribe();
+ float goods_price = goods.getGoods_price();
+ int goods_category = goods.getGoods_category();
+ //
JSONObject jsonObject = new JSONObject();
- Goods newgoods = new Goods(item_id,goods_name,seller_username,goods_stock,goods_img,goods_discribe,goods_class,goods_price);
- int result = goodsService.updateGoods(newgoods);
- if (result >= 1) {
- message = "success";
- }else {
- message = "error";
+ if (goods_name.length() >= 2 && goods_name.length() <= 20 &&
+ goods_stock >= 0 &&
+ goods_img.length() <= 2000 &&
+ goods_discribe.length() >= 2 && goods_discribe.length() <= 2000 &&
+ goods_price >= 0 &&
+ goods_category >= 0
+ ){
+ Goods newgoods = new Goods(item_id,goods_name,seller_username,goods_stock,goods_img,goods_discribe,goods_category,goods_price);
+ int result = goodsService.updateGoods(newgoods);
+ if (result >= 1) {
+ message = "success";
+ }else {
+ message = "error";
+ }
}
jsonObject.put("message",message);
return jsonObject;
}
//查看冻结商品
- @RequestMapping(value = "/searchFreezingGoods")
- public Object searchFreezingGoods(HttpServletRequest request, HttpServletResponse response){
- String seller_username = request.getParameter("seller_username");
+ @GetMapping(value = "/searchFreezingGoods")
+ public Object searchFreezingGoods(@RequestParam String seller_username){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
List goodsList = goodsService.searchFreezingGoods(seller_username);
List list = new ArrayList();
@@ -217,21 +239,22 @@ public class GoodsController {
}
//通过类别查询商品
- @RequestMapping(value = "/searchGoodsByClass")
- public Object searchGoodsByClass(HttpServletRequest request, HttpServletResponse response){
- int goods_class = Integer.getInteger(request.getParameter("goods_class"));
+ @GetMapping(value = "/searchGoodsByCategory")
+ public Object searchGoodsByCategory(@RequestParam Integer goods_category){
+ String message = "error";
+// System.out.println(goods_category);
JSONObject jsonObject = new JSONObject();
- List goodsList =goodsService.searchGoodsByClass(goods_class);
+ List goodsList =goodsService.searchGoodsByCategory(goods_category);
message = "success";
jsonObject.put("goods",goodsList);
jsonObject.put("message",message);
return jsonObject;
}
- //通过关键词查询商品
- @RequestMapping(value = "/searchGoodsByKeyName")
- public Object searchGoodsByKeyName(HttpServletRequest request, HttpServletResponse response){
- String key_name = request.getParameter("key_name");
+ //通过关键词查询上架商品
+ @GetMapping(value = "/searchGoodsByKeyName")
+ public Object searchGoodsByKeyName(@RequestParam String key_name){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
List goodsList =goodsService.searchGoodsByKeyName(key_name);
message = "success";
@@ -240,21 +263,38 @@ public class GoodsController {
return jsonObject;
}
+ //通过类别和关键词查询商品
+ @RequestMapping(value = "/searchGoodsByCategoryAndKeyName")
+ public Object searchGoodsByCategoryAndKeyName(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
+ int goods_category = Integer.parseInt(request.getParameter("goods_category"));
+ String key_name = request.getParameter("key_name");
+ JSONObject jsonObject = new JSONObject();
+ List goodsList = goodsService.searchGoodsByCategoryAndKeyName(goods_category,key_name);
+ message = "success";
+ jsonObject.put("goods",goodsList);
+ jsonObject.put("message",message);
+ return jsonObject;
+ }
+
//修改商品库存
@RequestMapping(value = "/updateGoodStock")
public Object updateGoodStock(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
int item_id = Integer.parseInt(request.getParameter("item_id"));
int new_stock = Integer.parseInt(request.getParameter("new_stock"));
Goods good = goodsService.searchGoods(item_id);
+ JSONObject jsonObject = new JSONObject();
+ System.out.println(message);
if (new_stock > 0 ){
goodsService.updateGoodsState(good.getSeller_username(),item_id,1);
- }else if (new_stock <= 0){
+ message = "success";
+ goodsService.updateGoodStock(item_id,new_stock);
+ }else if (new_stock == 0){
goodsService.updateGoodsState(good.getSeller_username(),item_id,3);
+ message = "success";
+ goodsService.updateGoodStock(item_id,new_stock);
}
- goodsService.updateGoodStock(item_id,new_stock);
- JSONObject jsonObject = new JSONObject();
- goodsService.updateGoodStock(item_id,new_stock);
- message = "success";
jsonObject.put("message",message);
return jsonObject;
}
diff --git a/back-end_code/src/main/java/com/shop/controller/OrderController.java b/back-end_code/src/main/java/com/shop/controller/OrderController.java
index 38740cdb1051d16ea5628cad5b5f959a9fcc567c..6c0d5bb439153d7df6a8cb14674b407947755010 100644
--- a/back-end_code/src/main/java/com/shop/controller/OrderController.java
+++ b/back-end_code/src/main/java/com/shop/controller/OrderController.java
@@ -10,8 +10,7 @@ import com.shop.service.OrderService;
import com.shop.service.UserService;
import net.minidev.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -20,13 +19,12 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
+import java.util.Map;
@RestController
@RequestMapping("/order")
public class OrderController {
- private String message = "error";
-
@Autowired
private UserService userService;
@@ -40,8 +38,9 @@ public class OrderController {
private GOService goService;
//查看商品意向购买买家
- @RequestMapping(value = "/searchBuyerlist")
- public Object searchBuyerlist(HttpServletRequest request, HttpServletResponse response){
+ @RequestMapping(value = "/searchWantBuyerlistByItemId")
+ public Object searchWantBuyerlistByItemId(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
String seller_username = request.getParameter("seller_username");
int item_id = Integer.parseInt(request.getParameter("item_id"));
JSONObject jsonObject = new JSONObject();
@@ -55,11 +54,12 @@ public class OrderController {
//查看商品意向购买买家名
@RequestMapping(value = "/searchSellingGoodsBuyerRealname")
public Object searchSellingGoodsBuyerRealname(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
int item_id = Integer.parseInt(request.getParameter("item_id"));
JSONObject jsonObject = new JSONObject();
List stringList = orderService.searchSellingGoodsBuyerRealname();
message = "success";
- jsonObject.put("stringList",stringList);
+ jsonObject.put("strings",stringList);
jsonObject.put("message",message);
return jsonObject;
}
@@ -67,6 +67,7 @@ public class OrderController {
//查看交易中的某商品对应的订单信息
@RequestMapping(value = "/searchFreezeGoodsBuyer")
public Object searchFreezeGoodsBuyer(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
String seller_username = request.getParameter("seller_username");
int item_id = Integer.parseInt(request.getParameter("item_id"));
JSONObject jsonObject = new JSONObject();
@@ -84,19 +85,21 @@ public class OrderController {
//查看已完成交易商品的历史意向买家
@RequestMapping(value = "/searchHistoryGoodsUnFinishedOrder")
public Object searchHistoryGoodsUnFinishedOrder(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
String seller_username = request.getParameter("seller_username");
int item_id = Integer.parseInt(request.getParameter("item_id"));
JSONObject jsonObject = new JSONObject();
List orderList = orderService.searchHistoryGoodsUnFinishedOrder(seller_username,item_id);
message = "success";
jsonObject.put("message",message);
- jsonObject.put("orderList",orderList);
+ jsonObject.put("orders",orderList);
return jsonObject;
}
//同意意向买家
@RequestMapping(value = "/agreeOrderwanted")
public Object agreeOrderwanted(HttpServletRequest request, HttpServletResponse response) {
+ String message = "error";
String seller_username = request.getParameter("seller_username");
int order_id = Integer.parseInt(request.getParameter("order_id"));
JSONObject jsonObject = new JSONObject();
@@ -118,11 +121,12 @@ public class OrderController {
//完成交易(下架)
@RequestMapping(value = "/finishOrder")
public Object finishOrder(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
String seller_username = request.getParameter("seller_username");
- int item_id = Integer.parseInt(request.getParameter("item_id"));
+ int order_id = Integer.parseInt(request.getParameter("order_id"));
JSONObject jsonObject = new JSONObject();
String finish_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
- int result = orderService.finishOrder(seller_username,item_id,finish_time);
+ int result = orderService.finishOrder(seller_username,order_id,finish_time);
if (result >=1){
message = "success";
}else {
@@ -135,11 +139,12 @@ public class OrderController {
//取消交易(恢复)
@RequestMapping(value = "/cancelOrder")
public Object cancelOrder(HttpServletRequest request, HttpServletResponse response){
+ String message = "error";
String seller_username = request.getParameter("seller_username");
- int item_id = Integer.parseInt(request.getParameter("item_id"));
+ int order_id = Integer.parseInt(request.getParameter("order_id"));
JSONObject jsonObject = new JSONObject();
- goService.deleteGOByItemId(item_id);
- int result = orderService.cancelOrder(seller_username,item_id);
+ goService.deleteGOByOrderId(order_id);
+ int result = orderService.cancelOrder(seller_username,order_id);
if (result >=1){
message = "success";
}else {
@@ -151,23 +156,36 @@ public class OrderController {
}
//意向购买者下单
- @RequestMapping(value = "/addToOrderWanted")
- public Object addToOrderWanted(HttpServletRequest request, HttpServletResponse response){
- int item_id = Integer.parseInt(request.getParameter("item_id"));
+ @PostMapping(value = "/addToOrderWanted")
+ public Object addToOrderWanted(@RequestBody Map request){
+ String message = "error";
+ int item_id = Integer.parseInt(request.get("item_id"));
Goods good = goodsService.searchGoods(item_id);
+ String goods_name = good.getGoods_name();
+ String goods_img = good.getGoods_img();
+ String goods_discribe = good.getGoods_discribe();
+ float goods_price = good.getGoods_price();
String seller_username = good.getSeller_username();
- String buyer_username = request.getParameter("buyer_username");
+ String buyer_username = request.get("buyer_username");
User user = userService.getUserInfo(buyer_username);
- String buyer_realname = request.getParameter("buyer_realname");
- String buyer_phonenumber = request.getParameter("buyer_phonenumber");
- String buyer_address = request.getParameter("buyer_address");
-// String buyer_realname = user.getRealname();
-// String buyer_phonenumber = user.getPhonenumber();
-// String buyer_address = user.getAddress();
- int buy_sum = Integer.getInteger(request.getParameter("buy_sum"));
+ String buyer_realname = request.get("buyer_realname");
+ String buyer_phonenumber = request.get("buyer_phonenumber");
+ String buyer_address = request.get("buyer_address");
+ if (buyer_realname == null){
+ buyer_realname = user.getRealname();
+ }
+ if (buyer_phonenumber == null){
+ buyer_phonenumber = user.getPhonenumber();
+ }
+ if (buyer_address == null){
+ buyer_address = user.getAddress();
+ }
+ int buy_sum = Integer.parseInt(request.get("buy_sum"));
+ float buy_amount;
+ buy_amount = buy_sum*good.getGoods_price();
String create_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
JSONObject jsonObject = new JSONObject();
- Order order = new Order(item_id,seller_username,buyer_username,buyer_realname,buyer_phonenumber,buyer_address,buy_sum,5,create_time);
+ Order order = new Order(item_id,goods_name,goods_img,goods_discribe,goods_price,seller_username,buyer_username,buyer_realname,buyer_phonenumber,buyer_address,buy_sum,buy_amount,5,create_time);
if (buyer_phonenumber.length() == 11 && buyer_address.length() >= 2 && buyer_address.length() <= 100 && good.getGoods_stock() >= buy_sum){
int result = orderService.addToOrderWanted(order);
if (result >=1){
@@ -175,16 +193,15 @@ public class OrderController {
}else {
message = "error";
}
-
}
jsonObject.put("message",message);
return jsonObject;
}
//根据用户名查看历史购买记录
- @RequestMapping("/searchFinishOrderByBuyerName")
- public Object searchFinishOrderByBuyerName(HttpServletRequest request, HttpServletResponse response){
- String buyer_username = request.getParameter("buyer_username");
+ @GetMapping("/searchFinishOrderByBuyerUserName")
+ public Object searchFinishOrderByBuyerName(@RequestParam String buyer_username){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
List orderList = orderService.searchFinishOrderByBuyerName(buyer_username);
message = "success";
@@ -192,6 +209,15 @@ public class OrderController {
jsonObject.put("message",message);
return jsonObject;
}
-
-
+ //根据卖家用户名查找所有订单
+ @GetMapping("/searchOrdersBySellerName")
+ public Object searchOrdersBySellerName(@RequestParam String seller_username){
+ String message = "error";
+ JSONObject jsonObject = new JSONObject();
+ List orderList = orderService.searchOrdersBySellerName(seller_username);
+ message = "success";
+ jsonObject.put("orders",orderList);
+ jsonObject.put("message",message);
+ return jsonObject;
+ }
}
diff --git a/back-end_code/src/main/java/com/shop/controller/ShowCategoryController.java b/back-end_code/src/main/java/com/shop/controller/ShowCategoryController.java
new file mode 100644
index 0000000000000000000000000000000000000000..b260bd9e805c4f837432993da4e501634386a2d5
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/controller/ShowCategoryController.java
@@ -0,0 +1,52 @@
+package com.shop.controller;
+
+import com.shop.entity.Category;
+import com.shop.entity.ShowCategory;
+import com.shop.service.ShowCategoryService;
+import net.minidev.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+
+@RestController
+@RequestMapping("/showcategory")
+public class ShowCategoryController {
+
+ @Autowired
+ private ShowCategoryService ShowCategoryService;
+
+ //查询ShowCategory
+ @GetMapping(value = "/searchCategory")
+ public Object searchShowCategory(){
+ String message = "error";
+ JSONObject jsonObject = new JSONObject();
+ List ShowCategoryList = ShowCategoryService.searchShowCategory();
+ if(ShowCategoryList != null){
+ message = "success";
+ jsonObject.put("showcategorys", ShowCategoryList);
+ } else{
+ message = "error";
+ }
+ jsonObject.put("message",message);
+ return jsonObject;
+ }
+
+ //修改ShowCategory
+ @PutMapping(value = "/updateShowCategory")
+ public Object updateShowCategory(@RequestBody List Categorys){
+ String message = "error";
+ JSONObject jsonObject = new JSONObject();
+ System.out.println(Categorys);
+ int result = ShowCategoryService.updateShowCategory(Categorys);
+ if (result >= 1){
+ message = "success";
+ }else {
+ message = "error";
+ }
+ jsonObject.put("message",message);
+ return jsonObject;
+ }
+
+}
diff --git a/back-end_code/src/main/java/com/shop/controller/UserController.java b/back-end_code/src/main/java/com/shop/controller/UserController.java
index 2a240a87c19732757e8689d40a39080095aad061..1b6258c4300cb99000ac57a0de7421894596ddb1 100644
--- a/back-end_code/src/main/java/com/shop/controller/UserController.java
+++ b/back-end_code/src/main/java/com/shop/controller/UserController.java
@@ -26,18 +26,17 @@ import java.util.Map;
@CrossOrigin
public class UserController {
- private String message = "error";
-
@Autowired
private UserService userService;
@Autowired
private TokenService tokenService;
//登录验证账号密码
- @RequestMapping(value = "/login")
- public Object loginByPassword(HttpServletRequest request, HttpServletResponse response){
- String username = request.getParameter("username");
- String password = request.getParameter("password");
+ @PostMapping(value = "/login")
+ public Object loginByPassword(@RequestBody User tryingUser){
+ String message = "error";
+ String username =tryingUser.getUserName();
+ String password = tryingUser.getPassword();
JSONObject jsonObject = new JSONObject();
if(username.length()<=10&&username.length()>=3&&password.length()>=7&&password.length()<=15){
User user = userService.login(username,password);
@@ -56,26 +55,30 @@ public class UserController {
}
//获取用户信息
- @RequestMapping(value = "/getUserInfo")
- public Object getUserInfo(HttpServletRequest request, HttpServletResponse response){
- String username = request.getParameter("username");
+ @GetMapping(value = "/getUserInfo")
+ public Object getUserInfo(@RequestParam (defaultValue = "1") String username){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
User user = userService.getUserInfo(username);
- jsonObject.put("user",user);
+ if (user != null){
+ message = "success";
+ jsonObject.put("user",user);
+ }else{
+ message = "error";
+ }
+ jsonObject.put("message",message);
return jsonObject;
}
//修改密码
- @RequestMapping(value = "/updatePassword")
- public Object updatePasswordByUsername(HttpServletRequest request, HttpServletResponse response){
- String username = request.getParameter("username");
- String oldPassword = request.getParameter("oldPassword");
- String newPassword = request.getParameter("newPassword");
+ @PutMapping(value = "/updatePassword")
+ public Object updatePasswordByUsername(@RequestBody Map json){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- User user = userService.login(username,oldPassword);
+ User user = userService.login(json.get("userName"),json.get("oldPassword"));
int result = 0;
if(user!=null){
- result = userService.updatePassword(username,newPassword);
+ result = userService.updatePassword(json.get("userName"),json.get("newPassword"));
}
if(result>=1){
message = "success";
@@ -90,6 +93,7 @@ public class UserController {
@UserLoginToken
@RequestMapping("/getMessage")
public Object getMessage(){
+ String message = "error";
message = "success";
JSONObject jsonObject = new JSONObject();
jsonObject.put("message",message);
@@ -97,35 +101,63 @@ public class UserController {
}
//用户注册
- @RequestMapping(value = "/registerUser")
- public Object registerUser(HttpServletRequest request, HttpServletResponse response){
- String username = request.getParameter("username");
- String password = request.getParameter("password");
- String nickname = request.getParameter("nickname");
+ @PostMapping(value = "/registerUser")
+ public Object registerUser(@RequestBody User user){
+ String message = "error";
+ String info="注册成功";
+ String username = user.getUserName();
+ String password = user.getPassword();
+ String nickname = user.getNickName();
int permission = 1;
- String phonenumber = request.getParameter("phonenumber");
- String address = request.getParameter("address");
- String realname = request.getParameter("realname");
- String user_head = request.getParameter("user_head");
+ String phonenumber = user.getPhonenumber();
+ String address = user.getAddress();
+ String realname = user.getRealname();
+ String user_head = user.getUserHead();
+ if (user_head == null){
+ user_head = "http://cdn.souldays.top/image/2021-12-06-eb3ac6b8edac4612806b08f967b88963.jpg";
+ }
JSONObject jsonObject = new JSONObject();
- User User = new User(username,password,nickname,permission,phonenumber,address,realname,user_head);
- int result = userService.registerUser(User);
+ User newUser = new User(username,password,nickname,permission,phonenumber,address,realname,user_head);
+ int result = userService.registerUser(newUser);
if (result >= 1){
message = "success";
+ }else if (result==-1){
+ info = "用户名长度错误";
+ }else if (result==-2){
+ info = "用户名重复";
+ }
+ else if (result==-3){
+ info = "用户名包含非数字或字母";
+ }
+ else if (result==-4){
+ info = "密码长度错误";
+ }
+ else if (result==-5){
+ info = "真实姓名长度过长";
+ }
+ else if (result==-6){
+ info = "电话号码格式不对";
+ }
+ else if (result==-7){
+ info = "地址过长";
+ }
+ if (info != null){
+ jsonObject.put("info",info);
}
jsonObject.put("message",message);
return jsonObject;
}
//用户修改个人信息
- @RequestMapping(value = "/updateUser")
- public Object updateUser(HttpServletRequest request, HttpServletResponse response){
- String username = request.getParameter("username");
- String nickname = request.getParameter("nickname");
- String realname = request.getParameter("realname");
- String phonenumber = request.getParameter("phonenumber");
- String address = request.getParameter("address");
- String user_head = request.getParameter("user_head");
+ @PutMapping(value = "/updateUser")
+ public Object updateUser(@RequestBody User user){
+ String message = "error";
+ String username = user.getUserName();
+ String nickname = user.getNickName();
+ String realname = user.getRealname();
+ String phonenumber = user.getPhonenumber();
+ String address = user.getAddress();
+ String user_head = user.getUserHead();
JSONObject jsonObject = new JSONObject();
User newUser = new User(username,nickname,phonenumber,address,realname,user_head);
int result = userService.updateUser(newUser);
@@ -137,10 +169,11 @@ public class UserController {
}
//卖家查看买家信息
- @RequestMapping(value = "/searchAllUser")
- public Object searchAllUser(HttpServletRequest request, HttpServletResponse response){
+ @GetMapping(value = "/searchAllBuyer")
+ public Object searchAllBuyer(){
+ String message = "error";
JSONObject jsonObject = new JSONObject();
- List UserList = userService.searchAllUser();
+ List UserList = userService.searchAllBuyer();
message = "success";
jsonObject.put("users",UserList);
// jsonObject.put("User",userService.searchAllUser());
diff --git a/back-end_code/src/main/java/com/shop/entity/Category.java b/back-end_code/src/main/java/com/shop/entity/Category.java
new file mode 100644
index 0000000000000000000000000000000000000000..d6002b7a1dee359d07cc9dfba40aa457324f40c9
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/entity/Category.java
@@ -0,0 +1,49 @@
+package com.shop.entity;
+
+public class Category {
+ private int category_id;
+ private String category_name;
+ private int parentCategory_id;
+
+ public int getCategory_id() {
+ return category_id;
+ }
+
+ public void setCategory_id(int category_id) {
+ this.category_id = category_id;
+ }
+
+ public String getCategory_name() {
+ return category_name;
+ }
+
+ public void setCategory_name(String category_name) {
+ this.category_name = category_name;
+ }
+
+ public int getParentCategory_id() {
+ return parentCategory_id;
+ }
+
+ public void setParentCategory_id(int parentCategory_id) {
+ this.parentCategory_id = parentCategory_id;
+ }
+
+ public Category() {
+ }
+
+ public Category(int category_id, String category_name, int parentCategory_id) {
+ this.category_id = category_id;
+ this.category_name = category_name;
+ this.parentCategory_id = parentCategory_id;
+ }
+
+ @Override
+ public String toString() {
+ return "Category{" +
+ "category_id=" + category_id +
+ ", category_name='" + category_name + '\'' +
+ ", parentCategory_id=" + parentCategory_id +
+ '}';
+ }
+}
diff --git a/back-end_code/src/main/java/com/shop/entity/Class.java b/back-end_code/src/main/java/com/shop/entity/Class.java
deleted file mode 100644
index 5667578ab6736d3fd0112e85810d14f4a80388d4..0000000000000000000000000000000000000000
--- a/back-end_code/src/main/java/com/shop/entity/Class.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.shop.entity;
-
-public class Class {
- private int class_id;
- private String class_name;
- private int parentClass_id;
-
- @Override
- public String toString() {
- return "Class{" +
- "class_id=" + class_id +
- ", class_name='" + class_name + '\'' +
- ", parentClass_id=" + parentClass_id +
- '}';
- }
-
- public int getClass_id() {
- return class_id;
- }
-
- public void setClass_id(int class_id) {
- this.class_id = class_id;
- }
-
- public String getClass_name() {
- return class_name;
- }
-
- public void setClass_name(String class_name) {
- this.class_name = class_name;
- }
-
- public int getParentClass_id() {
- return parentClass_id;
- }
-
- public void setParentClass_id(int parentClass_id) {
- this.parentClass_id = parentClass_id;
- }
-
- public Class(int class_id, String class_name, int parentClass_id) {
- this.class_id = class_id;
- this.class_name = class_name;
- this.parentClass_id = parentClass_id;
- }
-
- public Class() {
- }
-}
diff --git a/back-end_code/src/main/java/com/shop/entity/Goods.java b/back-end_code/src/main/java/com/shop/entity/Goods.java
index 2d47148b2f07dc1cde67acc81a7a8a15be3d22c4..a79dcc81ea7510594ea121953d102ac325afee95 100644
--- a/back-end_code/src/main/java/com/shop/entity/Goods.java
+++ b/back-end_code/src/main/java/com/shop/entity/Goods.java
@@ -7,7 +7,7 @@ public class Goods {
private int goods_stock;
private String goods_img;
private String goods_discribe;
- private int goods_class;
+ private int goods_category;
private float goods_price;
private int goods_state;//int型 1表示在售,2表示冻结,3表示下架
@@ -24,14 +24,22 @@ public class Goods {
this.goods_price = goods_price;
}
- public Goods(int item_id, String goods_name, String seller_username, int goods_stock, String goods_img, String goods_discribe, int goods_class, float goods_price) {
+ public int getGoods_category() {
+ return goods_category;
+ }
+
+ public void setGoods_category(int goods_category) {
+ this.goods_category = goods_category;
+ }
+
+ public Goods(int item_id, String goods_name, String seller_username, int goods_stock, String goods_img, String goods_discribe, int goods_category, float goods_price) {
this.item_id = item_id;
this.goods_name = goods_name;
this.seller_username = seller_username;
this.goods_stock = goods_stock;
this.goods_img = goods_img;
this.goods_discribe = goods_discribe;
- this.goods_class = goods_class;
+ this.goods_category = goods_category;
this.goods_price = goods_price;
}
@@ -119,23 +127,16 @@ public class Goods {
this.goods_state = goods_state;
}
- public Goods(String goods_name, String seller_username, int goods_stock, String goods_img, String goods_discribe, int goods_class, float goods_price) {
+ public Goods(String goods_name, String seller_username, int goods_stock, String goods_img, String goods_discribe, int goods_category, float goods_price) {
this.goods_name = goods_name;
this.seller_username = seller_username;
this.goods_stock = goods_stock;
this.goods_img = goods_img;
this.goods_discribe = goods_discribe;
- this.goods_class = goods_class;
+ this.goods_category = goods_category;
this.goods_price = goods_price;
}
- public int getGoods_class() {
- return goods_class;
- }
-
- public void setGoods_class(int goods_class) {
- this.goods_class = goods_class;
- }
@Override
public String toString() {
@@ -146,7 +147,7 @@ public class Goods {
", goods_stock=" + goods_stock +
", goods_img='" + goods_img + '\'' +
", goods_discribe='" + goods_discribe + '\'' +
- ", goods_class=" + goods_class +
+ ", goods_category=" + goods_category +
", goods_price=" + goods_price +
", goods_state=" + goods_state +
'}';
diff --git a/back-end_code/src/main/java/com/shop/entity/Order.java b/back-end_code/src/main/java/com/shop/entity/Order.java
index 8536312d1ff72e5808c9ee7bf2c1b2df6cd95613..4246ea61e8abb1878cd2238a30666d58fac859c3 100644
--- a/back-end_code/src/main/java/com/shop/entity/Order.java
+++ b/back-end_code/src/main/java/com/shop/entity/Order.java
@@ -3,12 +3,17 @@ package com.shop.entity;
public class Order {
private int order_id;
private int item_id;
+ private String goods_name;
+ private String goods_img;
+ private String goods_discribe;
+ private float goods_price;
private String seller_username;
private String buyer_username;
private String buyer_realname;
private String buyer_phonenumber;
private String buyer_address;
private int buy_sum;
+ private float buy_amount;//总价
private int state;//int,1表示进行中,2表示交易成功,3表示买家退款,4表示卖家关闭交易,5表示申请中
private String create_time;
private String finish_time;
@@ -17,6 +22,76 @@ public class Order {
super();
}
+ public Order(int item_id, String goods_name, String goods_img, String goods_discribe, float goods_price, String seller_username, String buyer_username, String buyer_realname, String buyer_phonenumber, String buyer_address, int buy_sum, float buy_amount, int state, String create_time) {
+ this.item_id = item_id;
+ this.goods_name = goods_name;
+ this.goods_img = goods_img;
+ this.goods_discribe = goods_discribe;
+ this.goods_price = goods_price;
+ this.seller_username = seller_username;
+ this.buyer_username = buyer_username;
+ this.buyer_realname = buyer_realname;
+ this.buyer_phonenumber = buyer_phonenumber;
+ this.buyer_address = buyer_address;
+ this.buy_sum = buy_sum;
+ this.buy_amount = buy_amount;
+ this.state = state;
+ this.create_time = create_time;
+ }
+
+ public String getGoods_name() {
+ return goods_name;
+ }
+
+ public void setGoods_name(String goods_name) {
+ this.goods_name = goods_name;
+ }
+
+ public String getGoods_img() {
+ return goods_img;
+ }
+
+ public void setGoods_img(String goods_img) {
+ this.goods_img = goods_img;
+ }
+
+ public String getGoods_discribe() {
+ return goods_discribe;
+ }
+
+ public void setGoods_discribe(String goods_discribe) {
+ this.goods_discribe = goods_discribe;
+ }
+
+ public float getGoods_price() {
+ return goods_price;
+ }
+
+ public void setGoods_price(float goods_price) {
+ this.goods_price = goods_price;
+ }
+
+ public float getBuy_amount() {
+ return buy_amount;
+ }
+
+ public void setBuy_amount(float buy_amount) {
+ this.buy_amount = buy_amount;
+ }
+
+ public Order(int item_id, String seller_username, String buyer_username, String buyer_realname, String buyer_phonenumber, String buyer_address, int buy_sum, float buy_amount, int state, String create_time) {
+ this.item_id = item_id;
+ this.seller_username = seller_username;
+ this.buyer_username = buyer_username;
+ this.buyer_realname = buyer_realname;
+ this.buyer_phonenumber = buyer_phonenumber;
+ this.buyer_address = buyer_address;
+ this.buy_sum = buy_sum;
+ this.buy_amount = buy_amount;
+ this.state = state;
+ this.create_time = create_time;
+ }
+
public Order(int order_id, int item_id, String seller_username, String buyer_username, String buyer_realname, String buyer_phonenumber, String buyer_address, int buy_sum, int state, String create_time, String finish_time) {
this.order_id = order_id;
this.item_id = item_id;
@@ -150,12 +225,17 @@ public class Order {
return "Order{" +
"order_id=" + order_id +
", item_id=" + item_id +
+ ", goods_name='" + goods_name + '\'' +
+ ", goods_img='" + goods_img + '\'' +
+ ", goods_discribe='" + goods_discribe + '\'' +
+ ", goods_price=" + goods_price +
", seller_username='" + seller_username + '\'' +
", buyer_username='" + buyer_username + '\'' +
", buyer_realname='" + buyer_realname + '\'' +
", buyer_phonenumber='" + buyer_phonenumber + '\'' +
", buyer_address='" + buyer_address + '\'' +
", buy_sum=" + buy_sum +
+ ", buy_amount=" + buy_amount +
", state=" + state +
", create_time='" + create_time + '\'' +
", finish_time='" + finish_time + '\'' +
diff --git a/back-end_code/src/main/java/com/shop/entity/ShowCategory.java b/back-end_code/src/main/java/com/shop/entity/ShowCategory.java
new file mode 100644
index 0000000000000000000000000000000000000000..49bd292af9ea7cb0f8d3b345b27cfcc1124bd6a9
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/entity/ShowCategory.java
@@ -0,0 +1,67 @@
+package com.shop.entity;
+
+public class ShowCategory {
+ private int show_id;
+ private int sequence;
+ private int category_id;
+ private String category_name;
+
+ public ShowCategory(int sequence, int category_id, String category_name) {
+ this.sequence = sequence;
+ this.category_id = category_id;
+ this.category_name = category_name;
+ }
+
+ public ShowCategory() {
+ }
+
+ public ShowCategory(int show_id, int sequence) {
+ this.show_id = show_id;
+ this.sequence = sequence;
+ this.category_id = 0;
+ this.category_name = null;
+ }
+
+ public int getShow_id() {
+ return show_id;
+ }
+
+ public ShowCategory(int show_id) {
+ this.show_id = show_id;
+ }
+
+ public void setShow_id(int show_id) {
+ this.show_id = show_id;
+ }
+
+ public ShowCategory(int show_id, int sequence, int category_id, String category_name) {
+ this.show_id = show_id;
+ this.sequence = sequence;
+ this.category_id = category_id;
+ this.category_name = category_name;
+ }
+
+ public int getSequence() {
+ return sequence;
+ }
+
+ public void setSequence(int sequence) {
+ this.sequence = sequence;
+ }
+
+ public int getCategory_id() {
+ return category_id;
+ }
+
+ public void setCategory_id(int category_id) {
+ this.category_id = category_id;
+ }
+
+ public String getCategory_name() {
+ return category_name;
+ }
+
+ public void setCategory_name(String category_name) {
+ this.category_name = category_name;
+ }
+}
diff --git a/back-end_code/src/main/java/com/shop/mapper/CategoryMapper.java b/back-end_code/src/main/java/com/shop/mapper/CategoryMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..907c7987fbb073243373bdcf138e8c376b17e064
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/mapper/CategoryMapper.java
@@ -0,0 +1,54 @@
+package com.shop.mapper;
+
+import com.shop.entity.Category;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CategoryMapper {
+ /**
+ * 添加类别
+ * @param category_name
+ * @param parentCategory_id
+ * @return
+ */
+ int addCategory(String category_name,int parentCategory_id);
+
+ /**
+ * 查询父类别
+ * @return
+ */
+ List searchParentCategory();
+
+ /**
+ * 查询所有类别
+ * @return
+ */
+ List searchAllCategory();
+ /**
+ * 根据parentCategory_id查询子类别
+ * @param parentCategory_id
+ * @return
+ */
+ List searchChildCategory(int parentCategory_id);
+
+ /**
+ * 根据categoryId删除Category
+ * @param category_id
+ * @return
+ */
+ int deleteCategoryByItemId(int category_id);
+ /**
+ * 根据categoryName查找category
+ * @param category_name
+ * @return
+ */
+ Category searchCategoryByName(String category_name);
+ /**
+ * 根据categoryId修改Category
+ * @param Category
+ * @return
+ */
+ int updateCategory(Category Category);
+}
diff --git a/back-end_code/src/main/java/com/shop/mapper/ClassMapper.java b/back-end_code/src/main/java/com/shop/mapper/ClassMapper.java
deleted file mode 100644
index adc8403864a557cdc6d68171debd7ad67ab22c63..0000000000000000000000000000000000000000
--- a/back-end_code/src/main/java/com/shop/mapper/ClassMapper.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.shop.mapper;
-
-import com.shop.entity.Class;
-import com.shop.entity.GO;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface ClassMapper {
- /**
- * 添加类别
- * @param class_name
- * @param parentClass_id
- * @return
- */
- int addClass(String class_name,int parentClass_id);
-
- /**
- * 查询父类别
- * @return
- */
- List searchParentClass();
-
- /**
- * 根据parentClass_id查询子类别
- * @param parentClass_id
- * @return
- */
- List searchChildClass(int parentClass_id);
-
- /**
- * 根据classId删除Class
- * @param class_id
- * @return
- */
- int deleteClassByItemId(int class_id);
-
- /**
- * 根据classId修改Class
- * @param Class
- * @return
- */
- int updateClass(Class Class);
-}
diff --git a/back-end_code/src/main/java/com/shop/mapper/GoodsMapper.java b/back-end_code/src/main/java/com/shop/mapper/GoodsMapper.java
index cb7ddcdf405edf3ecf2af7af6fe15e7aa1346884..f6601725a2630668102c31a566c2399ee33c6be4 100644
--- a/back-end_code/src/main/java/com/shop/mapper/GoodsMapper.java
+++ b/back-end_code/src/main/java/com/shop/mapper/GoodsMapper.java
@@ -25,10 +25,10 @@ public interface GoodsMapper {
* 根据item_id(商品ID),newstate(商品状态)向Goods表中更新商品状态信息
* @param seller_username
* @param item_id
- * @param newstate
+ * @param new_state
* @return
*/
- int updateGoodsState(String seller_username,int item_id,int newstate);
+ int updateGoodsState(String seller_username,int item_id,int new_state);
/**
*根据username查找此用户是否有正在出售的商品
@@ -69,12 +69,13 @@ public interface GoodsMapper {
*/
List searchFreezingGoods(String seller_username);
+
/**
* 通过类别查询商品
- * @param goods_class
+ * @param goods_category
* @return
*/
- List searchGoodsByClass(int goods_class);
+ List searchGoodsByCategory(int goods_category);
/**
* 通过类别查询商品
@@ -91,4 +92,12 @@ public interface GoodsMapper {
*/
int updateGoodStock(int item_id,int new_stock);
+ /**
+ * 通过类别和关键词查询商品
+ * @param goods_category
+ * @param key_name
+ * @return
+ */
+ List searchGoodsByCategoryAndKeyName(int goods_category,String key_name);
+
}
diff --git a/back-end_code/src/main/java/com/shop/mapper/OrderMapper.java b/back-end_code/src/main/java/com/shop/mapper/OrderMapper.java
index 632ac47ec375a179422f0231153538b1b272cd14..614eb4235e09a7c800993d726890b3d1679a3f2b 100644
--- a/back-end_code/src/main/java/com/shop/mapper/OrderMapper.java
+++ b/back-end_code/src/main/java/com/shop/mapper/OrderMapper.java
@@ -64,11 +64,15 @@ public interface OrderMapper {
/**
* 查询完成订单
* @param seller_username
- * @param page
* @return
*/
- List searchFinishOrder(String seller_username,int page);
-
+ List searchFinishOrder(String seller_username);
+ /**
+ * 按卖家查询所有订单
+ * @param seller_username
+ * @return
+ */
+ List searchOrdersBySellerUserName(String seller_username);
/**
* 在Order表中查找已完成交易商品的历史意向买家
* @param seller_username
diff --git a/back-end_code/src/main/java/com/shop/mapper/ShowCategoryMapper.java b/back-end_code/src/main/java/com/shop/mapper/ShowCategoryMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..948e372fc18c82db6530cfd484af37c373b3b7d7
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/mapper/ShowCategoryMapper.java
@@ -0,0 +1,25 @@
+package com.shop.mapper;
+
+import com.shop.entity.Category;
+import com.shop.entity.ShowCategory;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface ShowCategoryMapper {
+
+ /**
+ * 修改ShowCategory
+ * @param ShowCategory
+ * @return
+ */
+ int updateShowCategory(ShowCategory ShowCategory);
+
+ /**
+ * 查询ShowCategory
+ * @param
+ * @return
+ */
+ List searchShowCategory();
+}
diff --git a/back-end_code/src/main/java/com/shop/mapper/UserMapper.java b/back-end_code/src/main/java/com/shop/mapper/UserMapper.java
index 30aa7b16e87413d0178ec4da5bdaf64744bc82b8..567a515c1bf2f7bd3b0c05b0c188bf4a09f9724b 100644
--- a/back-end_code/src/main/java/com/shop/mapper/UserMapper.java
+++ b/back-end_code/src/main/java/com/shop/mapper/UserMapper.java
@@ -49,6 +49,6 @@ public interface UserMapper {
* @param
* @return
*/
- List searchAllUser();
+ List searchAllBuyer();
}
diff --git a/back-end_code/src/main/java/com/shop/service/CategoryService.java b/back-end_code/src/main/java/com/shop/service/CategoryService.java
new file mode 100644
index 0000000000000000000000000000000000000000..69af2ab65039d4731385e297535fa9942ff9f19f
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/service/CategoryService.java
@@ -0,0 +1,22 @@
+package com.shop.service;
+
+import com.shop.entity.Category;
+import com.shop.mapper.CategoryMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CategoryService {
+ @Autowired
+ private CategoryMapper categoryMapper;
+
+ public int addCategory(String category_name,int parentCategory_id){return categoryMapper.addCategory(category_name,parentCategory_id);}
+ public List searchParentCategory(){return categoryMapper.searchParentCategory();}
+ public List searchChildCategory(int parentCategory_id){return categoryMapper.searchChildCategory(parentCategory_id);}
+ public int deleteCategoryByItemId(int category_id){return categoryMapper.deleteCategoryByItemId(category_id);}
+ public int updateCategory(Category category){return categoryMapper.updateCategory(category);}
+ public Category searchCategoryByName(String category_name){return categoryMapper.searchCategoryByName(category_name);}
+ public List searchAllCategory(){return categoryMapper.searchAllCategory();}
+}
diff --git a/back-end_code/src/main/java/com/shop/service/ClassService.java b/back-end_code/src/main/java/com/shop/service/ClassService.java
deleted file mode 100644
index ee1994ffdbf2a277aed5f8744293adb4d64d4b38..0000000000000000000000000000000000000000
--- a/back-end_code/src/main/java/com/shop/service/ClassService.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.shop.service;
-
-import com.shop.entity.Class;
-import com.shop.entity.GO;
-import com.shop.mapper.ClassMapper;
-import com.shop.mapper.GOMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class ClassService {
- @Autowired
- private ClassMapper classMapper;
-
- public int addClass(String class_name,int parentClass_id){return classMapper.addClass(class_name,parentClass_id);}
- public List searchParentClass(){return classMapper.searchParentClass();}
- public List searchChildClass(int parentClass_id){return classMapper.searchChildClass(parentClass_id);}
- public int deleteClassByItemId(int class_id){return classMapper.deleteClassByItemId(class_id);}
- public int updateClass(Class Class){return classMapper.updateClass(Class);}
-}
diff --git a/back-end_code/src/main/java/com/shop/service/GoodsService.java b/back-end_code/src/main/java/com/shop/service/GoodsService.java
index 3b9a608db58fa73dfabf4679b15848af26fb10f0..f56b6df1cecb41b7d8aa847feea1dab787921087 100644
--- a/back-end_code/src/main/java/com/shop/service/GoodsService.java
+++ b/back-end_code/src/main/java/com/shop/service/GoodsService.java
@@ -1,28 +1,37 @@
package com.shop.service;
+import com.shop.entity.Category;
import com.shop.entity.Goods;
+import com.shop.mapper.CategoryMapper;
import com.shop.mapper.GoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
import java.util.List;
@Service
public class GoodsService {
@Autowired
private GoodsMapper goodsMapper;
+ @Autowired
+ private CategoryMapper categoryMapper;
public int addGoods(Goods Goods){
return goodsMapper.addGoods(Goods);
}
public Goods searchGoods(int item_id){ return goodsMapper.searchGoods(item_id); }
- public int updateGoodsState(String seller_username,int item_id,int newstate){
- return goodsMapper.updateGoodsState(seller_username,item_id, newstate);
- }
+ public int updateGoodsState(String seller_username,int item_id,int new_state){return goodsMapper.updateGoodsState(seller_username,item_id, new_state);}
public List searchSellingGoods(){return goodsMapper.searchSellingGoods();}//一页8条
public List searchFreezingGoods(String seller_username){return goodsMapper.searchFreezingGoods(seller_username);}//一页10条
public List searchHistoryGoods(String seller_username){ return goodsMapper.searchHistoryGoods(seller_username);}//一页10条
- public int updateGoods(Goods newgoods){ return goodsMapper.updateGoods(newgoods);}
+ public int updateGoods(Goods newgoods){
+ if (newgoods.getGoods_stock() == 0){
+ goodsMapper.updateGoodsState(newgoods.getSeller_username(),newgoods.getItem_id(),3);
+ }else if (newgoods.getGoods_stock() > 0){
+ goodsMapper.updateGoodsState(newgoods.getSeller_username(),newgoods.getItem_id(),1);
+ }
+ return goodsMapper.updateGoods(newgoods);}
public List searchWelcomeGoods(){return goodsMapper.searchWelcomeGoods();}
public boolean isHaveSellingGoods(String username){
if(goodsMapper.isHaveSellingGoods(username)==null){
@@ -31,7 +40,19 @@ public class GoodsService {
return true;
}
}
- public List searchGoodsByClass(int goods_class){return goodsMapper.searchGoodsByClass(goods_class);}
+ public List searchGoodsByCategory(int goods_category){
+ List goodsList = new ArrayList();
+ List categoryList = categoryMapper.searchChildCategory(goods_category);
+ if (categoryList != null){
+ for (Category category:categoryList
+ ) {
+ List goods = goodsMapper.searchGoodsByCategory(category.getCategory_id());
+ goodsList.addAll(goods);
+ }
+ }else
+ goodsList = goodsMapper.searchGoodsByCategory(goods_category);
+ return goodsList;
+ }
public List searchGoodsByKeyName(String key_name){return goodsMapper.searchGoodsByKeyName(key_name);}
// public int reduceGoodStock(int item_id,int reduce_sum){
// Goods good = goodsMapper.searchGoods(item_id);
@@ -44,4 +65,17 @@ public class GoodsService {
// return goodsMapper.updateGoodStock(item_id,new_stock);
// }
public int updateGoodStock(int item_id,int new_stock){return goodsMapper.updateGoodStock(item_id,new_stock);}
+ public List searchGoodsByCategoryAndKeyName(int goods_category,String key_name){
+ List goodsList = null;
+ List categoryList = categoryMapper.searchChildCategory(goods_category);
+ if (categoryList != null){
+ for (Category category:categoryList
+ ) {
+ List goods = goodsMapper.searchGoodsByCategoryAndKeyName(category.getCategory_id(),key_name);
+ goodsList.addAll(goods);
+ }
+ }else
+ goodsList = goodsMapper.searchGoodsByCategoryAndKeyName(goods_category,key_name);
+ return goodsList;
+ }
}
diff --git a/back-end_code/src/main/java/com/shop/service/OrderService.java b/back-end_code/src/main/java/com/shop/service/OrderService.java
index 05d42123241cb078d430e70941b6f3f80586cfb7..9749d29bcf30fa3174b18ba796b573f3adb5c77f 100644
--- a/back-end_code/src/main/java/com/shop/service/OrderService.java
+++ b/back-end_code/src/main/java/com/shop/service/OrderService.java
@@ -45,8 +45,12 @@ public class OrderService {
public Order agreeOrderwanted(String seller_username,int order_id){
int result = orderMapper.agreeOrderwanted(seller_username,order_id);
Order order = orderMapper.searchOrderByOrderId(seller_username,order_id);
- orderMapper.updateOtherOrders(seller_username,order.getItem_id());
- goodsMapper.updateGoodsState(seller_username,order.getItem_id(),2);
+ Goods good = goodsMapper.searchGoods(order.getItem_id());
+ int new_stock = good.getGoods_stock()-order.getBuy_sum();
+ goodsMapper.updateGoodStock(order.getItem_id(),new_stock);
+ if (new_stock == 0){
+ goodsMapper.updateGoodsState(order.getSeller_username(),order.getItem_id(),3);
+ }
return order;
}
public List searchSellingGoodsBuyerRealname(){
@@ -61,13 +65,9 @@ public class OrderService {
public List searchHistoryGoodsUnFinishedOrder(String seller_username,int item_id){
return orderMapper.searchHistoryGoodsUnFinishedOrder(seller_username,item_id);
}
- public int finishOrder(String seller_username,int item_id,String finish_time){
- int result = orderMapper.finishOrder(seller_username,item_id,finish_time);
- goodsMapper.updateGoodsState(seller_username,item_id,3);
- return result;
- }
+ public int finishOrder(String seller_username,int item_id,String finish_time){ return orderMapper.finishOrder(seller_username,item_id,finish_time); }
public Order searchOrderByOrderId(String seller_username,int order_id){return orderMapper.searchOrderByOrderId(seller_username,order_id);}
- public List searchFinishOrder(String seller_username,int page){return orderMapper.searchFinishOrder(seller_username,page);}
+ public List searchFinishOrder(String seller_username){return orderMapper.searchFinishOrder(seller_username);}
public List searchDealingOrder(String seller_username,int page){return orderMapper.searchDealingOrder(seller_username,page);}
public int cancelOrder(String seller_username,int order_id){
int result = orderMapper.cancelOrder(seller_username,order_id);
@@ -80,15 +80,7 @@ public class OrderService {
}
return result;
}
- public int addToOrderWanted(Order order){
- Goods good = goodsMapper.searchGoods(order.getItem_id());
- int new_stock = good.getGoods_stock()-order.getBuy_sum();
- goodsMapper.updateGoodStock(order.getItem_id(),new_stock);
- if (new_stock == 0){
- goodsMapper.updateGoodsState(order.getSeller_username(),order.getItem_id(),3);
- }
- int result = orderMapper.addToOrderWanted(order);
- return result;
- }
+ public int addToOrderWanted(Order order){return orderMapper.addToOrderWanted(order); }
public List searchFinishOrderByBuyerName(String buyer_username){return orderMapper.searchFinishOrderByBuyerName(buyer_username);}
+ public List searchOrdersBySellerName(String seller_username){return orderMapper.searchOrdersBySellerUserName(seller_username);}
}
diff --git a/back-end_code/src/main/java/com/shop/service/ShowCategoryService.java b/back-end_code/src/main/java/com/shop/service/ShowCategoryService.java
new file mode 100644
index 0000000000000000000000000000000000000000..e860ab691d26f6e8fcf343b60c2f3c46e811a078
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/service/ShowCategoryService.java
@@ -0,0 +1,32 @@
+package com.shop.service;
+
+import com.shop.entity.Category;
+import com.shop.entity.ShowCategory;
+import com.shop.mapper.ShowCategoryMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ShowCategoryService {
+ @Autowired
+ private ShowCategoryMapper ShowCategoryMapper;
+
+ public List searchShowCategory(){return ShowCategoryMapper.searchShowCategory();}
+ public int updateShowCategory(List Categorys){
+ int i = 1,sequence=1;
+ for (Category Category:Categorys
+ ) {
+ if (Category.getParentCategory_id() == 0 && Category.getCategory_name() != null){
+ ShowCategory showCategory = new ShowCategory(i,sequence,Category.getCategory_id(),Category.getCategory_name());
+ ShowCategoryMapper.updateShowCategory(showCategory);
+ sequence++;i++;
+ }
+ }
+ for (;i<=5;i++){
+ ShowCategory showCategory = new ShowCategory(i,0);
+ ShowCategoryMapper.updateShowCategory(showCategory);
+ }
+ return 1;}
+}
diff --git a/back-end_code/src/main/java/com/shop/service/UserService.java b/back-end_code/src/main/java/com/shop/service/UserService.java
index d661dfd56019fbd57e7dabd1170afd71f6897cf3..e95dd79cf0f37914e320ca695991d8973bf0701d 100644
--- a/back-end_code/src/main/java/com/shop/service/UserService.java
+++ b/back-end_code/src/main/java/com/shop/service/UserService.java
@@ -15,7 +15,31 @@ public class UserService {
public User login(String username, String password){ return userMapper.login(username,password); }
public User getUserInfo(String username){ return userMapper.getUserInfo(username); }
public int updatePassword(String username,String newPassword){ return userMapper.updatePassword(username,newPassword); }
- public int registerUser(User User){return userMapper.registerUser(User);}
+ public int registerUser(User user){
+ String username=user.getUserName();
+ String password=user.getPassword();
+ String realName=user.getRealname();
+ String phoneNumber=user.getPhonenumber();
+ String address=user.getAddress();
+ final String STR_ENG_PATTERN="^[a-z0-9A-Z]+$";
+ if(username.length()>11||username.length()<3){
+ return -1;//用户名长度错误
+ }else if(userMapper.getUserInfo(username)!=null){
+ return -2;//用户名重复
+ }else if(!username.matches(STR_ENG_PATTERN)){
+ return -3;//用户名包含非数字或字母
+ }else if(password.length()<7||password.length()>15){
+ return -4;//密码长度错误
+ }else if(realName.length()>10){
+ return -5;//真实姓名长度过长
+ }else if(phoneNumber.length()!=11||!phoneNumber.matches("^[0-9]+$")){
+ return -6;//电话号码格式错误
+ }else if(address.length()>50){
+ return -7;//地址过长
+ }
+ return userMapper.registerUser(user);
+ }
public int updateUser(User User){return userMapper.updateUser(User);}
- public List searchAllUser(){return userMapper.searchAllUser();}
+ public List searchAllBuyer(){return userMapper.searchAllBuyer();}
+
}
diff --git a/back-end_code/src/main/java/com/shop/utils/Result.java b/back-end_code/src/main/java/com/shop/utils/Result.java
new file mode 100644
index 0000000000000000000000000000000000000000..925998613105ad01c2e6877cae5d135d687dc93d
--- /dev/null
+++ b/back-end_code/src/main/java/com/shop/utils/Result.java
@@ -0,0 +1,75 @@
+package com.shop.utils;
+
+import net.minidev.json.JSONObject;
+
+public class Result extends JSONObject {
+
+ public static final String SUCCESS = "success";
+ public static final String FAILURE = "error";
+
+ private boolean result;
+ private String message;
+ private Object data;
+
+ private Result() {}
+
+ public static Result ok() {
+ Result result = new Result();
+ result.put("code:",200);
+ return result;
+ }
+
+ public static Result ok(Object data) {
+ Result result = new Result();
+ result.put("code:",200);
+ result.put("data:",data);
+ return result;
+ }
+
+
+// public static Result ok(String message, Object data) {
+// Result result = new Result();
+// result.put("code:",200);
+// result.put("data:",data);
+// return result;
+// }
+
+ public static Result fail() {
+ return Result.fail(FAILURE);
+ }
+
+ public static Result fail(String message) {
+ Result result = new Result();
+ result.put("code:",500);
+ result.put("message:",message);
+ return result;
+ }
+
+
+// public static Result fail(String dataName, Object data) {
+// Result result = new Result();
+// result.put("code:",500);
+// result.put("message:",FAILURE);
+// result.put(dataName,data);
+// return result;
+// }
+
+ public boolean isResult() {
+ return result;
+ }
+ public void setResult(boolean result) {
+ this.result = result;
+ }
+ public String getMsg() {
+ return message;
+ }
+ public void setMsg(String message) {
+ this.message = message;
+ }
+ public Object getData() {
+ return data;
+ }
+ public void setData(Object data) {
+ this.data = data;
+ }
+}
diff --git a/back-end_code/src/main/java/com/shop/utils/StringUtil.java b/back-end_code/src/main/java/com/shop/utils/StringUtil.java
index 8f4dcc1420126d15ebac3f14fabdd95c07435150..c24785853dd5456059771f6de7fa11e26ddef65e 100644
--- a/back-end_code/src/main/java/com/shop/utils/StringUtil.java
+++ b/back-end_code/src/main/java/com/shop/utils/StringUtil.java
@@ -31,4 +31,20 @@ public class StringUtil {
String path = "image/" + DateUtil.today() + "-" + uuid + suffix;
return path;
}
+
+ public static String getRandomName(String fileName) {
+
+ int index = fileName.lastIndexOf(".");
+
+ if ((fileName == null || fileName.isEmpty()) || index == -1){
+ throw new IllegalArgumentException();
+ }
+ // 获取文件后缀
+ String suffix = fileName.substring(index);
+ // 生成UUID
+ String uuid = UUID.randomUUID().toString().replaceAll("-", "");
+ // 生成文件名
+ String path = DateUtil.today() + "-" + uuid + suffix;
+ return path;
+ }
}
diff --git a/back-end_code/src/main/resources/application-dev.yml b/back-end_code/src/main/resources/application-dev.yml
index 8fa5d15f71b0a42f3b32c3fc095f97181488eda7..55c39bad9eccff854cbcb2f3c281ceb6ae264c4a 100644
--- a/back-end_code/src/main/resources/application-dev.yml
+++ b/back-end_code/src/main/resources/application-dev.yml
@@ -24,4 +24,8 @@ oss:
domain: http://cdn.souldays.top # 访问域名(默认使用七牛云测试域名)
accessKey: KJb6ZIW_mplRncSOOFRDf5efUF_EY6LMwdD09uMb # 公钥
secretKey: _3ZryKtRPL3X66byb5evv7OC4X6ddgpdwpQRLJfI # 私钥
- bucketName: shop-software #存储空间名称
\ No newline at end of file
+ bucketName: shop-software #存储空间名称
+
+#文件上传路径
+filepath:
+ bin: "E:/file/bin/"
\ No newline at end of file
diff --git a/back-end_code/src/main/resources/application-pro.yml b/back-end_code/src/main/resources/application-pro.yml
new file mode 100644
index 0000000000000000000000000000000000000000..2124426af8ac2af4e39aea52d17dc52243b087ed
--- /dev/null
+++ b/back-end_code/src/main/resources/application-pro.yml
@@ -0,0 +1,31 @@
+server:
+ port: 8083
+
+spring:
+ datasource:
+ username: root
+ password: jiaxintang
+ #url中database为对应的数据库名称
+ url: jdbc:mysql://localhost:3306/service2.0?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
+ driver-class-name: com.mysql.cj.jdbc.Driver
+
+mybatis:
+ mapper-locations: classpath:mapping/*.xml
+ type-aliases-package: com.shop.entity
+
+#showSql
+logging:
+ level:
+ com.example.demo.mapper: debug
+
+# 七牛云存储
+oss:
+ qiniu:
+ domain: http://cdn.souldays.top # 访问域名(默认使用七牛云测试域名)
+ accessKey: KJb6ZIW_mplRncSOOFRDf5efUF_EY6LMwdD09uMb # 公钥
+ secretKey: _3ZryKtRPL3X66byb5evv7OC4X6ddgpdwpQRLJfI # 私钥
+ bucketName: shop-software #存储空间名称
+
+#文件上传路径
+filepath:
+ bin: "C:/file/bin/"
\ No newline at end of file
diff --git a/back-end_code/src/main/resources/mapping/CategoryMapper.xml b/back-end_code/src/main/resources/mapping/CategoryMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5f1a15337dff4ffef198d70bd150e563eee18e8e
--- /dev/null
+++ b/back-end_code/src/main/resources/mapping/CategoryMapper.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+ insert into category
+
+
+
+ categoryName,
+
+
+ parentCategoryId,
+
+
+
+
+
+
+ #{category_name,jdbcType=VARCHAR},
+
+
+ #{parentCategory_id,jdbcType=INTEGER},
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ delete from category where categoryId = #{category_id}
+
+
+
+
+ update category
+
+
+ categoryName = #{category_name,jdbcType=VARCHAR},
+
+
+ parentCategoryId = #{parentCategory_id,jdbcType=INTEGER},
+
+
+ where categoryId = #{category_id,jdbcType=INTEGER}
+
+
+
\ No newline at end of file
diff --git a/back-end_code/src/main/resources/mapping/ClassMapper.xml b/back-end_code/src/main/resources/mapping/ClassMapper.xml
deleted file mode 100644
index d216f904d3656391f78b64c170bc5137b4b99ff5..0000000000000000000000000000000000000000
--- a/back-end_code/src/main/resources/mapping/ClassMapper.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- insert into class
-
-
-
- className,
-
-
- parentClassId,
-
-
-
-
-
-
- #{class_name,jdbcType=VARCHAR},
-
-
- #{parentClass_id,jdbcType=INTEGER},
-
-
-
-
-
-
-
-
-
-
-
-
- delete from class where classId = #{class_id}
-
-
-
-
- update class
-
-
- className = #{class_name,jdbcType=VARCHAR},
-
-
- parentClassId = #{parentClass_id,jdbcType=INTEGER},
-
-
- where classId = #{class_id,jdbcType=INTEGER}
-
-
-
\ No newline at end of file
diff --git a/back-end_code/src/main/resources/mapping/GoodsMapper.xml b/back-end_code/src/main/resources/mapping/GoodsMapper.xml
index 5709cc00be87b07c0868227c3040954bd76efb70..593271809ecb044de4ad8126e9219ddb16e4cb6c 100644
--- a/back-end_code/src/main/resources/mapping/GoodsMapper.xml
+++ b/back-end_code/src/main/resources/mapping/GoodsMapper.xml
@@ -8,7 +8,7 @@
-
+
@@ -33,8 +33,8 @@
goodsDiscribe,
-
- goodsClass,
+
+ goodsCategory,
goodsPrice,
@@ -59,8 +59,8 @@
#{goods_discribe,jdbcType=VARCHAR},
-
- #{goods_class,jdbcType=VARCHAR},
+
+ #{goods_category,jdbcType=VARCHAR},
#{goods_price,jdbcType=REAL},
@@ -93,8 +93,8 @@
goodsDiscribe = #{goods_discribe,jdbcType=VARCHAR},
-
- goodsClass = #{goods_class,jdbcType=INTEGER},
+
+ goodsCategory = #{goods_category,jdbcType=INTEGER},
goodsPrice = #{goods_price,jdbcType=REAL},
@@ -107,8 +107,8 @@
update goods
-
- goodsState = #{newstate,jdbcType=INTEGER},
+
+ goodsState = #{new_state,jdbcType=INTEGER},
where itemId = #{item_id,jdbcType=INTEGER}
@@ -140,13 +140,30 @@
-
-
+
select * from orders where itemId = #{item_id,jdbcType=INTEGER} and state = 4 and sellerUsername = #{seller_username}
@@ -65,7 +70,7 @@
select * from orders where sellerUsername = #{seller_username} and state = 2
-
+
select * from orders where sellerUsername = #{seller_username} and state = 1
@@ -78,9 +83,24 @@
itemId,
+
+ goodsName,
+
+
+ goodsImg,
+
+
+ goodsDiscribe,
+
+
+ goodsPrice,
+
sellerUsername,
+
+ buyerUsername,
+
buyerRealname,
@@ -93,6 +113,9 @@
buySum,
+
+ buyAmount,
+
state,
@@ -105,9 +128,24 @@
#{item_id,jdbcType=INTEGER},
+
+ #{goods_name,jdbcType=VARCHAR},
+
+
+ #{goods_img,jdbcType=VARCHAR},
+
+
+ #{goods_discribe,jdbcType=VARCHAR},
+
+
+ #{goods_price,jdbcType=REAL},
+
#{seller_username,jdbcType=VARCHAR},
+
+ #{buyer_username,jdbcType=VARCHAR},
+
#{buyer_realname,jdbcType=VARCHAR},
@@ -120,6 +158,9 @@
#{buy_sum ,jdbcType=INTEGER},
+
+ #{buy_amount ,jdbcType=REAL},
+
#{state ,jdbcType=INTEGER},
@@ -133,5 +174,8 @@
select * from orders where buyerUsername = #{buyer_username} and state = 2
+
+ select * from orders where sellerUsername = #{seller_username}
+
\ No newline at end of file
diff --git a/back-end_code/src/main/resources/mapping/ShowCategoryMapper.xml b/back-end_code/src/main/resources/mapping/ShowCategoryMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fe62f36769ba85f127cb74508bea5d026beea3fd
--- /dev/null
+++ b/back-end_code/src/main/resources/mapping/ShowCategoryMapper.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ update showcategory
+
+ Sequence = #{sequence,jdbcType=INTEGER},
+ categoryId = #{category_id,jdbcType=INTEGER},
+ categoryName = #{category_name,jdbcType=VARCHAR},
+
+ where ShowId = #{show_id,jdbcType=INTEGER}
+
+
+
+
+ select * from showcategory where Sequence != 0
+
+
+
diff --git a/back-end_code/src/main/resources/mapping/UserMapper.xml b/back-end_code/src/main/resources/mapping/UserMapper.xml
index 70d39846666b17a8ad00291e50d0628d31b4d65c..7b08e5f3caa72c8eb332c95f1b8ac737daa4dfd4 100644
--- a/back-end_code/src/main/resources/mapping/UserMapper.xml
+++ b/back-end_code/src/main/resources/mapping/UserMapper.xml
@@ -114,7 +114,7 @@
-
+
select userName,nickName,phoneNumber,address,realName,userHead,permission from user where permission = 1
diff --git a/back-end_code/src/test/java/com/shop/service/ServiceApplicationTests.java b/back-end_code/src/test/java/com/shop/service/ServiceApplicationTests.java
deleted file mode 100644
index ac56d4abc141cdd1304603fa5d49033ed239dd22..0000000000000000000000000000000000000000
--- a/back-end_code/src/test/java/com/shop/service/ServiceApplicationTests.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.shop.service;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class ServiceApplicationTests {
-
- @Test
- void contextLoads() {
- }
-
-}
diff --git "a/\346\216\245\345\217\243\346\226\207\346\241\243.md" "b/\346\216\245\345\217\243\346\226\207\346\241\243.md"
new file mode 100644
index 0000000000000000000000000000000000000000..3524a6971f6e8d10475302409f8e392a6aa49073
--- /dev/null
+++ "b/\346\216\245\345\217\243\346\226\207\346\241\243.md"
@@ -0,0 +1,1533 @@
+<<<<<<< HEAD
+# User
+
+## 登陆
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/user/login
+
+#### 线上
+>http://souldays.top:8083/user/login
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入用户名和密码
+* 实现登陆功能
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|username|用户名|String|Y|-|
+|password|密码|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "permission": 2,
+ "message": "success",
+ "username ": "admin",
+ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZG1pbiIsImV4cCI6MTYzODU4NDk2NSwiaWF0IjoxNjM4NTQxNzY1LCJ1c2VybmFtZSI6ImFkbWluIn0.eYprmaSIWmPd8mzI58dKpXVEwZ-uc-eggJl3MeaX2Ik"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|permission|权限|int|-|
+|token|token|String|-|
+|username|用户名|String|-|
+|message|调用信息|String|-|
+
+
+
+## 获取用户信息
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/user/getUserInfo
+
+#### 线上
+>http://souldays.top:8083/user/getUserInfo
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入用户名
+* 获取用户信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|username|用户名|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success",
+ "user": {
+ "password": "wxy123",
+ "permission": 1,
+ "phonenumber": "12345678900",
+ "address": "浙江工商大学",
+ "realname": "纹宗",
+ "userName": "xyWei",
+ "userHead": "http://cdn.souldays.top/image/2021-11-14-9565b3f30f124a02acc5e46da020afff.jpg",
+ "nickName": "纹宗"
+ }
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|user|用户信息|User|-|
+|message|调用信息|String|-|
+
+
+
+## 修改密码
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/user/updatePassword
+
+#### 线上
+>http://souldays.top:8083/user/updatePassword
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入用户名,旧密码,新密码
+* 实现修改密码
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|username|用户名|String|Y|-|
+|oldPassword|旧密码|String|Y|-|
+|newPassword|新密码|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 注册
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/user/registerUser
+
+#### 线上
+>http://souldays.top:8083/user/registerUser
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入注册用户信息
+* 实现注册用户
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|username|用户名|String|Y|-|
+|password|密码|String|Y|-|
+|nickname|昵称|String|Y|-|
+|phonenumber|电话|String|Y|-|
+|address|地址|String|Y|-|
+|realname|真实姓名|String|Y|-|
+|user_head|头像|String|N|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 修改用户信息
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/user/updateUser
+
+#### 线上
+>http://souldays.top:8083/user/updateUser
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入新用户信息
+* 实现用户修改个人信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|username|用户名|String|Y|-|
+|nickname|昵称|String|Y|-|
+|phonenumber|电话|String|Y|-|
+|address|地址|String|Y|-|
+|realname|真实姓名|String|Y|-|
+|user_head|头像|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 卖家查看买家信息
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/user/searchAllUser
+
+#### 线上
+>http://souldays.top:8083/user/searchAllUser
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 实现查看全部用户信息
+
+### 4) 请求参数:
+
+#### POST参数: 无
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success",
+ "users": [
+ {
+ "password": null,
+ "permission": 1,
+ "phonenumber": "17395711129",
+ "address": "翻斗花园",
+ "realname": "陈国栋",
+ "userName": "cgd",
+ "nickName": "cgd",
+ "userHead": ""
+ },
+ {
+ "password": null,
+ "permission": 1,
+ "phonenumber": "12345678900",
+ "address": "浙江工商大学",
+ "realname": "纹宗",
+ "userName": "xyWei",
+ "nickName": "纹宗",
+ "userHead": "http://cdn.souldays.top/image/2021-11-14-9565b3f30f124a02acc5e46da020afff.jpg"
+ }
+ ]
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+|users|用户信息表|List\|-|
+
+
+
+# Goods
+
+## 添加商品
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/addGoods
+
+#### 线上
+>http://souldays.top:8083/goods/addGoods
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入商品信息
+* 实现添加商品
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|goods_name|商品名称|String|Y|-|
+|goods_stock|商品数量|int|Y|-|
+|goods_img|商品图片|String|Y|-|
+|goods_discribe|商品描述|String|Y|-|
+|goods_price|商品价格|float|Y|-|
+|goods_category|商品类别|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 查询商品
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/searchGoods
+
+#### 线上
+>http://souldays.top:8083/goods/searchGoods
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入商品编号
+* 实现查询商品信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|item_id|商品编号|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success",
+ "good": {
+ "item_id": 2,
+ "goods_name": "红牛",
+ "seller_username": "admin",
+ "goods_stock": 90,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-5715365be9f84bf191e6c10f7d02fb31.jpg",
+ "goods_discribe": "我出钱你出命,咱们一块神经病",
+ "goods_price": 6.0,
+ "goods_state": 1,
+ "goods_category": 2
+ }
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|good|商品信息|Good|-|
+|message|调用信息|String|-|
+
+
+
+## 修改商品状态
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/updateGoodsState
+
+#### 线上
+>http://souldays.top:8083/goods/updateGoodsState
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入商品编号
+* 实现查询商品信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|seller_username|买家用户名|String|Y|-|
+|item_id|商品编号|int|Y|-|
+|new_state|新商品状态|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+
+## 查找正在出售的商品
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/searchSellingGoods
+
+#### 线上
+>http://souldays.top:8083/goods/searchSellingGoods
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 实现查询正在出售的商品信息
+
+### 4) 请求参数:
+
+#### POST参数: 无
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "goods": [
+ {
+ "item_id": 1,
+ "goods_name": "魔爪",
+ "seller_username": "admin",
+ "goods_stock": 100,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-bfe7515322954c53a89cd6b93dfdd4f6.jpg",
+ "goods_discribe": "不怕红牛不要命,就怕魔爪技术硬",
+ "goods_price": 6.0,
+ "goods_state": 1,
+ "goods_category": 2
+ },
+ {
+ "item_id": 2,
+ "goods_name": "红牛",
+ "seller_username": "admin",
+ "goods_stock": 90,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-5715365be9f84bf191e6c10f7d02fb31.jpg",
+ "goods_discribe": "我出钱你出命,咱们一块神经病",
+ "goods_price": 6.0,
+ "goods_state": 1,
+ "goods_category": 2
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+|goods|商品信息表|List\|-|
+
+
+
+## 查找正在出售的商品(首页使用)
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/searchWelcomeGoods
+
+#### 线上
+>http://souldays.top:8083/goods/searchWelcomeGoods
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 实现查询正在出售的商品信息
+
+### 4) 请求参数:
+
+#### POST参数: 无
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "goods": [
+ {
+ "item_id": 1,
+ "goods_name": "魔爪",
+ "seller_username": "admin",
+ "goods_stock": 100,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-bfe7515322954c53a89cd6b93dfdd4f6.jpg",
+ "goods_discribe": "不怕红牛不要命,就怕魔爪技术硬",
+ "goods_price": 6.0,
+ "goods_state": 1,
+ "goods_category": 2
+ },
+ {
+ "item_id": 2,
+ "goods_name": "红牛",
+ "seller_username": "admin",
+ "goods_stock": 90,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-5715365be9f84bf191e6c10f7d02fb31.jpg",
+ "goods_discribe": "我出钱你出命,咱们一块神经病",
+ "goods_price": 6.0,
+ "goods_state": 1,
+ "goods_category": 2
+ }
+ ],
+ "message": "success",
+ "Strings": [
+ "纹***",
+ "纹***",
+ "纹***"
+ ]
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+|goods|商品信息表|List\|-|
+|Strings|加密后的已下单用户名|List\|-|
+
+
+
+## 查找已下架的商品
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/searchHistoryGoods
+
+#### 线上
+>http://souldays.top:8083/goods/searchHistoryGoods
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入卖家用户名
+* 实现查询已下架的商品信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|seller_username|卖家用户名|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "goods": [
+ {
+ "item_id": 3,
+ "goods_name": "AD钙奶",
+ "seller_username": "admin",
+ "goods_stock": 100,
+ "goods_img": "http://cdn.souldays.top/image/2021-12-04-a1db84bba9ea4ed69736c756ec6955cf.jpg",
+ "goods_discribe": "童年的 味道",
+ "goods_price": 8.0,
+ "goods_state": 3,
+ "goods_category": 4
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+|goods|商品信息表|List\|-|
+
+
+
+## 通过类别查询商品信息
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/searchGoodsByCategory
+
+#### 线上
+>http://souldays.top:8083/goods/searchGoodsByCategory
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要查询的类别
+* 实现通过类别查询商品信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|goods_category|商品类别|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "goods": [
+ {
+ "item_id": 1,
+ "goods_name": "魔爪",
+ "seller_username": "admin",
+ "goods_stock": 100,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-bfe7515322954c53a89cd6b93dfdd4f6.jpg",
+ "goods_discribe": "不怕红牛不要命,就怕魔爪技术硬",
+ "goods_category": 2,
+ "goods_price": 6.0,
+ "goods_state": 1
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+|goods|商品信息表|List\|-|
+
+
+## 通过关键词查询商品信息
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/searchGoodsByKeyName
+
+#### 线上
+>http://souldays.top:8083/goods/searchGoodsByKeyName
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要查询的关键词
+* 实现通过关键词查询商品信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|key_name|商品关键词|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "goods": [
+ {
+ "item_id": 1,
+ "goods_name": "魔爪",
+ "seller_username": "admin",
+ "goods_stock": 100,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-bfe7515322954c53a89cd6b93dfdd4f6.jpg",
+ "goods_discribe": "不怕红牛不要命,就怕魔爪技术硬",
+ "goods_category": 2,
+ "goods_price": 6.0,
+ "goods_state": 1
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|goods|商品信息表|List\|-|
+|message|调用信息|String|-|
+
+
+
+## 通过类别和关键词查询商品信息
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/searchGoodsByCategoryAndKeyName
+
+#### 线上
+>http://souldays.top:8083/goods/searchGoodsByCategoryAndKeyName
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要查询的类别和关键词
+* 实现通过类别和关键词查询商品信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|goods_category|商品类别|int|Y|-|
+|key_name|商品关键词|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "goods": [
+ {
+ "item_id": 1,
+ "goods_name": "魔爪",
+ "seller_username": "admin",
+ "goods_stock": 100,
+ "goods_img": "http://cdn.souldays.top/image/2021-10-26-bfe7515322954c53a89cd6b93dfdd4f6.jpg",
+ "goods_discribe": "不怕红牛不要命,就怕魔爪技术硬",
+ "goods_category": 2,
+ "goods_price": 6.0,
+ "goods_state": 1
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|goods|商品信息表|List\|-|
+|message|调用信息|String|-|
+
+
+
+## 修改商品库存
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/goods/updateGoodStock
+
+#### 线上
+>http://souldays.top:8083/goods/updateGoodStock
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要修改的商品编号和新的库存
+* 实现通过类别和关键词查询商品信息
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|new_stock|商品库存|int|Y|-|
+|item_id|商品编号|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+# Order
+
+## 查看商品意向购买买家
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/order/searchWantBuyerlistByItemId
+
+#### 线上
+>http://souldays.top:8083/order/searchWantBuyerlistByItemId
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要查询的商品编号和卖家用户名
+* 实现通过商品编号查询商品意向买家
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|seller_username|卖家用户名|String|Y|-|
+|item_id|商品编号|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "orders": [
+ {
+ "order_id": 158,
+ "item_id": 2,
+ "goods_name": "",
+ "goods_img": "",
+ "goods_discribe": null,
+ "goods_price": 0.0,
+ "seller_username": "admin",
+ "buyer_username": "xyWei",
+ "buyer_realname": "纹宗",
+ "buyer_phonenumber": "12345678900",
+ "buyer_address": "浙江工商大学",
+ "buy_sum": 10,
+ "buy_amount": 0.0,
+ "state": 5,
+ "create_time": "2021-11-15 21:16:08",
+ "finish_time": null
+ },
+ {
+ "order_id": 160,
+ "item_id": 2,
+ "goods_name": "",
+ "goods_img": "",
+ "goods_discribe": null,
+ "goods_price": 0.0,
+ "seller_username": "admin",
+ "buyer_username": "xyWei",
+ "buyer_realname": "纹宗",
+ "buyer_phonenumber": "12345678900",
+ "buyer_address": "浙江工商大学",
+ "buy_sum": 10,
+ "buy_amount": 0.0,
+ "state": 5,
+ "create_time": "2021-11-15 21:17:20",
+ "finish_time": null
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|orders|订单信息表|List\|-|
+|message|调用信息|String|-|
+
+
+
+## 同意意向购买买家
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/order/agreeOrderwanted
+
+#### 线上
+>http://souldays.top:8083/order/agreeOrderwanted
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要同意的订单编号和卖家用户名
+* 实现同意商品意向买家
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|seller_username|卖家用户名|String|Y|-|
+|order_id|订单编号|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success",
+ "order": {
+ "order_id": 158,
+ "item_id": 2,
+ "goods_name": "",
+ "goods_img": "",
+ "goods_discribe": null,
+ "goods_price": 0.0,
+ "seller_username": "admin",
+ "buyer_username": "xyWei",
+ "buyer_realname": "纹宗",
+ "buyer_phonenumber": "12345678900",
+ "buyer_address": "浙江工商大学",
+ "buy_sum": 10,
+ "buy_amount": 0.0,
+ "state": 1,
+ "create_time": "2021-11-15 21:16:08",
+ "finish_time": null
+ }
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|order|订单信息|Order|-|
+|message|调用信息|String|-|
+
+
+
+## 完成交易
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/order/finishOrder
+
+#### 线上
+>http://souldays.top:8083/order/finishOrder
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要完成的订单编号和卖家用户名
+* 实现完成奖交易
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|seller_username|卖家用户名|String|Y|-|
+|order_id|订单编号|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 取消交易
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/order/cancelOrder
+
+#### 线上
+>http://souldays.top:8083/order/cancelOrder
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要取消的订单编号和卖家用户名
+* 实现取消交易
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|seller_username|卖家用户名|String|Y|-|
+|order_id|订单编号|int|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 意向买家下单
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/order/addToOrderWanted
+
+#### 线上
+>http://souldays.top:8083/order/addToOrderWanted
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要取消的订单编号和卖家用户名
+* 实现取消交易
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|buyer_username|买家用户名|String|Y|-|
+|item_id|商品编号|int|Y|-|
+|buyer_realname|买家真实姓名|String|N|-|
+|buyer_phonenumber|买家电话|int|N|-|
+|buyer_address|买家地址|String|N|-|
+|buy_sum|购买数量|int|Y|-|
+|buy_amount|订单总金额|float|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 查看历史购买记录
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/order/searchFinishOrderByBuyerUserName
+
+#### 线上
+>http://souldays.top:8083/order/searchFinishOrderByBuyerUserName
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要查询的家买用户名
+* 实现查看历史购买记录
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|buyer_username|买家用户名|String|Y|-|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "orders": [
+ {
+ "order_id": 157,
+ "item_id": 2,
+ "goods_name": "",
+ "goods_img": "",
+ "goods_discribe": null,
+ "goods_price": 0.0,
+ "seller_username": "admin",
+ "buyer_username": "xyWei",
+ "buyer_realname": "纹宗",
+ "buyer_phonenumber": "12345678900",
+ "buyer_address": "浙江工商大学",
+ "buy_sum": 10,
+ "buy_amount": 0.0,
+ "state": 2,
+ "create_time": "2021-11-15 20:58:48",
+ "finish_time": "2021-11-15 22:59:04"
+ },
+ {
+ "order_id": 158,
+ "item_id": 2,
+ "goods_name": "",
+ "goods_img": "",
+ "goods_discribe": null,
+ "goods_price": 0.0,
+ "seller_username": "admin",
+ "buyer_username": "xyWei",
+ "buyer_realname": "纹宗",
+ "buyer_phonenumber": "12345678900",
+ "buyer_address": "浙江工商大学",
+ "buy_sum": 10,
+ "buy_amount": 0.0,
+ "state": 2,
+ "create_time": "2021-11-15 21:16:08",
+ "finish_time": "2021-12-04 10:39:17"
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|orders|订单信息表|List\|-|
+|message|调用信息|String|-|
+
+
+
+# Category
+
+## 添加类别
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/category/addCategory
+
+#### 线上
+>http://souldays.top:8083/category/addCategory
+
+### 2) 调用方式:HTTP post
+
+### 3) 接口描述:
+
+* 传入需要添加的类别类
+* 实现添加类别
+
+### 4) 请求参数:
+
+#### POST参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|category_name|类别名|String|Y|-|
+|parentCategory_id|父类别编号|int|N|无参为父类别|
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
+
+
+
+## 查询父类别
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/category/searchParentCategory
+
+#### 线上
+>http://souldays.top:8083/category/searchParentCategory
+
+### 2) 调用方式:HTTP get
+
+### 3) 接口描述:
+
+* 实现查询父类别
+
+### 4) 请求参数:
+
+#### GET参数: 无
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "categorys": [
+ {
+ "category_id": 1,
+ "category_name": "饮料茶水",
+ "parentCategory_id": 0
+ },
+ {
+ "category_id": 5,
+ "category_name": "娃哈哈",
+ "parentCategory_id": 0
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|categorys|类别信息表|List\|-|
+|message|调用信息|String|-|
+
+
+
+## 查询子类别
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/category/searchChildCategory
+
+#### 线上
+>http://souldays.top:8083/category/searchChildCategory
+
+### 2) 调用方式:HTTP get
+
+### 3) 接口描述:
+
+* 传入需要查询的父类别编号
+* 实现查询子类别
+
+### 4) 请求参数:
+
+#### GET参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|parentCategory_id|父类别编号|int|Y||
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "categories": [
+ {
+ "category_id": 2,
+ "category_name": "白酒",
+ "parentCategory_id": 1
+ },
+ {
+ "category_id": 3,
+ "category_name": "茶饮料",
+ "parentCategory_id": 1
+ },
+ {
+ "category_id": 4,
+ "category_name": "牛奶",
+ "parentCategory_id": 1
+ }
+ ],
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|categorys|类别信息表|List\|-|
+|message|调用信息|String|-|
+
+
+
+## 查询子类别
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/category/deleteCategoryByItemId
+
+#### 线上
+>http://souldays.top:8083/category/deleteCategoryByItemId
+
+### 2) 调用方式:HTTP delete
+
+### 3) 接口描述:
+
+* 传入需要删除的类别编号
+* 实现删除类别
+
+### 4) 请求参数:
+
+#### DELETE参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|category_id|类别编号|int|Y||
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|、
+|message|调用信息|String|-|
+
+
+
+## 修改类别
+
+### 1) 请求地址
+
+#### 本地
+>http://localhost:8083/category/updateCategory
+
+#### 线上
+>http://souldays.top:8083/category/updateCategory
+
+### 2) 调用方式:HTTP delete
+
+### 3) 接口描述:
+
+* 传入需要修改的类别类
+* 实现修改类别
+
+### 4) 请求参数:
+
+#### DELETE参数:
+|字段名称 |字段说明 |类型 |必填 |备注 |
+| -------------|--------------|--------------|--------------| ------|
+|category_id|类别编号|int|Y||
+|parentCategory_id|类别编号|int|Y||
+|category_name|类别编号|String|Y||
+
+### 5) 请求返回结果:
+
+```
+成功
+{
+ "message": "success"
+}
+
+失败
+{
+ "message": "error"
+}
+```
+
+### 6) 请求返回结果参数说明:
+|字段名称 |字段说明 |类型 |备注 |
+| -------------|--------------|--------------|------|
+|message|调用信息|String|-|
diff --git "a/\346\216\245\345\217\243\346\226\207\346\241\243.pdf" "b/\346\216\245\345\217\243\346\226\207\346\241\243.pdf"
index a85856fab8b0b3efc6aa51fb96dc4d7b84ee3773..0c35d559f8fc3aa8d5baf6f876c51c316cd17ef9 100644
Binary files "a/\346\216\245\345\217\243\346\226\207\346\241\243.pdf" and "b/\346\216\245\345\217\243\346\226\207\346\241\243.pdf" differ