Selaa lähdekoodia

!3 更新店铺和店铺类型一对多
Merge pull request !3 from 快跑者

Liu 9 kuukautta sitten
vanhempi
commit
1cacb9c399

+ 1 - 1
src/main/java/com/sqx/modules/goods/entity/GoodsShop.java

@@ -36,7 +36,7 @@ public class GoodsShop implements Serializable {
 
 
     @ApiModelProperty("商铺类型id")
-    private Long shopTypeId;
+    private String shopTypeId;
 
 
     @ApiModelProperty("商铺标签")

+ 4 - 3
src/main/resources/mapper/goods/GoodsShopMapper.xml

@@ -3,7 +3,8 @@
 <mapper namespace="com.sqx.modules.goods.dao.GoodsShopDao">
 
     <select id="selectAllShop" resultType="com.sqx.modules.goods.entity.GoodsShop">
-        select gs.*, st.shop_type_name as shopTypeName,
+        select gs.*, (SELECT GROUP_CONCAT(st1.shop_type_name SEPARATOR ',')
+        FROM shop_type st1 WHERE FIND_IN_SET(st1.id,gs.shop_type_id) ) as shopTypeName,
         (select user_id from sys_user where user_id in (select s.user_id from sys_user_shop s where
         s.shop_id=gs.shop_id) and user_type=2) as adminUserId
         from goods_shop gs
@@ -235,7 +236,7 @@
             and gs.activity_id = #{activityId}
         </if>
         <if test="shopTypeId!=null">
-            and gs.shop_type_id = #{shopTypeId}
+            and  FIND_IN_SET(#{shopTypeId},gs.shop_type_id)
         </if>
         order by gs.is_recommend desc
         <if test="screen==1">
@@ -515,7 +516,7 @@
             and gs.activity_id = #{activityId}
         </if>
         <if test="shopTypeId!=null">
-            and gs.shop_type_id = #{shopTypeId}
+            and  FIND_IN_SET(#{shopTypeId},gs.shop_type_id)
         </if>
         order by gs.is_recommend desc
         <if test="screen==1">