SELECT b.BOOK_ID bookId, any(b.COVER_IMG) coverImg, any(bg.id) bookGroupId, any(b.ISBN) isbn, any(b.BOOK_NAME) bookName, any(concat('BK', toString(b.BOOK_ID))) bookNumber FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME FROM book WHERE IS_DELETE = 0 AND BOOK_NAME NOT LIKE concat('%', '红榜', '%') AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1) AND CHAR_LENGTH(BOOK_NAME) >= 8 ) b JOIN ( SELECT id, book_id, create_time, group_qrcode_name FROM book_group WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0) AND is_delete = 0 AND channel_id = ${channelId} AND create_time >= #{startTime} AND create_time <= #{endTime} AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME < now() AND START_TIME > now()) ) bg ON b.BOOK_ID = bg.book_id WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%') GROUP BY b.BOOK_ID ORDER BY b.BOOK_ID DESC LIMIT ${offset}, ${limit}

select book_id bookId, scans scanCount from collect.total_scan_gmv where toDate(create_time) = today() and toInt64(scans) > 0 and bookId in #{item}

SELECT uniqExact(b.BOOK_ID) FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME FROM book WHERE IS_DELETE = 0 AND BOOK_NAME NOT LIKE concat('%', '红榜', '%') AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1) AND CHAR_LENGTH(BOOK_NAME) >= 8 ) b JOIN ( SELECT id, book_id, create_time, group_qrcode_name FROM book_group WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0) AND is_delete = 0 AND channel_id = ${channelId} AND create_time >= #{startTime} AND create_time <= #{endTime} AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME < now() AND START_TIME > now()) ) bg ON b.BOOK_ID = bg.book_id WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%')
SELECT uniqExact(b.BOOK_ID) FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME FROM book WHERE IS_DELETE = 0 AND BOOK_NAME NOT LIKE concat('%', '红榜', '%') AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1) AND CHAR_LENGTH(BOOK_NAME) >= 8 ) b JOIN ( SELECT id, book_id, create_time, group_qrcode_name FROM book_group WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0) AND is_delete = 0 AND create_user = ${adviserId} AND create_time >= #{startTime} AND create_time <= #{endTime} AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME < now() AND START_TIME > now()) ) bg ON b.BOOK_ID = bg.book_id WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%')
SELECT b.BOOK_ID bookId, any(b.COVER_IMG) coverImg, any(bg.id) bookGroupId, any(b.ISBN) isbn, any(b.BOOK_NAME) bookName, any(concat('BK', toString(b.BOOK_ID))) bookNumber FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME FROM book WHERE IS_DELETE = 0 AND BOOK_NAME NOT LIKE concat('%', '红榜', '%') AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1) AND CHAR_LENGTH(BOOK_NAME) >= 8 ) b JOIN ( SELECT id, book_id, create_time, group_qrcode_name FROM book_group WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0) AND is_delete = 0 AND create_user = ${adviserId} AND create_time >= #{startTime} AND create_time <= #{endTime} AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME < now() AND START_TIME > now()) ) bg ON b.BOOK_ID = bg.book_id WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%') GROUP BY b.BOOK_ID ORDER BY b.BOOK_ID DESC LIMIT ${offset}, ${limit}