App(2)

时间:2022-05-27 05:20:43

@Entity
public class BBill{

    @Id(autoincrement = true)
    private Long id;  //本地id

    private String rid;  //服务器端id
    private float cost;  //金额
    private String content;  //内容
    private String userid;  //用户id
    private String payName;  //支付方式
    private String payImg;  //
    private String sortName;  //账单分类
    private String sortImg;  //
    private long crdate;  //创建时间
    private boolean income;  //收入支出
    private int version;  //版本

    @Generated(hash = 124482664)
    public BBill() {
    }
    @Generated(hash = 634586034)
    public BBill(Long id, String rid, float cost, String content, String userid, String payName, String payImg,
                 String sortName, String sortImg, long crdate, boolean income, int version) {
        this.id = id;
        this.rid = rid;
        this.cost = cost;
        this.content = content;
        this.userid = userid;
        this.payName = payName;
        this.payImg = payImg;
        this.sortName = sortName;
        this.sortImg = sortImg;
        this.crdate = crdate;
        this.income = income;
        this.version = version;
    }
    public Long getId() {
        return id;
    }

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

    public String getRid() {
        return rid;
    }

    public void setRid(String rid) {
        this.rid = rid;
    }

    public float getCost() {
        return cost;
    }

    public void setCost(float cost) {
        this.cost = cost;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getPayName() {
        return payName;
    }

    public void setPayName(String payName) {
        this.payName = payName;
    }

    public String getPayImg() {
        return payImg;
    }

    public void setPayImg(String payImg) {
        this.payImg = payImg;
    }

    public String getSortName() {
        return sortName;
    }

    public void setSortName(String sortName) {
        this.sortName = sortName;
    }

    public String getSortImg() {
        return sortImg;
    }

    public void setSortImg(String sortImg) {
        this.sortImg = sortImg;
    }

    public long getCrdate() {
        return crdate;
    }

    public void setCrdate(long crdate) {
        this.crdate = crdate;
    }

    public boolean isIncome() {
        return income;
    }

    public void setIncome(boolean income) {
        this.income = income;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }
    public boolean getIncome() {
        return this.income;
    }
}
package com.bill.model.gen;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.copasso.cocobill.model.bean.local.BBill;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "BBILL".
*/
public class BBillDao extends AbstractDao<BBill, Long> {

    public static final String TABLENAME = "BBILL";

