zhangjinli 3 years ago
parent 104d84c9bb
commit e1d861accd

@ -91,11 +91,14 @@ public class StatisticsController {
}
List<JSONObject> videoDataBydDay = adminMapper.statistics2(qw);
ArrayList<JSONObject> res = new ArrayList<>();
if (videoDataBydDay == null || videoDataBydDay.size() == 0) {
return Result.success(null, "请求成功");
}
JSONObject first = videoDataBydDay.get(0);
JSONObject last = videoDataBydDay.get(videoDataBydDay.size() - 1);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate dat = LocalDate.parse((CharSequence) first.get("dat"), df);
LocalDate dat2 = LocalDate.parse((CharSequence) last.get("dat"), df);
LocalDate dat = param.getBeginTime() == null ? LocalDate.parse((CharSequence) first.get("dat"), df) : param.getBeginTime().toLocalDate();
LocalDate dat2 = param.getEndTime() == null ? LocalDate.parse((CharSequence) last.get("dat"), df) : param.getEndTime().toLocalDate();
for (int i = 0; i <= ChronoUnit.DAYS.between(dat, dat2); i++) {
LocalDate today = dat.plusDays(i);
JSONObject obj = null;

@ -33,7 +33,8 @@ public interface AdminMapper extends BaseMapper<Admin> {
" from video as v ")
JSONObject statistics1();
@Select("SELECT date_format(creatAt, '%Y-%m-%d') as dat" +
@Select("<script>" +
"SELECT date_format(creatAt, '%Y-%m-%d') as dat" +
",sum(IFNULL(playNum,0)) as playNumSum " +
",sum(IFNULL(commendNum,0)) as commendNumSum " +
",sum(IFNULL(collectionNum,0)) as collectionNumSum " +
@ -41,13 +42,14 @@ public interface AdminMapper extends BaseMapper<Admin> {
",sum(IFNULL(reSendNum,0)) as reSendNumSum " +
",sum(IFNULL(recommendNum,0)) as recommendNumSum " +
"from video \n" +
"where dat" +
"where date_format(creatAt, '%Y-%m-%d')" +
"<if test='ew != null'>" +
"<if test='ew.nonEmptyOfWhere'>" +
"AND " +
"</if> " +
"${ew.SqlSegment}" +
"</if> " +
"GROUP BY dat ORDER BY dat ")
"GROUP BY dat ORDER BY dat "+
"</script>")
List<JSONObject> statistics2(@Param("ew") Wrapper<Video> queryWrapper);
}

@ -31,7 +31,7 @@ public interface UserMapper extends BaseMapper<User> {
@Select("UPDATE user set token=#{token},lastLoginAt=#{time} where openid=#{openid}")
void updByOpenid(String openid, String token, LocalDateTime time);
@Select("SELECT t1.name,t1.tel,t1.avatar,t1.main_department,t1.sub_department,t1.points,t1.historyPoints,t1.creatAt,t1.updateAt,t1.lastLoginAt" +
@Select("SELECT t1.id,t1.name,t1.tel,t1.avatar,t1.main_department,t1.sub_department,t1.points,t1.historyPoints,t1.creatAt,t1.updateAt,t1.lastLoginAt" +
",t2.name as main_departmentName,t3.name as sub_departmentName " +
"from user as t1 " +
"left join qywxDepartment as t2 on t1.main_department = t2.departmentId " +

Loading…
Cancel
Save