我的代码有问题。
我粘贴在我的DAO界面下面:
public interface EventDao extends CrudRepository<Event, Integer>{
...
@Query("SELECT new com.patryk.entity.ActionStatistics(e.action.actionname,sum(e.lengthinmilis)) FROM Event e where e.user = ?1 and e.removed = 0 and year(e.createdate) = year(?2) and month(e.createdate)=month(?2) and e.action.isworkingaction = 1")
public List<ActionStatistics> findMonthlyUserStatisticsByUserAndCreateDay(User user, Date createday);
...
}
Run Code Online (Sandbox Code Playgroud)
ActionStatistics类别:
package com.patryk.entity;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class ActionStatistics {
private String actionname;
private long time;
private String timeString;
public ActionStatistics() {
this.actionname = "actionname";
this.time = 0;
}
public ActionStatistics(String actionname, long time) {
this.actionname …Run Code Online (Sandbox Code Playgroud)