Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
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
hooloo
ms
soss
Commits
bc98754f
Commit
bc98754f
authored
Mar 02, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单时校验订单中sku数量
parent
4556b8d9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
soss-system/src/main/java/com/soss/system/domain/vo/SkuCountVo.java
+9
-0
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
+2
-0
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+6
-4
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+8
-0
No files found.
soss-system/src/main/java/com/soss/system/domain/vo/SkuCountVo.java
0 → 100644
View file @
bc98754f
package
com
.
soss
.
system
.
domain
.
vo
;
import
lombok.Data
;
@Data
public
class
SkuCountVo
{
private
Integer
sellin
=
0
;
private
Integer
sellout
=
0
;
}
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
View file @
bc98754f
...
...
@@ -2,6 +2,7 @@ package com.soss.system.mapper;
import
com.soss.system.domain.GoodsSku
;
import
com.soss.system.domain.ShopGoodsSku
;
import
com.soss.system.domain.vo.SkuCountVo
;
import
com.soss.system.domain.vo.orderTaking.SkuVo
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -33,6 +34,7 @@ public interface ShopGoodsSkuMapper {
Integer
getSellinSkuCount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
Integer
getSelloutSkuCount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
SkuCountVo
getSkuCount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
/**
* 新增从店铺到sku关联
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
bc98754f
...
...
@@ -10,6 +10,7 @@ import com.soss.common.enums.SkuDeleteState;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.vo.SkuCountVo
;
import
com.soss.system.domain.vo.orderTaking.*
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.mapper.*
;
...
...
@@ -279,10 +280,11 @@ public class ShopServiceImpl implements IShopService {
}
}
Integer
selloutCount
=
shopGoodsSkuMapper
.
getSelloutSkuCount
(
shopId
,
goods
.
getId
());
Integer
sellinCount
=
shopGoodsSkuMapper
.
getSellinSkuCount
(
shopId
,
goods
.
getId
());
goods
.
setSelloutCount
(
selloutCount
);
goods
.
setSkuCount
(
sellinCount
+
selloutCount
);
SkuCountVo
skuCountVo
=
shopGoodsSkuMapper
.
getSkuCount
(
shopId
,
goods
.
getId
());
if
(
skuCountVo
!=
null
)
{
goods
.
setSelloutCount
(
skuCountVo
.
getSellout
());
goods
.
setSkuCount
(
skuCountVo
.
getSellin
()
+
skuCountVo
.
getSellout
());
}
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
...
...
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
bc98754f
...
...
@@ -42,6 +42,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from shop_goods_sku where shop_id=#{shopId} and goods_id=#{goodsId} and `state`=1
</select>
<select
id=
"getSkuCount"
resultType=
"SkuCountVo"
>
select
sum(case when `state`=1 then 1 else 0 end) as sellin,
sum(case when `state`!=1 then 1 else 0 end) as sellout
from shop_goods_sku
where shop_id=#{shopId} and goods_id=#{goodsId}
</select>
<select
id=
"selectShopGoodsSkuById"
parameterType=
"String"
resultMap=
"ShopGoodsSkuResult"
>
<include
refid=
"selectShopGoodsSkuVo"
/>
where id = #{id}
...
...
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