    /**
     * Properties of entity BBill.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
        public final static Property Rid = new Property(1, String.class, "rid", false, "RID");
        public final static Property Cost = new Property(2, float.class, "cost", false, "COST");
        public final static Property Content = new Property(3, String.class, "content", false, "CONTENT");
        public final static Property Userid = new Property(4, String.class, "userid", false, "USERID");
        public final static Property PayName = new Property(5, String.class, "payName", false, "PAY_NAME");
        public final static Property PayImg = new Property(6, String.class, "payImg", false, "PAY_IMG");
        public final static Property SortName = new Property(7, String.class, "sortName", false, "SORT_NAME");
        public final static Property SortImg = new Property(8, String.class, "sortImg", false, "SORT_IMG");
        public final static Property Crdate = new Property(9, long.class, "crdate", false, "CRDATE");
        public final static Property Income = new Property(10, boolean.class, "income", false, "INCOME");
        public final static Property Version = new Property(11, int.class, "version", false, "VERSION");
    }


    public BBillDao(DaoConfig config) {
        super(config);
    }
    
    public BBillDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE "   constraint   ""BBILL" ("   //
                ""_id" INTEGER PRIMARY KEY AUTOINCREMENT ,"   // 0: id
                ""RID" TEXT,"   // 1: rid
                ""COST" REAL NOT NULL ,"   // 2: cost
                ""CONTENT" TEXT,"   // 3: content
                ""USERID" TEXT,"   // 4: userid
                ""PAY_NAME" TEXT,"   // 5: payName
                ""PAY_IMG" TEXT,"   // 6: payImg
                ""SORT_NAME" TEXT,"   // 7: sortName
                ""SORT_IMG" TEXT,"   // 8: sortImg
                ""CRDATE" INTEGER NOT NULL ,"   // 9: crdate
                ""INCOME" INTEGER NOT NULL ,"   // 10: income
                ""VERSION" INTEGER NOT NULL );"); // 11: version
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE "   (ifExists ? "IF EXISTS " : "")   ""BBILL"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, BBill entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String rid = entity.getRid();
        if (rid != null) {
            stmt.bindString(2, rid);
        }
        stmt.bindDouble(3, entity.getCost());
 
        String content = entity.getContent();
        if (content != null) {
            stmt.bindString(4, content);
        }
 
        String userid = entity.getUserid();
        if (userid != null) {
            stmt.bindString(5, userid);
        }
 
        String payName = entity.getPayName();
        if (payName != null) {
            stmt.bindString(6, payName);
        }
 
        String payImg = entity.getPayImg();
        if (payImg != null) {
            stmt.bindString(7, payImg);
        }
 
        String sortName = entity.getSortName();
        if (sortName != null) {
            stmt.bindString(8, sortName);
        }
 
        String sortImg = entity.getSortImg();
        if (sortImg != null) {
            stmt.bindString(9, sortImg);
        }
        stmt.bindLong(10, entity.getCrdate());
        stmt.bindLong(11, entity.getIncome() ? 1L: 0L);
        stmt.bindLong(12, entity.getVersion());
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, BBill entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String rid = entity.getRid();
        if (rid != null) {
            stmt.bindString(2, rid);
        }
        stmt.bindDouble(3, entity.getCost());
 
        String content = entity.getContent();
        if (content != null) {
            stmt.bindString(4, content);
        }
 
        String userid = entity.getUserid();
        if (userid != null) {
            stmt.bindString(5, userid);
        }
 
        String payName = entity.getPayName();
        if (payName != null) {
            stmt.bindString(6, payName);
        }
 
        String payImg = entity.getPayImg();
        if (payImg != null) {
            stmt.bindString(7, payImg);
        }
 
        String sortName = entity.getSortName();
        if (sortName != null) {
            stmt.bindString(8, sortName);
        }
 
        String sortImg = entity.getSortImg();
        if (sortImg != null) {
            stmt.bindString(9, sortImg);
        }
        stmt.bindLong(10, entity.getCrdate());
        stmt.bindLong(11, entity.getIncome() ? 1L: 0L);
        stmt.bindLong(12, entity.getVersion());
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset   0) ? null : cursor.getLong(offset   0);
    }    

    @Override
    public BBill readEntity(Cursor cursor, int offset) {
        BBill entity = new BBill( //
            cursor.isNull(offset   0) ? null : cursor.getLong(offset   0), // id
            cursor.isNull(offset   1) ? null : cursor.getString(offset   1), // rid
            cursor.getFloat(offset   2), // cost
            cursor.isNull(offset   3) ? null : cursor.getString(offset   3), // content
            cursor.isNull(offset   4) ? null : cursor.getString(offset   4), // userid
            cursor.isNull(offset   5) ? null : cursor.getString(offset   5), // payName
            cursor.isNull(offset   6) ? null : cursor.getString(offset   6), // payImg
            cursor.isNull(offset   7) ? null : cursor.getString(offset   7), // sortName
            cursor.isNull(offset   8) ? null : cursor.getString(offset   8), // sortImg
            cursor.getLong(offset   9), // crdate
            cursor.getShort(offset   10) != 0, // income
            cursor.getInt(offset   11) // version
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, BBill entity, int offset) {
        entity.setId(cursor.isNull(offset   0) ? null : cursor.getLong(offset   0));
        entity.setRid(cursor.isNull(offset   1) ? null : cursor.getString(offset   1));
        entity.setCost(cursor.getFloat(offset   2));
        entity.setContent(cursor.isNull(offset   3) ? null : cursor.getString(offset   3));
        entity.setUserid(cursor.isNull(offset   4) ? null : cursor.getString(offset   4));
        entity.setPayName(cursor.isNull(offset   5) ? null : cursor.getString(offset   5));
        entity.setPayImg(cursor.isNull(offset   6) ? null : cursor.getString(offset   6));
        entity.setSortName(cursor.isNull(offset   7) ? null : cursor.getString(offset   7));
        entity.setSortImg(cursor.isNull(offset   8) ? null : cursor.getString(offset   8));
        entity.setCrdate(cursor.getLong(offset   9));
        entity.setIncome(cursor.getShort(offset   10) != 0);
        entity.setVersion(cursor.getInt(offset   11));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(BBill entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(BBill entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(BBill entity) {
        return entity.getId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}

package com.bill.model.bean.local;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;

/**
 * 支付方式bean
 */
@Entity
public class BPay {

