From e102578ebfc95c27aeb13dce13fb82af53a2bead Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 25 二月 2021 17:07:23 +0800
Subject: [PATCH] 1. 新增夜间施工查询界面 2. 新增夜间施工管理统计界面

---
 app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java b/app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java
index ed9b1ce..19a66bb 100644
--- a/app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java
+++ b/app/src/main/java/com/ping/greendao/gen/MediaTypeAliasDao.java
@@ -24,7 +24,7 @@
      * 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 Id = new Property(0, Long.class, "id", true, "_id");
         public final static Property SceneTypeId = new Property(1, int.class, "sceneTypeId", false, "SCENE_TYPE_ID");
         public final static Property TypeId = new Property(2, int.class, "typeId", false, "TYPE_ID");
         public final static Property TypeName = new Property(3, String.class, "typeName", false, "TYPE_NAME");
@@ -44,7 +44,7 @@
     public static void createTable(Database db, boolean ifNotExists) {
         String constraint = ifNotExists? "IF NOT EXISTS ": "";
         db.execSQL("CREATE TABLE " + constraint + "\"MEDIA_TYPE_ALIAS\" (" + //
-                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ," + // 0: id
+                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
                 "\"SCENE_TYPE_ID\" INTEGER NOT NULL ," + // 1: sceneTypeId
                 "\"TYPE_ID\" INTEGER NOT NULL ," + // 2: typeId
                 "\"TYPE_NAME\" TEXT," + // 3: typeName
@@ -60,7 +60,11 @@
     @Override
     protected final void bindValues(DatabaseStatement stmt, MediaTypeAlias entity) {
         stmt.clearBindings();
-        stmt.bindLong(1, entity.getId());
+ 
+        Long id = entity.getId();
+        if (id != null) {
+            stmt.bindLong(1, id);
+        }
         stmt.bindLong(2, entity.getSceneTypeId());
         stmt.bindLong(3, entity.getTypeId());
  
@@ -78,7 +82,11 @@
     @Override
     protected final void bindValues(SQLiteStatement stmt, MediaTypeAlias entity) {
         stmt.clearBindings();
-        stmt.bindLong(1, entity.getId());
+ 
+        Long id = entity.getId();
+        if (id != null) {
+            stmt.bindLong(1, id);
+        }
         stmt.bindLong(2, entity.getSceneTypeId());
         stmt.bindLong(3, entity.getTypeId());
  
@@ -95,13 +103,13 @@
 
     @Override
     public Long readKey(Cursor cursor, int offset) {
-        return cursor.getLong(offset + 0);
+        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
     }    
 
     @Override
     public MediaTypeAlias readEntity(Cursor cursor, int offset) {
         MediaTypeAlias entity = new MediaTypeAlias( //
-            cursor.getLong(offset + 0), // id
+            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
             cursor.getInt(offset + 1), // sceneTypeId
             cursor.getInt(offset + 2), // typeId
             cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // typeName
@@ -112,7 +120,7 @@
      
     @Override
     public void readEntity(Cursor cursor, MediaTypeAlias entity, int offset) {
-        entity.setId(cursor.getLong(offset + 0));
+        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
         entity.setSceneTypeId(cursor.getInt(offset + 1));
         entity.setTypeId(cursor.getInt(offset + 2));
         entity.setTypeName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
@@ -136,7 +144,7 @@
 
     @Override
     public boolean hasKey(MediaTypeAlias entity) {
-        throw new UnsupportedOperationException("Unsupported for entities with a non-null key");
+        return entity.getId() != null;
     }
 
     @Override

--
Gitblit v1.9.3