package com.cyksj.model.manage.views;

import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author chan
 * @date 2022/10/12 2:31 PM
 */
@Getter
@Setter
@SearchBean(tables = " :fu: user u :fu_on: left join user_distribute_shared us on us.user_id = u.id"
		, where = ":otherConditionSql:")
public class UserView {

    /**
     * id
     */
    @DbField("u.id")
    private Long id;

    /**
     * 名称
     */
    @DbField("u.nickname")
    private String nickname;

    /**
     * 手机号
     */
    @DbField("u.phone")
    private String phone;

    /**
     * 绑定手机号
     */
    @DbIgnore
    private String bindPhone;

    /**
     * 绑定邮箱
     */
    @DbIgnore
    private String bindEmail;

    /**
     * 头像
     */
    @DbField("u.headimgurl")
    private String headimgurl;

    /**
     * 积分
     */
    @DbField("u.points")
    private BigDecimal points;

    @DbField("u.balance")
    private BigDecimal balance;

    @DbField("case when u.login_phone != '' then 'phone' when u.email != '' then 'email' when u.open_id != '' then 'wechat' else 'wechat' end")
    private String register;

    @DbField("u.show_id")
    private String showId;

    /**
     * 登录注册手机号
     */
    @DbField("u.login_phone")
    private String loginPhone;

    /**
     * 登录注册邮箱
     */
    @DbField("u.email")
    private String email;

    /**
     * 银河币
     */
    @DbField("u.galaxy_coin")
    private BigDecimal galaxyCoin;

    @DbField("u.register_env")
    private String registerEnv;

    @DbField("u.last_time")
    private Date lastTime;

    /**
     * 账户数
     */
    @DbIgnore
    private Integer accountNum;

    /**
     * 邀请人id
     */
    @DbField("us.shared_id")
    private Long sharedId;

    /**
     * 邀请人名称
     */
    @DbIgnore
    private String distributeName;

    @DbIgnore
    private String businessName;

    @DbIgnore
    private Integer inviteCount;

    /**
     * 渠道来源
     */
    @DbIgnore
    private String channelName;

    @DbField("u.is_black")
    private Boolean isBlack;

    @DbField("u.unionid")
    private String unionid;

    /**
     * 企业微信客服
     */
    @DbIgnore
    private String corpCustomers;

    /**
     * 首单信息
     */
    @DbIgnore
    private String firstOrderDetail;

    /**
     * 有无路由器订单
     */
    @DbIgnore
    private Boolean isHadRouteOrder;


    /**
     * 订单金额
     */
    @DbIgnore
    private BigDecimal orderMoney;

    /**
     * 订单数
     */
    @DbIgnore
    private Integer numOfOrder;

    /**
     * 退款金额
     */
    @DbIgnore
    private BigDecimal refundMoney;

    /**
     * 退款率
     */
    @DbIgnore
    private BigDecimal refundRate;

    /**
     * 创建时间
     */
    @DbField("u.created_time")
    private Date createdTime;

    /**
     * 最后更新时间
     */
    @DbField("u.update_time")
    private Date updateTime;

    @DbField("u.is_google")
    private Boolean isGoogle;

    /**
     * 是否实名
     */
    @DbIgnore
    private Boolean isCert;

    @DbIgnore
    private Boolean isVip = false;

    @DbIgnore
    private Date vipExpiryTime;
}