    @Id
    private Long id;
    private String payName;
    private String payImg;

    private float income;
    private float outcome;

    @Generated(hash = 48271616)
    public BPay() {
    }

    @Generated(hash = 572465971)
    public BPay(Long id, String payName, String payImg, float income,
                float outcome) {
        this.id = id;
        this.payName = payName;
        this.payImg = payImg;
        this.income = income;
        this.outcome = outcome;
    }

    public String getPayName() {
        return payName;
    }

    public void setPayName(String payName) {
        this.payName = payName;
    }

    public String getPayImg() {
        return payImg;
    }

    public void setPayImg(String payImg) {
        this.payImg = payImg;
    }

    public float getIncome() {
        return income;
    }

    public void setIncome(float income) {
        this.income = income;
    }

    public float getOutcome() {
        return outcome;
    }

    public void setOutcome(float outcome) {
        this.outcome = outcome;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }
}
package com.bill.model.gen;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.bill.model.bean.local.BPay;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "BPAY".
*/
public class BPayDao extends AbstractDao<BPay, Long> {

    public static final String TABLENAME = "BPAY";

    /**
     * Properties of entity BPay.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
        public final static Property PayName = new Property(1, String.class, "payName", false, "PAY_NAME");
        public final static Property PayImg = new Property(2, String.class, "payImg", false, "PAY_IMG");
        public final static Property Income = new Property(3, float.class, "income", false, "INCOME");
        public final static Property Outcome = new Property(4, float.class, "outcome", false, "OUTCOME");
    }


    public BPayDao(DaoConfig config) {
        super(config);
    }
    
    public BPayDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE "   constraint   ""BPAY" ("   //
                ""_id" INTEGER PRIMARY KEY ,"   // 0: id
                ""PAY_NAME" TEXT,"   // 1: payName
                ""PAY_IMG" TEXT,"   // 2: payImg
                ""INCOME" REAL NOT NULL ,"   // 3: income
                ""OUTCOME" REAL NOT NULL );"); // 4: outcome
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE "   (ifExists ? "IF EXISTS " : "")   ""BPAY"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, BPay entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String payName = entity.getPayName();
        if (payName != null) {
            stmt.bindString(2, payName);
        }
 
        String payImg = entity.getPayImg();
        if (payImg != null) {
            stmt.bindString(3, payImg);
        }
        stmt.bindDouble(4, entity.getIncome());
        stmt.bindDouble(5, entity.getOutcome());
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, BPay entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String payName = entity.getPayName();
        if (payName != null) {
            stmt.bindString(2, payName);
        }
 
        String payImg = entity.getPayImg();
        if (payImg != null) {
            stmt.bindString(3, payImg);
        }
        stmt.bindDouble(4, entity.getIncome());
        stmt.bindDouble(5, entity.getOutcome());
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset   0) ? null : cursor.getLong(offset   0);
    }    

    @Override
    public BPay readEntity(Cursor cursor, int offset) {
        BPay entity = new BPay( //
            cursor.isNull(offset   0) ? null : cursor.getLong(offset   0), // id
            cursor.isNull(offset   1) ? null : cursor.getString(offset   1), // payName
            cursor.isNull(offset   2) ? null : cursor.getString(offset   2), // payImg
            cursor.getFloat(offset   3), // income
            cursor.getFloat(offset   4) // outcome
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, BPay entity, int offset) {
        entity.setId(cursor.isNull(offset   0) ? null : cursor.getLong(offset   0));
        entity.setPayName(cursor.isNull(offset   1) ? null : cursor.getString(offset   1));
        entity.setPayImg(cursor.isNull(offset   2) ? null : cursor.getString(offset   2));
        entity.setIncome(cursor.getFloat(offset   3));
        entity.setOutcome(cursor.getFloat(offset   4));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(BPay entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(BPay entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(BPay entity) {
        return entity.getId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}