Browse Source

token取数逻辑

yumeng 3 years ago
parent
commit
b5d9c699be

+ 20 - 6
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml

@@ -89,12 +89,26 @@
 
 
 
 
     <select id="selectKuaiShouToken" resultType="cn.com.ctop.common.module.entity.CtopOauthToken">
     <select id="selectKuaiShouToken" resultType="cn.com.ctop.common.module.entity.CtopOauthToken">
-        select  t1.*
-        from ctop_oauth_token t1
-        left join ctop_user_allocation t2
-        on t1.account_id = t2.account_id
-        where t2.account_status = 0
-        and t1.media_id = 2
+    SELECT
+	t1.id AS 'id',
+	t1.media_id AS 'mediaId',
+	t1.advertiser_id AS 'advertiser_id',
+	t1.account_id AS 'accountId',
+	( CASE WHEN t3.access_token IS NOT NULL THEN t3.access_token ELSE t1.access_token END ) AS 'accessToken',
+	( CASE WHEN t3.refresh_token IS NOT NULL THEN t3.refresh_token ELSE t1.refresh_token END ) AS 'refreshToken',
+	t1.agent_type AS 'agentType',
+	t1.app_id AS 'appId',
+	t1.access_token_expires_in as 'accessTokenExpiresIn',
+	t1.refresh_token_expires_in as 'refreshTokenExpiresIn',
+	t1.create_time as 'createTime',
+	t1.update_time as 'updateTime'
+	FROM
+	ctop_oauth_token t1
+	LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+	LEFT JOIN ctop_oauth_agent_token t3 ON t1.app_id = t3.app_id
+    WHERE
+	t2.account_status = 0
+	AND t1.media_id = 2;
 
 
     </select>
     </select>
 
 

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -197,6 +197,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
 
 
     @Override
     @Override
     public List<CtopOauthToken> selectKuaiShouToken() {
     public List<CtopOauthToken> selectKuaiShouToken() {
+
         return ctopOauthTokenMapper.selectKuaiShouToken();
         return ctopOauthTokenMapper.selectKuaiShouToken();
     }
     }