select BOOK_ID from BOOK_ADVISER where IS_DELETE = 0 and ADVISER_ID = #{adviserId} and CREATED_DATE >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH)
INSERT INTO BOOK_ADVISER ( BOOK_ID, ADVISER_ID, CHANNEL_ID, CREATED_USER, CREATED_DATE,IS_MAIN_EDITOR, TEMPLET_ID, SECOND_TEMPLET_ID,third_templet_id, GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID,pro_label_id, dep_label_id,pur_label_id,is_open_robot_process, vol_label_id,LAST_MODIFIED_DATE,ip_address,open_rays_code, is_jump_book ) VALUES ( #{bookId, jdbcType=VARCHAR}, #{adviserId, jdbcType=VARCHAR}, #{channelId, jdbcType=VARCHAR}, #{adviserId, jdbcType=BIGINT}, NOW(),#{isMainEditor, jdbcType=BIT},#{templetId, jdbcType=BIGINT}, #{secondTempletId, jdbcType=BIGINT},#{thirdTempletId},#{graLabelId, jdbcType=BIGINT},#{subLabelId, jdbcType=BIGINT}, #{verLabelId, jdbcType=BIGINT},#{areaLabelId, jdbcType=BIGINT},#{proLabelId,jdbcType=BIGINT}, #{depLabelId,jdbcType=BIGINT},#{purLabelId,jdbcType=BIGINT},#{isOpenRobotProcess,jdbcType=BIT}, #{volLabelId},now(),#{ipAddress},IFNULL(#{openRaysCode},1), IFNULL(#{isJumpBook},0) ) ON DUPLICATE KEY UPDATE IS_DELETE = 0,LAST_MODIFIED_DATE=now(), IS_MAIN_EDITOR = #{isMainEditor, jdbcType=BIT} ,TEMPLET_ID=#{templetId, jdbcType=BIGINT} ,SECOND_TEMPLET_ID=#{secondTempletId, jdbcType=BIGINT} ,third_templet_id=#{thirdTempletId, jdbcType=BIGINT}

INSERT INTO BOOK_ADVISER ( BOOK_ID, ADVISER_ID, CHANNEL_ID, CREATED_USER, CREATED_DATE,IS_MAIN_EDITOR, TEMPLET_ID,SECOND_TEMPLET_ID,LAST_MODIFIED_DATE,third_TEMPLET_ID ) VALUES ( #{item.bookId, jdbcType=VARCHAR}, #{item.adviserId, jdbcType=VARCHAR}, #{item.channelId, jdbcType=VARCHAR}, #{item.adviserId, jdbcType=BIGINT}, NOW(),#{item.isMainEditor, jdbcType=BIT},#{item.templetId, jdbcType=BIGINT},#{item.secondTempletId, jdbcType=BIGINT},now(), #{item.thirdTempletId} ) ON DUPLICATE KEY UPDATE IS_DELETE = 0,LAST_MODIFIED_DATE=now(),IS_MAIN_EDITOR=#{item.isMainEditor, jdbcType=BIT} ,TEMPLET_ID=#{item.templetId, jdbcType=BIGINT} ,SECOND_TEMPLET_ID=#{item.secondTempletId, jdbcType=BIGINT} ,third_TEMPLET_ID=#{item.thirdTempletId, jdbcType=BIGINT}
UPDATE BOOK_ADVISER SET IS_DELETE = 1, LAST_MODIFIED_DATE = NOW() WHERE BOOK_ID = #{bookId, jdbcType=BIGINT}
UPDATE BOOK_ADVISER SET IS_DELETE = 1, LAST_MODIFIED_DATE = NOW() WHERE BOOK_ID IN ${item}
SELECT BOOK_ADVISER_ID, BOOK_ID, TEMPLET_ID, CHANNEL_ID, ADVISER_ID, IS_DELETE, TEMPLET_ID,SECOND_TEMPLET_ID,third_templet_id, GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID,is_open_robot_process,vol_label_id, is_open_catalog, pur_label_id, dep_label_id, pro_label_id, is_jump_book FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND ADVISER_ID = #{adviserId}
SELECT ba.BOOK_ADVISER_ID, ba.BOOK_ID, ba.CHANNEL_ID, ba.ADVISER_ID, ba.IS_DELETE FROM BOOK_ADVISER ba LEFT JOIN BOOK b on b.BOOK_ID = ba.BOOK_ID WHERE ba.BOOK_ID = #{bookId} AND ba.CHANNEL_ID = #{channelId} AND ba.ADVISER_ID = #{adviserId} AND ba.IS_DELETE = 0 AND b.SERIAL_NUMBER = #{serialNumber} ORDER BY ba.CREATED_DATE LIMIT 1
SELECT ba.BOOK_ADVISER_ID, ba.BOOK_ID, ba.CHANNEL_ID, ba.ADVISER_ID, ba.IS_DELETE FROM BOOK_ADVISER ba WHERE ba.BOOK_ID = #{bookId} AND ba.CHANNEL_ID = #{channelId} AND ba.ADVISER_ID = #{adviserId} ORDER BY ba.CREATED_DATE LIMIT 1
SELECT ADVISER_ID, COUNT(1) COUNT FROM BOOK_ADVISER WHERE ADVISER_ID IN ${item} AND IS_DELETE = 0 GROUP BY ADVISER_ID
SELECT ADVISER_ID FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND IS_DELETE = 0 LIMIT 1
SELECT COUNT(1) FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND IS_DELETE = 0 AND IS_MAIN_EDITOR = 1
UPDATE BOOK_ADVISER SET IS_DELETE = 1, LAST_MODIFIED_DATE = NOW() WHERE BOOK_ID = #{bookId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT} AND IS_DELETE = 0
SELECT ADVISER_ID FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND IS_MAIN_EDITOR = 1 AND IS_DELETE = 0 LIMIT 1
SELECT count(1) FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND IS_MAIN_EDITOR = 1 AND ADVISER_ID = #{adviserId}
SELECT BOOK_ADVISER_ID, CHANNEL_ID, #{bookId} bookId FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND IS_DELETE = 0 GROUP BY CHANNEL_ID
SELECT BOOK_ADVISER_ID, BOOK_ID, CHANNEL_ID, ADVISER_ID,IS_MAIN_EDITOR FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND IS_DELETE = 0
SELECT ADVISER_ID FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND IS_DELETE = 0
DELETE FROM BOOK_ADVISER WHERE IS_MAIN_EDITOR != 1 AND BOOK_ID = #{item.bookId, jdbcType=BIGINT} AND CHANNEL_ID = #{item.channelId, jdbcType=BIGINT} AND ADVISER_ID = #{item.adviserId, jdbcType=BIGINT} AND IS_DELETE = 0
SELECT ADVISER_ID FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND IS_DELETE = 0
SELECT BOOK_ADVISER_ID,BOOK_ID, ADVISER_ID, CHANNEL_ID,IS_MAIN_EDITOR FROM BOOK_ADVISER WHERE BOOK_ID IN ${item} AND IS_DELETE = 0 GROUP BY BOOK_ID
SELECT COUNT(DISTINCT A.BOOK_ID, A.CHANNEL_ID) FROM BOOK_ADVISER A INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0 AND ADVISER_ID IN ${item} AND A.IS_MAIN_EDITOR = 1
UPDATE BOOK_ADVISER SET TEMPLET_ID = #{templetId, jdbcType=BIGINT} ,SECOND_TEMPLET_ID = #{secondTempletId, jdbcType=BIGINT} ,GRA_LABEL_ID = #{graLabelId, jdbcType=BIGINT} ,SUB_LABEL_ID = #{subLabelId, jdbcType=BIGINT} ,VER_LABEL_ID = #{verLabelId, jdbcType=BIGINT} ,AREA_LABEL_ID = #{areaLabelId, jdbcType=BIGINT} ,pro_label_id = #{proLabelId, jdbcType=BIGINT} ,dep_label_id = #{depLabelId, jdbcType=BIGINT} ,pur_label_id = #{purLabelId, jdbcType=BIGINT} ,vol_label_id = #{volLabelId, jdbcType=BIGINT} , LAST_MODIFIED_DATE = NOW() WHERE BOOK_ID = #{bookId, jdbcType=BIGINT} AND ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT}
SELECT DATE(CREATED_DATE) date, COUNT(DISTINCT BOOK_ID) as bookCount FROM `BOOK_ADVISER` ba WHERE ba.IS_DELETE = 0 AND ba.ADVISER_ID IN ${item} AND DATE(CREATED_DATE) BETWEEN #{startDate} AND #{endDate} AND BOOK_ID NOT IN ( SELECT DISTINCT BOOK_ID FROM BOOK_ADVISER WHERE DATE(CREATED_DATE) < DATE(ba.CREATED_DATE) AND ADVISER_ID IN ${item} AND IS_DELETE = 0 ) GROUP BY DATE(CREATED_DATE)
UPDATE BOOK_ADVISER SET IS_DELETE = #{status, jdbcType=BIGINT} ,IS_MAIN_EDITOR = #{isMainAdviser} ,TEMPLET_ID = #{templetId} ,SECOND_TEMPLET_ID = #{secondTempletId} ,third_TEMPLET_ID = #{thirdTempletId} ,GRA_LABEL_ID = #{graLabelId, jdbcType=BIGINT} ,SUB_LABEL_ID = #{subLabelId, jdbcType=BIGINT} ,VER_LABEL_ID = #{verLabelId, jdbcType=BIGINT} ,AREA_LABEL_ID = #{areaLabelId, jdbcType=BIGINT} ,pro_label_id = #{proLabelId, jdbcType=BIGINT} ,dep_label_id = #{depLabelId, jdbcType=BIGINT} ,pur_label_id = #{purLabelId, jdbcType=BIGINT} ,vol_label_id = #{volLabelId, jdbcType=BIGINT} ,LAST_MODIFIED_DATE = NOW() WHERE BOOK_ID = #{bookId, jdbcType=BIGINT} AND ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT}
SELECT COUNT(b.BOOK_ID) FROM book b, book_adviser ba WHERE ba.ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND ba.IS_DELETE = 0 AND b.IS_DELETE = 0 AND ba.BOOK_ID = b.BOOK_ID
SELECT ADVISER_ID, BOOK_ID, CHANNEL_ID, IS_MAIN_EDITOR, CREATED_DATE FROM book_adviser WHERE BOOK_ID = #{bookId, jdbcType=BIGINT} AND IS_DELETE = 0
SELECT ba.BOOK_ID bookId, b.BOOK_NAME bookName, b.cover_img coverImg, b.type_code typeCode, b.isbn, b.serial_number serialNumber, ba.adviser_id adviserId, ba.channel_id channelId, ba.created_date createdDate FROM book_adviser ba join book b on ba.book_id = b.book_id and ba.is_delete = 0 and b.is_delete = 0 WHERE ba.BOOK_ID in ${item} AND ADVISER_ID in ${item} AND CHANNEL_ID in ${item}
SELECT adviser_id adviserId, count(distinct (book_id)) bookCount FROM book_adviser WHERE adviser_id IN #{adviserId} AND CREATED_DATE >= DATE_FORMAT(#{startTime}, '%Y-%m-%d 00:00:00') AND CREATED_DATE <= DATE_FORMAT(#{endTime}, '%Y-%m-%d 23:59:59') GROUP BY adviser_id
UPDATE book_adviser SET SECOND_TEMPLET_ID = #{secondTempletId}, TEMPLET_ID = #{parentId}, LAST_MODIFIED_DATE = NOW() WHERE TEMPLET_ID = #{originTempletId}
SELECT ba.BOOK_ID bookId, ba.ADVISER_ID adviserId, ba.channel_id channelId, b.BOOK_NAME bookName, b.COVER_IMG coverImg, b.ISBN isbn, CONCAT('BK', ba.BOOK_ID) uniqueNumber, ba.BOOK_ADVISER_ID bookAdviserId, b.SERIAL_NUMBER serialNumber FROM `book_adviser` ba LEFT JOIN book b ON ba.BOOK_ID = b.BOOK_ID WHERE ba.IS_DELETE = 0 AND b.IS_DELETE = 0 AND (b.ISBN = REPLACE(REPLACE(#{isbn},"-",""),"/","") or b.BOOK_NAME LIKE CONCAT('%', #{isbn}, '%') OR ( (b.BOOK_NAME LIKE CONCAT('%', '${item}', '%')) ) ) AND ba.BOOK_ID= REPLACE(#{uniqueNumber},"BK","") AND ba.ADVISER_ID IN ${item} ORDER BY ba.CREATED_DATE DESC
SELECT ba.BOOK_ID bookId, ba.ADVISER_ID adviserId, ba.channel_id channelId, b.BOOK_NAME bookName, b.COVER_IMG coverImg, b.ISBN isbn, b.SERIAL_NUMBER serialNumber, ba.BOOK_ADVISER_ID bookAdviserId FROM `book_adviser` ba LEFT JOIN book b ON ba.BOOK_ID = b.BOOK_ID WHERE ba.IS_DELETE = 0 AND ( b.ISBN =#{keyword} or b.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or b.BOOK_ID LIKE CONCAT('%', #{keyword}, '%') or ba.BOOK_ADVISER_ID LIKE CONCAT('%', #{keyword}, '%') ) AND b.IS_DELETE = 0 ORDER BY ba.CREATED_DATE DESC
update book_adviser set IS_PRINT = #{isPrint}, LAST_MODIFIED_DATE = NOW() where BOOK_ID = #{bookId} and CHANNEL_ID = #{channelId}
select distinct book_id from book_adviser WHERE TEMPLET_ID = #{templetId}
SELECT BOOK_ADVISER_ID, BOOK_ID, TEMPLET_ID, CHANNEL_ID, ADVISER_ID, IS_DELETE, TEMPLET_ID,SECOND_TEMPLET_ID,third_templet_id, GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID,vol_label_id, dep_label_id, pro_label_id, pur_label_id FROM book_adviser WHERE BOOK_ID=#{bookId} AND IS_MAIN_EDITOR=1 AND IS_DELETE=0 LIMIT 1
SELECT a.BOOK_ADVISER_ID, a.BOOK_ID, a.TEMPLET_ID, a.CHANNEL_ID, a.ADVISER_ID, a.IS_DELETE, a.TEMPLET_ID,a.SECOND_TEMPLET_ID,a.third_TEMPLET_ID, a.GRA_LABEL_ID,a.SUB_LABEL_ID,a.VER_LABEL_ID,a.AREA_LABEL_ID,a.vol_label_id FROM book_adviser a LEFT JOIN book_group b ON a.ADVISER_ID = b.create_user AND a.CHANNEL_ID = b.channel_id AND a.BOOK_ID = b.book_id WHERE b.id = #{bookGroupId} LIMIT 1
SELECT t.BOOK_ID bookId, t.channel_id channelId, t.adviser_id adviserId, tt.id bookGroupId, t1.BOOK_NAME bookName, t1.ISBN, t2.advertising_brand_id advertisingBrandId, t3.brand_name brandName FROM book_adviser t INNER JOIN book t1 ON t.BOOK_ID = t1.BOOK_ID INNER JOIN book_group tt on t.BOOK_ID = tt.BOOK_ID and tt.join_group_type=2 AND t.IS_DELETE = 0 AND t1.IS_DELETE = 0 LEFT JOIN advertising_brand_book t2 on t2.book_id=t.BOOK_ID LEFT JOIN advertising_brand t3 on t2.advertising_brand_id=t3.id WHERE t.IS_MAIN_EDITOR = 1 AND (t1.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or t1.ISBN LIKE CONCAT('%', #{keyword},'%')) and t2.advertising_brand_id=#{advertisingBrandId} and t2.advertising_brand_id is null group by t.BOOK_ID
SELECT a.BOOK_ADVISER_ID,a.BOOK_ID, a.ADVISER_ID, a.CHANNEL_ID,a.IS_MAIN_EDITOR b.isbn, FROM BOOK_ADVISER a left book b on a.book_Id = b.book_id WHERE BOOK_ID IN ${item} AND IS_DELETE = 0 GROUP BY BOOK_ID
SELECT COUNT(DISTINCT A.BOOK_ID, A.CHANNEL_ID) FROM BOOK_ADVISER A INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0 AND ADVISER_ID IN ${item} AND A.CREATED_DATE >= #{startTime} AND A.CREATED_DATE <= #{endTime} AND A.IS_MAIN_EDITOR = 1
SELECT COUNT(1) FROM ( SELECT a.BOOK_ADVISER_ID FROM book_adviser a LEFT JOIN book_group g ON a.BOOK_ID = g.book_id AND a.ADVISER_ID = g.create_user AND a.CHANNEL_ID = g.channel_id AND g.is_delete = 0 WHERE a.IS_DELETE = 0 AND g.join_group_type = 4 AND g.create_time BETWEEN #{startTime} AND #{endTime} UNION ( SELECT BOOK_ADVISER_ID FROM book_adviser WHERE is_delete = 0 AND is_open_robot_process = 1 AND LAST_MODIFIED_DATE BETWEEN #{startTime} AND #{endTime} ) ) AS a
SELECT IF(is_open_robot_process = 1 OR join_group_type = 4,1,0) isRui FROM book_adviser a LEFT JOIN book_group b ON a.BOOK_ID = b.book_id and b.is_delete = 0 AND a.CHANNEL_ID = b.channel_id WHERE a.BOOK_ID = #{bookId} AND a.CHANNEL_ID = #{channelId} AND a.ADVISER_ID = #{adviserId} and a.is_delete =0 limit 1
SELECT BOOK_ID,ADVISER_ID,CHANNEL_ID,TEMPLET_ID,CREATED_USER,SECOND_TEMPLET_ID,is_open_robot_process, GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID,dep_label_id,pro_label_id,pur_label_id,vol_label_id FROM book_adviser WHERE is_delete = 0 AND BOOK_ID IN ${item}
SELECT BOOK_ADVISER_ID, BOOK_ID, TEMPLET_ID, CHANNEL_ID, ADVISER_ID, IS_DELETE, TEMPLET_ID,SECOND_TEMPLET_ID, GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID,vol_label_id FROM book_adviser WHERE BOOK_ID = #{bookId} AND ADVISER_ID = #{adviserId} ORDER BY IS_MAIN_EDITOR DESC,IS_DELETE ASC LIMIT 1
SELECT BOOK_ID AS bookId, ADVISER_ID adviserId, CHANNEL_ID channelId, CREATED_DATE createdDate FROM book_adviser WHERE IS_DELETE = 0 AND ADVISER_ID IN #{item}
SELECT ADVISER_ID AS adviserId, CHANNEL_ID AS channelId, BOOK_ID AS bookId, CREATED_DATE AS createDate FROM book_adviser WHERE ADVISER_ID IN #{item} GROUP BY ADVISER_ID, CHANNEL_ID, BOOK_ID
SELECT ADVISER_ID AS adviserId, CHANNEL_ID AS channelId, BOOK_ID AS bookId, CREATED_DATE AS createDate FROM book_adviser WHERE ADVISER_ID IN #{item} and CREATED_DATE>= SUBDATE(now(),INTERVAL #{month} month) GROUP BY ADVISER_ID, CHANNEL_ID, BOOK_ID
SELECT tb.bookAdviserId, tb.channelId, tb.bookName, tb.isbn, tb.bookId, tb.adviserId, tb.isRay, tb.serialNumber, tb.bookGroupId FROM ( SELECT ba.BOOK_ADVISER_ID AS bookAdviserId, ba.CHANNEL_ID AS channelId, b.BOOK_NAME AS bookName, b.ISBN AS isbn, b.BOOK_ID AS bookId, ba.ADVISER_ID AS adviserId, IF(ba.is_open_robot_process OR bg.join_group_type = 4, 1, 0) AS isRay, b.SERIAL_NUMBER AS serialNumber, bg.id AS bookGroupId FROM book_adviser ba LEFT JOIN book b ON ba.BOOK_ID = b.BOOK_ID LEFT JOIN book_group bg on ba.BOOK_ID = bg.book_id AND ba.CHANNEL_ID = bg.channel_id AND ba.ADVISER_ID = bg.create_user ba.ADVISER_ID IN ${it} AND ( ( 1=1 AND ba.ADVISER_ID =${item.adviserId} AND ba.CHANNEL_ID=${item.raysChannelId} AND ba.BOOK_ID=${item.raysBookId} ) OR ( b.BOOK_NAME LIKE CONCAT('%',#{name},'%') OR b.ISBN LIKE CONCAT('%',#{name},'%') OR b.BOOK_ID LIKE CONCAT('%',#{bookNo},'%') ) ) ) tb where tb.isRay = #{isRay} ORDER BY tb.bookAdviserId DESC
UPDATE BOOK_ADVISER SET TEMPLET_ID = #{templetId, jdbcType=BIGINT} ,SECOND_TEMPLET_ID = #{secondTempletId, jdbcType=BIGINT} ,third_TEMPLET_ID = #{thirdTempletId, jdbcType=BIGINT} ,GRA_LABEL_ID = #{graLabelId, jdbcType=BIGINT} ,SUB_LABEL_ID = #{subLabelId, jdbcType=BIGINT} ,VER_LABEL_ID = #{verLabelId, jdbcType=BIGINT} ,AREA_LABEL_ID = #{areaLabelId, jdbcType=BIGINT} ,pro_label_id = #{proLabelId, jdbcType=BIGINT} ,dep_label_id = #{depLabelId, jdbcType=BIGINT} ,pur_label_id = #{purLabelId, jdbcType=BIGINT} ,vol_label_id = #{volLabelId, jdbcType=BIGINT} , LAST_MODIFIED_DATE = NOW() WHERE BOOK_ID = #{bookId, jdbcType=BIGINT} AND ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT}
select BOOK_ID AS bookId, TEMPLET_ID AS templetId, SECOND_TEMPLET_ID AS secondTempletId, third_templet_id AS thirdTempletId from book_adviser group by BOOK_ID
select BOOK_ADVISER_ID AS bookAdviserId, BOOK_ID AS bookId, ADVISER_ID AS adviserId, CHANNEL_ID AS channelId, TEMPLET_ID AS templetId, SECOND_TEMPLET_ID AS secondTempletId, third_templet_id AS thirdTempletId, pro_label_id AS proLabelId, dep_label_id AS depLabelId, pur_label_id AS purLabelId, GRA_LABEL_ID AS graLabelId, SUB_LABEL_ID AS subLabelId, VER_LABEL_ID AS verLabelId, AREA_LABEL_ID AS areaLabelId, vol_label_id AS volLabelId from book_adviser where BOOK_ID IN ${item} AND ADVISER_ID IN ${item} AND CHANNEL_ID IN ${item}
update book_adviser set is_send_mini_url = #{isSendMiniUrl}, LAST_MODIFIED_DATE = NOW() where BOOK_ID = #{bookId, jdbcType=BIGINT} AND ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT} and IS_DELETE = 0
SELECT B.BOOK_ID, B.TYPE_CODE,B.ISBN, B.BOOK_NAME, B.REMARK, B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.AD_IMG, B.DETAIL, B.`VERSION`,B.BOOK_PRICE,B.ISSN,B.SERIAL_NUMBER,BA.IS_MAIN_EDITOR,

BA.TEMPLET_ID,BA.SECOND_TEMPLET_ID,BA.third_templet_id, BA.GRA_LABEL_ID,BA.SUB_LABEL_ID,BA.VER_LABEL_ID,BA.AREA_LABEL_ID, BA.IS_PRINT isPrint, BA.pro_label_id, BA.dep_label_id,BA.pur_label_id,BA.vol_label_id, BA.is_open_robot_process,BA.vol_label_id,b.unique_number,BA.CREATED_DATE,b.edition,BA.is_send_mini_url FROM BOOK_ADVISER BA INNER JOIN BOOK B ON B.BOOK_ID = BA.BOOK_ID where B.BOOK_ID = #{bookId} AND BA.CHANNEL_ID = #{channelId} AND BA.ADVISER_ID = #{adviserId} AND BA.IS_DELETE = 0 LIMIT 1
SELECT a.BOOK_ID, a.CHANNEL_ID, a.ADVISER_ID, b.BOOK_NAME, b.COVER_IMG FROM book_adviser a INNER JOIN book b ON a.BOOK_ID = b.BOOK_ID AND b.IS_DELETE = 0 WHERE b.ISBN = #{isbn} AND a.IS_DELETE = 0 ORDER BY a.CREATED_DATE DESC LIMIT 1
SELECT BOOK_ADVISER_ID bookAdviserId, a.BOOK_ID bookId, CHANNEL_ID channelId, ADVISER_ID adviserId, TEMPLET_ID templateId, GRA_LABEL_ID graLabelId, SUB_LABEL_ID subLabelId, VER_LABEL_ID verLabelId, vol_label_id volLabelId, pro_label_id proLabelId, pur_label_id purLabelId, dep_label_id depLabelId, BOOK_NAME bookName FROM book_adviser a LEFT JOIN book b on a.BOOK_ID = b.BOOK_ID WHERE a.IS_DELETE = 0 AND BOOK_ADVISER_ID > ${cursor} ORDER BY BOOK_ADVISER_ID limit ${limit}
update book_adviser set is_open_catalog = #{isOpenCatalog}, LAST_MODIFIED_DATE = NOW() where BOOK_ID = #{bookId, jdbcType=BIGINT} and ADVISER_ID = #{adviserId, jdbcType=BIGINT} and CHANNEL_ID = #{channelId, jdbcType=BIGINT}
SELECT BOOK_ADVISER_ID bookAdviserId, BOOK_NAME bookName, b.isbn, b.serial_number serialNumber, b.unique_number uniqueNumber, a.CREATED_DATE createdDate, a.LAST_MODIFIED_DATE lastModifiedDate, a.book_id bookId, a.adviser_Id adviserId, a.channel_Id channelId FROM book_adviser a LEFT JOIN book b on a.BOOK_ID = b.BOOK_ID WHERE a.IS_DELETE = 0 and b.is_delete = 0
SELECT a.BOOK_ID, a.CHANNEL_ID, a.ADVISER_ID, b.BOOK_NAME, b.COVER_IMG, b.isbn, b.SERIAL_NUMBER, b.unique_number, a.CREATED_DATE, a.LAST_MODIFIED_DATE, a.BOOK_ADVISER_ID FROM book_adviser a INNER JOIN book b ON a.BOOK_ID = b.BOOK_ID AND b.IS_DELETE = 0 WHERE a.IS_DELETE = 0 and BOOK_ADVISER_ID in #{item}

UPDATE book_adviser SET is_approval = #{item.isApproval}, is_relate = #{item.isRelate}, LAST_MODIFIED_DATE = NOW() WHERE book_id = #{item.bookId} AND adviser_id = #{item.adviserId} AND channel_id = #{item.channelId}
SELECT COUNT(1) FROM book_adviser WHERE IS_DELETE = 0 AND is_approval = 1 AND CREATED_USER = #{adviserId}
update book_adviser set book_phone_auth = #{bookPhoneAuth}, LAST_MODIFIED_DATE = NOW() where BOOK_ID = #{bookId, jdbcType=BIGINT} AND ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT} and IS_DELETE = 0
select book_phone_auth from book_adviser where book_id = #{bookId} and adviser_id = #{adviserId} and channel_id = #{channelId} and is_delete = 0 limit 1
update book_adviser set is_wechat_auth = #{isWechatAuth}, LAST_MODIFIED_DATE = NOW() where BOOK_ID = #{bookId, jdbcType=BIGINT} AND ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT} and IS_DELETE = 0
select is_wechat_auth from book_adviser where book_id = #{bookId} and adviser_id = #{adviserId} and channel_id = #{channelId} and is_delete = 0 limit 1
SELECT DISTINCT BOOK_ID FROM book_adviser WHERE LAST_MODIFIED_DATE BETWEEN #{startTime} AND #{endTime}
update book_adviser set is_jump_book = #{isJumpBook} where BOOK_ID = #{bookId, jdbcType=BIGINT} AND ADVISER_ID = #{adviserId, jdbcType=BIGINT} AND CHANNEL_ID = #{channelId, jdbcType=BIGINT} and IS_DELETE = 0
update book_adviser set is_open_recommend = #{isOpenRecommend}, recommend_from_type = #{recommendFromType}, last_modified_date = NOW() where book_id = #{bookId, jdbcType=BIGINT} AND adviser_id = #{adviserId, jdbcType=BIGINT} AND channel_id = #{channelId, jdbcType=BIGINT} and is_delete = 0
select is_open_recommend isOpenRecommend, recommend_from_type recommendFromType from book_adviser where book_id = #{bookId} and adviser_id = #{adviserId} and channel_id = #{channelId} and is_delete = 0 limit 1
select distinct BOOK_ID from book_adviser where adviser_id=#{adviserId} and BOOK_ID in #{item} and is_delete = 0
UPDATE book_adviser SET is_print = 1, LAST_MODIFIED_DATE = NOW() WHERE book_id = #{item.bookId} AND adviser_id = #{item.adviserId} AND channel_id = #{item.channelId} and (is_print is null or is_print=0)
SELECT CREATED_USER adviserId, COUNT(1) bookCount, COUNT(CASE WHEN is_approval=1 THEN 1 ELSE NULL END) approvalBookCount, COUNT(CASE WHEN is_approval=0 THEN 1 ELSE NULL END) unApprovalBookCount FROM book_adviser WHERE IS_DELETE = 0 AND TEMPLET_ID = #{templetId} AND SECOND_TEMPLET_ID = #{secondTempletId} AND third_templet_id = #{thirdTempletId} GROUP BY CREATED_USER HAVING bookCount >= #{bookCount}
SELECT IFNULL(is_open_catalog,0) FROM BOOK_ADVISER WHERE BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND ADVISER_ID = #{adviserId}
UPDATE book_adviser SET open_rays_code = #{openRaysCode}, LAST_MODIFIED_DATE = NOW() WHERE book_adviser_id = #{bookAdviserId}
SELECT COUNT(1) FROM book_adviser WHERE ADVISER_ID = #{adviserId} AND CREATED_DATE > #{startTime}