提交 c091748c 作者: 刘明祎

根据话题id查询商品id

上级 5bad4814
流水线 #8824 已通过 于阶段
in 2 分 30 秒
package com.mmc.pms.controller.mall;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GambitIdsVO {
private List<Integer> gambitId;
}
......@@ -88,4 +88,12 @@ public class MallGoodsController extends BaseController {
public ResultBody feignRemoveGoodsByUserAccountId(@RequestParam(value = "id") Integer id, @RequestParam(value = "companyInfoId") Integer companyInfoId) {
return mallGoodsService.feignRemoveGoodsByBackUserAccountId(id, companyInfoId);
}
@ApiOperation(value = "根据话题id查询商城商品详情列表")
@PostMapping("GoodsInfoByGambitId")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> goodsInfoByGambitIds(@RequestBody GambitIdsVO gambitIds) {
return mallGoodsService.goodsInfoByGambitId(gambitIds);
}
}
......@@ -68,4 +68,6 @@ public interface MallGoodsDao {
int getMallGoodsCount();
List<MallGoodsDO> recommendMallGoods();
MallGoodsDO getMallGoodsInfoByGambitId(Integer gambitId);
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.service.mall;
import com.mmc.pms.auth.dto.LoginSuccessDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.controller.mall.GambitIdsVO;
import com.mmc.pms.model.lease.vo.LeaseGoodsVO;
import com.mmc.pms.model.lease.vo.LeasePriceStockVO;
import com.mmc.pms.model.mall.MallGoodsVO;
......@@ -44,4 +45,6 @@ public interface MallGoodsService {
void updateSpecInfo(MallGoodsVO mallGoodsVO, LeaseGoodsVO leaseGoodsVO);
PageResult listMallGoodsBySearch(MallGoodsInfoQO param, LoginSuccessDTO userLoginInfoFromRedis);
ResultBody<MallGoodsVO> goodsInfoByGambitId(GambitIdsVO gambitId);
}
......@@ -4,6 +4,7 @@ import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.auth.dto.LoginSuccessDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.controller.mall.GambitIdsVO;
import com.mmc.pms.dao.lease.LeaseGoodsDao;
import com.mmc.pms.dao.mall.MallGoodsDao;
import com.mmc.pms.entity.lease.LeasePriceStockDO;
......@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -294,6 +296,24 @@ public class MallGoodsServiceImpl implements MallGoodsService {
return pageResult;
}
@Override
public ResultBody<MallGoodsVO> goodsInfoByGambitId(GambitIdsVO gambitIds) {
List<MallGoodsVO> mallGoodsList = new ArrayList<>();
List<Integer> id = gambitIds.getGambitId();
for (Integer gambitId : id) {
MallGoodsDO mallGoodsDO = mallGoodsDao.getMallGoodsInfoByGambitId(gambitId);
if (mallGoodsDO != null) {
MallGoodsVO mallGoodsVO = mallGoodsDO.buildMallGoodsVO();
// 获取图片及其他资源信息
List<MallGoodsResourcesDO> mallGoodsResourcesList = mallGoodsDao.getMallGoodsResources(mallGoodsVO.getId());
mallGoodsVO.setResourcesList(mallGoodsResourcesList.stream()
.map(MallGoodsResourcesDO::buildGoodsResourcesVO).collect(Collectors.toList()));
mallGoodsList.add(mallGoodsVO);
}
}
return ResultBody.success(mallGoodsList);
}
/**
* 添加新规格值
*
......
......@@ -21,7 +21,7 @@
gambit_id)
values ( #{goodsNo}, #{tradeName}, #{description}, #{categoryPrimaryId}, #{categorySubId}
, #{shelfStatus}, #{goodsLabel}, #{labelShow}, #{goodsDetails}
, #{userAccountId}, #{recommend}, #{priceShow}, #{sort} , #{gambitId})
, #{userAccountId}, #{recommend}, #{priceShow}, #{sort}, #{gambitId})
</insert>
<insert id="batchInsertMallGoodsResources">
......@@ -328,4 +328,27 @@
where mg.is_deleted = 0
and mg.recommend = 1
</select>
<select id="getMallGoodsInfoByGambitId" resultType="com.mmc.pms.entity.mall.MallGoodsDO">
SELECT id,
goods_no,
trade_name,
description,
category_primary_id,
category_sub_id,
shelf_status,
goods_label,
label_show,
goods_details,
user_account_id,
price_show,
recommend,
sort,
gambit_id,
create_time
FROM mall_goods
WHERE gambit_id = #{gambitId}
and is_deleted = 0
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论