Développement de projet Springboot de système de gestion financière personnelle (quatre) Pojo

Dans le pojo, placez les différentes classes que nous avons définies.

Traditionnellement, nous définissons les attributs comme des variables privées, ce qui est sûr. Après avoir écrit toutes les propriétés, le getter et le setter n'ont pas besoin que nous écrivions à la main, vous pouvez utiliser la touche de raccourci d'IDEA Alt + Insert

Cliquez sur Getter et Setter et sélectionnez tous les attributs.

J'ai refactoré toString. C'est parce que lors du débogage, la classe de sortie directe affichera une adresse, et je veux voir tout le contenu de cette classe, donc je remplace un toString afin que System.out.println affiche la classe Tous les attributs.

(La sortie de Java est en fait la fonction toString appelée, qui est similaire à Python.)

ToString peut également utiliser Alt + Insert, comme vous pouvez le voir dans la capture d'écran ci-dessus, cliquez simplement sur toString ().

package com.demo.pojo;

public class User {
    private Integer id;
    private String username;
    private String realname;
    private String phone;
    private String email;
    private String password;
    private String reputation;
    private Integer status;
    private String IDcard;
    private String paypwd;


    public String getIDcard() {
        return IDcard;
    }

    public void setIDcard(String IDcard) {
        this.IDcard = IDcard;
    }

    public String getPaypwd() {
        return paypwd;
    }

    public void setPaypwd(String paypwd) {
        this.paypwd = paypwd;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getReputation() {
        return reputation;
    }

    public void setReputation(String reputation) {
        this.reputation = reputation;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", realname='" + realname + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", password='" + password + '\'' +
                ", reputation='" + reputation + '\'' +
                ", status=" + status +
                ", IDcard='" + IDcard + '\'' +
                ", paypwd='" + paypwd + '\'' +
                '}';
    }

    public User() {
    }
}

 

Je suppose que tu aimes

Origine blog.csdn.net/Luowaterbi/article/details/107693117
conseillé
Classement