package com.ks.push.manager;
|
|
import com.ks.push.dao.BPushPlatformAppInfoDao;
|
import com.ks.push.pojo.DO.BPushPlatformAppInfo;
|
import com.ks.push.pojo.DO.PushPlatform;
|
import org.springframework.data.mongodb.core.query.Criteria;
|
import org.springframework.data.mongodb.core.query.Query;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
@Component
|
public class BPushPlatformAppInfoManager {
|
|
@Resource
|
private BPushPlatformAppInfoDao bPushPlatformAppInfoDao;
|
|
|
/**
|
* 查询推送平台信息
|
*
|
* @param appCode
|
* @return
|
*/
|
public List<BPushPlatformAppInfo> listByAppCode(String appCode) {
|
Query query = new Query();
|
query.addCriteria(Criteria.where("appCode").is(appCode));
|
return bPushPlatformAppInfoDao.findList(query);
|
}
|
|
/**
|
* 查询推送平台
|
*
|
* @param appCode
|
* @param pushPlatform
|
* @return
|
*/
|
public BPushPlatformAppInfo selectByAppCodeAndPlatform(String appCode, PushPlatform pushPlatform) {
|
Query query = new Query();
|
query.addCriteria(Criteria.where("appCode").is(appCode).and("platform").is(pushPlatform));
|
return bPushPlatformAppInfoDao.findOne(query);
|
}
|
|
|
public String selectAppCode(String appId, PushPlatform pushPlatform) {
|
Query query = new Query();
|
query.addCriteria(Criteria.where("pushAppInfo.appId").is(appId).and("platform").is(pushPlatform));
|
BPushPlatformAppInfo appInfo = bPushPlatformAppInfoDao.findOne(query);
|
if (appInfo == null) {
|
return null;
|
}
|
return appInfo.getAppCode();
|
}
|
|
|
}
|