main
黄海 5 months ago
parent bfc42c2b0c
commit 6e2d26f04d

@ -32,10 +32,13 @@ public class SyncDataEase {
NianJiLessonSummary();
//学校数量
schoolCount();
//学区top5
//areaTop5();
}
/**
*
*
* @param cnt
* @param type
*/
@ -207,4 +210,36 @@ public class SyncDataEase {
String sql = Db.getSql("DataEase.updateSchoolCount");
Db.use(MYSQL_DB).update(sql, cnt, "参与学校数量");
}
/**
* top5
*
* @param areaName
* @param lessonCount
* @param regSchoolCount
* @param lessonSchoolCount
*/
public static void updateAreaTop5(String areaName, int lessonCount, int regSchoolCount, int lessonSchoolCount, int sort_id) {
String sql = Db.getSql("DataEase.areaTop5");
Db.use(MYSQL_DB).update(sql, areaName, lessonCount, regSchoolCount, lessonSchoolCount, sort_id);
}
/**
* top5
*/
public static void areaTop5() {
SqlPara sqlPara = Db.getSqlPara("DataEase.areaTop5");
List<Record> list = Db.find(sqlPara);
int idx = 0;
for (Record record : list) {
String gather_regionc = record.getStr("gather_regionc");
int cnt = record.getInt("cnt");
int regSchoolCount = record.getInt("regSchoolCount");
int lessonSchoolCount = record.getInt("lessonSchoolCount");
//更新
updateAreaTop5(gather_regionc, cnt, regSchoolCount, lessonSchoolCount, ++idx);
}
print("更新地区top5成功");
}
}

@ -142,4 +142,12 @@ ORDER BY
#sql("updateSchoolCount")
update `excel__d20e478c67` set ``=? where ``=?
#end
-- 区域建设排名前5
#sql("areaTop5")
SELECT gather_regionc,COUNT(*) as cnt FROM t_crawler_lesson_school WHERE match_type=2 GROUP BY gather_regionc ORDER BY cnt DESC LIMIT 5
#end
-- 更新区域建设排名前5
#sql("updateAreaTop5")
update `excel__a03b1bfada` set ``=?,``=?,``=?,``=? where ``=?
#end
#end
Loading…
Cancel
Save