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
49a25d0e
Commit
49a25d0e
authored
Mar 08, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
恢复部分代码
parent
3eac39b6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
10 deletions
+41
-10
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
+3
-5
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
+2
-0
soss-system/src/main/java/com/soss/system/service/IShopGoodsService.java
+1
-1
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsServiceImpl.java
+26
-4
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+9
-0
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
View file @
49a25d0e
...
...
@@ -217,13 +217,11 @@ public class ShopController extends BaseController {
}
@GetMapping
(
"/updateShopGoodsSkuState"
)
public
AjaxResult
updateShopGoodsSkuState
(
@RequestParam
(
"ids"
)
List
<
Long
>
shopGoodsSkuIds
,
@RequestParam
(
"state"
)
Integer
state
)
{
public
AjaxResult
updateShopGoodsSkuState
(
@RequestParam
(
"shopId"
)
Long
shopId
,
@RequestParam
(
"goodsId"
)
Long
goodsId
,
@RequestParam
(
"ids"
)
List
<
Long
>
shopGoodsSkuIds
,
@RequestParam
(
"state"
)
Integer
state
)
{
if
(
CollectionUtils
.
isEmpty
(
shopGoodsSkuIds
))
{
return
AjaxResult
.
error
(
"id列表为空"
);
}
for
(
Long
id
:
shopGoodsSkuIds
)
{
shopGoodsService
.
updateShopGoodsSkuState
(
id
,
state
);
}
return
AjaxResult
.
success
();
return
AjaxResult
.
success
(
shopGoodsService
.
updateShopGoodsSkuState
(
shopId
,
goodsId
,
shopGoodsSkuIds
,
state
));
}
}
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
View file @
49a25d0e
...
...
@@ -50,6 +50,8 @@ public interface ShopGoodsSkuMapper {
int
updateShopGoodsSkuState
(
@Param
(
"id"
)
Long
shopGoodsSkuId
,
@Param
(
"state"
)
Integer
state
);
List
<
Long
>
selectSkuIds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
/**
* 删除从店铺到sku关联
*
...
...
soss-system/src/main/java/com/soss/system/service/IShopGoodsService.java
View file @
49a25d0e
...
...
@@ -61,5 +61,5 @@ public interface IShopGoodsService {
public
int
deleteShopGoodsById
(
String
id
);
List
<
ShopGoodsSku
>
selectSkuByShopGoods
(
Long
shopId
,
Long
goodsId
);
Boolean
updateShopGoodsSkuState
(
Long
shopGoodsSkuId
,
Integer
state
);
Boolean
updateShopGoodsSkuState
(
Long
shop
Id
,
Long
goodsId
,
List
<
Long
>
shop
GoodsSkuId
,
Integer
state
);
}
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsServiceImpl.java
View file @
49a25d0e
package
com
.
soss
.
system
.
service
.
impl
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.ShopGoods
;
import
com.soss.system.domain.ShopGoodsSku
;
import
com.soss.system.mapper.*
;
import
com.soss.system.service.IShopGoodsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 店铺和商品关联Service业务层处理
...
...
@@ -103,11 +107,29 @@ public class ShopGoodsServiceImpl implements IShopGoodsService {
}
@Override
public
Boolean
updateShopGoodsSkuState
(
Long
shopGoodsSkuId
,
Integer
state
)
{
int
i
=
shopGoodsSkuMapper
.
updateShopGoodsSkuState
(
shopGoodsSkuId
,
state
);
if
(
i
>
0
)
{
public
Boolean
updateShopGoodsSkuState
(
Long
shopId
,
Long
goodsId
,
List
<
Long
>
shopGoodsSkuIds
,
Integer
state
)
{
// int i = shopGoodsSkuMapper.updateShopGoodsSkuState(shopGoodsSkuId, state);
// if (i > 0) {
// return true;
// }
for
(
Long
id
:
shopGoodsSkuIds
)
{
shopGoodsSkuMapper
.
updateShopGoodsSkuState
(
id
,
state
);
}
List
<
Long
>
skuIds
=
shopGoodsSkuMapper
.
selectSkuIds
(
shopGoodsSkuIds
);
if
(!
CollectionUtils
.
isEmpty
(
skuIds
))
{
//推送给极光
List
<
Machine
>
machines
=
machineMapper
.
selectMachineByShopId
(
shopId
);
if
(
CollectionUtils
.
isEmpty
(
machines
))
{
return
true
;
}
return
false
;
Machine
machine
=
machines
.
get
(
0
);
Map
<
Long
,
List
<
Long
>>
map
=
new
HashMap
<>();
map
.
put
(
goodsId
,
skuIds
);
machineApiService
.
push
(
machine
,
String
.
valueOf
(
state
),
map
);
}
return
true
;
}
}
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
49a25d0e
...
...
@@ -84,6 +84,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update
id=
"updateShopGoodsSkuState"
>
update shop_goods_sku set `state`= #{state} where id = #{id}
</update>
<select
id=
"selectSkuIds"
>
select sku_id from shop_goods_sku
<if
test=
"ids!=null"
>
where id in
<foreach
collection=
"ids"
index=
"index"
item=
"id"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
</select>
<delete
id=
"deleteShopGoodsSkuById"
parameterType=
"String"
>
delete from shop_goods_sku 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