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.CattleResumeEntity;

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

    public static final String TABLENAME = "CATTLE_RESUME_ENTITY";

    /**
     * Properties of entity CattleResumeEntity.<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 RegistrationNo = new Property(1, String.class, "registrationNo", false, "REGISTRATION_NO");
        public final static Property IndividualNo = new Property(2, String.class, "individualNo", false, "INDIVIDUAL_NO");
        public final static Property CircleNo = new Property(3, String.class, "circleNo", false, "CIRCLE_NO");
        public final static Property RaiseType = new Property(4, String.class, "raiseType", false, "RAISE_TYPE");
        public final static Property RaiseVarieties = new Property(5, String.class, "raiseVarieties", false, "RAISE_VARIETIES");
        public final static Property Birthdate = new Property(6, String.class, "birthdate", false, "BIRTHDATE");
        public final static Property BirthHeavy = new Property(7, Double.class, "birthHeavy", false, "BIRTH_HEAVY");
        public final static Property Sex = new Property(8, String.class, "sex", false, "SEX");
        public final static Property BirthDifficulty = new Property(9, String.class, "birthDifficulty", false, "BIRTH_DIFFICULTY");
        public final static Property IsTwins = new Property(10, String.class, "isTwins", false, "IS_TWINS");
        public final static Property ChildTime = new Property(11, String.class, "childTime", false, "CHILD_TIME");
        public final static Property Grade = new Property(12, String.class, "grade", false, "GRADE");
        public final static Property FatherReg = new Property(13, String.class, "fatherReg", false, "FATHER_REG");
        public final static Property MotherReg = new Property(14, String.class, "motherReg", false, "MOTHER_REG");
        public final static Property FromMilkHeavy = new Property(15, Double.class, "fromMilkHeavy", false, "FROM_MILK_HEAVY");
        public final static Property Health = new Property(16, String.class, "health", false, "HEALTH");
        public final static Property JunHeavy = new Property(17, String.class, "junHeavy", false, "JUN_HEAVY");
        public final static Property DecAppScore = new Property(18, String.class, "decAppScore", false, "DEC_APP_SCORE");
        public final static Property Photo = new Property(19, String.class, "photo", false, "PHOTO");
        public final static Property PhotoPath = new Property(20, String.class, "photoPath", false, "PHOTO_PATH");
        public final static Property Status = new Property(21, String.class, "status", false, "STATUS");
        public final static Property IsOut = new Property(22, Long.class, "isOut", false, "IS_OUT");
        public final static Property InputTime = new Property(23, String.class, "inputTime", false, "INPUT_TIME");
        public final static Property DeptId = new Property(24, Long.class, "deptId", false, "DEPT_ID");
        public final static Property UploadStatus = new Property(25, String.class, "uploadStatus", false, "UPLOAD_STATUS");
        public final static Property UploadTime = new Property(26, String.class, "uploadTime", false, "UPLOAD_TIME");
        public final static Property CreateBy = new Property(27, String.class, "createBy", false, "CREATE_BY");
        public final static Property CreateTime = new Property(28, String.class, "createTime", false, "CREATE_TIME");
        public final static Property UpdateBy = new Property(29, String.class, "updateBy", false, "UPDATE_BY");
        public final static Property UpdateTime = new Property(30, String.class, "updateTime", false, "UPDATE_TIME");
        public final static Property Remark = new Property(31, String.class, "remark", false, "REMARK");
    }


    public CattleResumeEntityDao(DaoConfig config) {
        super(config);
    }
    
    public CattleResumeEntityDao(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 + "\"CATTLE_RESUME_ENTITY\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: unid
                "\"REGISTRATION_NO\" TEXT," + // 1: registrationNo
                "\"INDIVIDUAL_NO\" TEXT," + // 2: individualNo
                "\"CIRCLE_NO\" TEXT," + // 3: circleNo
                "\"RAISE_TYPE\" TEXT," + // 4: raiseType
                "\"RAISE_VARIETIES\" TEXT," + // 5: raiseVarieties
                "\"BIRTHDATE\" TEXT," + // 6: birthdate
                "\"BIRTH_HEAVY\" REAL," + // 7: birthHeavy
                "\"SEX\" TEXT," + // 8: sex
                "\"BIRTH_DIFFICULTY\" TEXT," + // 9: birthDifficulty
                "\"IS_TWINS\" TEXT," + // 10: isTwins
                "\"CHILD_TIME\" TEXT," + // 11: childTime
                "\"GRADE\" TEXT," + // 12: grade
                "\"FATHER_REG\" TEXT," + // 13: fatherReg
                "\"MOTHER_REG\" TEXT," + // 14: motherReg
                "\"FROM_MILK_HEAVY\" REAL," + // 15: fromMilkHeavy
                "\"HEALTH\" TEXT," + // 16: health
                "\"JUN_HEAVY\" TEXT," + // 17: junHeavy
                "\"DEC_APP_SCORE\" TEXT," + // 18: decAppScore
                "\"PHOTO\" TEXT," + // 19: photo
                "\"PHOTO_PATH\" TEXT," + // 20: photoPath
                "\"STATUS\" TEXT," + // 21: status
                "\"IS_OUT\" INTEGER," + // 22: isOut
                "\"INPUT_TIME\" TEXT," + // 23: inputTime
                "\"DEPT_ID\" INTEGER," + // 24: deptId
                "\"UPLOAD_STATUS\" TEXT," + // 25: uploadStatus
                "\"UPLOAD_TIME\" TEXT," + // 26: uploadTime
                "\"CREATE_BY\" TEXT," + // 27: createBy
                "\"CREATE_TIME\" TEXT," + // 28: createTime
                "\"UPDATE_BY\" TEXT," + // 29: updateBy
                "\"UPDATE_TIME\" TEXT," + // 30: updateTime
                "\"REMARK\" TEXT);"); // 31: remark
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, CattleResumeEntity entity) {
        stmt.clearBindings();
 
        Long unid = entity.getUnid();
        if (unid != null) {
            stmt.bindLong(1, unid);
        }
 
        String registrationNo = entity.getRegistrationNo();
        if (registrationNo != null) {
            stmt.bindString(2, registrationNo);
        }
 
        String individualNo = entity.getIndividualNo();
        if (individualNo != null) {
            stmt.bindString(3, individualNo);
        }
 
        String circleNo = entity.getCircleNo();
        if (circleNo != null) {
            stmt.bindString(4, circleNo);
        }
 
        String raiseType = entity.getRaiseType();
        if (raiseType != null) {
            stmt.bindString(5, raiseType);
        }
 
        String raiseVarieties = entity.getRaiseVarieties();
        if (raiseVarieties != null) {
            stmt.bindString(6, raiseVarieties);
        }
 
        String birthdate = entity.getBirthdate();
        if (birthdate != null) {
            stmt.bindString(7, birthdate);
        }
 
        Double birthHeavy = entity.getBirthHeavy();
        if (birthHeavy != null) {
            stmt.bindDouble(8, birthHeavy);
        }
 
        String sex = entity.getSex();
        if (sex != null) {
            stmt.bindString(9, sex);
        }
 
        String birthDifficulty = entity.getBirthDifficulty();
        if (birthDifficulty != null) {
            stmt.bindString(10, birthDifficulty);
        }
 
        String isTwins = entity.getIsTwins();
        if (isTwins != null) {
            stmt.bindString(11, isTwins);
        }
 
        String childTime = entity.getChildTime();
        if (childTime != null) {
            stmt.bindString(12, childTime);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(13, grade);
        }
 
        String fatherReg = entity.getFatherReg();
        if (fatherReg != null) {
            stmt.bindString(14, fatherReg);
        }
 
        String motherReg = entity.getMotherReg();
        if (motherReg != null) {
            stmt.bindString(15, motherReg);
        }
 
        Double fromMilkHeavy = entity.getFromMilkHeavy();
        if (fromMilkHeavy != null) {
            stmt.bindDouble(16, fromMilkHeavy);
        }
 
        String health = entity.getHealth();
        if (health != null) {
            stmt.bindString(17, health);
        }
 
        String junHeavy = entity.getJunHeavy();
        if (junHeavy != null) {
            stmt.bindString(18, junHeavy);
        }
 
        String decAppScore = entity.getDecAppScore();
        if (decAppScore != null) {
            stmt.bindString(19, decAppScore);
        }
 
        String photo = entity.getPhoto();
        if (photo != null) {
            stmt.bindString(20, photo);
        }
 
        String photoPath = entity.getPhotoPath();
        if (photoPath != null) {
            stmt.bindString(21, photoPath);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(22, status);
        }
 
        Long isOut = entity.getIsOut();
        if (isOut != null) {
            stmt.bindLong(23, isOut);
        }
 
        String inputTime = entity.getInputTime();
        if (inputTime != null) {
            stmt.bindString(24, inputTime);
        }
 
        Long deptId = entity.getDeptId();
        if (deptId != null) {
            stmt.bindLong(25, deptId);
        }
 
        String uploadStatus = entity.getUploadStatus();
        if (uploadStatus != null) {
            stmt.bindString(26, uploadStatus);
        }
 
        String uploadTime = entity.getUploadTime();
        if (uploadTime != null) {
            stmt.bindString(27, uploadTime);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(28, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(29, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(30, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(31, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(32, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, CattleResumeEntity entity) {
        stmt.clearBindings();
 
        Long unid = entity.getUnid();
        if (unid != null) {
            stmt.bindLong(1, unid);
        }
 
        String registrationNo = entity.getRegistrationNo();
        if (registrationNo != null) {
            stmt.bindString(2, registrationNo);
        }
 
        String individualNo = entity.getIndividualNo();
        if (individualNo != null) {
            stmt.bindString(3, individualNo);
        }
 
        String circleNo = entity.getCircleNo();
        if (circleNo != null) {
            stmt.bindString(4, circleNo);
        }
 
        String raiseType = entity.getRaiseType();
        if (raiseType != null) {
            stmt.bindString(5, raiseType);
        }
 
        String raiseVarieties = entity.getRaiseVarieties();
        if (raiseVarieties != null) {
            stmt.bindString(6, raiseVarieties);
        }
 
        String birthdate = entity.getBirthdate();
        if (birthdate != null) {
            stmt.bindString(7, birthdate);
        }
 
        Double birthHeavy = entity.getBirthHeavy();
        if (birthHeavy != null) {
            stmt.bindDouble(8, birthHeavy);
        }
 
        String sex = entity.getSex();
        if (sex != null) {
            stmt.bindString(9, sex);
        }
 
        String birthDifficulty = entity.getBirthDifficulty();
        if (birthDifficulty != null) {
            stmt.bindString(10, birthDifficulty);
        }
 
        String isTwins = entity.getIsTwins();
        if (isTwins != null) {
            stmt.bindString(11, isTwins);
        }
 
        String childTime = entity.getChildTime();
        if (childTime != null) {
            stmt.bindString(12, childTime);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(13, grade);
        }
 
        String fatherReg = entity.getFatherReg();
        if (fatherReg != null) {
            stmt.bindString(14, fatherReg);
        }
 
        String motherReg = entity.getMotherReg();
        if (motherReg != null) {
            stmt.bindString(15, motherReg);
        }
 
        Double fromMilkHeavy = entity.getFromMilkHeavy();
        if (fromMilkHeavy != null) {
            stmt.bindDouble(16, fromMilkHeavy);
        }
 
        String health = entity.getHealth();
        if (health != null) {
            stmt.bindString(17, health);
        }
 
        String junHeavy = entity.getJunHeavy();
        if (junHeavy != null) {
            stmt.bindString(18, junHeavy);
        }
 
        String decAppScore = entity.getDecAppScore();
        if (decAppScore != null) {
            stmt.bindString(19, decAppScore);
        }
 
        String photo = entity.getPhoto();
        if (photo != null) {
            stmt.bindString(20, photo);
        }
 
        String photoPath = entity.getPhotoPath();
        if (photoPath != null) {
            stmt.bindString(21, photoPath);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(22, status);
        }
 
        Long isOut = entity.getIsOut();
        if (isOut != null) {
            stmt.bindLong(23, isOut);
        }
 
        String inputTime = entity.getInputTime();
        if (inputTime != null) {
            stmt.bindString(24, inputTime);
        }
 
        Long deptId = entity.getDeptId();
        if (deptId != null) {
            stmt.bindLong(25, deptId);
        }
 
        String uploadStatus = entity.getUploadStatus();
        if (uploadStatus != null) {
            stmt.bindString(26, uploadStatus);
        }
 
        String uploadTime = entity.getUploadTime();
        if (uploadTime != null) {
            stmt.bindString(27, uploadTime);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(28, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(29, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(30, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(31, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(32, remark);
        }
    }

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

    @Override
    public CattleResumeEntity readEntity(Cursor cursor, int offset) {
        CattleResumeEntity entity = new CattleResumeEntity( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // unid
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // registrationNo
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // individualNo
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // circleNo
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // raiseType
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // raiseVarieties
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // birthdate
            cursor.isNull(offset + 7) ? null : cursor.getDouble(offset + 7), // birthHeavy
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // sex
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // birthDifficulty
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // isTwins
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // childTime
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // grade
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // fatherReg
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // motherReg
            cursor.isNull(offset + 15) ? null : cursor.getDouble(offset + 15), // fromMilkHeavy
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // health
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // junHeavy
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // decAppScore
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // photo
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // photoPath
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // status
            cursor.isNull(offset + 22) ? null : cursor.getLong(offset + 22), // isOut
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // inputTime
            cursor.isNull(offset + 24) ? null : cursor.getLong(offset + 24), // deptId
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // uploadStatus
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // uploadTime
            cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // createBy
            cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // createTime
            cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // updateBy
            cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // updateTime
            cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, CattleResumeEntity entity, int offset) {
        entity.setUnid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setRegistrationNo(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setIndividualNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setCircleNo(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setRaiseType(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setRaiseVarieties(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setBirthdate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setBirthHeavy(cursor.isNull(offset + 7) ? null : cursor.getDouble(offset + 7));
        entity.setSex(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setBirthDifficulty(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setIsTwins(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setChildTime(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setGrade(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setFatherReg(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setMotherReg(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setFromMilkHeavy(cursor.isNull(offset + 15) ? null : cursor.getDouble(offset + 15));
        entity.setHealth(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setJunHeavy(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setDecAppScore(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setPhoto(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setPhotoPath(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setStatus(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setIsOut(cursor.isNull(offset + 22) ? null : cursor.getLong(offset + 22));
        entity.setInputTime(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setDeptId(cursor.isNull(offset + 24) ? null : cursor.getLong(offset + 24));
        entity.setUploadStatus(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setUploadTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
        entity.setCreateBy(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
        entity.setCreateTime(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28));
        entity.setUpdateBy(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29));
        entity.setUpdateTime(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30));
        entity.setRemark(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(CattleResumeEntity entity, long rowId) {
        entity.setUnid(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(CattleResumeEntity entity) {
        if(entity != null) {
            return entity.getUnid();
        } else {
            return null;
        }
    }

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

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