| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.zsjz.ai.module.eds.mapper.EdsSocialApplicationQueryMapper">
- <!-- 社交应用账号。 -->
- <select id="selectAccount" resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationAccountDTO">
- select user_photo as userPhoto,
- account_id as accountId,
- account,
- regis_nickname as regisNickname,
- "password" as password,
- fans_counter as fansCounter,
- follow_counter as followCounter,
- message_counter as messageCounter,
- prevacy_message_counter as prevacyMessageCounter,
- url,
- certificate_content as certificateContent,
- sexcode,
- birthday,
- try_cast(age as integer) as age,
- zodiac,
- constallation,
- reg_city as regCity,
- graduateschool,
- occupation_name as occupationName,
- blood_type as bloodType,
- "name" as name,
- sign_name as signName,
- personal_desc as personalDesc,
- msisdn,
- fixed_phone as fixedPhone,
- email_account as emailAccount,
- postal_address as postalAddress,
- postal_code as postalCode,
- certificate_type as certificateType,
- certificate_code as certificateCode,
- install_time as installTime,
- account_reg_date as accountRegDate,
- last_login_time as lastLoginTime,
- latest_mod_time as latestModTime,
- delete_status as deleteStatus,
- delete_time as deleteTime
- from wa_mforensics_030100 a
- where a.collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- limit 1
- </select>
- <!-- 好友分组统计。 -->
- <select id="selectFriendGroupStats" resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationGroupStatDTO">
- select friend_group as name,
- count(1) as num,
- sum(case when delete_status = 1 then 1 else 0 end) as deleteNum
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- group by friend_group
- </select>
- <!-- 默认分组好友列表。 -->
- <select id="selectDefaultGroupFriends" resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationFriendDTO">
- select friend_account as friendAccount,
- max(friend_nickname) as friendNickname,
- max(user_photo) as userPhoto,
- max(delete_status) as deleteStatus
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- and (friend_group = '默认分组' or friend_group is null)
- group by friend_account
- order by friendNickname
- </select>
- <!-- 指定分组好友列表。 -->
- <select id="selectGroupFriends" resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationFriendDTO">
- select friend_account as friendAccount,
- max(friend_nickname) as friendNickname,
- max(user_photo) as userPhoto,
- max(delete_status) as deleteStatus
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- and friend_group = #{param.groupName}
- group by friend_account
- order by friendNickname
- </select>
- <!-- 好友详情。 -->
- <select id="selectFriendAccount" resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationFriendAccountDTO">
- select user_photo as userPhoto,
- friend_id as friendId,
- friend_account as friendAccount,
- friend_nickname as friendNickname,
- fans_counter as fansCounter,
- follow_counter as followCounter,
- friend_remark as friendRemark,
- message_counter as messageCounter,
- url,
- certificate_content as certificateContent,
- sexcode,
- birthday,
- try_cast(age as integer) as age,
- zodiac,
- constallation,
- reg_city as regCity,
- graduateschool,
- occupation_name as occupationName,
- blood_type as bloodType,
- "name" as name,
- sign_name as signName,
- personal_desc as personalDesc,
- msisdn,
- fixed_phone as fixedPhone,
- email_account as emailAccount,
- postal_address as postalAddress,
- postal_code as postalCode,
- certificate_type as certificateType,
- certificate_code as certificateCode,
- account_reg_date as accountRegDate,
- last_login_time as lastLoginTime,
- latest_mod_time as latestModTime,
- delete_status as deleteStatus,
- delete_time as deleteTime
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- and (friend_account = #{param.friendAccount}
- or (friend_account is null
- and #{param.friendAccount} = ''
- and (#{param.friendNickname} is null
- or #{param.friendNickname} = ''
- or friend_nickname = #{param.friendNickname})))
- limit 1
- </select>
- <!-- 博文分组统计。 -->
- <select id="selectBlogGroupStats" resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationGroupStatDTO">
- select count(1) as num,
- friend_group as name,
- sum(delete_status) as deleteNum,
- count(distinct friend_account) as personNum
- from (
- select a.friend_account, friend_group, a.delete_status
- from wa_mforensics_030300 a
- left join (
- select collect_target_id, account, friend_account, max(friend_group) as friend_group
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- group by collect_target_id, account, friend_account
- ) b
- on a.collect_target_id = b.collect_target_id
- and a.account = b.account
- and a.friend_account = b.friend_account
- where a.collect_target_id = #{param.collectTargetId}
- and a.account = #{param.account}
- and a.contact_account_type = #{param.type}
- ) t
- group by t.friend_group
- order by num desc
- </select>
- <!-- 博文默认分组好友统计。 -->
- <select id="selectBlogDefaultGroupFriends"
- resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationFriendStatDTO">
- select count(1) as num,
- friend_account as friendAccount,
- sum(delete_status) as deleteNum,
- max(friend_nickname) as friendNickname,
- max(user_photo) as userPhoto
- from (
- select a.friend_account, a.friend_nickname, friend_group, a.delete_status, b.user_photo
- from wa_mforensics_030300 a
- left join (
- select collect_target_id, account, friend_account,
- max(friend_group) as friend_group, max(user_photo) as user_photo
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- group by collect_target_id, account, friend_account
- ) b
- on a.collect_target_id = b.collect_target_id
- and a.account = b.account
- and a.friend_account = b.friend_account
- where a.collect_target_id = #{param.collectTargetId}
- and a.account = #{param.account}
- and a.contact_account_type = #{param.type}
- and (b.friend_group = '默认分组' or b.friend_group is null)
- ) t
- group by t.friend_account
- order by num desc
- </select>
- <!-- 博文指定分组好友统计。 -->
- <select id="selectBlogGroupFriends"
- resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationFriendStatDTO">
- select count(1) as num,
- friend_account as friendAccount,
- sum(delete_status) as deleteNum,
- max(friend_nickname) as friendNickname,
- max(user_photo) as userPhoto
- from (
- select a.friend_account, a.friend_nickname, friend_group, a.delete_status, b.user_photo
- from wa_mforensics_030300 a
- left join (
- select collect_target_id, account, friend_account,
- max(friend_group) as friend_group, max(user_photo) as user_photo
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- group by collect_target_id, account, friend_account
- ) b
- on a.collect_target_id = b.collect_target_id
- and a.account = b.account
- and a.friend_account = b.friend_account
- where a.collect_target_id = #{param.collectTargetId}
- and a.account = #{param.account}
- and a.contact_account_type = #{param.type}
- and friend_group = #{param.groupName}
- ) t
- group by t.friend_account
- order by num desc
- </select>
- <!-- 博文列表。 -->
- <select id="selectBlogs" resultType="com.zsjz.ai.module.eds.dto.EdsBlogDTO">
- select mail_send_time as mailSendTime,
- weibo_message as weiboMessage,
- weibo_reply_counter as weiboReplyCounter,
- weibo_retweet_counter as weiboRetweetCounter,
- weibo_like_counter as weiboLikeCounter,
- copy_from as copyFrom,
- city_code as cityCode,
- company_address as companyAddress,
- delete_status as deleteStatus,
- delete_time as deleteTime,
- friend_nickname as friendNickName
- from wa_mforensics_030300
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- and friend_account = #{param.friendAccount}
- </select>
- <!-- 私信分组统计。 -->
- <select id="selectPrivateLetterGroupStats" resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationGroupStatDTO">
- select count(1) as num,
- friend_group as name,
- sum(delete_status) as deleteNum,
- count(distinct friend_account) as personNum
- from (
- select a.friend_account, friend_group, a.delete_status
- from wa_mforensics_030400 a
- left join (
- select collect_target_id, account, friend_account, max(friend_group) as friend_group
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- group by collect_target_id, account, friend_account
- ) b
- on a.collect_target_id = b.collect_target_id
- and a.account = b.account
- and a.friend_account = b.friend_account
- where a.collect_target_id = #{param.collectTargetId}
- and a.account = #{param.account}
- and a.contact_account_type = #{param.type}
- ) t
- group by t.friend_group
- order by num desc
- </select>
- <!-- 私信默认分组好友统计。 -->
- <select id="selectPrivateLetterDefaultGroupFriends"
- resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationFriendStatDTO">
- select count(1) as num,
- friend_account as friendAccount,
- sum(delete_status) as deleteNum,
- max(friend_nickname) as friendNickname,
- max(user_photo) as userPhoto
- from (
- select a.friend_account, a.friend_nickname, friend_group, a.delete_status, b.user_photo
- from wa_mforensics_030400 a
- left join (
- select collect_target_id, account, friend_account,
- max(friend_group) as friend_group, max(user_photo) as user_photo
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- group by collect_target_id, account, friend_account
- ) b
- on a.collect_target_id = b.collect_target_id
- and a.account = b.account
- and a.friend_account = b.friend_account
- where a.collect_target_id = #{param.collectTargetId}
- and a.account = #{param.account}
- and a.contact_account_type = #{param.type}
- and (b.friend_group = '默认分组' or b.friend_group is null)
- ) t
- group by t.friend_account
- order by num desc
- </select>
- <!-- 私信指定分组好友统计。 -->
- <select id="selectPrivateLetterGroupFriends"
- resultType="com.zsjz.ai.module.eds.dto.EdsSocialApplicationFriendStatDTO">
- select count(1) as num,
- friend_account as friendAccount,
- sum(delete_status) as deleteNum,
- max(friend_nickname) as friendNickname,
- max(user_photo) as userPhoto
- from (
- select a.friend_account, a.friend_nickname, friend_group, a.delete_status, b.user_photo
- from wa_mforensics_030400 a
- left join (
- select collect_target_id, account, friend_account,
- max(friend_group) as friend_group, max(user_photo) as user_photo
- from wa_mforensics_030200
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- group by collect_target_id, account, friend_account
- ) b
- on a.collect_target_id = b.collect_target_id
- and a.account = b.account
- and a.friend_account = b.friend_account
- where a.collect_target_id = #{param.collectTargetId}
- and a.account = #{param.account}
- and a.contact_account_type = #{param.type}
- and friend_group = #{param.groupName}
- ) t
- group by t.friend_account
- order by num desc
- </select>
- <!-- 私信列表。 -->
- <select id="selectPrivateLetters" resultType="com.zsjz.ai.module.eds.dto.EdsPrivateLetterDTO">
- select mail_send_time as mailSendTime,
- content,
- local_action as localAction,
- delete_status as deleteStatus,
- delete_time as deleteTime,
- regis_nickname as regisNickname,
- friend_nickname as friendNickname
- from wa_mforensics_030400
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.contactAccountType}
- and friend_account = #{param.friendAccount}
- <if test="param.startDateTime != null">
- and mail_send_time >= #{param.startDateTime}
- </if>
- <if test="param.endDateTime != null">
- and mail_send_time <= #{param.endDateTime}
- </if>
- <if test="param.keyword != null and param.keyword != ''">
- and strpos(content, #{param.keyword}) > 0
- </if>
- <if test="param.mediaType != null">
- and media_type = #{param.mediaType.code}
- </if>
- </select>
- <!-- 搜索记录。 -->
- <select id="selectSearchRecords" resultType="com.zsjz.ai.module.eds.dto.EdsSocialSearchRecordDTO">
- select create_time as createTime,
- keyword,
- delete_status as deleteStatus,
- delete_time as deleteTime
- from wa_mforensics_030500
- where collect_target_id = #{param.collectTargetId}
- and account = #{param.account}
- and contact_account_type = #{param.type}
- order by create_time desc
- </select>
- </mapper>
|