|
|
@@ -30,18 +30,73 @@ public interface LifeBrowseRecordMapper extends BaseMapper<LifeBrowseRecord> {
|
|
|
"Order by lbr.liulan_time desc")
|
|
|
List<Map<String, Object>> getGroupBuyBrowseRecordByUserId(String userId);
|
|
|
|
|
|
- @Select("select lbr.id, lud.id dynamicsId, IFNULL(lud.cover_image, '') coverImage, lbr.liulan_date liulanDate, " +
|
|
|
- "lud.phone_id phoneId, lud.title, lud.context, lud.image_path imagePath, lud.address, " +
|
|
|
- "lud.address_context addressContext, lud.address_name addressName, lud.liulan_count liulanCount, " +
|
|
|
- "lud.dianzan_count dianzanCount, lud.type, lud.draft, lud.created_time createdTime, lud.updated_time updatedTime, " +
|
|
|
- "lud.address_province addressProvince, lud.top_status topStatus, lud.top_time topTime, " +
|
|
|
- "lud.enable_status enableStatus, lud.expert_id expertId, lud.business_id businessId, " +
|
|
|
- "lud.transfer_count transferCount, lud.reality_count realityCount, lud.check_flag checkFlag, " +
|
|
|
- "lud.ai_task_id aiTaskId, lud.reason, lud.delete_flag deleteFlag\n" +
|
|
|
- "from life_browse_record lbr \n" +
|
|
|
- "inner join life_user_dynamics lud on lud.id = lbr.dynamics_id \n" +
|
|
|
- "and lud.delete_flag = 0 and lbr.delete_flag = 0 \n" +
|
|
|
- "where lbr.user_id = #{userId} and lbr.dynamics_id is not null\n" +
|
|
|
- "Order by lbr.liulan_time desc")
|
|
|
+ @Select("SELECT " +
|
|
|
+ "lbr.id, " +
|
|
|
+ "lud.id dynamicsId, " +
|
|
|
+ "IFNULL(lud.cover_image, '') coverImage, " +
|
|
|
+ "lbr.liulan_date liulanDate, " +
|
|
|
+ "lud.phone_id phoneId, " +
|
|
|
+ "lud.title, " +
|
|
|
+ "lud.context, " +
|
|
|
+ "lud.image_path imagePath, " +
|
|
|
+ "lud.address, " +
|
|
|
+ "lud.address_context addressContext, " +
|
|
|
+ "lud.address_name addressName, " +
|
|
|
+ "lud.liulan_count liulanCount, " +
|
|
|
+ "lud.dianzan_count dianzanCount, " +
|
|
|
+ "lud.type, " +
|
|
|
+ "lud.draft, " +
|
|
|
+ "lud.created_time createdTime, " +
|
|
|
+ "lud.updated_time updatedTime, " +
|
|
|
+ "lud.address_province addressProvince, " +
|
|
|
+ "lud.top_status topStatus, " +
|
|
|
+ "lud.top_time topTime, " +
|
|
|
+ "lud.enable_status enableStatus, " +
|
|
|
+ "lud.expert_id expertId, " +
|
|
|
+ "lud.business_id businessId, " +
|
|
|
+ "lud.transfer_count transferCount, " +
|
|
|
+ "lud.reality_count realityCount, " +
|
|
|
+ "lud.check_flag checkFlag, " +
|
|
|
+ "lud.ai_task_id aiTaskId, " +
|
|
|
+ "lud.reason, " +
|
|
|
+ "lud.delete_flag deleteFlag, " +
|
|
|
+ "si1.id storeId, " +
|
|
|
+ "si1.store_name storeName, " +
|
|
|
+ "si1.score_avg scoreAvg, " +
|
|
|
+ "si1.business_section businessSection, " +
|
|
|
+ "si1.business_section_name businessSectionName, " +
|
|
|
+ "ROUND(IFNULL(si1.score_one, 0), 2) scoreOne, " +
|
|
|
+ "ROUND(IFNULL(si1.score_two, 0), 2) scoreTwo, " +
|
|
|
+ "ROUND(IFNULL(si1.score_three, 0), 2) scoreThree, " +
|
|
|
+ "IFNULL(cr.ratingCount, 0) ratingCount " +
|
|
|
+ "FROM " +
|
|
|
+ "life_browse_record lbr " +
|
|
|
+ "INNER JOIN life_user_dynamics lud ON lud.id = lbr.dynamics_id " +
|
|
|
+ "AND lud.delete_flag = 0 " +
|
|
|
+ "AND lbr.delete_flag = 0 " +
|
|
|
+ "LEFT JOIN store_user su ON SUBSTRING_INDEX(lud.phone_id, '_', -1) = su.phone " +
|
|
|
+ "AND su.delete_flag = 0 " +
|
|
|
+ "AND SUBSTRING_INDEX(lud.phone_id, '_', 1) = 'store' " +
|
|
|
+ "LEFT JOIN store_info si1 ON si1.id = su.store_id " +
|
|
|
+ "AND si1.delete_flag = 0 " +
|
|
|
+ "LEFT JOIN ( " +
|
|
|
+ "SELECT " +
|
|
|
+ "business_id, " +
|
|
|
+ "count(*) AS ratingCount " +
|
|
|
+ "FROM " +
|
|
|
+ "common_rating " +
|
|
|
+ "WHERE " +
|
|
|
+ "business_type = 1 " +
|
|
|
+ "AND delete_flag = 0 " +
|
|
|
+ "AND audit_status = 1 " +
|
|
|
+ "AND is_show = 1 " +
|
|
|
+ "GROUP BY " +
|
|
|
+ "business_id " +
|
|
|
+ ") cr ON cr.business_id = si1.id " +
|
|
|
+ "WHERE " +
|
|
|
+ "lbr.user_id = #{userId} " +
|
|
|
+ "AND lbr.dynamics_id IS NOT NULL " +
|
|
|
+ "ORDER BY " +
|
|
|
+ "lbr.liulan_time DESC")
|
|
|
List<Map<String, Object>> getDynamicsBrowseRecordByUserId(String userId);
|
|
|
}
|