package com.chushang.loan.domin.query;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chushang.common.mybatis.page.CommonParam;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LoanFormQuery extends CommonParam {

    private Long userId;

    /** 编号 */
    private String formNumber;

    /** 时间区间 */
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private List<LocalDateTime> submissionTimes;

    /** 业务状态 */
    private Integer status;

    /** 提交人姓名/手机号 */
    private String author;

    /** 渠道名称 */
    private String channelName;

    /** 部门id */
    private Long deptId;

    /** 当前页 */
    protected Integer page;

    /** 每页显示条数 */
    protected Integer limit;

    public <R> Page<R> of() {
        return Page.of(page, limit);
    }
}
