提交 ac7ead32 作者: xiaowang

新增:商品上下架、删除

上级 48bd80af
...@@ -63,6 +63,23 @@ public class BackstageGoodsManageController { ...@@ -63,6 +63,23 @@ public class BackstageGoodsManageController {
return ResultBody.success(goodsInfoService.listPageGoodsInfo(param)); return ResultBody.success(goodsInfoService.listPageGoodsInfo(param));
} }
@ApiOperation(value = "商品批量上下架")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("batchOnShelfOrTakeDown")
public ResultBody batchOnShelfOrTakeDown(
@RequestParam(value = "goodsIds") List<Integer> goodsIds,
@ApiParam("状态:上架:1,下架:0") @RequestParam(value = "status") Integer status) {
return goodsInfoService.batchOnShelfOrTakeDown(goodsIds, status);
}
@ApiOperation(value = "商品批量删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchRemoveWareInfo")
public ResultBody batchRemoveWareInfo(
@ApiParam(value = "商品id数组", required = true) @RequestBody List<Integer> ids) {
return goodsInfoService.batchRemoveWareInfo(ids);
}
@ApiOperation(value = "单位信息") @ApiOperation(value = "单位信息")
@GetMapping("getSkuUnit") @GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
......
...@@ -101,4 +101,8 @@ public interface GoodsInfoDao { ...@@ -101,4 +101,8 @@ public interface GoodsInfoDao {
int countListGoodsInfo(MallGoodsQO param); int countListGoodsInfo(MallGoodsQO param);
List<GoodsInfo> listGoodsInfo(MallGoodsQO param); List<GoodsInfo> listGoodsInfo(MallGoodsQO param);
void batchUpOrDownWare(@Param("ids") List<Integer> ids, @Param("status") Integer status);
void removeWareInfo(List<Integer> ids);
} }
...@@ -42,4 +42,8 @@ public interface GoodsInfoService { ...@@ -42,4 +42,8 @@ public interface GoodsInfoService {
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
PageResult listPageGoodsInfo(MallGoodsQO param); PageResult listPageGoodsInfo(MallGoodsQO param);
ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
ResultBody batchRemoveWareInfo(List<Integer> ids);
} }
...@@ -1123,4 +1123,16 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -1123,4 +1123,16 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
goodsInfo.stream().map(GoodsInfo::buildGoodsInfoListDTO).collect(Collectors.toList()); goodsInfo.stream().map(GoodsInfo::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList); return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
} }
@Override
public ResultBody batchOnShelfOrTakeDown(List<Integer> ids, Integer status) {
goodsInfoDao.batchUpOrDownWare(ids, status);
return ResultBody.success();
}
@Override
public ResultBody batchRemoveWareInfo(List<Integer> ids) {
goodsInfoDao.removeWareInfo(ids);
return ResultBody.success();
}
} }
...@@ -143,6 +143,24 @@ ...@@ -143,6 +143,24 @@
and is_deleted = 0 and is_deleted = 0
</foreach> </foreach>
</update> </update>
<update id="batchDownWare">
update goods_info set shelf_status = 0 where id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="batchUpOrDownWare">
update goods_info set shelf_status = #{status} where id in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="removeWareInfo">
update goods_info set is_deleted=1 where id in
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
</update>
<delete id="deleteGoodsServiceByGoodsId"> <delete id="deleteGoodsServiceByGoodsId">
delete delete
from goods_service from goods_service
...@@ -154,6 +172,7 @@ ...@@ -154,6 +172,7 @@
from goods_info from goods_info
where is_deleted = 0 where is_deleted = 0
and goods_name = #{goodsName} and goods_name = #{goodsName}
and goods_type = #{goodsType}
<if test="id!=null and id!=''"> <if test="id!=null and id!=''">
and id <![CDATA[<>]]> #{id} and id <![CDATA[<>]]> #{id}
</if> </if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论