Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
74559e53
Commit
74559e53
authored
Sep 22, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sdzq' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
into sdzq-ld
parents
651cd804
7f9c99bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
289 additions
and
7 deletions
+289
-7
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+101
-0
RB_GoodsRepository.cs
Mall.Repository/Product/RB_GoodsRepository.cs
+133
-7
GuideCarController.cs
Mall.WebApi/Controllers/Product/GuideCarController.cs
+16
-0
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+39
-0
No files found.
Mall.Module.Product/ProductModule.cs
View file @
74559e53
...
@@ -3936,6 +3936,107 @@ namespace Mall.Module.Product
...
@@ -3936,6 +3936,107 @@ namespace Mall.Module.Product
}
}
/// <summary>
/// 获取后台商品分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <param name="IsGetSpec">是否获取规格</param>
/// <returns></returns>
public
List
<
RB_Goods_Extend
>
GetListByGoodsClassify
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_Extend
demodel
,
int
IsGetSpec
=
0
)
{
var
list
=
goodsRepository
.
GetPageList_V2
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
//if (list.Any())
//{
// //查询分类
// string ids = string.Join(",", list.Select(x => x.Id));
// var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
// var olist = goods_OrderRepository.GetGoodsOrderNum(ids);
// //规格列表
// List<RB_Goods_Specification_Extend> SpecificationList = new List<RB_Goods_Specification_Extend>();
// //规格值
// List<RB_Goods_SpecificationValue_Extend> svlist = new List<RB_Goods_SpecificationValue_Extend>();
// //规格值列表
// List<RB_Goods_SpecificationPrice_Extend> SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
// if (IsGetSpec == 1)
// {
// SpecificationList = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
// svlist = goods_SpecificationValueRepository.GetList(new RB_Goods_SpecificationValue_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
// SpecificationPriceList = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
// }
// foreach (var item in list)
// {
// item.CategoryList = clist.Where(x => x.GoodsId == item.Id).ToList();
// //轮播图
// item.CoverImage = "";
// item.CarouselImageList = new List<RB_ImageCommonModel>();
// if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
// {
// List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
// //封面图
// item.CoverImage = CarouselIdList[0];
// //轮播图
// //轮播图
// foreach (var qitem in CarouselIdList)
// {
// item.CarouselImageList.Add(new RB_ImageCommonModel()
// {
// Id = 0,
// Name = "",
// Path = qitem
// });
// }
// }
// item.GoodsBuyNum = olist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0;
// if (IsGetSpec == 1)
// {
// item.SpecificationList = SpecificationList?.Where(qitem => qitem.GoodsId == item.Id)?.ToList() ?? new List<RB_Goods_Specification_Extend>();
// if (item.SpecificationList != null && item.SpecificationList.Count > 0)
// {
// foreach (var subItem in item.SpecificationList)
// {
// subItem.SpecificationValueList = svlist.Where(x => x.SpecificationId == subItem.Id).ToList();
// }
// }
// var tempPriceList = SpecificationPriceList?.Where(qitem => qitem.GoodsId == item.Id)?.ToList() ?? new List<RB_Goods_SpecificationPrice_Extend>();
// int SortNum = 1;
// foreach (var childItem in tempPriceList)
// {
// if (!string.IsNullOrEmpty(childItem.SpecificationSort))
// {
// var ssarr = childItem.SpecificationSort.Split(':');
// int Sort = Convert.ToInt32(ssarr[0]);
// string pic_url = item.SpecificationList[0].SpecificationValueList.Where(x => x.Sort == Sort).FirstOrDefault()?.ImagePath;
// List<object> AttrList = new List<object>();
// for (int i = 0; i < ssarr.Length; i++)
// {
// var smodel = item.SpecificationList[i];
// var svmodel = smodel.SpecificationValueList.Where(x => x.Sort == Convert.ToInt32(ssarr[i])).FirstOrDefault();
// AttrList.Add(new
// {
// SName = smodel.Name,
// SId = smodel.Id,
// SVId = svmodel.Sort,
// SVName = svmodel.Name
// });
// }
// childItem.AttrList = AttrList;
// }
// childItem.SortNum = SortNum;
// SortNum++;
// }
// item.SpecificationPriceList = tempPriceList.OrderByDescending(x => x.SortNum).ToList();
// }
// }
//}
return
list
;
}
/// <summary>
/// <summary>
/// 获取分类=>商品列表
/// 获取分类=>商品列表
/// </summary>
/// </summary>
...
...
Mall.Repository/Product/RB_GoodsRepository.cs
View file @
74559e53
...
@@ -22,10 +22,11 @@ namespace Mall.Repository.Product
...
@@ -22,10 +22,11 @@ namespace Mall.Repository.Product
/// <param name="rowCount">总条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Goods_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Goods_Extend
dmodel
,
bool
IsAllClassify
=
false
)
public
List
<
RB_Goods_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Goods_Extend
dmodel
,
bool
IsAllClassify
=
false
)
{
{
string
where
=
$" 1=1 and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 "
;
string
where
=
$" 1=1 and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 "
;
if
(
IsAllClassify
==
false
)
{
if
(
IsAllClassify
==
false
)
{
where
+=
$@" and g.GoodsClassify=0"
;
where
+=
$@" and g.GoodsClassify=0"
;
}
}
if
(
dmodel
.
TenantId
>
0
)
if
(
dmodel
.
TenantId
>
0
)
...
@@ -133,6 +134,129 @@ where {where} group by g.Id order by {orderBy}";
...
@@ -133,6 +134,129 @@ where {where} group by g.Id order by {orderBy}";
return
GetPage
<
RB_Goods_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
return
GetPage
<
RB_Goods_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Goods_Extend
>
GetPageList_V2
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Goods_Extend
dmodel
)
{
string
where
=
$" 1=1 and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 "
;
if
(
dmodel
.
GoodsClassify
>
-
1
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
GoodsClassify
)}
=
{
dmodel
.
GoodsClassify
}
"
;
}
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
NotTenantId
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
TenantId
)}
<>
{
dmodel
.
NotTenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
GoodsIds
))
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
Id
)}
in(
{
dmodel
.
GoodsIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
GoodsStatus
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
GoodsStatus
)}
=
{
dmodel
.
GoodsStatus
}
"
;
}
if
(
dmodel
.
IsSelectSellOut
==
1
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
InventoryNum
)}
<=0"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
CategoryIds
))
{
where
+=
$@" and c.
{
nameof
(
RB_Goods_Category
.
CategoryId
)}
in(
{
dmodel
.
CategoryIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
StartTime
))
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
CreateDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
EndTime
))
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
CreateDate
)}
<='
{
dmodel
.
EndTime
+
" 23:59:59"
}
'"
;
}
if
(
dmodel
.
IsProcurement
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
IsProcurement
)}
=
{
dmodel
.
IsProcurement
}
"
;
}
if
(
dmodel
.
IsProxy
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
IsProxy
)}
=
{
dmodel
.
IsProxy
}
"
;
}
if
(
dmodel
.
SupplierId
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
SupplierId
)}
=
{
dmodel
.
SupplierId
}
"
;
}
string
orderBy
=
" g.CreateDate desc"
;
if
(
dmodel
.
OrderBy
==
1
)
{
//id升序
orderBy
=
" g.Id asc"
;
}
else
if
(
dmodel
.
OrderBy
==
2
)
{
//id降序
orderBy
=
" g.Id desc"
;
}
else
if
(
dmodel
.
OrderBy
==
3
)
{
//排序升序
orderBy
=
" g.Sort asc"
;
}
else
if
(
dmodel
.
OrderBy
==
4
)
{
//排序降序
orderBy
=
" g.Sort desc"
;
}
else
if
(
dmodel
.
OrderBy
==
5
)
{
//售价升序
orderBy
=
" g.SellingPrice asc"
;
}
else
if
(
dmodel
.
OrderBy
==
6
)
{
//售价降序
orderBy
=
" g.SellingPrice desc"
;
}
else
if
(
dmodel
.
OrderBy
==
7
)
{
//库存升序
orderBy
=
" g.InventoryNum asc"
;
}
else
if
(
dmodel
.
OrderBy
==
8
)
{
//库存降序
orderBy
=
" g.InventoryNum desc"
;
}
string
sql
=
$@"select g.* from RB_Goods g
inner join rb_goods_category c on g.Id=c.GoodsId
where
{
where
}
group by g.Id order by
{
orderBy
}
"
;
return
GetPage
<
RB_Goods_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// <summary>
/// 获取列表
/// 获取列表
/// </summary>
/// </summary>
...
@@ -202,10 +326,11 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -202,10 +326,11 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
/// </summary>
/// </summary>
/// <param name="dmodel"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
RB_Goods_Extend
>
GetSingleList
(
RB_Goods_Extend
dmodel
,
bool
IsAllClassify
=
false
)
public
List
<
RB_Goods_Extend
>
GetSingleList
(
RB_Goods_Extend
dmodel
,
bool
IsAllClassify
=
false
)
{
{
string
where
=
$" 1=1 and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 "
;
string
where
=
$" 1=1 and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 "
;
if
(
IsAllClassify
==
false
)
{
if
(
IsAllClassify
==
false
)
{
where
+=
$@" and g.GoodsClassify=0"
;
where
+=
$@" and g.GoodsClassify=0"
;
}
}
if
(
dmodel
.
TenantId
>
0
)
if
(
dmodel
.
TenantId
>
0
)
...
@@ -314,7 +439,8 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -314,7 +439,8 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
public
List
<
RB_Goods_Extend
>
GetSingleListForGoodsSubName
(
RB_Goods_Extend
dmodel
,
bool
IsSelectAll
=
false
)
public
List
<
RB_Goods_Extend
>
GetSingleListForGoodsSubName
(
RB_Goods_Extend
dmodel
,
bool
IsSelectAll
=
false
)
{
{
string
where
=
$" 1=1 and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 "
;
string
where
=
$" 1=1 and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 "
;
if
(
IsSelectAll
==
false
)
{
if
(
IsSelectAll
==
false
)
{
where
+=
$@" and g.GoodsClassify=0 "
;
where
+=
$@" and g.GoodsClassify=0 "
;
}
}
if
(
dmodel
.
TenantId
>
0
)
if
(
dmodel
.
TenantId
>
0
)
...
@@ -922,7 +1048,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -922,7 +1048,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{
{
where
+=
$" and DATE_FORMAT(b.Date,'%Y-%m-%d' )=DATE_FORMAT('
{
System
.
DateTime
.
Now
.
AddDays
(
1
)}
','%Y-%m-%d' ) "
;
where
+=
$" and DATE_FORMAT(b.Date,'%Y-%m-%d' )=DATE_FORMAT('
{
System
.
DateTime
.
Now
.
AddDays
(
1
)}
','%Y-%m-%d' ) "
;
}
}
if
(
dmodel
.
IsProcurement
>
0
)
if
(
dmodel
.
IsProcurement
>
0
)
{
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
IsProcurement
)}
=
{
dmodel
.
IsProcurement
}
"
;
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
IsProcurement
)}
=
{
dmodel
.
IsProcurement
}
"
;
...
@@ -946,7 +1072,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -946,7 +1072,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
// //价格降序
// //价格降序
// orderBy = " g.Sort desc";
// orderBy = " g.Sort desc";
//}
//}
if
(
dmodel
.
OrderBy
==
1
)
if
(
dmodel
.
OrderBy
==
1
)
{
{
//价格升序
//价格升序
orderBy
=
" g.SellingPrice asc"
;
orderBy
=
" g.SellingPrice asc"
;
...
...
Mall.WebApi/Controllers/Product/GuideCarController.cs
View file @
74559e53
...
@@ -1696,6 +1696,22 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -1696,6 +1696,22 @@ namespace Mall.WebApi.Controllers.MallBase
bool
flag
=
guideCarModule
.
SetGoodsCommentInfo_V2
(
list
);
bool
flag
=
guideCarModule
.
SetGoodsCommentInfo_V2
(
list
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
}
/// <summary>
/// 获取司导订单状态枚举
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GuidCarOrderStatusEnumList
()
{
var
list
=
EnumHelper
.
GetEnumList
(
typeof
(
GuidCarOrderStatusEnum
));
return
ApiResult
.
Success
(
""
,
list
.
OrderBy
(
x
=>
Convert
.
ToInt32
(
x
.
Value
)).
Select
(
x
=>
new
{
Name
=
x
.
Key
,
Id
=
Convert
.
ToInt32
(
x
.
Value
)
}));
}
#
endregion
#
endregion
}
}
}
}
\ No newline at end of file
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
74559e53
...
@@ -1436,6 +1436,45 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -1436,6 +1436,45 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
Success
(
""
,
pagelist
);
return
ApiResult
.
Success
(
""
,
pagelist
);
}
}
/// <summary>
/// 获取商品列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetListByGoodsClassify
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Extend
>(
parms
.
msg
.
ToString
());
JObject
parameters
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetListByGoodsClassify
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
CoverImage
,
x
.
CarouselImageList
,
x
.
SellingPrice
,
x
.
SalesNum
,
x
.
InventoryNum
,
x
.
Sort
,
x
.
OriginalPrice
,
x
.
DefaultSpecificationName
,
x
.
GoodsNumbers
,
x
.
GoodsWeight
,
x
.
IsDefaultService
,
x
.
GoodsService
,
x
.
SpecificationList
,
x
.
SpecificationPriceList
,
x
.
SendArea
,
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// <summary>
/// 获取商品详情
/// 获取商品详情
/// </summary>
/// </summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment