diff --git a/ElectronicMallProject.Backend/.vscode/launch.json b/ElectronicMallProject.Backend/.vscode/launch.json
new file mode 100644
index 0000000000000000000000000000000000000000..6552a5d01a1aaaccb9b7550ceaed5fe01a97afe6
--- /dev/null
+++ b/ElectronicMallProject.Backend/.vscode/launch.json
@@ -0,0 +1,33 @@
+{
+ // 使用 IntelliSense 了解相关属性。
+ // 悬停以查看现有属性的描述。
+ // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": ".NET Core Launch (web)",
+ "type": "coreclr",
+ "request": "launch",
+ "preLaunchTask": "build",
+ "program": "${workspaceFolder}/ElectronicMallProject.Backend.Api/bin/Debug/netcoreapp3.1/ElectronicMallProject.Backend.Api.dll",
+ "args": [],
+ "cwd": "${workspaceFolder}/ElectronicMallProject.Backend.Api",
+ "stopAtEntry": false,
+ "serverReadyAction": {
+ "action": "openExternally",
+ "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
+ },
+ "env": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "sourceFileMap": {
+ "/Views": "${workspaceFolder}/Views"
+ }
+ },
+ {
+ "name": ".NET Core Attach",
+ "type": "coreclr",
+ "request": "attach"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/.vscode/tasks.json b/ElectronicMallProject.Backend/.vscode/tasks.json
new file mode 100644
index 0000000000000000000000000000000000000000..c0c8acf88752ba7e82a69c9cee9d5fd5d1b7a064
--- /dev/null
+++ b/ElectronicMallProject.Backend/.vscode/tasks.json
@@ -0,0 +1,42 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "build",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "build",
+ "${workspaceFolder}/ElectronicMallProject.Backend.Api/ElectronicMallProject.Backend.Api.csproj",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "publish",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "publish",
+ "${workspaceFolder}/ElectronicMallProject.Backend.Api/ElectronicMallProject.Backend.Api.csproj",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "watch",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "watch",
+ "run",
+ "${workspaceFolder}/ElectronicMallProject.Backend.Api/ElectronicMallProject.Backend.Api.csproj",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/.gitignore b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..2e9693ed1a9619a49dcd4c7f3e9ea26541ff27d7
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/.gitignore
@@ -0,0 +1,2 @@
+obj
+bin
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/AddRessController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/AddRessController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f85f30a6e715aba96a593630b98fb851fd6c3c42
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/AddRessController.cs
@@ -0,0 +1,188 @@
+using ElectronicMallProject.Backend.Api.Database;
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Repository;
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Params;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ //地址控制器
+ [ApiController]
+ [Route("[controller]")]
+
+ public class AddRessController:ControllerBase
+ {
+ private readonly IRepository
_addressRepository;
+
+ public AddRessController(IRepository addressRepository)
+ {
+ _addressRepository = addressRepository;
+ }
+
+
+ //获取地址表数据
+ [HttpGet]
+ public dynamic getAddRess()
+ {
+ var address = _addressRepository.Table;
+
+ return new
+ {
+ code = 200,
+ data = address,
+ msg = "请求成功"
+ };
+ }
+
+ //添加地址表数据
+ [HttpPost]
+ public dynamic postAddRess(CreateAddRess createAddRess)
+ {
+ //省
+ var province = createAddRess.Province.Trim();
+
+ //市
+ var city = createAddRess.City.Trim();
+
+ //区
+ var district = createAddRess.District.Trim();
+
+ //街道
+ var street = createAddRess.Street.Trim();
+
+ //详细地址
+ var detailedaddress = createAddRess.Detailedaddress.Trim();
+
+ //号码
+ var number = createAddRess.Number.Trim();
+
+ //收件人
+ var addressee = createAddRess.Addressee.Trim();
+
+
+ var address = _addressRepository.Table;
+
+ var res = new AddRess
+ {
+ Province = province,
+ City = city,
+ District = district,
+ Street = street,
+ Detailedaddress = detailedaddress,
+ Number = number,
+ Addressee = addressee
+ };
+
+ _addressRepository.Insert(res);
+
+ return new
+ {
+ code = 200,
+ data = "",
+ msg = "添加成功"
+ };
+ }
+
+
+ //修改地址表信息
+ [HttpPut("{id}")]
+ public dynamic putAddRess(int id , ChangeAddRess changeAddRess)
+ {
+ var address = _addressRepository.GetById(id);
+
+ //省
+ var Province = changeAddRess.Province.Trim();
+
+ //市
+ var city = changeAddRess.City.Trim();
+
+ //区
+ var district = changeAddRess.District.Trim();
+
+ //街道
+ var street = changeAddRess.Street.Trim();
+
+ //详细地址
+ var detailedaddress = changeAddRess.Detailedaddress.Trim();
+
+ //号码
+ var number = changeAddRess.Number.Trim();
+
+ //收件人
+ var addressee = changeAddRess.Addressee.Trim();
+
+
+
+ address.Province = changeAddRess.Province;
+ address.City = changeAddRess.City;
+ address.District = changeAddRess.District;
+ address.Street = changeAddRess.Street;
+ address.Detailedaddress = changeAddRess.Detailedaddress;
+ address.Number = changeAddRess.Number;
+ address.Addressee = changeAddRess.Addressee;
+
+ _addressRepository.Updated(address);
+
+ return new
+ {
+ code = 200,
+ data = address,
+ msg = "修改成功"
+ };
+ }
+
+
+ //冻结信息
+ [HttpPut("{id}/freeze")]
+ public dynamic freezeAddRess(int id)
+ {
+ var address = _addressRepository.GetById(id);
+
+ if (address == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该记录不存在"
+ };
+ }
+ address.IsActived = false;
+ _addressRepository.Updated(address);
+
+ return new
+ {
+ Code = 200,
+ Data = address,
+ Msg = "冻结成功"
+ };
+ }
+
+ //启用
+ [HttpPut("{id}/enable")]
+ public dynamic enableAddRess(int id)
+ {
+ var address = _addressRepository.GetById(id);
+
+ if (address == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该记录不存在"
+ };
+ }
+ address.IsActived = true;
+ _addressRepository.Updated(address);
+
+ return new
+ {
+ Code = 200,
+ Data = address,
+ Msg = "启用成功"
+ };
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/BrandController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/BrandController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ea0e5ca2db7a67539aae032e02ffbe0082213b93
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/BrandController.cs
@@ -0,0 +1,170 @@
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Repository;
+using System.Linq;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ //品牌控制器
+ [ApiController]
+ [Route("[controller]")]
+ public class BrandController : ControllerBase
+ {
+ private IRepository _brandRepository;
+
+ public BrandController(IRepository brandRepository)
+ {
+ _brandRepository = brandRepository;
+ }
+
+
+ //查看所有品牌
+ [HttpGet, Route("BrandGet")]
+ public dynamic brandGet()
+ {
+ var brand = _brandRepository.Table;
+
+ return new
+ {
+ Code = 200,
+ Data = brand,
+ Msg = "获取所有品牌成功"
+ };
+ }
+
+ //添加品牌
+ [HttpPost, Route("AddBrand")]
+ public dynamic AddPost(CreateBrand brand)
+ {
+ var brandname = brand.BrandName.Trim();
+ var logoimgid = brand.logoImgId;
+ var coverimgid = brand.coverImgId;
+
+ if (string.IsNullOrEmpty(brandname))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "品牌名不能为空"
+ };
+ }
+
+ var addbrand = _brandRepository.Table;
+
+ var ishavebrandname = addbrand.Where(x => x.BrandName.Equals(brandname)).ToList();
+
+ if (ishavebrandname.Count() == 0)
+ {
+ var res = new Brand
+ {
+ BrandName = brandname,
+ logoImgId = logoimgid
+ };
+
+ _brandRepository.Insert(res);
+
+ return new
+ {
+ Code = 200,
+ Data = res,
+ Msg = "添加品牌成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该品牌已存在"
+ };
+ }
+ }
+
+ //修改品牌
+ [HttpPut, Route("{id}/updatebrand")]
+ public dynamic updateBrandPut(int id, CreateBrand brand)
+ {
+ var brandname = brand.BrandName.Trim();
+ var logoimgid = brand.logoImgId;
+ var coverimgid = brand.coverImgId;
+
+ var updatebrand = _brandRepository.GetById(id);
+
+ if (updatebrand == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改品牌不存在"
+ };
+ }
+
+ updatebrand.BrandName = brand.BrandName;
+ updatebrand.logoImgId = brand.logoImgId;
+
+ _brandRepository.Updated(updatebrand);
+
+ return new
+ {
+ Code = 200,
+ Data = updatebrand,
+ Msg = "修改品牌成功"
+ };
+ }
+
+ //冻结商品类型
+ [HttpPut, Route("{id}/frozenbrand")]
+ public dynamic frozenPut(int id)
+ {
+ var frozenbrand = _brandRepository.GetById(id);
+
+ if (frozenbrand == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该品牌不存在"
+ };
+ }
+ frozenbrand.IsActived = false;
+ _brandRepository.Updated(frozenbrand);
+
+ return new
+ {
+ Code = 200,
+ Data = frozenbrand,
+ Msg = "冻结品牌成功"
+ };
+ }
+
+ //是否启用商品类型
+ [HttpPut, Route("{id}/enablebrand")]
+ public dynamic enablePut(int id)
+ {
+ var enablebrand = _brandRepository.GetById(id);
+
+ if (enablebrand == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该品牌不存在"
+ };
+ }
+ enablebrand.IsActived = true;
+ _brandRepository.Updated(enablebrand);
+
+ return new
+ {
+ Code = 200,
+ Data = enablebrand,
+ Msg = "启用品牌成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/CarouselsController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/CarouselsController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..76146183c1ddb3684b4b648cc73be25e5956a2dc
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/CarouselsController.cs
@@ -0,0 +1,53 @@
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Repository;
+using System.Collections;
+using System.Linq;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ //轮播图控制器
+ [ApiController]
+ [Route("[controller]")]
+
+ public class CarouselsController : ControllerBase
+ {
+ private readonly IRepository _carouselsRepository;
+ private readonly IRepository _imgsRepository;
+
+ public CarouselsController(IRepository carouselsRepository, IRepository imgsRepository)
+ {
+ _carouselsRepository = carouselsRepository;
+ _imgsRepository = imgsRepository;
+ }
+
+ [HttpGet, Route("imgget")]
+ public dynamic imgGet()
+ {
+ var carousels = _carouselsRepository.Table.ToList();
+ var imgs = _imgsRepository.Table;
+
+ ArrayList arr = new ArrayList();
+
+ foreach (var item in carousels)
+ {
+ var img = imgs.Where(x => x.Id.Equals(item.ImgsId)).FirstOrDefault();
+
+ var tmp = new
+ {
+ id = item.Id,
+ CommodityId = item.CommodityId,
+ ImgsPath = img != null ? img.ImgsPath : ""
+ };
+ arr.Add(tmp);
+ }
+
+ return new
+ {
+ Code = 200,
+ Data = arr,
+ Msg = "获取轮播图成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/CommodityController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/CommodityController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..3c54c44e9587d28b6151864d855baf3ec66c2dbf
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/CommodityController.cs
@@ -0,0 +1,392 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Repository;
+using System.Linq;
+using System.Collections;
+using System.Collections.Generic;
+
+//商品控制器
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class CommodityController : ControllerBase
+ {
+ //图片
+ private IRepository _imgRepository;
+ //商品
+ private IRepository _commodityRepository;
+ //类型
+ private IRepository _shoptypeRepository;
+ //品牌
+ private IRepository _brandRepository;
+ //规格
+ private IRepository _specificationsRepository;
+ private IConfiguration _configuration;
+
+ public CommodityController(IRepository imgRepository, IRepository commodityRepository, IRepository shoptypeRepository,
+ IRepository brandRepository, IRepository specificationsRepository, IConfiguration configuration)
+ {
+ _imgRepository = imgRepository;
+ _commodityRepository = commodityRepository;
+ _shoptypeRepository = shoptypeRepository;
+ _brandRepository = brandRepository;
+ _specificationsRepository = specificationsRepository;
+ _configuration = configuration;
+ // _salesRepository = salesRepository;
+ }
+
+ //查询所有商品
+ [HttpGet]
+ public dynamic Get()
+ {
+ var commodity = _commodityRepository.Table.ToList();
+
+ ArrayList list = new ArrayList();
+
+ foreach (var item in commodity)
+ {
+ var imgpath = _imgRepository.Table.Where(x => x.Id == item.ImgId).FirstOrDefault();
+
+ var brandid = _brandRepository.Table.Where(x => x.Id == item.BrandId).FirstOrDefault();
+
+ var res = new
+ {
+ Id = item.Id,
+ isActived = item.IsActived,
+ isDeleted = item.IsDeleted,
+ createdTime = item.CreatedTime,
+ updatedTime = item.UpdatedTime,
+ displayOrder = item.DisplayOrder,
+ remarks = item.Remarks,
+ CommodityName = item.CommodityName,
+ CommodityCurrentPrice = item.CommodityCurrentPrice,
+ SpecificationsId = item.SpecificationsId,
+ ProductDetails = item.ProductDetails,
+ ProductStocks = item.ProductStocks,
+ SupplierId = item.SupplierId,
+ ShopTypeId = item.ShopTypeId,
+ imgpath = imgpath.ImgsPath,
+ brandname = brandid.BrandName
+ };
+ list.Add(res);
+ }
+
+
+ return new
+ {
+ Code = 200,
+ Data = list,
+ Msg = "查询所有商品成功"
+ };
+}
+
+
+// [HttpGet("{id}")]
+// public dynamic GetComName(int id)
+// {
+
+// ArrayList list = new ArrayList();
+// }
+
+
+//添加商品
+[HttpPost, Route("Addcommodity")]
+public dynamic AddPost(CreateCommodity create)
+{
+ var commodityname = create.CommodityName.Trim();
+ var commoditytype = create.CommodityType.Trim();
+ var commoditycurrentprice = create.CommodityCurrentPrice;
+ var specificationsid = create.SpecificationsId;
+ var productdetails = create.ProductDetails.Trim();
+ var productstocks = create.ProductStocks;
+ var imgid = create.ImgId;
+ var supplierid = create.SupplierId;
+ var brandid = create.BrandId;
+ var shoptypeid = create.ShopTypeId;
+
+ if (string.IsNullOrEmpty(commodityname) && string.IsNullOrEmpty(commoditytype) &&
+ string.IsNullOrEmpty(commoditycurrentprice.ToString()) && string.IsNullOrEmpty(specificationsid.ToString()) &&
+ string.IsNullOrEmpty(productdetails) && string.IsNullOrEmpty(productstocks.ToString()) &&
+ string.IsNullOrEmpty(imgid.ToString()) && string.IsNullOrEmpty(supplierid.ToString()) &&
+ string.IsNullOrEmpty(brandid.ToString()) && string.IsNullOrEmpty(shoptypeid.ToString()))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "请填写完整"
+ };
+ }
+
+ var addcommodity = _commodityRepository.Table;
+
+ var ishavecreate = addcommodity.Where(x => x.CommodityName.Equals(commodityname)).ToList();
+
+ if (ishavecreate.Count() == 0)
+ {
+ var res = new Commodity
+ {
+ CommodityName = commodityname,
+ CommodityType = commoditytype,
+ CommodityCurrentPrice = commoditycurrentprice,
+ SpecificationsId = specificationsid,
+ ProductDetails = productdetails,
+ ProductStocks = productstocks,
+ ImgId = imgid,
+ SupplierId = supplierid,
+ BrandId = brandid,
+ ShopTypeId = shoptypeid
+ };
+ _commodityRepository.Insert(res);
+
+ return new
+ {
+ Code = 200,
+ Data = res,
+ Msg = "添加商品成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该商品已存在"
+ };
+ }
+}
+
+//卖出商品减库存
+[HttpPut, Route("{id}/reducestock")]
+public dynamic ReducePut(int id, CreateCommodity commodity)
+{
+ var commodityname = commodity.CommodityName.Trim();
+ var commodityquantity = commodity.ProductStocks;
+
+ if (!string.IsNullOrEmpty(commodityname) && !string.IsNullOrEmpty(commodityquantity.ToString()))
+ {
+ var reducestock = _commodityRepository.GetById(id);
+
+ if (reducestock == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "出库商品不存在"
+ };
+ }
+
+ reducestock.ProductStocks = reducestock.ProductStocks - commodity.ProductStocks;
+
+ _commodityRepository.Updated(reducestock);
+
+ return new
+ {
+ Code = 200,
+ Data = reducestock,
+ Msg = "商品出库成功"
+ };
+ }
+ return "";
+}
+
+
+//修改商品
+[HttpPut, Route("{id}/Updatecommodity")]
+public dynamic UpdatePut(int id, CreateCommodity commodity)
+{
+ var commodityname = commodity.CommodityName.Trim();
+ var commoditytype = commodity.CommodityType.Trim();
+ var commoditycurrentprice = commodity.CommodityCurrentPrice;
+ var specificationsid = commodity.SpecificationsId;
+ var productdetails = commodity.ProductDetails.Trim();
+ var productstocks = commodity.ProductStocks;
+ var imgid = commodity.ImgId;
+ var supplierid = commodity.SupplierId;
+ var brandid = commodity.BrandId;
+ var shoptypeid = commodity.ShopTypeId;
+
+ if (!string.IsNullOrEmpty(commodityname) && !string.IsNullOrEmpty(commoditytype) &&
+ !string.IsNullOrEmpty(commoditycurrentprice.ToString()) && !string.IsNullOrEmpty(specificationsid.ToString()) &&
+ !string.IsNullOrEmpty(productdetails) && !string.IsNullOrEmpty(productstocks.ToString()) &&
+ !string.IsNullOrEmpty(imgid.ToString()) && !string.IsNullOrEmpty(supplierid.ToString()) &&
+ !string.IsNullOrEmpty(brandid.ToString()) && !string.IsNullOrEmpty(shoptypeid.ToString()))
+ {
+ var updatecommodity = _commodityRepository.GetById(id);
+
+ if (updatecommodity == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改商品不存在"
+ };
+ }
+
+ updatecommodity.CommodityName = commodity.CommodityName;
+ updatecommodity.CommodityType = commodity.CommodityType;
+ updatecommodity.CommodityCurrentPrice = commodity.CommodityCurrentPrice;
+ updatecommodity.SpecificationsId = commodity.SpecificationsId;
+ updatecommodity.ProductDetails = commodity.ProductDetails;
+ updatecommodity.ProductStocks = commodity.ProductStocks;
+ updatecommodity.ImgId = commodity.ImgId;
+ updatecommodity.SupplierId = commodity.SupplierId;
+ updatecommodity.BrandId = commodity.BrandId;
+ updatecommodity.ShopTypeId = commodity.ShopTypeId;
+
+ _commodityRepository.Updated(updatecommodity);
+
+ return new
+ {
+ Code = 200,
+ Data = updatecommodity,
+ Msg = "修改商品成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改商品失败"
+ };
+ }
+}
+
+
+//冻结商品
+[HttpPut, Route("{id}/frozencommodity")]
+public dynamic frozenPut(int id)
+{
+ var frozencommodity = _commodityRepository.GetById(id);
+
+ if (frozencommodity == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该商品不存在"
+ };
+ }
+ frozencommodity.IsActived = false;
+ _commodityRepository.Updated(frozencommodity);
+
+ return new
+ {
+ Code = 200,
+ Data = frozencommodity,
+ Msg = "冻结商品成功"
+ };
+}
+
+//启用商品
+[HttpPut, Route("{id}/enablecommodity")]
+public dynamic enablePut(int id)
+{
+ var enablecommodity = _commodityRepository.GetById(id);
+
+ if (enablecommodity == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该商品不存在"
+ };
+ }
+ enablecommodity.IsActived = true;
+ _commodityRepository.Updated(enablecommodity);
+
+ return new
+ {
+ Code = 200,
+ Data = enablecommodity,
+ Msg = "启用商品成功"
+ };
+}
+
+
+//查看商品表和图片
+[HttpGet, Route("CommodityImgGet")]
+public dynamic imgGet()
+{
+ var commodity = _commodityRepository.Table.ToList();
+
+ ArrayList list = new ArrayList();
+
+ foreach (var item in commodity)
+ {
+ var img = _imgRepository.Table.Where(x => x.Id == item.ImgId).FirstOrDefault();
+
+ var res = new
+ {
+ CommodityName = item.CommodityName,
+ CommodityType = item.CommodityType,
+ CommodityCurrentPrice = item.CommodityCurrentPrice,
+ SpecificationsId = item.SpecificationsId,
+ ProductDetails = item.ProductDetails,
+ ProductStocks = item.ProductStocks,
+ ImgId = item.ImgId,
+ SupplierId = item.SupplierId,
+ BrandId = item.BrandId,
+ ShopTypeId = item.ShopTypeId,
+ imgPath = img.ImgsPath
+ };
+ list.Add(res);
+ }
+ return new
+ {
+ Code = 200,
+ Data = list,
+ Msg = "查询成功"
+ };
+}
+
+
+//查看商品所有分类具体到型号
+[HttpGet, Route("{id}")]
+public dynamic seeGet(int id)
+{
+ var commoditys = _commodityRepository.Table;
+ //商品中含有该品牌
+ // var brand = commodity.Where(x => x.BrandId == id).ToList();
+ //商品中含有该规格
+ // var specifications = commoditys.Where(x =>x.SpecificationsId == id).ToList();
+
+ //对应商品
+ var commodity = commoditys.Where(x => x.Id == id).FirstOrDefault();
+ //商品类型表
+ var shoptypes = _shoptypeRepository.Table;
+ //品牌表
+ var brands = _brandRepository.Table;
+ //规格表
+ var specifications = _specificationsRepository.Table;
+
+
+ //对应商品类型
+ var shoptype = shoptypes.Where(x => x.Id == commodity.ShopTypeId).FirstOrDefault();
+ //对应品牌
+ var brand = brands.Where(x => x.Id == commodity.BrandId).FirstOrDefault();
+ //对应规格
+ var specification = specifications.Where(x => x.Id == commodity.SpecificationsId).FirstOrDefault();
+
+
+
+
+ return new
+ {
+ Code = 200,
+ Data = new { shoptype = shoptype, brand = brand, specification = specification },
+ Msg = "查询成功"
+ };
+
+}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/FileUploadProcessingController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/FileUploadProcessingController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d1131e7b26312bb12a4a86522a68ba6b3b4981e5
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/FileUploadProcessingController.cs
@@ -0,0 +1,49 @@
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Repository;
+using ElectronicMallProject.Backend.Api.Entity;
+using Microsoft.AspNetCore.Hosting;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ //文件上传控制器
+ [ApiController]
+ [Route("[controller]")]
+ public class FileUploadProcessingController : ControllerBase
+ {
+ private readonly IRepository _imgsRepository;
+ private readonly IWebHostEnvironment _iWebHostEnvironment;
+
+ public FileUploadProcessingController(IRepository imgsRepository, IWebHostEnvironment iWebHostEnvironment)
+ {
+ _imgsRepository = imgsRepository;
+ _iWebHostEnvironment = iWebHostEnvironment;
+ }
+
+ //文件上传
+ [HttpPost,Route("FileUpload")]
+ public dynamic FileUpload ()
+ {
+ var file=Request.Form.Files;
+ var filePath= FilesHelper.UpImgs(file,_iWebHostEnvironment,_imgsRepository);
+
+ var sql = new Imgs
+ {
+ ImgsPath = filePath
+ };
+ _imgsRepository.Insert(sql);
+
+ return sql;
+ }
+
+ //查看图片
+ [HttpGet,Route("imgs")]
+ public dynamic Getimgs()
+ {
+ var imgs = _imgsRepository.Table;
+
+ return new {
+ imgs
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SalesController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SalesController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..929a800dabcdaae0fc6d3479b6f60cf029942428
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SalesController.cs
@@ -0,0 +1,285 @@
+
+using ElectronicMallProject.Backend.Api.Repository;
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Params;
+using System.Linq;
+using System.Collections;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+
+ //销售控制器
+ [ApiController]
+ [Route("[controller]")]
+ public class SalesController : ControllerBase
+ {
+ private readonly IRepository _salesRepository;
+ private readonly IRepository _commodityRepository;
+ private readonly IRepository _usersRepository;
+ private readonly IRepository _shoppingcartRepository;
+
+ public SalesController(IRepository salesRepository , IRepository commodityRepository , IRepository usersRepository , IRepository shoppingResitory)
+
+ {
+ _salesRepository = salesRepository;
+ _commodityRepository = commodityRepository;
+ _usersRepository = usersRepository;
+ _shoppingcartRepository = shoppingResitory;
+ }
+
+
+ //获取表数据
+ [HttpGet]
+ public dynamic getSales()
+ {
+ var sales = _salesRepository.Table;
+ return new
+ {
+ code = 200,
+ data = sales,
+ msg = "请求成功"
+ };
+ }
+
+
+ //订单表商品表连接查询
+ [HttpGet("{id}")]
+ public dynamic GetCom(int id)
+ {
+
+ var uu = _salesRepository.Table.Where(x => x.UserId == id).ToList();
+
+ ArrayList list = new ArrayList();
+ foreach (var item in uu)
+ {
+ var children = _commodityRepository.Table.Where(x => x.Id == item.CommodityId).FirstOrDefault();
+ var otherUserId = _shoppingcartRepository.Table.Where(x => x.UserId != id).FirstOrDefault();
+
+ var otherId = otherUserId.UserId;
+
+ var res = new
+ {
+ Id = item.Id,
+ SalesNumber = item.SalesNumber,
+ Date = item.Date,
+ NumberOfSingleProductItems = item.NumberOfSingleProductItems,
+ TotalNumberOfObjects = item.TotalNumberOfObjects,
+ SingleAmount = item.SingleAmount,
+ TotalMoney = item.TotalMoney,
+ PaymentMethod = item.PaymentMethod.Trim(),
+ UserId = item.UserId,
+ CommodityId = item.CommodityId,
+ LogisticsInformation = item.LogisticsInformation.Trim(),
+ DeliveryTime = item.DeliveryTime,
+ SalesStatus = item.SalesStatus.Trim(),
+ PaymentStatus = item.PaymentStatus.Trim(),
+ PaymentAmount = item.PaymentAmount,
+ BuyerStatus = item.BuyerStatus,
+ IsActived = item.IsActived,
+ IsDeleted = item.IsDeleted,
+ Remarks = item.Remarks,
+ UpdatedTime = item.UpdatedTime,
+ CommodityName = children.CommodityName,
+ CommodityCurrentPrice = children.CommodityCurrentPrice,
+ otherUserId = otherId
+ };
+ list.Add(res);
+ }
+
+ // var result = from commodity in _commodityRepository join sales in _salesRepository
+ // on commodity.id equals sales.CommodityId select new (commodity , sales);
+
+ return new
+ {
+ Code = 200,
+ Data = list,
+ Msg = "请求成功"
+ };
+ }
+
+
+ //添加
+ [HttpPost]
+ public dynamic postSales(CreateSales createSales)
+ {
+ //订单号
+ var salesNumber = createSales.SalesNumber.Trim();
+ //日期
+ var date = createSales.Date;
+ //单个商品物件数
+ var numberOfSingleProductItems = createSales.NumberOfSingleProductItems;
+ //总物件数
+ var totalNumberOfObjects = createSales.TotalNumberOfObjects;
+ //单笔金额
+ var singleAmount = createSales.SingleAmount;
+ //总金额
+ var totalMoney = createSales.TotalMoney;
+ //支付方式
+ var paymentMethod = createSales.PaymentMethod.Trim();
+ //用户Id
+ var userId = createSales.UserId;
+ //商品Id
+ var commodityId = createSales.CommodityId;
+ //物流信息
+ var logisticsInformation = createSales.LogisticsInformation.Trim();
+ //发货时间
+ var deliveryTime = createSales.DeliveryTime;
+ //订单状态
+ var salesStatus = createSales.SalesStatus.Trim();
+ //支付状态
+ var paymentStatus = createSales.PaymentStatus.Trim();
+ //实际付款金额
+ var paymentAmount = createSales.PaymentAmount;
+ //买家状态
+ var buyerStatus = createSales.BuyerStatus;
+
+ var addSales = new Sales
+ {
+ SalesNumber = salesNumber,
+ Date = date,
+ NumberOfSingleProductItems = numberOfSingleProductItems,
+ TotalNumberOfObjects = totalNumberOfObjects,
+ SingleAmount = singleAmount,
+ TotalMoney = totalMoney,
+ PaymentMethod = paymentMethod,
+ UserId = userId,
+ CommodityId = commodityId,
+ LogisticsInformation = logisticsInformation,
+ DeliveryTime = deliveryTime,
+ SalesStatus = salesStatus,
+ PaymentStatus = paymentStatus,
+ PaymentAmount = paymentAmount,
+ BuyerStatus = buyerStatus,
+ };
+ _salesRepository.Insert(addSales);
+
+ return new
+ {
+ code = 200,
+ data = "",
+ msg = "添加成功"
+ };
+ }
+
+
+ [HttpPut("{id}")]
+ public dynamic putSales(int id , ChangeSales changesales)
+ {
+ var salesForId = _salesRepository.GetById(id);
+
+ //订单号
+ var SalesNumber = changesales.SalesNumber.Trim();
+ //日期
+ var Date = changesales.Date;
+ //单个商品物件数
+ var NumberOfSingleProductItems = changesales.NumberOfSingleProductItems;
+ //总物件数
+ var TotalNumberOfObjects = changesales.TotalNumberOfObjects;
+ //单笔金额
+ var SingleAmount = changesales.SingleAmount;
+ //总金额
+ var TotalMoney = changesales.TotalMoney;
+ //支付方式
+ var PaymentMethod = changesales.PaymentMethod.Trim();
+ //用户Id
+ var UserId = changesales.UserId;
+ //商品Id
+ var CommodityId = changesales.CommodityId;
+ //物流信息
+ var LogisticsInformation = changesales.LogisticsInformation.Trim();
+ //发货时间
+ var DeliveryTime = changesales.DeliveryTime;
+ //订单状态
+ var SalesStatus = changesales.SalesStatus.Trim();
+ //支付状态
+ var PaymentStatus = changesales.PaymentStatus.Trim();
+ //实际付款金额
+ var PaymentAmount = changesales.PaymentAmount;
+ //买家状态
+ var BuyerStatus = changesales.BuyerStatus;
+
+
+ salesForId.SalesNumber = changesales.SalesNumber;
+ salesForId.Date = changesales.Date;
+ salesForId.NumberOfSingleProductItems = changesales.NumberOfSingleProductItems;
+ salesForId.TotalNumberOfObjects = changesales.TotalNumberOfObjects;
+ salesForId.SingleAmount = changesales.SingleAmount;
+ salesForId.TotalMoney = changesales.TotalMoney;
+ salesForId.PaymentMethod = changesales.PaymentMethod;
+ salesForId.UserId = changesales.UserId;
+ salesForId.CommodityId = changesales.CommodityId;
+ salesForId.LogisticsInformation = changesales.LogisticsInformation;
+ salesForId.DeliveryTime = changesales.DeliveryTime;
+ salesForId.SalesStatus = changesales.SalesStatus;
+ salesForId.PaymentAmount = changesales.PaymentAmount;
+ salesForId.BuyerStatus = changesales.BuyerStatus;
+
+
+ _salesRepository.Updated(salesForId);
+
+ return new
+ {
+ code = 200,
+ data = salesForId,
+ msg = "修改成功"
+ };
+ }
+
+
+ //冻结销售信息
+ [HttpPut("{id}/freeze")]
+ public dynamic freezeSales(int id)
+ {
+ var sales = _salesRepository.GetById(id);
+
+ if (sales == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该记录不存在"
+ };
+ }
+ sales.IsActived = false;
+ _salesRepository.Updated(sales);
+
+ return new
+ {
+ Code = 200,
+ Data = sales,
+ Msg = "冻结成功"
+ };
+ }
+
+
+ [HttpPut("{id}/enable")]
+ public dynamic enableSales(int id)
+ {
+ var sales = _salesRepository.GetById(id);
+
+ if (sales == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该记录不存在"
+ };
+ }
+ sales.IsActived = true;
+ _salesRepository.Updated(sales);
+
+ return new
+ {
+ Code = 200,
+ Data = sales,
+ Msg = "启用成功"
+ };
+ }
+
+ }
+}
+
+
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/ShopTypeController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/ShopTypeController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..02d6bb8d3a5c85ecf96690c929327f1cddb72d98
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/ShopTypeController.cs
@@ -0,0 +1,249 @@
+using Microsoft.AspNetCore.Mvc;
+using System.Linq;
+using ElectronicMallProject.Backend.Api.Entity;
+using Microsoft.Extensions.Configuration;
+using ElectronicMallProject.Backend.Api.Repository;
+using System.Collections;
+
+//商品类型控制器
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class ShopTypeController : ControllerBase
+ {
+ //商品类型表
+ private IRepository _shoptyperepository;
+ private IConfiguration _configuration;
+
+ public ShopTypeController(IRepository shoptyperepository, IConfiguration configuration)
+ {
+ _shoptyperepository = shoptyperepository;
+ _configuration = configuration;
+ }
+
+
+ //获取所有商品类型
+ [HttpGet, Route("get")]
+ public dynamic Get()
+ {
+ var shop = _shoptyperepository.Table;
+ return new
+ {
+ Code = 200,
+ Data = shop,
+ Msg = "获取所有商品类型成功"
+ };
+ }
+
+ //通过id获取商品类型
+ [HttpGet, Route("{id}/getshop")]
+ public dynamic shopGet(int id)
+ {
+ var shop = _shoptyperepository.GetById(id);
+
+ return new
+ {
+ Code = 200,
+ Data = shop,
+ Msg = "获取所有商品类型成功"
+ };
+ }
+
+ //添加商品类型
+ [HttpPost, Route("addshop")]
+ public dynamic addPost(ChangeShopType shopType)
+ {
+ var shoptypename = shopType.ShopTypeName.Trim();
+ var superiorshoptypeid = shopType.SuperiorShopTypeId;
+ var measure = shopType.Measure.Trim();
+ var shoptypeiconid = shopType.ShopTypeIconId;
+ var filterproperties = shopType.FilterProperties.Trim();
+ var keyword = shopType.keyword.Trim();
+
+ if (string.IsNullOrEmpty(shoptypename) && string.IsNullOrEmpty(superiorshoptypeid.ToString()))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "请填写完整"
+ };
+ }
+
+ var shoptype = _shoptyperepository.Table;
+
+ var ishaveshoptypename = shoptype.Where(x => x.ShopTypeName.Equals(shoptypename)).ToList();
+
+ if (ishaveshoptypename.Count() == 0)
+ {
+ var res = new ShopType
+ {
+ ShopTypeName = shoptypename,
+ SuperiorShopTypeId = superiorshoptypeid,
+ Measure = measure,
+ ShopTypeIconId = shoptypeiconid,
+ FilterProperties = filterproperties,
+ keyword = keyword
+ };
+
+ _shoptyperepository.Insert(res);
+
+ return new
+ {
+ Code = 200,
+ Data = res,
+ Msg = "添加商品类型成功"
+ };
+ }
+
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该商品类型已存在"
+ };
+
+ }
+
+ //修改商品类型
+ [HttpPut, Route("{id}/updateshop")]
+ public dynamic updateshopPut(int id, ChangeShopType shopType)
+ {
+ var shoptypename = shopType.ShopTypeName.Trim();
+ var superiorshoptypeid = shopType.SuperiorShopTypeId;
+ var measure = shopType.Measure.Trim();
+ var shoptypeiconid = shopType.ShopTypeIconId;
+ var filterproperties = shopType.FilterProperties.Trim();
+ var keyword = shopType.keyword.Trim();
+
+ if (!string.IsNullOrEmpty(shoptypename) && !string.IsNullOrEmpty(superiorshoptypeid.ToString()) )
+ {
+ var updateshop = _shoptyperepository.GetById(id);
+
+ if (updateshop == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改商品类型不存在"
+ };
+ }
+
+ updateshop.ShopTypeName = shopType.ShopTypeName;
+ updateshop.SuperiorShopTypeId = shopType.SuperiorShopTypeId;
+ updateshop.Measure = shopType.Measure;
+ updateshop.FilterProperties = shopType.FilterProperties;
+ updateshop.keyword = shopType.keyword;
+
+ _shoptyperepository.Updated(updateshop);
+
+ return new
+ {
+ Code = 200,
+ Data = updateshop,
+ Msg = "修改商品类型成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改商品类型失败"
+ };
+ }
+
+ }
+
+ //冻结商品类型
+ [HttpPut, Route("{id}/frozenshop")]
+ public dynamic frozenPut(int id)
+ {
+ var frozenshop = _shoptyperepository.GetById(id);
+
+ if (frozenshop == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该商品类型不存在"
+ };
+ }
+ frozenshop.IsActived = false;
+ _shoptyperepository.Updated(frozenshop);
+
+ return new
+ {
+ Code = 200,
+ Data = frozenshop,
+ Msg = "冻结商品类型成功"
+ };
+ }
+
+ //是否启用商品类型
+ [HttpPut, Route("{id}/enableshop")]
+ public dynamic enablePut(int id)
+ {
+ var enableshop = _shoptyperepository.GetById(id);
+
+ if (enableshop == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该商品类型不存在"
+ };
+ }
+ enableshop.IsActived = !enableshop.IsActived;
+ _shoptyperepository.Updated(enableshop);
+
+ return new
+ {
+ Code = 200,
+ Data = enableshop,
+ Msg = "启用商品类型成功"
+ };
+ }
+
+ //通过商品id查询上一级和本级
+ [HttpGet,Route("{id}")]
+ public dynamic GradeGet(int id)
+ {
+ var shop = _shoptyperepository.Table;
+ var Grade = _shoptyperepository.Table.Where(x=>x.SuperiorShopTypeId == id).ToList();
+ ArrayList list = new ArrayList();
+ foreach (var item in Grade)
+ {
+ var children = _shoptyperepository.Table.Where(x=>x.SuperiorShopTypeId == item.Id).ToList();
+ var res = new {
+ Id = item.Id,
+ SuperiorShopTypeId = item.SuperiorShopTypeId,
+ ShopTypeName= item.ShopTypeName,
+ ShopTypeIconId = item.ShopTypeIconId,
+ IsActived = item.IsActived,
+ IsDeleted = item.IsDeleted,
+ keyword = item.keyword,
+ Measure = item.Measure,
+ Remarks = item.Remarks,
+ UpdatedTime = item.UpdatedTime,
+ children = children
+ };
+ list.Add(res);
+ }
+
+ return new
+ {
+ Code = 200,
+ Data = list,
+ Msg = "查询成功"
+ };
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/ShoppingCartController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/ShoppingCartController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..29a93aac7ae45d909294ecdd3ee8ee6e621c2d92
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/ShoppingCartController.cs
@@ -0,0 +1,307 @@
+using System.Linq;
+using ElectronicMallProject.Backend.Api.Repository;
+using Microsoft.Extensions.Configuration;
+using ElectronicMallProject.Backend.Api.Entity;
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Params;
+using System.Collections;
+using Microsoft.EntityFrameworkCore;
+
+//购物车表
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class ShoppingCartController : ControllerBase
+
+ {
+ //图片表
+ private IRepository _imgRepository;
+ //购物车
+ private IRepository _shoppingcartRepository;
+ //规格表
+ private IRepository _specificationsRepository;
+ //商品表
+ private IRepository _commodityRepository;
+ //品牌表
+ private IRepository _brandRepository;
+ //类型表
+ private IRepository _shoptypeRepository;
+ private IConfiguration _configuration;
+
+ public ShoppingCartController(IRepository imgRepository,IRepository shoptypeRepository,IRepository brandRepository,
+ IRepository shoppingcartRepository, IConfiguration configuration ,
+ IRepository specificationsRepository ,IRepository commodityRepository)
+ {
+ _imgRepository = imgRepository;
+ _shoptypeRepository = shoptypeRepository;
+ _brandRepository = brandRepository;
+ _shoppingcartRepository = shoppingcartRepository;
+ _configuration = configuration;
+ _specificationsRepository = specificationsRepository;
+ _commodityRepository = commodityRepository;
+ }
+
+ //查询所有购物车
+ [HttpGet]
+ public dynamic Get()
+ {
+ var shoppingcart = _shoppingcartRepository.Table;
+
+ return new
+ {
+ Card = 200,
+ Data = shoppingcart,
+ Msg = "查询购物车成功"
+ };
+ }
+
+ //通过用户Id后去该用户购物车记录
+ [HttpGet("{id}/uid")]
+ public dynamic getByUid(int id)
+ {
+ var shop = _shoppingcartRepository.Table.Where(x => x.UserId == id).ToList();
+
+ return new
+ {
+ code = 200,
+ data = shop,
+ msg = "请求成功"
+ };
+ }
+
+ //通过用户Id查找该用户购物车记录同时获取商品表,类型表,品牌表
+ [HttpGet,Route("{id}/getuserId")]
+ public dynamic UserIdGet(int id)
+ {
+ var shoppingCart = _shoppingcartRepository.Table.Where(x =>x.UserId ==id).ToList();
+ ArrayList list = new ArrayList();
+ foreach (var item in shoppingCart)
+ {
+ var commoditys = _commodityRepository.Table.Where(x =>x.Id == item.CommodityId).ToList();
+ foreach (var commodity in commoditys)
+ {
+ var ShopType = _shoptypeRepository.Table.Where(x =>x.Id == commodity.ShopTypeId).FirstOrDefault();
+ var brand = _brandRepository.Table.Where(x=>x.Id == commodity.BrandId).FirstOrDefault();
+ var specification = _specificationsRepository.Table.Where(x=>x.Id == commodity.SpecificationsId).FirstOrDefault();
+ var img = _imgRepository.Table.Where(x =>x.Id == commodity.ImgId).FirstOrDefault();
+
+ var res = new
+ {
+ Id= commodity.Id,
+ CommodityName = commodity.CommodityName,
+ IsActived = commodity.IsActived,
+ IsDeleted = commodity.IsDeleted,
+ Remarks = commodity.Remarks,
+ UpdatedTime = commodity.UpdatedTime,
+ CommodityCurrentPrice = commodity.CommodityCurrentPrice,
+ ShopType=ShopType.ShopTypeName,
+ brand = brand.BrandName,
+ specification = specification.SpecificationsName,
+ imgpath = img.ImgsPath
+ };
+ list.Add(res);
+ }
+ }
+ return new
+ {
+ code = 200,
+ data = list,
+ msg = "请求成功"
+ };
+ }
+
+
+ //通过用户Id查找该用户购物车记录同时获取商品表信息
+ [HttpGet("{id}")]
+ public dynamic getByUserId(int id)
+ {
+ var shoppingcart = _shoppingcartRepository.Table.Where(x => x.UserId == id).ToList();
+
+
+ ArrayList list = new ArrayList();
+
+ foreach (var item in shoppingcart)
+ {
+ var commoditys = _commodityRepository.Table.Where(x => x.Id == item.CommodityId).ToList();
+
+ foreach (var commodity in commoditys)
+ {
+ var specification = _specificationsRepository.Table.Where(x =>x.Id == commodity.SpecificationsId).ToList();
+ var res = new {
+ Id= commodity.Id,
+ CommodityName = commodity.CommodityName,
+ IsActived = commodity.IsActived,
+ IsDeleted = commodity.IsDeleted,
+ Remarks = commodity.Remarks,
+ UpdatedTime = commodity.UpdatedTime,
+ CommodityCurrentPrice = commodity.CommodityCurrentPrice,
+ SpecificationsId = specification
+ };
+ list.Add(res);
+ }
+ // var res = new
+ // {
+ // Id = item.Id,
+ // CommodityId = item.CommodityId,
+ // UserId = item.UserId,
+ // IsActived = item.IsActived,
+ // IsDeleted = item.IsDeleted,
+ // Remarks = item.Remarks,
+ // UpdatedTime = item.UpdatedTime,
+ // children = children,
+ // };
+
+ }
+ return new
+ {
+ code = 200,
+ data = list,
+ msg = "请求成功"
+ };
+ }
+
+ //添加到购物车
+ [HttpPost, Route("Addshoppingcart")]
+ public dynamic AddPost(CreateShoppingCart ShoppingCart)
+ {
+ var CommodityId = ShoppingCart.CommodityId;
+ var UserId = ShoppingCart.UserId;
+
+ if (string.IsNullOrEmpty(CommodityId.ToString()) && string.IsNullOrEmpty(UserId.ToString()))
+ {
+ return new
+ {
+ Card = 104,
+ Data = "",
+ Msg = "请填写完整"
+ };
+ }
+
+ var shoppingcart = _shoppingcartRepository.Table;
+ var commoditys =_commodityRepository.Table;
+
+ // var ishaveCommodityId = commoditys.Where(x => x.Id.Equals(CommodityId)).ToList();
+
+ // if (ishaveCommodityId.Count() == 0)
+ // {
+ var res = new ShoppingCart
+ {
+ CommodityId = CommodityId,
+ UserId = UserId
+ };
+
+ _shoppingcartRepository.Insert(res);
+
+ return new
+ {
+ Code = 200,
+ Data = res,
+ Msg = "添加购物车成功"
+ };
+ // }
+ // return new
+ // {
+ // Code = 104,
+ // Data = "",
+ // Msg = "该购物车已存在"
+ // };
+
+ }
+
+ //修改购物车
+ [HttpPut, Route("{id}/Updateshoppingcart")]
+ public dynamic UpdatePut(int id, CreateShoppingCart shoppingCart)
+ {
+ var CommodityId = shoppingCart.CommodityId;
+ var UserId = shoppingCart.UserId;
+
+ if (string.IsNullOrEmpty(CommodityId.ToString()) && string.IsNullOrEmpty(UserId.ToString()))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "请填写完整"
+ };
+ }
+
+ var updateshoppingcart = _shoppingcartRepository.GetById(id);
+
+ if (updateshoppingcart == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "找不到该购物车"
+ };
+ }
+
+ updateshoppingcart.CommodityId = shoppingCart.CommodityId;
+ updateshoppingcart.UserId = shoppingCart.UserId;
+
+ _shoppingcartRepository.Updated(updateshoppingcart);
+
+ return new
+ {
+ Code = 200,
+ Data = updateshoppingcart,
+ Msg = "修改购物车成功"
+ };
+ }
+
+ //冻结购物车
+ [HttpPut, Route("{id}/frozenshoppingcart")]
+ public dynamic frozenPut(int id)
+ {
+ var frozenshoppingcart = _shoppingcartRepository.GetById(id);
+
+ if (frozenshoppingcart == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该购物车不存在"
+ };
+ }
+ frozenshoppingcart.IsActived = false;
+ _shoppingcartRepository.Updated(frozenshoppingcart);
+
+ return new
+ {
+ Code = 200,
+ Data = frozenshoppingcart,
+ Msg = "冻结购物车成功"
+ };
+ }
+
+ //启用购物车
+ [HttpPut, Route("{id}/enableshoppingcart")]
+ public dynamic enablePut(int id)
+ {
+ var enableshoppingcart = _shoppingcartRepository.GetById(id);
+
+ if (enableshoppingcart == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该购物车不存在"
+ };
+ }
+ enableshoppingcart.IsActived = true;
+ _shoppingcartRepository.Updated(enableshoppingcart);
+
+ return new
+ {
+ Code = 200,
+ Data = enableshoppingcart,
+ Msg = "启用购物车成功"
+ };
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SpecificationsController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SpecificationsController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..1f34626e808250ec7cff65dad3cbb2de68852881
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SpecificationsController.cs
@@ -0,0 +1,180 @@
+using Microsoft.AspNetCore.Mvc;
+using System.Linq;
+using ElectronicMallProject.Backend.Api.Entity;
+using Microsoft.Extensions.Configuration;
+using ElectronicMallProject.Backend.Api.Repository;
+
+
+//规格控制器
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class SpecificationsController : ControllerBase
+ {
+ private IRepository _specificationsRepository;
+ private IConfiguration _configuration;
+
+ public SpecificationsController(IRepository specificationsRepository, IConfiguration configuration)
+ {
+ _specificationsRepository = specificationsRepository;
+ _configuration = configuration;
+ }
+
+ //查询所有规格
+ [HttpGet]
+ public dynamic Get()
+ {
+ var specifications = _specificationsRepository.Table;
+
+ return new
+ {
+ Code = 200,
+ Data = specifications,
+ Msg = "查询规格成功"
+ };
+ }
+
+ //添加规格
+ [HttpPost, Route("Addspecifications")]
+ public dynamic AddPost(CreateSpecifications specifications)
+ {
+ var specificationsname = specifications.SpecificationsName.Trim();
+ var commodityid = specifications.CommodityId;
+
+ if (string.IsNullOrEmpty(specificationsname) && string.IsNullOrEmpty(commodityid.ToString()))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "规格名称不能为空"
+ };
+ }
+
+ var Addspecifications = _specificationsRepository.Table;
+
+ var ishavespecifications = Addspecifications.Where(x => x.SpecificationsName.Equals(specificationsname)).ToList();
+
+ if (ishavespecifications.Count() == 0)
+ {
+ var res = new Specifications
+ {
+ SpecificationsName = specificationsname,
+ CommodityId = commodityid
+ };
+
+ _specificationsRepository.Insert(res);
+
+ return new
+ {
+ Code = 200,
+ Data = res,
+ Msg = "添加规格成功"
+ };
+ }
+ return "";
+ }
+
+ //修改规格
+ [HttpPut, Route("{id}/updatespecifications")]
+ public dynamic UpdatePut(int id, CreateSpecifications specifications)
+ {
+ var specificationsname = specifications.SpecificationsName.Trim();
+ var commodityid = specifications.CommodityId;
+
+ if (!string.IsNullOrEmpty(specificationsname) && !string.IsNullOrEmpty(commodityid.ToString()))
+ {
+ var updatespecifications = _specificationsRepository.GetById(id);
+
+ if (updatespecifications == null)
+ {
+ return new
+ {
+ Code = 200,
+ Data = "",
+ Msg = "要修改的规格不存在"
+ };
+ }
+
+ updatespecifications.SpecificationsName = specifications.SpecificationsName;
+ updatespecifications.CommodityId = specifications.CommodityId;
+
+ _specificationsRepository.Updated(updatespecifications);
+
+ return new
+ {
+ Code = 200,
+ Data = updatespecifications,
+ Msg = "修改规格成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改规格失败"
+ };
+ }
+
+ }
+
+ //冻结规格
+ [HttpPut, Route("{id}/frozenspecifications")]
+ public dynamic frozenPut(int id)
+ {
+ var frozenspecifications = _specificationsRepository.GetById(id);
+
+ if (frozenspecifications == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该规格不存在"
+ };
+ }
+
+ frozenspecifications.IsActived = false;
+
+ _specificationsRepository.Updated(frozenspecifications);
+
+ return new
+ {
+ Code = 200,
+ Data = frozenspecifications,
+ Msg = "冻结规格成功"
+ };
+ }
+
+ //启用规格
+ [HttpPut, Route("{id}/enablespecifications")]
+ public dynamic enablePut(int id)
+ {
+ var enablespecifications = _specificationsRepository.GetById(id);
+
+ if (enablespecifications == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该规格不存在"
+ };
+ }
+
+ enablespecifications.IsActived = true;
+
+ _specificationsRepository.Updated(enablespecifications);
+
+ return new
+ {
+ Code = 200,
+ Data = enablespecifications,
+ Msg = "启用规格成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SupplierController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SupplierController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d8292de377dbf5ea6bfad8a1b898b484dc24259e
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/SupplierController.cs
@@ -0,0 +1,171 @@
+using System.Linq;
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Repository;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using ElectronicMallProject.Backend.Api.Params;
+
+//供应商控制器
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class SupplierController : ControllerBase
+ {
+ //供应商表
+ private IRepository _specificationsRepository;
+ private IConfiguration _configuration;
+ public SupplierController(IRepository specificationsRepository, IConfiguration configuration)
+ {
+ _specificationsRepository = specificationsRepository;
+
+ _configuration = configuration;
+ }
+
+ //获取所有供应商
+ [HttpGet, Route("Get")]
+ public dynamic Get()
+ {
+ var specifications = _specificationsRepository.Table;
+ return new
+ {
+ Code = 200,
+ Data = specifications,
+ Msg = "获取所有供应商成功"
+ };
+ }
+
+ //添加供应商
+ [HttpPost, Route("Addspecifications")]
+ public dynamic SpecificationsPost(CreateSpecifications specifications)
+ {
+ var specificationsname = specifications.SpecificationsName.Trim();
+
+ if (string.IsNullOrEmpty(specificationsname))
+ {
+ return new
+ {
+ Code = 104,
+ Data = specificationsname,
+ Msg = "请输入供应商"
+ };
+ }
+
+ var Specifications = _specificationsRepository.Table;
+ var ishaveSpecifications = Specifications.Where(x => x.SpecificationsName.Equals(specificationsname)).ToList();
+
+ if (ishaveSpecifications.Count() == 0)
+ {
+ var res = new Specifications
+ {
+ SpecificationsName = specificationsname
+ };
+ _specificationsRepository.Insert(res);
+
+ return new
+ {
+ Code = 200,
+ Data = res,
+ Msg = "添加供应商成功"
+ };
+ }
+
+ return "";
+ }
+
+ //修改供应商
+ [HttpPut, Route("{id}/Changespecifications")]
+ public dynamic Put(int id, ChangeSpecifications change)
+ {
+ var specificationsname = change.SpecificationsName.Trim();
+
+ if (!string.IsNullOrEmpty(specificationsname))
+ {
+ var specifications = _specificationsRepository.GetById(id);
+
+ if (specifications == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改供应商不存在"
+ };
+ }
+
+ specifications.SpecificationsName = change.SpecificationsName;
+
+ _specificationsRepository.Updated(specifications);
+
+ return new
+ {
+ Code = 200,
+ Data = specifications,
+ Msg = "修改供应商成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "修改供应商失败"
+ };
+ }
+ }
+
+
+ //冻结供应商
+ [HttpPut, Route("{id}/Frozenspecifications")]
+ public dynamic frozenPut(int id)
+ {
+ var specifications = _specificationsRepository.GetById(id);
+
+ if (specifications == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该供应商不存在"
+ };
+ }
+ specifications.IsActived = false;
+ _specificationsRepository.Insert(specifications);
+
+ return new
+ {
+ Code = 200,
+ Data = specifications,
+ Msg = "冻结用户成功"
+ };
+ }
+
+ //启用供应商
+ [HttpPut, Route("{id}/Enablespecifications")]
+ public dynamic enablePut(int id)
+ {
+ var specifications = _specificationsRepository.GetById(id);
+
+ if (specifications == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该供应商不存在"
+ };
+ }
+ specifications.IsActived = true;
+ _specificationsRepository.Updated(specifications);
+
+ return new
+ {
+ Code = 200,
+ Data = specifications,
+ Msg = "启用供应商成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/UserinfoController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/UserinfoController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..e573a90a4d350dfa5fd73e28ce7225cf7b03ac45
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/UserinfoController.cs
@@ -0,0 +1,149 @@
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Repository;
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Params;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ //用户信息控制器
+ [ApiController]
+ [Route("[controller]")]
+ public class UserinfoController : ControllerBase
+ {
+ private readonly IRepository _userInfoRepository;
+
+ public UserinfoController(IRepository userInfoRepository)
+ {
+ _userInfoRepository = userInfoRepository;
+ }
+
+
+ //获取用户信息表
+ [HttpGet]
+ public dynamic getUserInfo()
+ {
+ var userInfo = _userInfoRepository.Table;
+
+ return new
+ {
+ code = 200,
+ data = userInfo,
+ msg = "请求成功"
+ };
+ }
+
+ [HttpPost]
+ public dynamic postUserInfo(CreateUserInfo createUserInfo)
+ {
+ var userId = createUserInfo.UserId;
+ var imgId = createUserInfo.ImgId;
+ var cardType = createUserInfo.CardType;
+ var cardNumber = createUserInfo.CardNumber;
+ var sex = createUserInfo.Sex;
+ var phoneNum = createUserInfo.phoneNumber;
+
+ var res = new UserInfo
+ {
+ UserId = userId,
+ ImgId = imgId,
+ CardType = cardType,
+ CardNumber = cardNumber,
+ Sex = sex,
+ phoneNumber = phoneNum
+ };
+
+
+ _userInfoRepository.Insert(res);
+
+ return new
+ {
+ code = 200,
+ data = "",
+ msg = "添加成功"
+ };
+ }
+
+ [HttpPut("{id}")]
+ public dynamic putUserInfo(int id,ChangeUserInfo changeUserInfo)
+ {
+ var UserId = changeUserInfo.UserId;
+ var ImgId = changeUserInfo.ImgId;
+ var CardType = changeUserInfo.CardType;
+ var CardNumber = changeUserInfo.CardNumber;
+ var Sex = changeUserInfo.Sex;
+ var phoneNumber = changeUserInfo.phoneNumber;
+
+ var ui = _userInfoRepository.GetById(id);
+
+ ui.UserId = changeUserInfo.UserId;
+ ui.ImgId = changeUserInfo.ImgId;
+ ui.CardType = changeUserInfo.CardType;
+ ui.CardNumber = changeUserInfo.CardNumber;
+ ui.Sex = changeUserInfo.Sex;
+ ui.phoneNumber = changeUserInfo.phoneNumber;
+
+ _userInfoRepository.Updated(ui);
+
+ return new
+ {
+ code = 200,
+ data = ui,
+ msg = "修改成功"
+ };
+ }
+
+
+ //冻结用户信息
+ [HttpPut("{id}/freeze")]
+ public dynamic freezeUserInfo(int id)
+ {
+ var userInfo = _userInfoRepository.GetById(id);
+
+ if (userInfo == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该用户信息不存在"
+ };
+ }
+ userInfo.IsActived = false;
+ _userInfoRepository.Updated(userInfo);
+
+ return new
+ {
+ Code = 200,
+ Data = userInfo,
+ Msg = "冻结用户成功"
+ };
+ }
+
+
+ [HttpPut("{id}/enable")]
+ //启用用户信息
+ public dynamic enableUserInfo(int id)
+ {
+ var userInfo = _userInfoRepository.GetById(id);
+
+ if (userInfo == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该用户信息不存在"
+ };
+ }
+ userInfo.IsActived = true;
+ _userInfoRepository.Updated(userInfo);
+
+ return new
+ {
+ Code = 200,
+ Data = userInfo,
+ Msg = "启用用户成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/UsersController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/UsersController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..7b2d4a66b25b04fbd0fbead902da0e55d559e56d
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/UsersController.cs
@@ -0,0 +1,443 @@
+using Microsoft.AspNetCore.Mvc;
+using ElectronicMallProject.Backend.Api.Repository;
+using ElectronicMallProject.Backend.Api.Entity;
+using System.Linq;
+using Microsoft.Extensions.Configuration;
+using ElectronicMallProject.Backend.Api.Params;
+using ElectronicMallProject.Backend.Api.Utils;
+using Microsoft.AspNetCore.Authorization;
+using System.Collections;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class UsersController : ControllerBase
+ {
+
+ private IRepository _usersRepository;
+ private IConfiguration _configuration;
+ private readonly IRepository _salesRepository;
+ private readonly IRepository _commodityRepository;
+ private TokenParameter _tokenparameter;
+ public UsersController(IRepository usersRepository, IConfiguration configuration, IRepository salesRepository, IRepository commodityRepository)
+ {
+ _usersRepository = usersRepository;
+
+ _configuration = configuration;
+
+ _salesRepository = salesRepository;
+
+ _commodityRepository = commodityRepository;
+
+ _tokenparameter = _configuration.GetSection("TokenParameter").Get();
+ }
+
+ //获取所有用户
+ [HttpGet, Route("get")]
+ public dynamic Get()
+ {
+ var Users = _usersRepository.Table;
+ return new
+ {
+ Code = 200,
+ Data = Users,
+ Msg = "获取用户成功"
+ };
+ }
+
+ // [HttpGet("{id}")]
+ // public dynamic getById(int id)
+ // {
+ // var ss = _salesRepository.Table.Where(x => x.CommodityId == id).ToList();
+
+ // var uu = _salesRepository.Table.Where(x => x.UserId == id).ToList();
+
+ // ArrayList list = new ArrayList();
+
+
+ // }
+
+ //获取管理员用户
+ [HttpGet, Route("getadmin")]
+ public dynamic AdminGet()
+ {
+ var user = _usersRepository.Table;
+ var userrole = user.Where(x => x.UserRole.Equals("管理员")).FirstOrDefault();
+
+ if (userrole == null)
+ {
+ var res = new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "没有找到管理员"
+ };
+ return JsonHelper.Serialize(res);
+ }
+ else
+ {
+ return new
+ {
+ Code = 200,
+ Data = userrole,
+ Msg = "获取管理员成功"
+ };
+
+ }
+
+ }
+
+ //获取商家用户
+ [HttpGet, Route("getbusiness")]
+ public dynamic BusinessGet()
+ {
+ var user = _usersRepository.Table;
+ var userrole = user.Where(x => x.UserRole.Equals("商家")).FirstOrDefault();
+
+ if (userrole == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "没有找到商家"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 200,
+ Data = userrole,
+ Msg = "获取商家成功"
+ };
+
+ }
+ }
+
+ //获取用户
+ [HttpGet, Route("getusers")]
+ public dynamic UsersGet()
+ {
+ var user = _usersRepository.Table;
+ var userrole = user.Where(x => x.UserRole.Equals("用户"));
+
+ if (userrole == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "没有找到用户"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 200,
+ Data = userrole,
+ Msg = "获取用户成功"
+ };
+
+ }
+ }
+
+ //用户登录
+ [HttpPost, Route("userslogin")]
+ public dynamic Post(LoginUsers loginusers)
+ {
+ var username = loginusers.UserName.Trim();
+ var password = loginusers.PassWord.Trim();
+ var user = _usersRepository.Table.Where(x => x.UserName == username && x.PassWord == password).FirstOrDefault();
+
+ if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
+ {
+ if (user == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "用户名或密码错误"
+ };
+ }
+
+ var token = TokenHelper.GenUserToken(_tokenparameter, user.UserName);
+ var refreshToken = "123456789";
+
+ if (user.IsActived == false)
+ {
+ return new
+ {
+ Code = 105,
+ Data = "",
+ Msg = "该用户已被封号"
+ };
+ }
+ else
+ {
+ if (user.UserRole == "用户")
+ {
+ return new
+ {
+ Code = 200,
+ Data = new { Token = token, refreshToken = refreshToken, user = user },
+ Msg = "用户登陆成功"
+ };
+ }
+ else if (user.UserRole == "商家")
+ {
+ return new
+ {
+ Code = 200,
+ Data = new { Token = token, refreshToken = refreshToken, user = user },
+ Msg = "商家登陆成功"
+ };
+ }
+ return new
+ {
+ Code = 200,
+ Data = new { Token = token, refreshToken = refreshToken, user = user },
+ Msg = "管理员登陆成功"
+ };
+ }
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "用户名密码不能为空"
+ };
+ }
+ }
+
+ //用户注册
+ [HttpPost, Route("userregistry")]
+ public dynamic Post(CreateUsers newUser)
+ {
+ var username = newUser.UserName.Trim();
+ var password = newUser.PassWord.Trim();
+ var repassword = newUser.RePassword.Trim();
+ var userrole = newUser.UserRole.Trim();
+
+ if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(repassword) && !string.IsNullOrEmpty(userrole))
+ {
+ if (!password.Equals(repassword))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "两次密码输入不一致"
+ };
+ }
+ var user = _usersRepository.Table;
+ var ishaveuser = user.Where(x => x.UserName.Equals(username)).ToList();
+
+ //注册用户
+ if (ishaveuser.Count() == 0)
+ {
+ var res = new Users
+ {
+ UserName = username,
+ PassWord = password,
+ UserRole = userrole
+ };
+
+ _usersRepository.Insert(res);
+
+ return new
+ {
+ Code = 200,
+ Data = res,
+ Msg = "注册用户成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该用户已注册"
+ };
+ }
+ }
+ else
+ {
+ //用户名密码不能为空
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "用户名密码不能为空"
+ };
+ }
+ }
+
+ //修改用户密码
+ [HttpPut, Route("{id}/changeusers")]
+ public dynamic Put(int id, ChangeUsers changeusers)
+ {
+ var username = changeusers.UserName.Trim();
+ var password = changeusers.PassWord.Trim();
+
+ if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
+ {
+ var user = _usersRepository.GetById(id);
+ if (user == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "要修改的用户不存在"
+ };
+ }
+ user.UserName = changeusers.UserName;
+ user.PassWord = changeusers.PassWord;
+
+ _usersRepository.Updated(user);
+
+ return new
+
+ {
+ Code = 200,
+ Data = user,
+ Msg = "修改用户成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "用户名密码不能为空"
+ };
+ }
+ }
+
+ //分配用户角色
+ [HttpPut, Route("{id}/distributionrole")]
+ public dynamic distributionPut(int id, CreateUserRole create)
+ {
+ var userrole = create.UserRole.Trim();
+
+ if (!string.IsNullOrEmpty(userrole))
+ {
+ var user = _usersRepository.GetById(id);
+
+ if (user == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "要分配角色的用户不存在"
+ };
+ }
+
+ user.UserRole = create.UserRole;
+
+ _usersRepository.Updated(user);
+
+ return new
+ {
+ Code = 200,
+ Data = user,
+ Msg = "分配用户角色成功"
+ };
+ }
+ return "";
+ }
+
+ //冻结用户
+ [HttpPut, Route("{id}/frozenusers")]
+ public dynamic frozenPut(int id)
+ {
+ var user = _usersRepository.GetById(id);
+
+ if (user == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该用户不存在"
+ };
+ }
+ user.IsActived = false;
+ _usersRepository.Updated(user);
+
+ return new
+ {
+ Code = 200,
+ Data = user,
+ Msg = "冻结用户成功"
+ };
+ }
+
+
+ //启用用户
+ [HttpPut, Route("{id}/enableusers")]
+ public dynamic enablePut(int id)
+ {
+ var user = _usersRepository.GetById(id);
+
+ if (user == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "该用户不存在"
+ };
+ }
+ user.IsActived = true;
+ _usersRepository.Updated(user);
+
+ return new
+ {
+ Code = 200,
+ Data = user,
+ Msg = "启用用户成功"
+ };
+ }
+
+ //刷新重新获取token
+ [AllowAnonymous]
+ [HttpPost, Route("userRefreshToken")]
+ public dynamic UserRefreshTokenPost(RefreshTokenDTO refresh)
+ {
+ var users = _usersRepository.Table;
+ var user = TokenHelper.ValidateToken(_tokenparameter, refresh);
+
+ if (string.IsNullOrEmpty(user))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "userRefreshToken验证失败"
+ };
+ }
+
+ var token = TokenHelper.GenUserToken(_tokenparameter, user);
+
+ var refreshToken = "123456789";
+
+ return new
+ {
+ Code = 200,
+ Data = new { token = token, refreshToken = refreshToken, users = users },
+ Msg = "刷新重新获取token,refreshToken成功"
+ };
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/WeatherForecastController.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/WeatherForecastController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..df6c036a13212bbb4b51d30b7f1a61979316bcf5
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Controllers/WeatherForecastController.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+
+namespace ElectronicMallProject.Backend.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class WeatherForecastController : ControllerBase
+ {
+ private static readonly string[] Summaries = new[]
+ {
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ };
+
+ private readonly ILogger _logger;
+
+ public WeatherForecastController(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ [HttpGet]
+ public IEnumerable Get()
+ {
+ var rng = new Random();
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateTime.Now.AddDays(index),
+ TemperatureC = rng.Next(-20, 55),
+ Summary = Summaries[rng.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+ }
+}
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Database/DbInit.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Database/DbInit.cs
new file mode 100644
index 0000000000000000000000000000000000000000..6c92da7f1011509339aadb813a8d68b5f064a082
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Database/DbInit.cs
@@ -0,0 +1,72 @@
+using ElectronicMallProject.Backend.Api.Entity;
+using Microsoft.EntityFrameworkCore;
+
+namespace ElectronicMallProject.Backend.Api.Database
+{
+ public class DbInit : DbContext
+ {
+ public DbInit()
+ {
+
+ }
+
+ public DbInit(DbContextOptions options) : base(options)
+ {
+
+ }
+
+ public DbSet users { get; set; }
+ public DbSet account { get; set; }
+ public DbSet address { get; set; }
+
+ //审计日志
+ public DbSet auditinfo { get; set; }
+ public DbSet brand { get; set; }
+ public DbSet carousels { get; set; }
+ public DbSet comment { get; set; }
+ public DbSet commodity { get; set; }
+ public DbSet commoditydisplaycolumn { get; set; }
+ public DbSet imgs { get; set; }
+ public DbSet logistics { get; set; }
+ public DbSet sales { get; set; }
+ public DbSet shop { get; set; }
+ public DbSet shoppingcart { get; set; }
+ public DbSet shoptypes { get; set; }
+ public DbSet Specifications { get; set; }
+ public DbSet supplier { get; set; }
+ public DbSet userinfo { get; set; }
+
+
+
+
+ protected override void OnConfiguring(DbContextOptionsBuilder options)
+ {
+ options.UseNpgsql(@"server=47.113.121.34;database=EMMS;uid=postgres;pwd=XiongYY200012152841735357***;");
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ // 初始化一个管理员用户 虽然Id是自动生成,但此处必须明确指定
+ modelBuilder.Entity().HasData(
+ new Users
+ {
+ Id = 1,
+ UserName = "admin",
+ PassWord = "113",
+ PhoneNumber = "13174562456",
+ Address = null,
+ CustomerOrderAddress = null,
+ UserRole = "管理员",
+ IsActived = true,
+ IsDeleted = false,
+ CreatedTime = System.DateTime.Now,
+ UpdatedTime = System.DateTime.Now,
+ DisplayOrder = 0,
+ Remarks = null
+ }
+ );
+ base.OnModelCreating(modelBuilder);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/ElectronicMallProject.Backend.Api.csproj b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/ElectronicMallProject.Backend.Api.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..30a12931d21aecc09d9bee7effeef309e7c2032c
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/ElectronicMallProject.Backend.Api.csproj
@@ -0,0 +1,18 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Account.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Account.cs
new file mode 100644
index 0000000000000000000000000000000000000000..62c74b72ddb565523cbb16dbe8700065ddddbcb3
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Account.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Account:BaseInit
+ {
+ //账户余额
+ public int AccountBalance {get;set;}
+ //用户Id
+ public int UserId{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/AddRess.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/AddRess.cs
new file mode 100644
index 0000000000000000000000000000000000000000..a3ebb7f987dc9b1d38b58e0dc721757b4056c901
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/AddRess.cs
@@ -0,0 +1,24 @@
+using ElectronicMallProject.Backend.Api.Entity;
+
+namespace ElectronicMallProject.Backend.Api.Database
+{
+
+ //收件地址表
+ public class AddRess : BaseInit
+ {
+ //省
+ public string Province { get; set; }
+ //市
+ public string City { get; set; }
+ //区
+ public string District { get; set; }
+ //街道
+ public string Street { get; set; }
+ //详细地址
+ public string Detailedaddress { get; set; }
+ //号码
+ public string Number { get; set; }
+ //收件人
+ public string Addressee { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/AuditInfo.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/AuditInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..b214e0dd86b8e180bebfbbf2c7ab403b388b73ec
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/AuditInfo.cs
@@ -0,0 +1,71 @@
+using System;
+using ElectronicMallProject.Backend.Api;
+
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ ///
+ /// 角色实体
+ ///
+ public class AuditInfo : BaseInit
+ {
+ ///
+ /// 调用参数
+ ///
+ public string Parameters { get; set; }
+
+ ///
+ /// 浏览器信息
+ ///
+ public string BrowserInfo { get; set; }
+
+ ///
+ /// 客户端信息
+ ///
+ public string ClientName { get; set; }
+
+ ///
+ /// 客户端IP地址
+ ///
+ public string ClientIpAddress { get; set; }
+
+ ///
+ /// 执行耗时
+ ///
+ public int ExecutionDuration { get; set; }
+
+ ///
+ /// 执行时间
+ ///
+ public DateTime ExecutionTime { get; set; }
+
+ ///
+ /// 返回内容
+ ///
+ public string ReturnValue { get; set; }
+
+ ///
+ /// 异常对象
+ ///
+ public string Exception { get; set; }
+
+ ///
+ /// 方法名
+ ///
+ public string MethodName { get; set; }
+
+ ///
+ /// 服务名
+ ///
+ public string ServiceName { get; set; }
+
+ ///
+ /// 调用者信息
+ ///
+ public string UserInfo { get; set; }
+
+ ///
+ /// 自定义数据
+ ///
+ public string CustomData { get; set; }
+ }
+}
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/BaseInit.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/BaseInit.cs
new file mode 100644
index 0000000000000000000000000000000000000000..35fa1c8afd03d695c6b17d637ea7f84a7718968c
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/BaseInit.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public abstract class BaseInit
+ {
+ public int Id {get;set;}
+ public bool IsActived {get;set;}
+ public bool IsDeleted {get;set;}
+ public DateTime CreatedTime {get;set;}
+ public DateTime UpdatedTime {get;set;}
+ public int DisplayOrder {get;set;}
+ public string Remarks {get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Brand.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Brand.cs
new file mode 100644
index 0000000000000000000000000000000000000000..b844a06993de6799f87e0062c1ec3d93dcbef405
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Brand.cs
@@ -0,0 +1,12 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ //品牌
+ public class Brand : BaseInit
+ {
+ //品牌表
+ public string BrandName { get; set; }
+ //品牌logo图id
+ public int logoImgId { get; set; }
+ }
+}
+
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Carousels.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Carousels.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9cf6366cf2ece4297659cb1cfa4b7628292225a2
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Carousels.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Carousels:BaseInit
+ {
+ //图片Id
+ public int ImgsId{get;set;}
+ //商品Id
+ public int CommodityId{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Comment.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Comment.cs
new file mode 100644
index 0000000000000000000000000000000000000000..b6e8b3c6b3ad3685bb52b79f91d3dc5efe00db99
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Comment.cs
@@ -0,0 +1,14 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Comment:BaseInit
+ {
+ //评论内容
+ public string Content{get;set;}
+ //评论用户Id
+ public int ComUserId{get;set;}
+ //回复用户Id
+ public int ReplyUserId{get;set;}
+ //商品展示栏Id
+ public int CommodityDisplayColumnId{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Commodity.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Commodity.cs
new file mode 100644
index 0000000000000000000000000000000000000000..49a1a7d7379cebbeffe2aec3d334dfa0dccf53b1
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Commodity.cs
@@ -0,0 +1,30 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Commodity : BaseInit
+ {
+ //商品名称
+ public string CommodityName { get; set; }
+ //商品类型
+ public string CommodityType { get; set; }
+ //商品原价
+ public int CommodityOriginalPrice { get; set; }
+ //商品当前售价
+ public int CommodityCurrentPrice { get; set; }
+ //商品品级
+ public int CommodityGrade { get; set; }
+ //商品规格Id
+ public int SpecificationsId { get; set; }
+ //商品详情
+ public string ProductDetails { get; set; }
+ //商品库存
+ public int ProductStocks { get; set; }
+ //封面图Id
+ public int ImgId { get; set; }
+ //供应商Id
+ public int SupplierId { get; set; }
+ //商品品牌Id
+ public int BrandId { get; set; }
+ //商品类型Id
+ public int ShopTypeId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/CommodityDisplayColumn.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/CommodityDisplayColumn.cs
new file mode 100644
index 0000000000000000000000000000000000000000..a8b2112cc6a3d99f220a082c62966bd047986ece
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/CommodityDisplayColumn.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class CommodityDisplayColumn:BaseInit
+ {
+ //展示栏名
+ public string DisplayBar{get;set;}
+ //商铺Id
+ public int ShopId{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/DetailsChart.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/DetailsChart.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9d41e50aa5ff727594e5add1ad0d23b0609fe77d
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/DetailsChart.cs
@@ -0,0 +1,9 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class DetailsChart : BaseInit
+ {
+ public int ImgId { get; set; }
+ public int CommodityId { get; set; }
+ }
+}
+
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Imgs.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Imgs.cs
new file mode 100644
index 0000000000000000000000000000000000000000..223c8cb35a27e3ccc084cfd65eefdd52cd61bc1d
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Imgs.cs
@@ -0,0 +1,8 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Imgs:BaseInit
+ {
+ //图片路径
+ public string ImgsPath{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Logistics.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Logistics.cs
new file mode 100644
index 0000000000000000000000000000000000000000..19b4976d67ebabb603ce38f0c15956673f13da69
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Logistics.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Logistics:BaseInit
+ {
+ //订单Id
+ public int SalesId{get;set;}
+ //物流公司
+ public string logisticsCompany{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Sales.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Sales.cs
new file mode 100644
index 0000000000000000000000000000000000000000..1622ee97b8e07255c06d9832108545a5df7d5fcc
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Sales.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Sales:BaseInit
+ {
+ //订单号
+ public string SalesNumber{get;set;}
+ //日期
+ public string Date{get;set;}
+ //单个商品物件数
+ public int NumberOfSingleProductItems{get;set;}
+ //总物件数
+ public int TotalNumberOfObjects{get;set;}
+ //单笔金额
+ public int SingleAmount{get;set;}
+ //总金额
+ public int TotalMoney{get;set;}
+ //支付方式
+ public string PaymentMethod{get;set;}
+ //用户Id
+ public int UserId{get;set;}
+ //商品Id
+ public int CommodityId{get;set;}
+ //物流信息
+ public string LogisticsInformation{get;set;}
+ //发货时间
+ public string DeliveryTime{get;set;}
+ //订单状态
+ public string SalesStatus{get;set;}
+ //支付状态
+ public string PaymentStatus{get;set;}
+ //实际付款金额
+ public int PaymentAmount{get;set;}
+ //买家状态
+ public string BuyerStatus{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Shop.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Shop.cs
new file mode 100644
index 0000000000000000000000000000000000000000..aae4587d7b1bfccd6c7313a7406a0fd800e16ec0
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Shop.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Shop:BaseInit
+ {
+ //店铺名称
+ public string ShopName{get;set;}
+ //商品类型id
+ public int ShopTypeId{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/ShopType.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/ShopType.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4febec8e25b1693297511ab068746fd60749ab9f
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/ShopType.cs
@@ -0,0 +1,25 @@
+
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ //商品类型
+ public class ShopType : BaseInit
+ {
+ //商店类型名
+ public string ShopTypeName {get;set;}
+
+ //上级分类
+ public int SuperiorShopTypeId {get;set;}
+
+ //数量
+ public string Measure {get;set;}
+
+ //商店类型图片Id
+ public int ShopTypeIconId{get;set;}
+
+ //删选属性
+ public string FilterProperties{get;set;}
+
+ //关键词
+ public string keyword {get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/ShoppingCart.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/ShoppingCart.cs
new file mode 100644
index 0000000000000000000000000000000000000000..b8b70fe0f24b8468b633b2defd49dca075139680
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/ShoppingCart.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class ShoppingCart:BaseInit
+ {
+ //商品Id
+ public int CommodityId{get;set;}
+ //用户Id
+ public int UserId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Specifications.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Specifications.cs
new file mode 100644
index 0000000000000000000000000000000000000000..15c6f0d93bacaeb7dd22e10d18baa01b7e3195bb
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Specifications.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Specifications : BaseInit
+ {
+ // 规格名
+ public string SpecificationsName { get; set; }
+ //商品Id
+ public int CommodityId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Supplier.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Supplier.cs
new file mode 100644
index 0000000000000000000000000000000000000000..db6cea318510567dab4896aa556a789aad3419d1
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Supplier.cs
@@ -0,0 +1,14 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Supplier:BaseInit
+ {
+ //供应商名字
+ public string SupplierName{get;set;}
+ //供应商地址
+ public string SupplierAddress{get;set;}
+ //联系人
+ public string Contacts{get;set;}
+ //供应商营业
+ public string MainBusiness{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/UserInfo.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/UserInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..6c1b7e99ee55813d271d8b3ffb6b89b32e3c5044
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/UserInfo.cs
@@ -0,0 +1,24 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ //用户信息
+ public class UserInfo : BaseInit
+ {
+ //用户Id
+ public int UserId { get; set; }
+
+ //图片Id
+ public int ImgId { get; set; }
+
+ // 证件信息
+ public string CardType { get; set; }
+
+ //身份证号
+ public string CardNumber { get; set; }
+
+ //性别
+ public char Sex { get; set; }
+
+ //手机号
+ public string phoneNumber { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/UserRole.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/UserRole.cs
new file mode 100644
index 0000000000000000000000000000000000000000..3a983a689786f4b2d7a17e758e8b5e89b5a98e5b
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/UserRole.cs
@@ -0,0 +1,10 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class UserRole : BaseInit
+ {
+ public string Admin { get; set; }
+ public string Business { get; set; }
+ public string Users { get; set; }
+ public string Supplier { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Users.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Users.cs
new file mode 100644
index 0000000000000000000000000000000000000000..5d73b2be79d8f93d9eed6ac02a60c81749f47635
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Entity/Users.cs
@@ -0,0 +1,18 @@
+namespace ElectronicMallProject.Backend.Api.Entity
+{
+ public class Users:BaseInit
+ {
+ //用户名
+ public string UserName{get;set;}
+ //密码
+ public string PassWord{get;set;}
+ //手机号
+ public string PhoneNumber{get;set;}
+ //地址
+ public string Address{get;set;}
+ //订单地址
+ public string CustomerOrderAddress{get;set;}
+ //用户角色
+ public string UserRole{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Filters/AuditLogActionFilter.cs b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Filters/AuditLogActionFilter.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f2dfa4f4b317a64253b82d429f198c834809bbf9
--- /dev/null
+++ b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Filters/AuditLogActionFilter.cs
@@ -0,0 +1,162 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using ElectronicMallProject.Backend.Api.Entity;
+using ElectronicMallProject.Backend.Api.Repository;
+
+namespace ElectronicMallProject.Backend.Api.Filters
+{
+ public class AuditLogActionFilter : IAsyncActionFilter
+ {
+ ///
+ /// 登录用户
+ ///
+ // private readonly ISession _Session;
+ ///
+ /// 日志记录
+ ///
+ private readonly ILogger _logger;
+
+ private readonly IRepository _auditLogService;
+
+ public AuditLogActionFilter(
+ // ISession Session,
+ ILogger logger,
+ IRepository auditLogService
+ )
+ {
+ // _Session = Session;
+ _logger = logger;
+ _auditLogService=auditLogService;
+ }
+
+ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
+ {
+ // 判断是否写日志
+ if (!ShouldSaveAudit(context))
+ {
+ await next();
+ return;
+ }
+ //接口Type
+ var type = (context.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.AsType();
+ //方法信息
+ var method = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo;
+ //方法参数
+ var arguments = context.ActionArguments;
+ //开始计时
+ var stopwatch = Stopwatch.StartNew();
+
+ var auditInfo = new AuditInfo
+ {
+ // UserInfo = _Session?.Id,
+ ServiceName = type != null ? type.FullName: "",
+ MethodName = method.Name,
+ ////请求参数转Json
+ Parameters = JsonConvert.SerializeObject(arguments),
+ ExecutionTime = DateTime.Now,
+ BrowserInfo = context.HttpContext.Request.Headers["User-Agent"].ToString(),
+ ClientIpAddress = context.HttpContext.Connection.RemoteIpAddress.ToString(),
+ //ClientName = _clientInfoProvider.ComputerName.TruncateWithPostfix(EntityDefault.FieldsLength100),
+ // Id = Guid.NewGuid().ToString()
+ };
+
+ ActionExecutedContext result = null;
+ try
+ {
+ result = await next();
+ if (result.Exception != null && !result.ExceptionHandled)
+ {
+ auditInfo.Exception = result.Exception.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ auditInfo.Exception = ex.ToString();
+ throw;
+ }
+ finally
+ {
+ stopwatch.Stop();
+ auditInfo.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
+
+ if (result != null)
+ {
+ switch (result.Result)
+ {
+ case ObjectResult objectResult:
+ auditInfo.ReturnValue = JsonConvert.SerializeObject(objectResult.Value);
+ break;
+
+ case JsonResult jsonResult:
+ auditInfo.ReturnValue = JsonConvert.SerializeObject(jsonResult.Value);
+ break;
+
+ case ContentResult contentResult:
+ auditInfo.ReturnValue = contentResult.Content;
+ break;
+ }
+ }
+ Console.WriteLine(auditInfo.ToString());
+ //保存审计日志
+ await _auditLogService.InserAsync(auditInfo);
+ }
+ }
+
+ ///
+ /// 是否需要记录审计
+ ///
+ ///
+ ///
+ private bool ShouldSaveAudit(ActionExecutingContext context)
+ {
+ if (!(context.ActionDescriptor is ControllerActionDescriptor))
+ return false;
+ var methodInfo = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo;
+
+ if (methodInfo == null)
+ {
+ return false;
+ }
+
+ if (!methodInfo.IsPublic)
+ {
+ return false;
+ }
+
+ // if (methodInfo.GetCustomAttribute() != null)
+ // {
+ // return true;
+ // }
+
+ // if (methodInfo.GetCustomAttribute() != null)
+ // {
+ // return false;
+ // }
+
+ // var classType = methodInfo.DeclaringType;
+ // if (classType != null)
+ // {
+ // if (classType.GetTypeInfo().GetCustomAttribute() != null)
+ // {
+ // return true;
+ // }
+
+ // if (classType.GetTypeInfo().GetCustomAttribute() != null)
+ // {
+ // return false;
+ // }
+ // }
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git "a/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Migrations/20210819081101_\346\267\273\345\212\240\350\247\204\346\240\274\345\225\206\345\223\201Id.Designer.cs" "b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Migrations/20210819081101_\346\267\273\345\212\240\350\247\204\346\240\274\345\225\206\345\223\201Id.Designer.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..8c70575e0f7ce0759ecc38e64d8acc70faf15626
--- /dev/null
+++ "b/ElectronicMallProject.Backend/ElectronicMallProject.Backend.Api/Migrations/20210819081101_\346\267\273\345\212\240\350\247\204\346\240\274\345\225\206\345\223\201Id.Designer.cs"
@@ -0,0 +1,848 @@
+//
+using System;
+using ElectronicMallProject.Backend.Api.Database;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+namespace ElectronicMallProject.Backend.Api.Migrations
+{
+ [DbContext(typeof(DbInit))]
+ [Migration("20210819081101_添加规格商品Id")]
+ partial class 添加规格商品Id
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 63)
+ .HasAnnotation("ProductVersion", "5.0.9")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Database.AddRess", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("Addressee")
+ .HasColumnType("text");
+
+ b.Property("City")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("Detailedaddress")
+ .HasColumnType("text");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("District")
+ .HasColumnType("text");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Number")
+ .HasColumnType("text");
+
+ b.Property("Province")
+ .HasColumnType("text");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("Street")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("address");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Account", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("AccountBalance")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("account");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.AuditInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("BrowserInfo")
+ .HasColumnType("text");
+
+ b.Property("ClientIpAddress")
+ .HasColumnType("text");
+
+ b.Property("ClientName")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("CustomData")
+ .HasColumnType("text");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("Exception")
+ .HasColumnType("text");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("integer");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("MethodName")
+ .HasColumnType("text");
+
+ b.Property("Parameters")
+ .HasColumnType("text");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("ReturnValue")
+ .HasColumnType("text");
+
+ b.Property("ServiceName")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserInfo")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("auditinfo");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Brand", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("BrandName")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("logoImgId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("brand");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Carousels", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CommodityId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("ImgsId")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("carousels");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("ComUserId")
+ .HasColumnType("integer");
+
+ b.Property("CommodityDisplayColumnId")
+ .HasColumnType("integer");
+
+ b.Property("Content")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("ReplyUserId")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("comment");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Commodity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("BrandId")
+ .HasColumnType("integer");
+
+ b.Property("CommodityCurrentPrice")
+ .HasColumnType("integer");
+
+ b.Property("CommodityGrade")
+ .HasColumnType("integer");
+
+ b.Property("CommodityName")
+ .HasColumnType("text");
+
+ b.Property("CommodityOriginalPrice")
+ .HasColumnType("integer");
+
+ b.Property("CommodityType")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("ImgId")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ProductDetails")
+ .HasColumnType("text");
+
+ b.Property("ProductStocks")
+ .HasColumnType("integer");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("ShopTypeId")
+ .HasColumnType("integer");
+
+ b.Property("SpecificationsId")
+ .HasColumnType("integer");
+
+ b.Property("SupplierId")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("commodity");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.CommodityDisplayColumn", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayBar")
+ .HasColumnType("text");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("ShopId")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("commoditydisplaycolumn");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Imgs", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("ImgsPath")
+ .HasColumnType("text");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("imgs");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Logistics", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("SalesId")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("logisticsCompany")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("logistics");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Sales", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("BuyerStatus")
+ .HasColumnType("text");
+
+ b.Property("CommodityId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("Date")
+ .HasColumnType("text");
+
+ b.Property("DeliveryTime")
+ .HasColumnType("text");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("LogisticsInformation")
+ .HasColumnType("text");
+
+ b.Property("NumberOfSingleProductItems")
+ .HasColumnType("integer");
+
+ b.Property("PaymentAmount")
+ .HasColumnType("integer");
+
+ b.Property("PaymentMethod")
+ .HasColumnType("text");
+
+ b.Property("PaymentStatus")
+ .HasColumnType("text");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("SalesNumber")
+ .HasColumnType("text");
+
+ b.Property("SalesStatus")
+ .HasColumnType("text");
+
+ b.Property("SingleAmount")
+ .HasColumnType("integer");
+
+ b.Property("TotalMoney")
+ .HasColumnType("integer");
+
+ b.Property("TotalNumberOfObjects")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("sales");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.Shop", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("ShopName")
+ .HasColumnType("text");
+
+ b.Property("ShopTypeId")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("shop");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.ShopType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("FilterProperties")
+ .HasColumnType("text");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Measure")
+ .HasColumnType("text");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("ShopTypeIconId")
+ .HasColumnType("integer");
+
+ b.Property("ShopTypeName")
+ .HasColumnType("text");
+
+ b.Property("SuperiorShopTypeId")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("keyword")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("shoptypes");
+ });
+
+ modelBuilder.Entity("ElectronicMallProject.Backend.Api.Entity.ShoppingCart", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CommodityId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property