Authored by zhengwen.ge

联盟查询慢sql修改

... ... @@ -7,10 +7,10 @@
<result column="app_key" property="appKey" jdbcType="VARCHAR" />
</resultMap>
<select id="selectByIdfaAndDate" resultMap="BaseResultMap">
select * from app_activate_idfa_list where date_id=#{dateId} and idfa=#{idfa} and instr(app_key, #{appKey}) &gt; 0
select * from app_activate_idfa_list where date_id=#{dateId} and idfa=#{idfa} and app_key = #{appKey}
</select>
<select id="select15DaysByIdfaAndDate" resultMap="BaseResultMap">
select * from app_activate_idfa_list_15days where date_id=#{dateId} and idfa=#{idfa} and instr(app_key, #{appKey}) &gt; 0
select * from app_activate_idfa_list_15days where date_id=#{dateId} and idfa=#{idfa} and app_key = #{appKey}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -373,15 +373,19 @@ public class UnionServiceImpl implements IUnionService {
String yesterday = DateUtil.dateAdd(DateUtil.getToday("yyyyMMdd"), "d", -1, "yyyyMMdd");
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
String appkey = request.getAppkey();
String app_key = "yohobuy_ios";
if ("yohobuy".equals(appkey)) {
appkey = "yohobuy";
app_key = "yohobuy_ios";
} else if ("yoho".equals(appkey)) {
appkey = "yoho!";
app_key = "yoho!_ios";
} else if ("mars".equals(appkey)) {
appkey = "yohomars";
app_key = "yohomars_ios";
}
List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), appkey));
List<AppActivateIdfaList> _15DayIdfaList = appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), appkey));
List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), app_key));
List<AppActivateIdfaList> _15DayIdfaList = appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), app_key));
//判断90天内是否在大数据有记录
if (CollectionUtils.isNotEmpty(_90DayIdfaList)) {
log.warn("activateUnion error because 90 days has activate in bigdata database info with param is {}", request);
... ...