package com.phlx.anchorcollect_p.db.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.phlx.anchorcollect_p.entity.PerformanceEntity;

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

    public static final String TABLENAME = "PERFORMANCE_ENTITY";

    /**
     * Properties of entity PerformanceEntity.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Unid = new Property(0, Long.class, "unid", true, "_id");
        public final static Property CattleresumeId = new Property(1, Long.class, "cattleresumeId", false, "CATTLERESUME_ID");
        public final static Property Age = new Property(2, String.class, "age", false, "AGE");
        public final static Property MeasureDate = new Property(3, String.class, "measureDate", false, "MEASURE_DATE");
        public final static Property Height = new Property(4, Double.class, "height", false, "HEIGHT");
        public final static Property Length = new Property(5, Double.class, "length", false, "LENGTH");
        public final static Property Bust = new Property(6, Double.class, "bust", false, "BUST");
        public final static Property Weight = new Property(7, Double.class, "weight", false, "WEIGHT");
        public final static Property ChestWidth = new Property(8, Double.class, "chestWidth", false, "CHEST_WIDTH");
        public final static Property ChestDeep = new Property(9, Double.class, "chestDeep", false, "CHEST_DEEP");
        public final static Property WaistWidth = new Property(10, Double.class, "waistWidth", false, "WAIST_WIDTH");
        public final static Property CrossWidth = new Property(11, Double.class, "crossWidth", false, "CROSS_WIDTH");
        public final static Property GuanWei = new Property(12, Double.class, "guanWei", false, "GUAN_WEI");
        public final static Property EyeMuscleArea = new Property(13, Double.class, "eyeMuscleArea", false, "EYE_MUSCLE_AREA");
        public final static Property Grade = new Property(14, String.class, "grade", false, "GRADE");
        public final static Property HairLength = new Property(15, Double.class, "hairLength", false, "HAIR_LENGTH");
        public final static Property HairFineness = new Property(16, Double.class, "hairFineness", false, "HAIR_FINENESS");
        public final static Property Shearing = new Property(17, Double.class, "shearing", false, "SHEARING");
        public final static Property BackWidth = new Property(18, Double.class, "backWidth", false, "BACK_WIDTH");
        public final static Property BreedRes = new Property(19, String.class, "breedRes", false, "BREED_RES");
        public final static Property Health = new Property(20, String.class, "health", false, "HEALTH");
        public final static Property Immune = new Property(21, String.class, "immune", false, "IMMUNE");
        public final static Property UploadStatus = new Property(22, String.class, "uploadStatus", false, "UPLOAD_STATUS");
        public final static Property DeptId = new Property(23, Long.class, "deptId", false, "DEPT_ID");
        public final static Property SearchValue = new Property(24, String.class, "searchValue", false, "SEARCH_VALUE");
        public final static Property CreateBy = new Property(25, String.class, "createBy", false, "CREATE_BY");
        public final static Property CreateTime = new Property(26, String.class, "createTime", false, "CREATE_TIME");
        public final static Property UpdateBy = new Property(27, String.class, "updateBy", false, "UPDATE_BY");
        public final static Property UpdateTime = new Property(28, String.class, "updateTime", false, "UPDATE_TIME");
        public final static Property Remark = new Property(29, String.class, "remark", false, "REMARK");
    }


    public PerformanceEntityDao(DaoConfig config) {
        super(config);
    }
    
    public PerformanceEntityDao(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 + "\"PERFORMANCE_ENTITY\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: unid
                "\"CATTLERESUME_ID\" INTEGER," + // 1: cattleresumeId
                "\"AGE\" TEXT," + // 2: age
                "\"MEASURE_DATE\" TEXT," + // 3: measureDate
                "\"HEIGHT\" REAL," + // 4: height
                "\"LENGTH\" REAL," + // 5: length
                "\"BUST\" REAL," + // 6: bust
                "\"WEIGHT\" REAL," + // 7: weight
                "\"CHEST_WIDTH\" REAL," + // 8: chestWidth
                "\"CHEST_DEEP\" REAL," + // 9: chestDeep
                "\"WAIST_WIDTH\" REAL," + // 10: waistWidth
                "\"CROSS_WIDTH\" REAL," + // 11: crossWidth
                "\"GUAN_WEI\" REAL," + // 12: guanWei
                "\"EYE_MUSCLE_AREA\" REAL," + // 13: eyeMuscleArea
                "\"GRADE\" TEXT," + // 14: grade
                "\"HAIR_LENGTH\" REAL," + // 15: hairLength
                "\"HAIR_FINENESS\" REAL," + // 16: hairFineness
                "\"SHEARING\" REAL," + // 17: shearing
                "\"BACK_WIDTH\" REAL," + // 18: backWidth
                "\"BREED_RES\" TEXT," + // 19: breedRes
                "\"HEALTH\" TEXT," + // 20: health
                "\"IMMUNE\" TEXT," + // 21: immune
                "\"UPLOAD_STATUS\" TEXT," + // 22: uploadStatus
                "\"DEPT_ID\" INTEGER," + // 23: deptId
                "\"SEARCH_VALUE\" TEXT," + // 24: searchValue
                "\"CREATE_BY\" TEXT," + // 25: createBy
                "\"CREATE_TIME\" TEXT," + // 26: createTime
                "\"UPDATE_BY\" TEXT," + // 27: updateBy
                "\"UPDATE_TIME\" TEXT," + // 28: updateTime
                "\"REMARK\" TEXT);"); // 29: remark
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, PerformanceEntity entity) {
        stmt.clearBindings();
 
        Long unid = entity.getUnid();
        if (unid != null) {
            stmt.bindLong(1, unid);
        }
 
        Long cattleresumeId = entity.getCattleresumeId();
        if (cattleresumeId != null) {
            stmt.bindLong(2, cattleresumeId);
        }
 
        String age = entity.getAge();
        if (age != null) {
            stmt.bindString(3, age);
        }
 
        String measureDate = entity.getMeasureDate();
        if (measureDate != null) {
            stmt.bindString(4, measureDate);
        }
 
        Double height = entity.getHeight();
        if (height != null) {
            stmt.bindDouble(5, height);
        }
 
        Double length = entity.getLength();
        if (length != null) {
            stmt.bindDouble(6, length);
        }
 
        Double bust = entity.getBust();
        if (bust != null) {
            stmt.bindDouble(7, bust);
        }
 
        Double weight = entity.getWeight();
        if (weight != null) {
            stmt.bindDouble(8, weight);
        }
 
        Double chestWidth = entity.getChestWidth();
        if (chestWidth != null) {
            stmt.bindDouble(9, chestWidth);
        }
 
        Double chestDeep = entity.getChestDeep();
        if (chestDeep != null) {
            stmt.bindDouble(10, chestDeep);
        }
 
        Double waistWidth = entity.getWaistWidth();
        if (waistWidth != null) {
            stmt.bindDouble(11, waistWidth);
        }
 
        Double crossWidth = entity.getCrossWidth();
        if (crossWidth != null) {
            stmt.bindDouble(12, crossWidth);
        }
 
        Double guanWei = entity.getGuanWei();
        if (guanWei != null) {
            stmt.bindDouble(13, guanWei);
        }
 
        Double eyeMuscleArea = entity.getEyeMuscleArea();
        if (eyeMuscleArea != null) {
            stmt.bindDouble(14, eyeMuscleArea);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(15, grade);
        }
 
        Double hairLength = entity.getHairLength();
        if (hairLength != null) {
            stmt.bindDouble(16, hairLength);
        }
 
        Double hairFineness = entity.getHairFineness();
        if (hairFineness != null) {
            stmt.bindDouble(17, hairFineness);
        }
 
        Double shearing = entity.getShearing();
        if (shearing != null) {
            stmt.bindDouble(18, shearing);
        }
 
        Double backWidth = entity.getBackWidth();
        if (backWidth != null) {
            stmt.bindDouble(19, backWidth);
        }
 
        String breedRes = entity.getBreedRes();
        if (breedRes != null) {
            stmt.bindString(20, breedRes);
        }
 
        String health = entity.getHealth();
        if (health != null) {
            stmt.bindString(21, health);
        }
 
        String immune = entity.getImmune();
        if (immune != null) {
            stmt.bindString(22, immune);
        }
 
        String uploadStatus = entity.getUploadStatus();
        if (uploadStatus != null) {
            stmt.bindString(23, uploadStatus);
        }
 
        Long deptId = entity.getDeptId();
        if (deptId != null) {
            stmt.bindLong(24, deptId);
        }
 
        String searchValue = entity.getSearchValue();
        if (searchValue != null) {
            stmt.bindString(25, searchValue);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(26, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(27, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(28, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(29, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(30, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, PerformanceEntity entity) {
        stmt.clearBindings();
 
        Long unid = entity.getUnid();
        if (unid != null) {
            stmt.bindLong(1, unid);
        }
 
        Long cattleresumeId = entity.getCattleresumeId();
        if (cattleresumeId != null) {
            stmt.bindLong(2, cattleresumeId);
        }
 
        String age = entity.getAge();
        if (age != null) {
            stmt.bindString(3, age);
        }
 
        String measureDate = entity.getMeasureDate();
        if (measureDate != null) {
            stmt.bindString(4, measureDate);
        }
 
        Double height = entity.getHeight();
        if (height != null) {
            stmt.bindDouble(5, height);
        }
 
        Double length = entity.getLength();
        if (length != null) {
            stmt.bindDouble(6, length);
        }
 
        Double bust = entity.getBust();
        if (bust != null) {
            stmt.bindDouble(7, bust);
        }
 
        Double weight = entity.getWeight();
        if (weight != null) {
            stmt.bindDouble(8, weight);
        }
 
        Double chestWidth = entity.getChestWidth();
        if (chestWidth != null) {
            stmt.bindDouble(9, chestWidth);
        }
 
        Double chestDeep = entity.getChestDeep();
        if (chestDeep != null) {
            stmt.bindDouble(10, chestDeep);
        }
 
        Double waistWidth = entity.getWaistWidth();
        if (waistWidth != null) {
            stmt.bindDouble(11, waistWidth);
        }
 
        Double crossWidth = entity.getCrossWidth();
        if (crossWidth != null) {
            stmt.bindDouble(12, crossWidth);
        }
 
        Double guanWei = entity.getGuanWei();
        if (guanWei != null) {
            stmt.bindDouble(13, guanWei);
        }
 
        Double eyeMuscleArea = entity.getEyeMuscleArea();
        if (eyeMuscleArea != null) {
            stmt.bindDouble(14, eyeMuscleArea);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(15, grade);
        }
 
        Double hairLength = entity.getHairLength();
        if (hairLength != null) {
            stmt.bindDouble(16, hairLength);
        }
 
        Double hairFineness = entity.getHairFineness();
        if (hairFineness != null) {
            stmt.bindDouble(17, hairFineness);
        }
 
        Double shearing = entity.getShearing();
        if (shearing != null) {
            stmt.bindDouble(18, shearing);
        }
 
        Double backWidth = entity.getBackWidth();
        if (backWidth != null) {
            stmt.bindDouble(19, backWidth);
        }
 
        String breedRes = entity.getBreedRes();
        if (breedRes != null) {
            stmt.bindString(20, breedRes);
        }
 
        String health = entity.getHealth();
        if (health != null) {
            stmt.bindString(21, health);
        }
 
        String immune = entity.getImmune();
        if (immune != null) {
            stmt.bindString(22, immune);
        }
 
        String uploadStatus = entity.getUploadStatus();
        if (uploadStatus != null) {
            stmt.bindString(23, uploadStatus);
        }
 
        Long deptId = entity.getDeptId();
        if (deptId != null) {
            stmt.bindLong(24, deptId);
        }
 
        String searchValue = entity.getSearchValue();
        if (searchValue != null) {
            stmt.bindString(25, searchValue);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(26, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(27, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(28, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(29, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(30, remark);
        }
    }

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

    @Override
    public PerformanceEntity readEntity(Cursor cursor, int offset) {
        PerformanceEntity entity = new PerformanceEntity( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // unid
            cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // cattleresumeId
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // age
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // measureDate
            cursor.isNull(offset + 4) ? null : cursor.getDouble(offset + 4), // height
            cursor.isNull(offset + 5) ? null : cursor.getDouble(offset + 5), // length
            cursor.isNull(offset + 6) ? null : cursor.getDouble(offset + 6), // bust
            cursor.isNull(offset + 7) ? null : cursor.getDouble(offset + 7), // weight
            cursor.isNull(offset + 8) ? null : cursor.getDouble(offset + 8), // chestWidth
            cursor.isNull(offset + 9) ? null : cursor.getDouble(offset + 9), // chestDeep
            cursor.isNull(offset + 10) ? null : cursor.getDouble(offset + 10), // waistWidth
            cursor.isNull(offset + 11) ? null : cursor.getDouble(offset + 11), // crossWidth
            cursor.isNull(offset + 12) ? null : cursor.getDouble(offset + 12), // guanWei
            cursor.isNull(offset + 13) ? null : cursor.getDouble(offset + 13), // eyeMuscleArea
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // grade
            cursor.isNull(offset + 15) ? null : cursor.getDouble(offset + 15), // hairLength
            cursor.isNull(offset + 16) ? null : cursor.getDouble(offset + 16), // hairFineness
            cursor.isNull(offset + 17) ? null : cursor.getDouble(offset + 17), // shearing
            cursor.isNull(offset + 18) ? null : cursor.getDouble(offset + 18), // backWidth
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // breedRes
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // health
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // immune
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // uploadStatus
            cursor.isNull(offset + 23) ? null : cursor.getLong(offset + 23), // deptId
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // searchValue
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // createBy
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // createTime
            cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // updateBy
            cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // updateTime
            cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, PerformanceEntity entity, int offset) {
        entity.setUnid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setCattleresumeId(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
        entity.setAge(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setMeasureDate(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setHeight(cursor.isNull(offset + 4) ? null : cursor.getDouble(offset + 4));
        entity.setLength(cursor.isNull(offset + 5) ? null : cursor.getDouble(offset + 5));
        entity.setBust(cursor.isNull(offset + 6) ? null : cursor.getDouble(offset + 6));
        entity.setWeight(cursor.isNull(offset + 7) ? null : cursor.getDouble(offset + 7));
        entity.setChestWidth(cursor.isNull(offset + 8) ? null : cursor.getDouble(offset + 8));
        entity.setChestDeep(cursor.isNull(offset + 9) ? null : cursor.getDouble(offset + 9));
        entity.setWaistWidth(cursor.isNull(offset + 10) ? null : cursor.getDouble(offset + 10));
        entity.setCrossWidth(cursor.isNull(offset + 11) ? null : cursor.getDouble(offset + 11));
        entity.setGuanWei(cursor.isNull(offset + 12) ? null : cursor.getDouble(offset + 12));
        entity.setEyeMuscleArea(cursor.isNull(offset + 13) ? null : cursor.getDouble(offset + 13));
        entity.setGrade(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setHairLength(cursor.isNull(offset + 15) ? null : cursor.getDouble(offset + 15));
        entity.setHairFineness(cursor.isNull(offset + 16) ? null : cursor.getDouble(offset + 16));
        entity.setShearing(cursor.isNull(offset + 17) ? null : cursor.getDouble(offset + 17));
        entity.setBackWidth(cursor.isNull(offset + 18) ? null : cursor.getDouble(offset + 18));
        entity.setBreedRes(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setHealth(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setImmune(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setUploadStatus(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setDeptId(cursor.isNull(offset + 23) ? null : cursor.getLong(offset + 23));
        entity.setSearchValue(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
        entity.setCreateBy(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setCreateTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
        entity.setUpdateBy(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
        entity.setUpdateTime(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28));
        entity.setRemark(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(PerformanceEntity entity, long rowId) {
        entity.setUnid(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(PerformanceEntity entity) {
        if(entity != null) {
            return entity.getUnid();
        } else {
            return null;
        }
    }

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

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