service.java
/**
*
* @param type 1: ;2: :3: 4:
* @param startDay
* @param endDay
* @return list
*/
public List countNumber(int type, String startDay, String endDay) {
if (StringUtils.isEmpty(startDay)){
startDay = "2017-11-13";
}
if (StringUtils.isEmpty(endDay)){
endDay = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
}
List
Repository.java
@Query(value = "SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) date, COUNT( * ) number FROM register_user where create_time BETWEEN ?1 and ?2 GROUP BY date; ",nativeQuery = true)
List