浏览代码

修改用户动态新增接口

zc 2 月之前
父节点
当前提交
fa505fa065

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserDynamicsVo.java

@@ -54,4 +54,10 @@ public class LifeUserDynamicsVo extends LifeUserDynamics {
 
     @ApiModelProperty(value = "粉丝量")
     private Integer fansCount;
+
+    @ApiModelProperty(value = "商家还是用户")
+    private String userType;
+
+    @ApiModelProperty(value = "动态类型1-图片 2-视频 3-其他")
+    private String dynamicsType;
 }

+ 14 - 20
alien-entity/src/main/resources/mapper/LifeUserDynamicsMapper.xml

@@ -6,7 +6,12 @@
         select dyna1.*, COUNT(dyna1.id) AS fansCount from (
         select dyna.*,COUNT(lc.id) AS commentCount,  COUNT(lm.id) AS transferNum from (
         with dynamice as(
-        select id, title, phone_id phoneId, context, image_path, address,address_name,address_context, liulan_count, dianzan_count, type, created_time, substring_index(phone_id, '_', 1) flag, substring_index(phone_id, '_', -1) phone, draft , address_province, top_status, top_time, enable_status
+        select
+        CASE
+        WHEN image_path REGEXP '.mp4|.avi|.flv|.mkv|.rmvb|.wmv|.3gp|.mov' THEN 2
+        WHEN image_path REGEXP '.jpg|.jpeg|.png|.bmp|.webp|.gif|.svg' THEN 1
+        ELSE 0
+        END AS dynamicsType,id, title, phone_id phoneId, context, image_path, address,address_name,address_context, liulan_count, dianzan_count, type, created_time, substring_index(phone_id, '_', 1) userType, substring_index(phone_id, '_', -1) phone, draft , address_province, top_status, top_time, enable_status
         from life_user_dynamics
         where delete_flag = 0 and draft = 0 order by created_time desc
         )
@@ -15,13 +20,13 @@
         left join store_user user on dynamice.phone = user.phone and user.delete_flag = 0
         left join store_info info on info.id = user.store_id and info.delete_flag = 0
         left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0
-        where dynamice.flag = 'store'
+        where dynamice.userType = 'store'
         union
         select dynamice.*, user.user_name userName, user.user_image userImage, user.id storeUserId, user.id storeOrUserId, IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert
         from dynamice
         join life_user user on dynamice.phone = user.user_phone and user.delete_flag = 0
         left join life_user_expert  lue on lue.user_id = user.id and lue.delete_flag = 0
-        where dynamice.flag = 'user') dyna
+        where dynamice.userType = 'user') dyna
         left join life_comment lc on lc.dongtai_shequ_id = dyna.id
         left join life_message lm on lm.business_id = dyna.id
         GROUP BY dyna.id order by  dyna.created_time desc) dyna1
@@ -32,24 +37,13 @@
         </if>
 
         <if test="userType != null and userType != ''">
-            AND dyna1.flag = #{userType}
+            AND dyna1.userType = #{userType}
         </if>
 
-        <!-- 同时处理字符串和数字类型 -->
-        <if test="dynamicsType != null">
-            <choose>
-                <when test="dynamicsType == 1">
-                    and dyna1.image_path REGEXP '.jpg|.jpeg|.png|.bmp|.webp|.gif|.svg'
-                </when>
-                <when test="dynamicsType == 2">
-                    <!-- 其他条件 -->
-                    and dyna1.image_path REGEXP '.mp4|.avi|.flv|.mkv|.rmvb|.wmv|.3gp|.mov'
-                </when>
-            </choose>
+        <if test="dynamicsType != null and dynamicsType != ''">
+            AND dyna1.dynamicsType = #{dynamicsType}
         </if>
 
-
-
         <if test="releaseStartTime != null and releaseStartTime != ''">
             AND dyna1.created_time >= #{releaseStartTime}
         </if>
@@ -64,7 +58,7 @@
         select dyna1.*, COUNT(dyna1.id) AS fansCount from (
         select dyna.*,COUNT(lc.id) AS commentCount,  COUNT(lm.id) AS transferNum from (
         with dynamice as(
-        select id, title, phone_id phoneId, context, image_path, address,address_name,address_context, liulan_count, dianzan_count, type, created_time, substring_index(phone_id, '_', 1) flag, substring_index(phone_id, '_', -1) phone, draft , address_province, top_status, top_time, enable_status
+        select id, title, phone_id phoneId, context, image_path, address,address_name,address_context, liulan_count, dianzan_count, type, created_time, substring_index(phone_id, '_', 1) userType, substring_index(phone_id, '_', -1) phone, draft , address_province, top_status, top_time, enable_status
         from life_user_dynamics
         where id = #{id} and delete_flag = 0 and draft = 0 order by created_time desc
         )
@@ -73,13 +67,13 @@
         left join store_user user on dynamice.phone = user.phone and user.delete_flag = 0
         left join store_info info on info.id = user.store_id and info.delete_flag = 0
         left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0
-        where dynamice.flag = 'store'
+        where dynamice.userType = 'store'
         union
         select dynamice.*, user.user_name userName, user.user_image userImage, user.id storeUserId, user.id storeOrUserId, IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert
         from dynamice
         join life_user user on dynamice.phone = user.user_phone and user.delete_flag = 0
         left join life_user_expert  lue on lue.user_id = user.id and lue.delete_flag = 0
-        where dynamice.flag = 'user') dyna
+        where dynamice.userType = 'user') dyna
         left join life_comment lc on lc.dongtai_shequ_id = dyna.id
         left join life_message lm on lm.business_id = dyna.id
         GROUP BY dyna.id order by  dyna.created_time desc) dyna1