diff --git a/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java b/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java index 444ee2d..40efee4 100644 --- a/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java +++ b/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java @@ -3,7 +3,6 @@ import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Generated; import org.greenrobot.greendao.annotation.Id; -import org.greenrobot.greendao.annotation.Unique; @Entity public class PipeLocalBean { @@ -11,7 +10,6 @@ @Id(autoincrement = true) private Long id;//主键自增 - @Unique private String pipeCode; private String endLatitudeGd; private String endLongitudeGd; diff --git a/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java b/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java index 444ee2d..40efee4 100644 --- a/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java +++ b/app/src/main/java/com/casic/app/smartwell/bean/PipeLocalBean.java @@ -3,7 +3,6 @@ import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Generated; import org.greenrobot.greendao.annotation.Id; -import org.greenrobot.greendao.annotation.Unique; @Entity public class PipeLocalBean { @@ -11,7 +10,6 @@ @Id(autoincrement = true) private Long id;//主键自增 - @Unique private String pipeCode; private String endLatitudeGd; private String endLongitudeGd; diff --git a/app/src/main/java/com/casic/app/smartwell/greendao/PipeLocalBeanDao.java b/app/src/main/java/com/casic/app/smartwell/greendao/PipeLocalBeanDao.java index d0eb697..aab4d3f 100644 --- a/app/src/main/java/com/casic/app/smartwell/greendao/PipeLocalBeanDao.java +++ b/app/src/main/java/com/casic/app/smartwell/greendao/PipeLocalBeanDao.java @@ -12,9 +12,10 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "PIPE_LOCAL_BEAN". -*/ + */ public class PipeLocalBeanDao extends AbstractDao { public static final String TABLENAME = "PIPE_LOCAL_BEAN"; @@ -36,24 +37,28 @@ public PipeLocalBeanDao(DaoConfig config) { super(config); } - + public PipeLocalBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"PIPE_LOCAL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"PIPE_CODE\" TEXT UNIQUE ," + // 1: pipeCode + "\"PIPE_CODE\" TEXT," + // 1: pipeCode "\"END_LATITUDE_GD\" TEXT," + // 2: endLatitudeGd "\"END_LONGITUDE_GD\" TEXT," + // 3: endLongitudeGd "\"START_LATITUDE_GD\" TEXT," + // 4: startLatitudeGd "\"START_LONGITUDE_GD\" TEXT);"); // 5: startLongitudeGd } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PIPE_LOCAL_BEAN\""; db.execSQL(sql); @@ -62,32 +67,32 @@ @Override protected final void bindValues(DatabaseStatement stmt, PipeLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String pipeCode = entity.getPipeCode(); if (pipeCode != null) { stmt.bindString(2, pipeCode); } - + String endLatitudeGd = entity.getEndLatitudeGd(); if (endLatitudeGd != null) { stmt.bindString(3, endLatitudeGd); } - + String endLongitudeGd = entity.getEndLongitudeGd(); if (endLongitudeGd != null) { stmt.bindString(4, endLongitudeGd); } - + String startLatitudeGd = entity.getStartLatitudeGd(); if (startLatitudeGd != null) { stmt.bindString(5, startLatitudeGd); } - + String startLongitudeGd = entity.getStartLongitudeGd(); if (startLongitudeGd != null) { stmt.bindString(6, startLongitudeGd); @@ -97,32 +102,32 @@ @Override protected final void bindValues(SQLiteStatement stmt, PipeLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String pipeCode = entity.getPipeCode(); if (pipeCode != null) { stmt.bindString(2, pipeCode); } - + String endLatitudeGd = entity.getEndLatitudeGd(); if (endLatitudeGd != null) { stmt.bindString(3, endLatitudeGd); } - + String endLongitudeGd = entity.getEndLongitudeGd(); if (endLongitudeGd != null) { stmt.bindString(4, endLongitudeGd); } - + String startLatitudeGd = entity.getStartLatitudeGd(); if (startLatitudeGd != null) { stmt.bindString(5, startLatitudeGd); } - + String startLongitudeGd = entity.getStartLongitudeGd(); if (startLongitudeGd != null) { stmt.bindString(6, startLongitudeGd); @@ -132,21 +137,21 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override public PipeLocalBean readEntity(Cursor cursor, int offset) { PipeLocalBean entity = new PipeLocalBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipeCode - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // endLatitudeGd - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // endLongitudeGd - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startLatitudeGd - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5) // startLongitudeGd + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipeCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // endLatitudeGd + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // endLongitudeGd + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // startLatitudeGd + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5) // startLongitudeGd ); return entity; } - + @Override public void readEntity(Cursor cursor, PipeLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); @@ -155,17 +160,17 @@ entity.setEndLongitudeGd(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); entity.setStartLatitudeGd(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setStartLongitudeGd(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - } - + } + @Override protected final Long updateKeyAfterInsert(PipeLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override public Long getKey(PipeLocalBean entity) { - if(entity != null) { + if (entity != null) { return entity.getId(); } else { return null; @@ -181,5 +186,5 @@ protected final boolean isEntityUpdateable() { return true; } - + }