sql.append("select user_id,real_name,left(`timestamp`,7) date6,SUBSTR(`timestamp`,6,2) mon,(case book_type_code when 'DIGITAL' then 1 else 2 end ) book_type,count(*) cc from reading_data ");
sql.append(" where user_id is not null and verb_name<>'归还' ");
sql.append(" and create_time >=:beginTime and create_time <:endTime ");
params.put("beginTime",beginTime);
params.put("endTime",endTime);
sql.append(" GROUP BY user_id,left(`timestamp`,7),book_type_code ");
sql.append("select (case book_type_code when 'DIGITAL' then 1 else 2 end ) book_type,left(`timestamp`,4) year,SUBSTR(`timestamp`,6,2) mon,count(*)/count(distinct user_id) cc,client_id from reading_data ");
sql.append(" where book_type_code is not null and verb_name<>'归还' ");
sql.append(" and create_time >=:beginTime and create_time <:endTime ");
params.put("beginTime",beginTime);
params.put("endTime",endTime);
sql.append(" GROUP BY book_type_code,left(`timestamp`,7) ");
sql.append("select grade_code,age,(case sex_code when '1' then '男' else '女' end ) sex_name,left(`timestamp`,7) date6,count(*) cc,client_id from reading_data ");
sql.append(" where grade_code >=1 and grade_code <=12 and age is not null and sex_code is not null and verb_name<>'归还' ");
sql.append(" and create_time >=:beginTime and create_time <:endTime ");
params.put("beginTime",beginTime);
params.put("endTime",endTime);
sql.append(" GROUP BY grade_code,age,sex_code,left(`timestamp`,7) ");
sql.append("select grade_code,grade_name,sex_code,(case sex_code when '1' then '男' else '女' end ) sex_name,book_id,book_name,author,pub_name,left(`timestamp`,4) year,count(*) cc,client_id from reading_data ");
sql.append(" where book_id is not null and grade_code is not null and sex_code is not null and verb_name<>'归还' ");
sql.append(" and create_time >=:beginTime and create_time <:endTime ");
params.put("beginTime",beginTime);
params.put("endTime",endTime);
sql.append(" GROUP BY grade_code,sex_code,book_id,left(`timestamp`,4) having count(*)>=5");
sql.append("select region_code,region_name,sex_code,(case sex_code when '1' then '男' else '女' end ) sex_name,left(clc_code,1)clc_code ,left(`timestamp`,7) date6,count(*) cc,client_id from reading_data ");
sql.append(" where clc_code is not null and region_code is not null and sex_code is not null and verb_name<>'归还' ");
sql.append(" and create_time >=:beginTime and create_time <:endTime ");
params.put("beginTime",beginTime);
params.put("endTime",endTime);
sql.append(" GROUP BY region_code, sex_code,left(clc_code,1),left(`timestamp`,7) ");
sql.append("select sex_code,(case sex_code when '1' then '男' else '女' end ) sex_name ,grade_code,grade_name,author_id,author,left(`timestamp`,4) year,count(*) cc,client_id from reading_data ");
sql.append(" where sex_code is not null and grade_code is not null and author is not null and verb_name<>'归还' ");
sql.append(" and create_time >=:beginTime and create_time <:endTime ");
params.put("beginTime",beginTime);
params.put("endTime",endTime);
sql.append(" GROUP BY sex_code,grade_code, author,left(`timestamp`,4) ");