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
f20d798f
Commit
f20d798f
authored
Mar 03, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化店铺距离限制
parent
b7bfea54
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
37 deletions
+19
-37
soss-system/src/main/java/com/soss/system/domain/Goods.java
+2
-2
soss-system/src/main/java/com/soss/system/domain/vo/SkuCountVo.java
+0
-9
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
+0
-5
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+17
-5
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+0
-16
No files found.
soss-system/src/main/java/com/soss/system/domain/Goods.java
View file @
f20d798f
...
...
@@ -138,10 +138,10 @@ public class Goods extends BaseEntity {
private
String
preferential
;
/** 商品sku数量 */
private
Integer
skuCount
;
private
Integer
skuCount
=
0
;
/** 商品售罄sku数量 */
private
Integer
selloutCount
;
private
Integer
selloutCount
=
0
;
/**
* 总销量
...
...
soss-system/src/main/java/com/soss/system/domain/vo/SkuCountVo.java
deleted
100644 → 0
View file @
b7bfea54
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 @
f20d798f
...
...
@@ -2,7 +2,6 @@ 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
;
...
...
@@ -32,10 +31,6 @@ public interface ShopGoodsSkuMapper {
*/
public
List
<
ShopGoodsSku
>
selectShopGoodsSkuList
(
ShopGoodsSku
shopGoodsSku
);
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 @
f20d798f
...
...
@@ -10,7 +10,6 @@ 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.*
;
...
...
@@ -58,6 +57,8 @@ public class ShopServiceImpl implements IShopService {
private
JiGuangPushServiceImpl
jiGuangPushService
;
@Autowired
private
GoodsTagMapper
goodsTagMapper
;
@Autowired
private
ShopGoodsServiceImpl
shopGoodsService
;
/**
* 查询店铺
...
...
@@ -280,11 +281,22 @@ public class ShopServiceImpl implements IShopService {
}
}
SkuCountVo
skuCountVo
=
shopGoodsSkuMapper
.
getSkuCount
(
shopId
,
goods
.
getId
());
if
(
skuCountVo
!=
null
)
{
goods
.
setSelloutCount
(
skuCountVo
.
getSellout
()
);
goods
.
setSkuCount
(
skuCountVo
.
getSellin
()
+
skuCountVo
.
getSellout
()
);
List
<
Spec
>
specs
=
shopGoodsService
.
getShopGoodsSpecs
(
shopId
,
goods
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
specs
)
)
{
goods
.
setSelloutCount
(
0
);
goods
.
setSkuCount
(
0
);
}
specs
.
forEach
(
spec
->
{
if
(
CollectionUtils
.
isEmpty
(
spec
.
getSpecRules
()))
{
return
;
}
spec
.
getSpecRules
().
forEach
(
rule
->
{
goods
.
setSkuCount
(
goods
.
getSkuCount
()
+
1
);
if
(
rule
.
getState
()
==
0
)
{
goods
.
setSelloutCount
(
goods
.
getSelloutCount
()
+
1
);
}
});
});
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
...
...
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
f20d798f
...
...
@@ -33,22 +33,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
</where>
</select>
<select
id=
"getSelloutSkuCount"
resultType=
"Integer"
>
select count(1) from shop_goods_sku where shop_id=#{shopId} and goods_id=#{goodsId} and `state`!=1
</select>
<select
id=
"getSellinSkuCount"
resultType=
"Integer"
>
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"
/>
...
...
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