package com.ruoyi.common.core.domain.query;

import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author jlzhou
 */
@Data
public class CountQuery {

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date endTime = new Date();

    private Integer num = 5;

    private Integer per;

    private Long userId;

    public String getTimeKey() {
        return userId+":"+num+":"+per+":"+ DateUtil.format(endTime,"yyMMddHHmm");
    }

    public String getDateKey() {
        return userId+":"+num+":"+per+":"+ DateUtil.format(endTime,"yyMMdd");
    }
}
