package cn.reghao.tnb.sb.db.mybatis.test.model;

import cn.reghao.tnb.sb.db.mybatis.test.BaseObject;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author reghao
 * @date 2021-03-10 04:35:11
 */
@NoArgsConstructor
@Data
public class UserInfo extends BaseObject<Integer> {
    private Long userId;
    private String username;

    public UserInfo(long userId, String username) {
        this.userId = userId;
        this.username = username;
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = result * 31 + userId.hashCode();
        return result;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }

        if (other instanceof UserInfo) {
            UserInfo o = (UserInfo) other;
            return o.userId.equals(userId);
        } else {
            return false;
        }
    }
}
