2019-03-26 12:04
select a.`key`,a.`name`,a.content,a.cat_name,a.type,a.answers,a.prompt,a.average,a.create_time,'0' as `star` from ccp_study_daily a where to_days(a.`create_time`) = to_days(now()) and a.`key` not in (select daily_key from ccp_study_record where user_key=?)
union all
select a.`key`,a.`name`,a.content,a.cat_name,a.type,a.answers,a.prompt,a.average,a.create_time,'1' as `star` from ccp_study_daily a where to_days(a.`create_time`) = to_days(now()) and a.`key` in (select daily_key from ccp_study_record where user_key=?)
2019-03-26 12:03
if(!StrUtil.isEmptyOrUndefined(startTime) && StrUtil.isEmptyOrUndefined(endtTime)){
sql+="and a.create_time between '"+startTime+"'and '" + endtTime+"'";
}
if(!StrUtil.isEmptyOrUndefined(catCode)){
sql+=" and a.cat_code in ("+catCode+")";
}
if(!StrUtil.isEmptyOrUndefined(name)){
sql+=" and b.user_name = '"+name+"'";
}