浏览代码

小小训练营活动
直播间商品

zouxuan 3 年之前
父节点
当前提交
dedfd79539

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/LiveGoodsMapperDao.java

@@ -17,7 +17,7 @@ public interface LiveGoodsMapperDao extends BaseDAO<Integer, LiveGoodsMapper> {
 
     LiveGoodsMapper findByLiveIdAndGoodsId(@Param("liveId") String liveId, @Param("liveGoodsId") Integer liveGoodsId);
 
-    List<LiveGoodsMapperDto> getLiveGoodsList(@Param("liveId") String liveId, @Param("liveGoodsId") Integer liveGoodsId, @Param("status") boolean status);
+    List<LiveGoodsMapperDto> getLiveGoodsList(@Param("liveId") String liveId, @Param("liveGoodsId") Integer liveGoodsId, @Param("status") Boolean status);
 
     void batchInsert(@Param("liveGoodsMappers") List<LiveGoodsMapper> liveGoodsMappers);
 

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/LiveGoodsMapperMapper.xml

@@ -84,7 +84,7 @@
 				AND lgm.status_ = #{status}
 			</if>
 			<if test="liveGoodsId != null">
-				AND lg.goods_id_ = #{liveGoodsId}
+				AND lg.id_ = #{liveGoodsId}
 			</if>
 		</where>
 	</sql>
@@ -120,7 +120,7 @@
 				AND lgm.status_ = #{status}
 			</if>
 			<if test="liveGoodsId != null">
-				AND lg.goods_id_ = #{liveGoodsId}
+				AND lg.id_ = #{liveGoodsId}
 			</if>
 		</where>
 	</sql>

+ 7 - 1
mec-student/src/main/java/com/ym/mec/student/controller/LiveGoodsMapperController.java

@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @Api(tags = "直播商品关联管理")
 @RequestMapping("liveGoodsMapper")
 @RestController
@@ -38,6 +40,10 @@ public class LiveGoodsMapperController extends BaseController {
             @ApiImplicitParam(name = "liveId", value = "房间号", required = true,dataType = "String")
     })
     public HttpResponseResult<LiveGoodsMapperDto> getGoodsDetail(Integer liveGoodsId, String liveId) {
-        return succeed(liveGoodsMapperService.getLiveGoodsList(liveId,liveGoodsId,null).get(0));
+        List<LiveGoodsMapperDto> liveGoodsList = liveGoodsMapperService.getLiveGoodsList(liveId, liveGoodsId, null);
+        if (liveGoodsList.size() > 0) {
+            return succeed(liveGoodsList.get(0));
+        }
+        return failed("商品不存在");
     }
 }